Skip to content

Commit 197f773

Browse files
authored
Remove xfail_if_mempool_oom and xfail_on_graph_mempool_oom helpers (#3004)
* Remove xfail_if_mempool_oom and xfail_on_graph_mempool_oom helpers Issue #2381 (mempool OOMs on Windows MCDM) was resolved by disabling ASLR on the affected machine. Drop the xfail helpers that papered over those failures so the test suite surfaces any remaining OOMs directly, and rerun to confirm the helpers are no longer needed. - Delete cuda_python_test_helpers/cuda_python_test_helpers/mempool.py (xfail_if_mempool_oom, is_windows_mcdm_device). - Remove xfail_on_graph_mempool_oom from cuda_core/tests/helpers/memory.py and drop its import across the graph test suite; de-indent the bodies of the removed 'with' blocks. - Drop direct xfail_if_mempool_oom calls in cuda_bindings tests (test_cuda.py, test_cudart.py, test_interoperability.py) and cuda_core (test_managed_memory_warning.py). - In helpers/memory.py, remove the now-dead xfail branches from skip_if_managed_memory_unsupported, create_managed_memory_resource_or_skip, and create_pinned_memory_resource_or_xfail (the latter now just returns the resource). The xfail_device parameter is retained on the public helper signatures to avoid churning call sites.
1 parent 93eb6d5 commit 197f773

11 files changed

Lines changed: 119 additions & 276 deletions

File tree

‎cuda_bindings/tests/test_cuda.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import numpy as np
1111
import pytest
12-
from cuda_python_test_helpers.mempool import xfail_if_mempool_oom
1312
from cuda_python_test_helpers.subprocess_runner import run_python_snippet
1413

1514
import cuda.bindings.driver as cuda
@@ -269,7 +268,6 @@ def test_cuda_memPool_attr():
269268

270269
attr_list = [None] * 8
271270
err, pool = cuda.cuMemPoolCreate(poolProps)
272-
xfail_if_mempool_oom(err, "cuMemPoolCreate", poolProps.location.id)
273271
assert err == cuda.CUresult.CUDA_SUCCESS
274272

275273
for idx, attr in enumerate(
@@ -487,7 +485,6 @@ def test_cuda_graphMem_attr(device):
487485
assert destroy_err == cuda.CUresult.CUDA_SUCCESS
488486
(destroy_err,) = cuda.cuStreamDestroy(stream)
489487
assert destroy_err == cuda.CUresult.CUDA_SUCCESS
490-
xfail_if_mempool_oom(err, "cuGraphAddMemAllocNode", device)
491488
assert err == cuda.CUresult.CUDA_SUCCESS
492489
err, freeNode = cuda.cuGraphAddMemFreeNode(graph, [allocNode], 1, params.dptr)
493490
assert err == cuda.CUresult.CUDA_SUCCESS

‎cuda_bindings/tests/test_cudart.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import numpy as np
88
import pytest
9-
from cuda_python_test_helpers.mempool import xfail_if_mempool_oom
109

1110
import cuda.bindings.driver as cuda
1211
import cuda.bindings.runtime as cudart
@@ -524,7 +523,6 @@ def test_cudart_MemPool_attr():
524523

525524
attr_list = [None] * 8
526525
err, pool = cudart.cudaMemPoolCreate(poolProps)
527-
xfail_if_mempool_oom(err, "cudaMemPoolCreate", poolProps.location.id)
528526
assertSuccess(err)
529527

530528
for idx, attr in enumerate(

‎cuda_core/tests/graph/test_graph_definition.py‎

Lines changed: 48 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import pytest
1414
from helpers.graph_kernels import compile_common_kernels
15-
from helpers.memory import xfail_on_graph_mempool_oom
1615
from helpers.misc import try_create_condition
1716

1817
from cuda.core import Device, LaunchConfig
@@ -206,15 +205,13 @@ def _build_disconnected():
206205
def graph_spec(request, init_cuda):
207206
if request.param is not _build_empty:
208207
_skip_if_no_mempool()
209-
with xfail_on_graph_mempool_oom():
210-
return request.param()
208+
return request.param()
211209

212210

213211
@pytest.fixture(params=_NONEMPTY_BUILDERS)
214212
def nonempty_graph_spec(request, init_cuda):
215213
_skip_if_no_mempool()
216-
with xfail_on_graph_mempool_oom():
217-
return request.param()
214+
return request.param()
218215

219216

220217
# =============================================================================
@@ -569,8 +566,7 @@ def node_spec(request, init_cuda):
569566
if spec.needs_mempool:
570567
_skip_if_no_mempool()
571568
g = GraphDefinition()
572-
with xfail_on_graph_mempool_oom():
573-
node, expected_attrs = spec.builder(g)
569+
node, expected_attrs = spec.builder(g)
574570
return spec, g, node, expected_attrs
575571

576572

@@ -854,21 +850,19 @@ def test_free_creates_dependency(init_cuda):
854850
"""Free node depends on its predecessor."""
855851
sample_graphdef = GraphDefinition()
856852
_skip_if_no_mempool()
857-
with xfail_on_graph_mempool_oom():
858-
alloc = sample_graphdef.allocate(ALLOC_SIZE)
859-
free = alloc.deallocate(alloc.dptr)
853+
alloc = sample_graphdef.allocate(ALLOC_SIZE)
854+
free = alloc.deallocate(alloc.dptr)
860855
assert alloc in free.pred
861856

862857

863858
def test_alloc_free_chain(init_cuda):
864859
"""Alloc and free can be chained."""
865860
sample_graphdef = GraphDefinition()
866861
_skip_if_no_mempool()
867-
with xfail_on_graph_mempool_oom():
868-
a1 = sample_graphdef.allocate(ALLOC_SIZE)
869-
a2 = a1.allocate(ALLOC_SIZE)
870-
f2 = a2.deallocate(a2.dptr)
871-
f1 = f2.deallocate(a1.dptr)
862+
a1 = sample_graphdef.allocate(ALLOC_SIZE)
863+
a2 = a1.allocate(ALLOC_SIZE)
864+
f2 = a2.deallocate(a2.dptr)
865+
f1 = f2.deallocate(a1.dptr)
872866
assert a1 in a2.pred
873867
assert a2 in f2.pred
874868
assert f2 in f1.pred
@@ -898,17 +892,15 @@ def test_alloc_device_option(init_cuda, device_spec):
898892
sample_graphdef = GraphDefinition()
899893
_skip_if_no_mempool()
900894
device = Device()
901-
with xfail_on_graph_mempool_oom(device):
902-
node = sample_graphdef.allocate(ALLOC_SIZE, device=device_spec(device))
895+
node = sample_graphdef.allocate(ALLOC_SIZE, device=device_spec(device))
903896
assert node.dptr != 0
904897

905898

906899
def test_alloc_peer_access(mempool_device_x2):
907900
"""AllocNode.peer_access reflects requested peers."""
908901
d0, d1 = mempool_device_x2
909902
g = GraphDefinition()
910-
with xfail_on_graph_mempool_oom(d0):
911-
node = g.allocate(ALLOC_SIZE, device=d0.device_id, peer_access=[d1.device_id])
903+
node = g.allocate(ALLOC_SIZE, device=d0.device_id, peer_access=[d1.device_id])
912904
assert d1.device_id in node.peer_access
913905

914906

@@ -920,8 +912,7 @@ def test_alloc_memory_type_host(init_cuda):
920912

921913
g = GraphDefinition()
922914
try:
923-
with xfail_on_graph_mempool_oom():
924-
node = g.allocate(ALLOC_SIZE, memory_type=GraphMemoryType.HOST)
915+
node = g.allocate(ALLOC_SIZE, memory_type=GraphMemoryType.HOST)
925916
except CUDAError as e:
926917
if "CUDA_ERROR_NOT_SUPPORTED" in str(e):
927918
pytest.skip("Driver does not support graph alloc memory_type='host'")
@@ -950,9 +941,8 @@ def test_join_merges_branches(init_cuda, num_branches):
950941
"""join() with multiple branches creates correct dependencies."""
951942
sample_graphdef = GraphDefinition()
952943
_skip_if_no_mempool()
953-
with xfail_on_graph_mempool_oom():
954-
branches = [sample_graphdef.allocate(ALLOC_SIZE) for _ in range(num_branches)]
955-
joined = sample_graphdef.join(*branches)
944+
branches = [sample_graphdef.allocate(ALLOC_SIZE) for _ in range(num_branches)]
945+
joined = sample_graphdef.join(*branches)
956946
assert isinstance(joined, EmptyNode)
957947
assert set(joined.pred) == set(branches)
958948

@@ -1048,9 +1038,8 @@ def test_instantiate_with_nodes(init_cuda, inst_kwargs):
10481038
"""Graph with nodes can be instantiated."""
10491039
sample_graphdef = GraphDefinition()
10501040
_skip_if_no_mempool()
1051-
with xfail_on_graph_mempool_oom():
1052-
sample_graphdef.allocate(ALLOC_SIZE)
1053-
sample_graphdef.allocate(ALLOC_SIZE)
1041+
sample_graphdef.allocate(ALLOC_SIZE)
1042+
sample_graphdef.allocate(ALLOC_SIZE)
10541043
graph = _instantiate(sample_graphdef, inst_kwargs)
10551044
assert graph is not None
10561045

@@ -1093,9 +1082,8 @@ def test_instantiate_and_execute_alloc_free(init_cuda, inst_kwargs):
10931082
"""Graph with alloc/free can be executed."""
10941083
sample_graphdef = GraphDefinition()
10951084
_skip_if_no_mempool()
1096-
with xfail_on_graph_mempool_oom():
1097-
alloc = sample_graphdef.allocate(ALLOC_SIZE)
1098-
alloc.deallocate(alloc.dptr)
1085+
alloc = sample_graphdef.allocate(ALLOC_SIZE)
1086+
alloc.deallocate(alloc.dptr)
10991087

11001088
stream = Device().create_stream()
11011089
graph = _instantiate_and_upload(sample_graphdef, inst_kwargs, stream)
@@ -1108,10 +1096,9 @@ def test_instantiate_and_execute_memset(init_cuda, inst_kwargs):
11081096
"""Graph with alloc/memset/free can be executed."""
11091097
sample_graphdef = GraphDefinition()
11101098
_skip_if_no_mempool()
1111-
with xfail_on_graph_mempool_oom():
1112-
alloc = sample_graphdef.allocate(ALLOC_SIZE)
1113-
ms = alloc.memset(alloc.dptr, 0xAB, ALLOC_SIZE)
1114-
ms.deallocate(alloc.dptr)
1099+
alloc = sample_graphdef.allocate(ALLOC_SIZE)
1100+
ms = alloc.memset(alloc.dptr, 0xAB, ALLOC_SIZE)
1101+
ms.deallocate(alloc.dptr)
11151102

11161103
stream = Device().create_stream()
11171104
graph = _instantiate_and_upload(sample_graphdef, inst_kwargs, stream)
@@ -1126,13 +1113,12 @@ def test_instantiate_and_execute_memcpy(init_cuda, inst_kwargs):
11261113
_skip_if_no_mempool()
11271114
import ctypes
11281115

1129-
with xfail_on_graph_mempool_oom():
1130-
src_alloc = sample_graphdef.allocate(ALLOC_SIZE)
1131-
dst_alloc = sample_graphdef.allocate(ALLOC_SIZE)
1132-
dep = sample_graphdef.join(src_alloc, dst_alloc)
1133-
ms = dep.memset(src_alloc.dptr, 0xAB, ALLOC_SIZE)
1134-
cp = ms.memcpy(dst_alloc.dptr, src_alloc.dptr, ALLOC_SIZE)
1135-
cp.deallocate(src_alloc.dptr)
1116+
src_alloc = sample_graphdef.allocate(ALLOC_SIZE)
1117+
dst_alloc = sample_graphdef.allocate(ALLOC_SIZE)
1118+
dep = sample_graphdef.join(src_alloc, dst_alloc)
1119+
ms = dep.memset(src_alloc.dptr, 0xAB, ALLOC_SIZE)
1120+
cp = ms.memcpy(dst_alloc.dptr, src_alloc.dptr, ALLOC_SIZE)
1121+
cp.deallocate(src_alloc.dptr)
11361122

11371123
stream = Device().create_stream()
11381124
graph = _instantiate_and_upload(sample_graphdef, inst_kwargs, stream)
@@ -1360,12 +1346,11 @@ def test_instantiate_and_execute_if_then(init_cuda):
13601346
set_handle = mod.get_kernel("set_handle")
13611347
add_one = mod.get_kernel("add_one")
13621348

1363-
with xfail_on_graph_mempool_oom():
1364-
alloc = sample_graphdef.allocate(ctypes.sizeof(ctypes.c_int))
1365-
ms = alloc.memset(alloc.dptr, 0, ctypes.sizeof(ctypes.c_int))
1366-
setter = ms.launch(LaunchConfig(grid=1, block=1), set_handle, condition, 1)
1367-
if_node = setter.if_then(condition)
1368-
if_node.then.launch(LaunchConfig(grid=1, block=1), add_one, alloc.dptr)
1349+
alloc = sample_graphdef.allocate(ctypes.sizeof(ctypes.c_int))
1350+
ms = alloc.memset(alloc.dptr, 0, ctypes.sizeof(ctypes.c_int))
1351+
setter = ms.launch(LaunchConfig(grid=1, block=1), set_handle, condition, 1)
1352+
if_node = setter.if_then(condition)
1353+
if_node.then.launch(LaunchConfig(grid=1, block=1), add_one, alloc.dptr)
13691354

13701355
graph = sample_graphdef.instantiate()
13711356
stream = Device().create_stream()
@@ -1394,14 +1379,13 @@ def test_instantiate_and_execute_if_else(init_cuda):
13941379
set_handle = mod.get_kernel("set_handle")
13951380
add_one = mod.get_kernel("add_one")
13961381

1397-
with xfail_on_graph_mempool_oom():
1398-
alloc = sample_graphdef.allocate(ctypes.sizeof(ctypes.c_int))
1399-
ms = alloc.memset(alloc.dptr, 0, ctypes.sizeof(ctypes.c_int))
1400-
setter = ms.launch(LaunchConfig(grid=1, block=1), set_handle, condition, 0)
1401-
ie_node = setter.if_else(condition)
1402-
ie_node.then.launch(LaunchConfig(grid=1, block=1), add_one, alloc.dptr)
1403-
n1 = ie_node.else_.launch(LaunchConfig(grid=1, block=1), add_one, alloc.dptr)
1404-
n1.launch(LaunchConfig(grid=1, block=1), add_one, alloc.dptr)
1382+
alloc = sample_graphdef.allocate(ctypes.sizeof(ctypes.c_int))
1383+
ms = alloc.memset(alloc.dptr, 0, ctypes.sizeof(ctypes.c_int))
1384+
setter = ms.launch(LaunchConfig(grid=1, block=1), set_handle, condition, 0)
1385+
ie_node = setter.if_else(condition)
1386+
ie_node.then.launch(LaunchConfig(grid=1, block=1), add_one, alloc.dptr)
1387+
n1 = ie_node.else_.launch(LaunchConfig(grid=1, block=1), add_one, alloc.dptr)
1388+
n1.launch(LaunchConfig(grid=1, block=1), add_one, alloc.dptr)
14051389

14061390
graph = sample_graphdef.instantiate()
14071391
stream = Device().create_stream()
@@ -1430,13 +1414,12 @@ def test_instantiate_and_execute_switch(init_cuda):
14301414
set_handle = mod.get_kernel("set_handle")
14311415
add_one = mod.get_kernel("add_one")
14321416

1433-
with xfail_on_graph_mempool_oom():
1434-
alloc = sample_graphdef.allocate(ctypes.sizeof(ctypes.c_int))
1435-
ms = alloc.memset(alloc.dptr, 0, ctypes.sizeof(ctypes.c_int))
1436-
setter = ms.launch(LaunchConfig(grid=1, block=1), set_handle, condition, 2)
1437-
sw_node = setter.switch(condition, 4)
1438-
for branch in sw_node.branches:
1439-
branch.launch(LaunchConfig(grid=1, block=1), add_one, alloc.dptr)
1417+
alloc = sample_graphdef.allocate(ctypes.sizeof(ctypes.c_int))
1418+
ms = alloc.memset(alloc.dptr, 0, ctypes.sizeof(ctypes.c_int))
1419+
setter = ms.launch(LaunchConfig(grid=1, block=1), set_handle, condition, 2)
1420+
sw_node = setter.switch(condition, 4)
1421+
for branch in sw_node.branches:
1422+
branch.launch(LaunchConfig(grid=1, block=1), add_one, alloc.dptr)
14401423

14411424
graph = sample_graphdef.instantiate()
14421425
stream = Device().create_stream()
@@ -1474,8 +1457,7 @@ def test_debug_dot_print_creates_file(init_cuda, tmp_path):
14741457
sample_graphdef = GraphDefinition()
14751458
dot_file = tmp_path / "graph.dot"
14761459
_skip_if_no_mempool()
1477-
with xfail_on_graph_mempool_oom():
1478-
sample_graphdef.allocate(ALLOC_SIZE)
1460+
sample_graphdef.allocate(ALLOC_SIZE)
14791461
sample_graphdef.debug_dot_print(str(dot_file))
14801462
assert dot_file.exists()
14811463
content = dot_file.read_text()
@@ -1487,8 +1469,7 @@ def test_debug_dot_print_with_options(init_cuda, tmp_path):
14871469
sample_graphdef = GraphDefinition()
14881470
dot_file = tmp_path / "graph.dot"
14891471
_skip_if_no_mempool()
1490-
with xfail_on_graph_mempool_oom():
1491-
sample_graphdef.allocate(ALLOC_SIZE)
1472+
sample_graphdef.allocate(ALLOC_SIZE)
14921473
options = GraphDebugPrintOptions(verbose=True, handles=True)
14931474
sample_graphdef.debug_dot_print(str(dot_file), options)
14941475
assert dot_file.exists()
@@ -1499,7 +1480,6 @@ def test_debug_dot_print_invalid_options(init_cuda, tmp_path):
14991480
sample_graphdef = GraphDefinition()
15001481
dot_file = tmp_path / "graph.dot"
15011482
_skip_if_no_mempool()
1502-
with xfail_on_graph_mempool_oom():
1503-
sample_graphdef.allocate(ALLOC_SIZE)
1483+
sample_graphdef.allocate(ALLOC_SIZE)
15041484
with pytest.raises(TypeError, match="options must be a GraphDebugPrintOptions"):
15051485
sample_graphdef.debug_dot_print(str(dot_file), "invalid")

‎cuda_core/tests/graph/test_graph_definition_errors.py‎

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import pytest
99
from helpers.graph_kernels import compile_common_kernels
10-
from helpers.memory import xfail_on_graph_mempool_oom
1110
from helpers.misc import try_create_condition
1211

1312
from cuda.core import Device, LaunchConfig
@@ -70,8 +69,7 @@ def test_memset_invalid_value_size(init_cuda):
7069
"""memset with 3-byte value (not 1, 2, or 4) raises ValueError."""
7170
_skip_if_no_mempool()
7271
g = GraphDefinition()
73-
with xfail_on_graph_mempool_oom():
74-
alloc = g.allocate(1024)
72+
alloc = g.allocate(1024)
7573
with pytest.raises(ValueError):
7674
alloc.memset(alloc.dptr, b"\x01\x02\x03", 100)
7775

@@ -115,9 +113,8 @@ def test_join_single_predecessor(init_cuda):
115113
"""node.join() with no extra args creates a single-dep empty node."""
116114
_skip_if_no_mempool()
117115
g = GraphDefinition()
118-
with xfail_on_graph_mempool_oom():
119-
a = g.allocate(1024)
120-
joined = a.join()
116+
a = g.allocate(1024)
117+
joined = a.join()
121118
assert isinstance(joined, EmptyNode)
122119
assert set(joined.pred) == {a}
123120

@@ -139,8 +136,7 @@ def test_unmatched_alloc_succeeds(init_cuda):
139136
"""Alloc without corresponding free is valid (graph-scoped lifetime)."""
140137
_skip_if_no_mempool()
141138
g = GraphDefinition()
142-
with xfail_on_graph_mempool_oom():
143-
g.allocate(1024)
139+
g.allocate(1024)
144140
graph = g.instantiate()
145141
stream = Device().create_stream()
146142
graph.launch(stream)
@@ -178,11 +174,10 @@ def test_while_loop_zero_iterations(init_cuda):
178174

179175
g = GraphDefinition()
180176
condition = g.create_condition(default_value=0)
181-
with xfail_on_graph_mempool_oom():
182-
alloc = g.allocate(SIZEOF_INT)
183-
ms = alloc.memset(alloc.dptr, 0, SIZEOF_INT)
184-
loop = ms.while_loop(condition)
185-
loop.body.launch(cfg, add_one, alloc.dptr)
177+
alloc = g.allocate(SIZEOF_INT)
178+
ms = alloc.memset(alloc.dptr, 0, SIZEOF_INT)
179+
loop = ms.while_loop(condition)
180+
loop.body.launch(cfg, add_one, alloc.dptr)
186181

187182
graph = g.instantiate()
188183
stream = Device().create_stream()
@@ -207,11 +202,10 @@ def test_if_then_false_skips_body(init_cuda):
207202

208203
g = GraphDefinition()
209204
condition = g.create_condition(default_value=0)
210-
with xfail_on_graph_mempool_oom():
211-
alloc = g.allocate(SIZEOF_INT)
212-
ms = alloc.memset(alloc.dptr, 0, SIZEOF_INT)
213-
if_node = ms.if_then(condition)
214-
if_node.then.launch(cfg, add_one, alloc.dptr)
205+
alloc = g.allocate(SIZEOF_INT)
206+
ms = alloc.memset(alloc.dptr, 0, SIZEOF_INT)
207+
if_node = ms.if_then(condition)
208+
if_node.then.launch(cfg, add_one, alloc.dptr)
215209

216210
graph = g.instantiate()
217211
stream = Device().create_stream()
@@ -236,12 +230,11 @@ def test_switch_oob_skips_all_branches(init_cuda):
236230

237231
g = GraphDefinition()
238232
condition = g.create_condition(default_value=99)
239-
with xfail_on_graph_mempool_oom():
240-
alloc = g.allocate(SIZEOF_INT)
241-
ms = alloc.memset(alloc.dptr, 0, SIZEOF_INT)
242-
sw = ms.switch(condition, 3)
243-
for branch in sw.branches:
244-
branch.launch(cfg, add_one, alloc.dptr)
233+
alloc = g.allocate(SIZEOF_INT)
234+
ms = alloc.memset(alloc.dptr, 0, SIZEOF_INT)
235+
sw = ms.switch(condition, 3)
236+
for branch in sw.branches:
237+
branch.launch(cfg, add_one, alloc.dptr)
245238

246239
graph = g.instantiate()
247240
stream = Device().create_stream()

0 commit comments

Comments
 (0)