Skip to content

Fix issue in bytecode analysis where target and next are same. - #7149

Merged
sklam merged 1 commit into
numba:masterfrom
stuartarchibald:fix/5097
Jun 25, 2021
Merged

sklam merged 1 commit into
numba:masterfrom
stuartarchibald:fix/5097

Conversation

@stuartarchibald

Copy link
Copy Markdown
Contributor

As title.

Fixes #5097
Fixes #5680

@gmarkall

Copy link
Copy Markdown
Member

This fixes the issue for my reproducer too:

from numba import cuda
import numpy as np


@cuda.jit(debug=True)
def f(x, y):
    i = 0
    for xv, yv in zip(x, y):
        if xv != x[i]:
            pass
        i += 1


x = np.asarray((10, 9, 8, 7, 6))
y = np.asarray((1, 2, 3, 4, 5))

f[1, 1](x, y)

which used to fail with:

  File "/home/gmarkall/numbadev/numba/numba/core/utils.py", line 307, in __setitem__
    raise AssertionError("key already in dictionary: %r" % (key,))
AssertionError: Failed in cuda mode pipeline (step: analyzing bytecode)
key already in dictionary: '$phi36.0'

@sklam sklam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed that this patch works.

btw, I'm surprise to see that this can happen and CPython is not optimizing it into a unconditional-jump

@sklam sklam added 5 - Ready to merge Review and testing done, is ready to merge and removed 3 - Ready for Review labels Jun 25, 2021
@sklam
sklam merged commit 0cdb1ea into numba:master Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 - Ready to merge Review and testing done, is ready to merge Effort - short Short size effort needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'key already in dictionary' while analyzing bytecode "pass" combined with isnan fail in njit mode in 0.47 and 0.48 and 0.49

3 participants