Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions clang/lib/DPCT/RulesLang/APINamesGraph.inc
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,14 @@ ASSIGNABLE_FACTORY(CONDITIONAL_FACTORY_ENTRY(
Diagnostics::TRY_EXPERIMENTAL_FEATURE,
ARG("cudaGraphExecUpdate"),
ARG("--use-experimental-features=graph"))))

ASSIGNABLE_FACTORY(CONDITIONAL_FACTORY_ENTRY(
UseExtGraph,
MEMBER_CALL_FACTORY_ENTRY(
"cudaGraphDebugDotPrint", ARG(0), true, "print_graph",
CAST_IF_NOT_SAME(makeLiteral("std::string"), ARG(1)),
makeLiteral("true")),
UNSUPPORT_FACTORY_ENTRY("cudaGraphDebugDotPrint",
Diagnostics::TRY_EXPERIMENTAL_FEATURE,
ARG("cudaGraphDebugDotPrint"),
ARG("--use-experimental-features=graph"))))
3 changes: 2 additions & 1 deletion clang/lib/DPCT/RulesLang/RulesLangGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ void GraphRule::registerMatcher(MatchFinder &MF) {
auto functionName = [&]() {
return hasAnyName("cudaGraphInstantiate", "cudaGraphLaunch",
"cudaGraphExecDestroy", "cudaGraphAddEmptyNode",
"cudaGraphAddDependencies", "cudaGraphExecUpdate");
"cudaGraphAddDependencies", "cudaGraphExecUpdate",
"cudaGraphDebugDotPrint");
};
MF.addMatcher(
callExpr(callee(functionDecl(functionName()))).bind("FunctionCall"),
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/DPCT/SrcAPI/APINames.inc
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ ENTRY(cudaGraphChildGraphNodeGetGraph, cudaGraphChildGraphNodeGetGraph, false, N
ENTRY(cudaGraphClone, cudaGraphClone, false, NO_FLAG, P4, "comment")
ENTRY(cudaGraphConditionalHandleCreate, cudaGraphConditionalHandleCreate, false, NO_FLAG, P4, "comment")
ENTRY(cudaGraphCreate, cudaGraphCreate, false, NO_FLAG, P4, "comment")
ENTRY(cudaGraphDebugDotPrint, cudaGraphDebugDotPrint, false, NO_FLAG, P4, "comment")
ENTRY(cudaGraphDebugDotPrint, cudaGraphDebugDotPrint, true, NO_FLAG, P4, "Successful/DPCT1119")
ENTRY(cudaGraphDestroy, cudaGraphDestroy, false, NO_FLAG, P4, "comment")
ENTRY(cudaGraphDestroyNode, cudaGraphDestroyNode, false, NO_FLAG, P4, "comment")
ENTRY(cudaGraphEventRecordNodeGetEvent, cudaGraphEventRecordNodeGetEvent, false, NO_FLAG, P4, "comment")
Expand Down
7 changes: 7 additions & 0 deletions clang/test/dpct/cudaGraph_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ int main() {
CUDA_CHECK_THROW(cudaGraphLaunch(execGraph, stream));
cudaGraphLaunch(*execGraph2, *stream2);

// CHECK: graph->print_graph((std::string)"graph.dot", true);
// CHECK-NEXT: graph->print_graph((std::string)"graph.dot", true);
// CHECK-NEXT: graph->print_graph((std::string)"graph.dot", true);
cudaGraphDebugDotPrint(graph, "graph.dot", 1);
cudaGraphDebugDotPrint(graph, "graph.dot", cudaGraphDebugDotFlagsVerbose);
cudaGraphDebugDotPrint(graph, "graph.dot", cudaGraphDebugDotFlagsConditionalNodeParams);

#ifndef DNO_BUILD_TEST
// CHECK: execGraph->update(*graph);
cudaGraphExecUpdate(execGraph, graph, nullptr, nullptr);
Expand Down
5 changes: 5 additions & 0 deletions clang/test/dpct/cudaGraph_test_default_option.cu
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ int main() {
// CHECK-NEXT: */
cudaGraphExecDestroy(execGraph);

// CHECK: /*
// CHECK-NEXT: DPCT1119:{{[0-9]+}}: Migration of cudaGraphDebugDotPrint is not supported, please try to remigrate with option: --use-experimental-features=graph.
// CHECK-NEXT: */
cudaGraphDebugDotPrint(graph, "graph.dot", 1);

return 0;
}

Expand Down