Skip to content

Commit 3eb2338

Browse files
[SYCLomatic] Add migration of cudaGraphDestroy (#2761)
Signed-off-by: Daiyaan Ahmed <daiyaan.ahmed@intel.com>
1 parent 3afce99 commit 3eb2338

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

clang/lib/DPCT/RulesLang/APINamesGraph.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,10 @@ ASSIGNABLE_FACTORY(CONDITIONAL_FACTORY_ENTRY(
9797
Diagnostics::TRY_EXPERIMENTAL_FEATURE,
9898
ARG("cudaGraphGetRootNodes"),
9999
ARG("--use-experimental-features=graph"))))
100+
101+
ASSIGNABLE_FACTORY(CONDITIONAL_FACTORY_ENTRY(
102+
UseExtGraph, DELETE_FACTORY_ENTRY("cudaGraphDestroy", ARG(0)),
103+
UNSUPPORT_FACTORY_ENTRY("cudaGraphDestroy",
104+
Diagnostics::TRY_EXPERIMENTAL_FEATURE,
105+
ARG("cudaGraphDestroy"),
106+
ARG("--use-experimental-features=graph"))))

clang/lib/DPCT/RulesLang/RulesLangGraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void GraphRule::registerMatcher(MatchFinder &MF) {
3434
"cudaGraphExecDestroy", "cudaGraphAddEmptyNode",
3535
"cudaGraphAddDependencies", "cudaGraphExecUpdate",
3636
"cudaGraphNodeGetType", "cudaGraphGetNodes",
37-
"cudaGraphGetRootNodes");
37+
"cudaGraphGetRootNodes", "cudaGraphDestroy");
3838
};
3939
MF.addMatcher(
4040
callExpr(callee(functionDecl(functionName()))).bind("FunctionCall"),

clang/lib/DPCT/SrcAPI/APINames.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ ENTRY(cudaGraphClone, cudaGraphClone, false, NO_FLAG, P4, "comment")
419419
ENTRY(cudaGraphConditionalHandleCreate, cudaGraphConditionalHandleCreate, false, NO_FLAG, P4, "comment")
420420
ENTRY(cudaGraphCreate, cudaGraphCreate, false, NO_FLAG, P4, "comment")
421421
ENTRY(cudaGraphDebugDotPrint, cudaGraphDebugDotPrint, false, NO_FLAG, P4, "comment")
422-
ENTRY(cudaGraphDestroy, cudaGraphDestroy, false, NO_FLAG, P4, "comment")
422+
ENTRY(cudaGraphDestroy, cudaGraphDestroy, true, NO_FLAG, P4, "Successful/DPCT1119")
423423
ENTRY(cudaGraphDestroyNode, cudaGraphDestroyNode, false, NO_FLAG, P4, "comment")
424424
ENTRY(cudaGraphEventRecordNodeGetEvent, cudaGraphEventRecordNodeGetEvent, false, NO_FLAG, P4, "comment")
425425
ENTRY(cudaGraphEventRecordNodeSetEvent, cudaGraphEventRecordNodeSetEvent, false, NO_FLAG, P4, "comment")

clang/test/dpct/cudaGraph_test.cu

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,12 @@ int main() {
141141
cudaGraphExecDestroy(**execGraph3);
142142
CUDA_CHECK_THROW(cudaGraphExecDestroy(**execGraph3));
143143

144+
// CHECK: delete (graph);
145+
// CHECK-NEXT: delete (*graph2);
146+
// CHECK-NEXT: CUDA_CHECK_THROW(DPCT_CHECK_ERROR(delete (**graph3)));
147+
cudaGraphDestroy(graph);
148+
cudaGraphDestroy(*graph2);
149+
CUDA_CHECK_THROW(cudaGraphDestroy(**graph3));
150+
144151
return 0;
145152
}

clang/test/dpct/cudaGraph_test_default_option.cu

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ int main() {
121121
// CHECK-NEXT: */
122122
nodeType = cudaGraphNodeTypeKernel;
123123

124+
// CHECK: /*
125+
// CHECK-NEXT: DPCT1119:{{[0-9]+}}: Migration of cudaGraphDestroy is not supported, please try to remigrate with option: --use-experimental-features=graph.
126+
// CHECK-NEXT: */
127+
cudaGraphDestroy(graph);
128+
124129
return 0;
125130
}
126131

0 commit comments

Comments
 (0)