Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.52.0rc2 regression: invalid array data if used after print #6444

Closed
2 tasks done
ehsantn opened this issue Nov 2, 2020 · 3 comments · Fixed by #6446
Closed
2 tasks done

0.52.0rc2 regression: invalid array data if used after print #6444

ehsantn opened this issue Nov 2, 2020 · 3 comments · Fixed by #6446
Labels
bug - incorrect behavior Bugs: incorrect behavior bug - regression A regression against a previous version of Numba
Milestone

Comments

@ehsantn
Copy link
Collaborator

ehsantn commented Nov 2, 2020

Reporting a bug

Array data looks invalid if used after a print. Looks like a refcount issue:

import numba
import numpy as np

@numba.njit
def f():
    A = np.ones(3)
    print(A)
    return A[0]

print(f())
[1. 1. 1.]
-9.868309920863368e+148
@sklam sklam added bug - incorrect behavior Bugs: incorrect behavior bug - regression A regression against a previous version of Numba labels Nov 2, 2020
@stuartarchibald
Copy link
Contributor

Thanks for the report. Think this is the diamond pruner:

import numba
import numpy as np

@numba.njit
def f():
    A = np.ones(3)
    print(A)
    return A[0]

print(f())
f.inspect_cfg(f.signatures[0]).display(view=True)
cres = f.overloads[f.signatures[0]]
print(cres.metadata['prune_stats'])

Output:

$ NUMBA_LLVM_REFPRUNE_FLAGS='diamond' python issue6444.py 
[1. 1. 1.]
-9.868309920863368e+148
PruneStats(basicblock=0, diamond=2, fanout=0, fanout_raise=0)

@sklam
Copy link
Member

sklam commented Nov 2, 2020

This is coming from NRT_adapt_ndarray_to_python that is stealing a reference and the pruner did not account for the stealing.

sklam added a commit that referenced this issue Nov 10, 2020
Fix #6444: pruner issues with reference stealing functions
sklam added a commit to sklam/numba that referenced this issue Nov 12, 2020
Fix numba#6444: pruner issues with reference stealing functions
@sklam
Copy link
Member

sklam commented Nov 19, 2020

RC3 builts are now available and it contains fixes for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - incorrect behavior Bugs: incorrect behavior bug - regression A regression against a previous version of Numba
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants