Skip to content

Commit 91b3b4e

Browse files
committed
Skip NULL nodes in graph_node_registry to fix sentinel identity collision
Sentinel (entry) nodes use NULL as their CUgraphNode, so caching them under a NULL key caused all sentinels across different graphs to share the same handle. This made nodes built from the wrong graph's entry point, causing CUDA_ERROR_INVALID_VALUE for conditional nodes and hash collisions in equality tests. Made-with: Cursor
1 parent 7a3dbb4 commit 91b3b4e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cuda_core/cuda/core/_cpp/resource_handles.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -972,12 +972,16 @@ static const GraphNodeBox* get_box(const GraphNodeHandle& h) {
972972
static HandleRegistry<CUgraphNode, GraphNodeHandle> graph_node_registry;
973973

974974
GraphNodeHandle create_graph_node_handle(CUgraphNode node, const GraphHandle& h_graph) {
975-
if (auto h = graph_node_registry.lookup(node)) {
976-
return h;
975+
if (node) {
976+
if (auto h = graph_node_registry.lookup(node)) {
977+
return h;
978+
}
977979
}
978980
auto box = std::make_shared<const GraphNodeBox>(GraphNodeBox{node, h_graph});
979981
GraphNodeHandle h(box, &box->resource);
980-
graph_node_registry.register_handle(node, h);
982+
if (node) {
983+
graph_node_registry.register_handle(node, h);
984+
}
981985
return h;
982986
}
983987

0 commit comments

Comments
 (0)