Skip to content

Commit 51cfcb0

Browse files
committed
Fix GraphDef test race condition; correct handle property annotations
- Chain GraphDef kernel launches sequentially (n.launch instead of g.launch) to avoid concurrent writes to the same memory location - Update GraphDef.handle and GraphNode.handle annotations to reflect that as_py returns driver types (CUgraph, CUgraphNode), not int Made-with: Cursor
1 parent d3c4ef4 commit 51cfcb0

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

cuda_core/cuda/core/_graph/_graphdef.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,8 @@ cdef class GraphDef:
529529
)
530530

531531
@property
532-
def handle(self) -> int:
533-
"""Return the underlying CUgraph handle."""
532+
def handle(self):
533+
"""Return the underlying driver CUgraph handle."""
534534
return as_py(self._h_graph)
535535

536536

@@ -624,8 +624,8 @@ cdef class GraphNode:
624624
return GraphDef._from_handle(graph_node_get_graph(self._h_node))
625625

626626
@property
627-
def handle(self) -> int | None:
628-
"""Return the underlying CUgraphNode handle as an int.
627+
def handle(self):
628+
"""Return the underlying driver CUgraphNode handle.
629629
630630
Returns None for the entry node.
631631
"""

cuda_core/tests/graph/test_graph_update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def build(ptr):
3838

3939
def build(ptr):
4040
g = GraphDef()
41-
g.launch(LaunchConfig(grid=1, block=1), add_one, ptr)
42-
g.launch(LaunchConfig(grid=1, block=1), add_one, ptr)
41+
n = g.launch(LaunchConfig(grid=1, block=1), add_one, ptr)
42+
n.launch(LaunchConfig(grid=1, block=1), add_one, ptr)
4343
return g.instantiate(), g
4444

4545
graph, _ = build(arr[0:].ctypes.data)

0 commit comments

Comments
 (0)