Skip to content

Commit 1b7743d

Browse files
committed
Unregister destroyed nodes from C++ graph_node_registry
When a node is destroyed, the driver may reuse its CUgraphNode pointer for a new node. Without unregistering the old entry, the registry returns a stale handle pointing to the wrong node type and graph. Made-with: Cursor
1 parent 91b3b4e commit 1b7743d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cuda_core/cuda/core/_cpp/resource_handles.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,10 @@ GraphHandle graph_node_get_graph(const GraphNodeHandle& h) noexcept {
991991

992992
void invalidate_graph_node_handle(const GraphNodeHandle& h) noexcept {
993993
if (h) {
994+
CUgraphNode node = get_box(h)->resource;
995+
if (node) {
996+
graph_node_registry.unregister_handle(node);
997+
}
994998
get_box(h)->resource = nullptr;
995999
}
9961000
}

0 commit comments

Comments
 (0)