Skip to content

Commit ab9e20f

Browse files
authored
test: harden test_vmm_allocate_zero_size against parallel-run flakes (#3010)
test_vmm_allocate_zero_size asserts that grown.close() waits on the recorded deallocation stream (done.is_done after a 200ms nanosleep). It ran as PARALLEL under the free-threaded (py3.14t) job and failed on aarch64 / A100 / CUDA 13.0.2 with assert done.is_done == False, while its sibling test_vmm_close_synchronizes_recorded_streams (which is marked thread_unsafe and wraps the close in assert_no_cuda_warning) passed. The close path never raises: if cuStreamSynchronize is skipped (capture) or fails, sync_recorded_stream reports a CUDAWarning and unmaps anyway, so the failure surfaced as a bare event-check failure with no clue why. Match the sibling test: - Mark thread_unsafe so the free-threaded job runs it serially, matching the other close-synchronizes tests that record process-global warnings. - Wrap grown.close() in assert_no_cuda_warning() so a skipped/failed sync surfaces as the warning text instead of a bare assert False. If the test still fails when run serially on that job, it is a real library bug in the VMM sync path rather than a parallel-execution artifact.
1 parent 6869849 commit ab9e20f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎cuda_core/tests/test_memory.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,6 +1765,7 @@ def test_vmm_host_modify_allocation_rejects_exportable_handle_type(init_cuda):
17651765

17661766

17671767
@pytest.mark.agent_authored(model="claude-fable-5-1")
1768+
@pytest.mark.thread_unsafe(reason="records process-global warnings")
17681769
def test_vmm_allocate_zero_size(init_cuda):
17691770
"""allocate(0) returns an empty buffer without a driver call; a grow of it inherits its stream."""
17701771
device = _vmm_device_or_skip()
@@ -1780,10 +1781,12 @@ def test_vmm_allocate_zero_size(init_cuda):
17801781
# The grown buffer's deallocation is ordered on the stream passed to
17811782
# allocate(0): its close waits for the work queued there. The sleep
17821783
# kernel does not touch the buffer, so a missing wait fails the event
1783-
# check instead of faulting.
1784+
# check instead of faulting. The close is wrapped so a skipped sync
1785+
# surfaces as a CUDAWarning instead of a bare event-check failure.
17841786
NanosleepKernel(device, sleep_duration_ms=200).launch(s)
17851787
done = s.record()
1786-
grown.close()
1788+
with assert_no_cuda_warning():
1789+
grown.close()
17871790
assert done.is_done
17881791
buf.close()
17891792
finally:

0 commit comments

Comments
 (0)