Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 14 additions & 25 deletions cuda_core/tests/graph/test_graph_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import ctypes
import gc
import sys
import weakref
from collections.abc import Callable
from dataclasses import dataclass, field

Expand Down Expand Up @@ -761,7 +760,6 @@ def test_identity_preservation(init_cuda):

def test_registry_cleanup(init_cuda):
"""Node registry entries are removed on destroy() and graph teardown."""
import gc

from cuda.core.graph._graph_node import _node_registry

Expand Down Expand Up @@ -926,37 +924,28 @@ def test_alloc_peer_access(mempool_device_x2):
assert d1.device_id in node.peer_access


# This test is not currently run in any CI job
@pytest.mark.agent_authored(model="gpt-5.6-sol")
def test_alloc_memory_type_host(init_cuda):
"""HOST graph alloc nodes reconstruct memory_type from the driver, not the Python argument."""
skip_if_mempool_unsupported()
@pytest.mark.agent_authored(model="claude-opus-5-5")
def test_alloc_memory_type_host_not_supported(init_cuda):
"""Drivers reject host-located graph allocations with NOT_SUPPORTED.

Graph memory nodes are documented only for device-resident memory, and
every driver checked rejects host locations (#3588): CUDA 13.0 through
13.5, on Linux, Windows (TCC, MCDM, WDDM) and WSL, including GH200 and
GB300. If a driver starts accepting them, this fails; replace it with a
test that the allocation round-trips (memory_type and dptr of the node
reconstructed from the driver).
"""
from cuda.core._utils.cuda_utils import CUDAError
from cuda.core._utils.version import driver_version

skip_if_mempool_unsupported()
# CUDA 12 rejects HOST pool properties before graph support is checked.
if driver_version() < (13, 0, 0):
pytest.skip("CUDA drivers before 13.0 reject HOST allocation properties")

g = GraphDefinition()
try:
node = g.allocate(ALLOC_SIZE, memory_type=GraphMemoryType.HOST)
except CUDAError as e:
if "CUDA_ERROR_NOT_SUPPORTED" in str(e):
pytest.skip("Driver does not support graph alloc memory_type='host'")
raise

expected_dptr = node.dptr
succ = node.record(Device().create_event())
node_ref = weakref.ref(node)
del node
gc.collect()
assert node_ref() is None
reconstructed = next(iter(succ.pred))
assert isinstance(reconstructed, AllocNode)
assert reconstructed.memory_type == GraphMemoryType.HOST
assert reconstructed.dptr == expected_dptr
assert reconstructed.dptr != 0
with pytest.raises(CUDAError, match="CUDA_ERROR_NOT_SUPPORTED"):
g.allocate(ALLOC_SIZE, memory_type=GraphMemoryType.HOST)
Comment on lines 946 to +948

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

important: The test now permanently asserts that the driver rejects HOST graph allocation. A driver that starts accepting it will fail the suite.

Take a driver on CUDA 13.0 or later with mempool support that accepts HOST graph allocation. g.allocate(...) succeeds, pytest.raises fails, and the test gives no skip or round-trip coverage. The docstring tells maintainers to replace the test in that case. That makes a driver upgrade break CI. It also removes the earlier memory_type and dptr round-trip coverage.

The PR objectives record this as intended, backed by reported probes on CUDA 13.0 through 13.5. The linked issue #3588 asks for the feature requirement to be encoded in a skip condition. The test does not do that. The failure is a deliberate signal, but it blocks unrelated work. Check whether a failure on a newer driver should block CI. If it should not, accept a successful allocation and run the round trip on that path. Keep the NOT_SUPPORTED assertion for drivers that reject it.

Based on learnings, do not replace test coverage by deleting it. Keep the round-trip assertions available for drivers that accept HOST allocation.

Source: Learnings



# =============================================================================
Expand Down
Loading