Skip to content

Commit

Permalink
pull in another test from numba cpu target
Browse files Browse the repository at this point in the history
  • Loading branch information
isVoid committed Dec 4, 2024
1 parent 050f21c commit 8f454ac
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions numba_cuda/numba/cuda/tests/nrt/test_nrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,29 @@ def if_with_allocation_and_initialization(arr1, test1):
self.assertEqual(cur_stats.alloc - init_stats.alloc,
cur_stats.free - init_stats.free)

def test_del_at_beginning_of_loop(self):
"""
Test issue #1734
"""
@cuda.jit
def f(arr):
res = 0

for i in (0, 1):
# `del t` is issued here before defining t. It must be
# correctly handled by the lowering phase.
t = arr[i]
if t[i] > 1:
res += t[i]

arr = np.ones((2, 2))
init_stats = rtsys.get_allocation_stats()
with patch('numba.config.CUDA_ENABLE_NRT', True, create=True):
f[1, 1](arr)
cur_stats = rtsys.get_allocation_stats()
self.assertEqual(cur_stats.alloc - init_stats.alloc,
cur_stats.free - init_stats.free)


class TestNrtBasic(CUDATestCase):
def test_nrt_launches(self):
Expand Down

0 comments on commit 8f454ac

Please sign in to comment.