1212
1313import pytest
1414from helpers .graph_kernels import compile_common_kernels
15- from helpers .memory import xfail_on_graph_mempool_oom
1615from helpers .misc import try_create_condition
1716
1817from cuda .core import Device , LaunchConfig
@@ -206,15 +205,13 @@ def _build_disconnected():
206205def 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 )
214212def 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
863858def 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
906899def 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" )
0 commit comments