You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on the AMD functionality, I came across an issue in Numba. I'm also filing an issue with the Numba folks, but until they get back, be advised that memory associated with arrays can (apparently) be freed and re-used before the last reference to its content is used.
This program, which should print 67890 (the value most recently assigned to func_b's local_record), actually prints 12345 (the value most recently assigned to func_a's local_record).
It looks like Numba thinks we aren't using the local_record from func_b anymore because we are passing one of its elements, rather than the whole thing.
The memory associated with func_b's local_record gets re-used as the local_record for func_a, and now we have two separate variables seemingly occupying the same memory.
It's a bit clunky, but it may be our only option in the short term. I'm tweaking my AMD branch to match this fix. I'll let you folks know how it goes, in case you want to perform similar changes to dev ahead of the merge.
The text was updated successfully, but these errors were encountered:
Are the ones currently in MC/DC (the local_*s) good, @braxtoncuneo?
Not exactly. Those functions were written under the idea that the values passed out of those functions are passed out by value. This bug implies that records always refer to their originating array, and that arrays do not persist in other scopes unless those arrays are passed through.
I'm working on possible workarounds. My current best candidate is declaring arrays through inlined overloads/intrinsics/builtins.
While working on the AMD functionality, I came across an issue in Numba. I'm also filing an issue with the Numba folks, but until they get back, be advised that memory associated with arrays can (apparently) be freed and re-used before the last reference to its content is used.
Here's a minimum viable reproduction:
This program, which should print
67890
(the value most recently assigned tofunc_b
'slocal_record
), actually prints12345
(the value most recently assigned to func_a'slocal_record
).It looks like Numba thinks we aren't using the
local_record
fromfunc_b
anymore because we are passing one of its elements, rather than the whole thing.The memory associated with
func_b
'slocal_record
gets re-used as thelocal_record
forfunc_a
, and now we have two separate variables seemingly occupying the same memory.Here is a fix that works for the mvr:
It's a bit clunky, but it may be our only option in the short term. I'm tweaking my AMD branch to match this fix. I'll let you folks know how it goes, in case you want to perform similar changes to
dev
ahead of the merge.The text was updated successfully, but these errors were encountered: