test(cuda.core): cover PDL same-stream overlap via GraphBuilder capture - #2524
Conversation
Cover GraphBuilder stream-capture for programmatic_stream_serialization: functional launch, programmatic dependency edge mapping, and Hopper+ overlap (xfail if opportunistic), plus 1.2.0 release notes.
Refer to cudaLaunchAttributeProgrammaticStreamSerialization instead of the driver-style CU_LAUNCH_ATTRIBUTE_* spelling.
7ebea54 to
4ca415b
Compare
|
/ok to test 4ca415b |
The test writes host buffers from np.from_dlpack, which are read-only before NumPy 2.2.5 (GH #28632).
Align with other graph builder tests so context setup and teardown stay consistent.
Drop fragile Programming Guide section numbers and note Driver vs Runtime enum name equivalence at the edge asserts.
Extract kernels and the same-stream / graph-capture overlap check into run_pdl_overlap_check so launcher and GraphBuilder tests stay in sync.
Both direct and graph-capture paths are same-stream; update names and docs accordingly.
|
/ok to test fdfdf8b |
This comment has been minimized.
This comment has been minimized.
| return mod.get_kernel("primary_kernel"), mod.get_kernel("secondary_kernel") | ||
|
|
||
|
|
||
| def run_pdl_overlap_check(device, *, via_graph: bool = False): |
There was a problem hiding this comment.
Why do we need to test with graph launch? This seems like an additional requirement for programmatic stream.
There was a problem hiding this comment.
Yeah, that is a request in #1334
per "PDL launches are graph-compatible and this use case should be tested and showcased"
| mod = compile_common_kernels() | ||
| producer = mod.get_kernel("add_one") | ||
| consumer = mod.get_kernel("add_one") |
There was a problem hiding this comment.
So... I'm curious. add_one is a simple kernel that doesn't have programmatic dependency like the kernel primary_kernel. Setting programmatic_stream_serialization between for the second launch still create a graph dependency between these two kernels?
There was a problem hiding this comment.
Yeah, here just needs two dummy kernels as input so that we can check things in _assert_programmatic_dependency_edge.
Renamed to dummy_kernel.
fdfdf8b to
2e0d2e6
Compare
…tests Keep the stream overlap case self-contained in test_launcher, and inline the graph capture/overlap checks in test_graph_builder so each path stays simple.
Avoid implying an in-kernel producer/consumer dependency; the test only needs two launches for the programmatic edge assert.
|
/ok to test 8f922e6 |
| from cuda.bindings import driver | ||
|
|
||
| h_graph = graph_definition.handle | ||
| err, _, _, _, num_edges = driver.cuGraphGetEdges(h_graph) |
There was a problem hiding this comment.
This API seems to return different number of results based on the major version so you can do:
| err, _, _, _, num_edges = driver.cuGraphGetEdges(h_graph) | |
| if driver.CUDA_VERSION >= 13000: | |
| err, _, _, _, num_edges = driver.cuGraphGetEdges(h_graph) | |
| else: | |
| err, _, _, _, num_edges = driver.cuGraphGetEdges_v2(h_graph) |
Though what stands out here is that cuda.core graph APIs discards the edge data to prevent implementing the whole helper solely with cuda.core. A feature gap we can consider adding?
There was a problem hiding this comment.
Good point — yeah, without edge metadata on the cuda.core graph APIs this helper has to go through cuda.bindings.
|
/ok to test ee0e37f |
Published cuda-bindings <13.3.0 (or <12.9.7 on 12.x) returns dangling CUgraphEdgeData from cuGraphGetEdges; also fix release-note RST indent.
|
/ok to test b98324c |
|
@isVoid Thanks for the commit that handles the versioned cuGraphGetEdges / cuGraphGetEdges_v2 API! I dug into the remaining CI failures on the CUDA 13.0.x rows. They weren’t from the versioned-edge-API handling — those jobs install published cuda-bindings==13.0.* from PyPI, and that line still has the use-after-free in cuGraphGetEdges where the returned CUgraphEdgeData wrappers point at a freed scratch buffer (#1804). The fix only shipped in 13.3.0 (and was backported to 12.9.7 on the 12.x branch), so 13.0.x / 13.1.x / 13.2.x published wheels don’t have it. I pushed a follow-up that skips the edge-data assertion on those older bindings. |
|
pre-commit.ci run |
|
Description
close #1334
programmatic_stream_serialization: programmatic dependency-edge mapping and same-stream primary/secondary overlap (Hopper+, opportunistic → xfail).helpers/pdl_kernels.pyso direct and graph-capture paths stay in sync.Checklist