Skip to content

Commit a325e62

Browse files
[SYCL][Graph] Fix bug with debug print graph feature (#11976)
Some nodes may not have any associated CommandGroup, e.g. empty nodes. This PR therefore changes the way node IDs are assigned in the printed graph. Node IDs are now based on the Node address instead of the CommandGroup address. The test has been update to generate a node without a CommandGroup.
1 parent 54e1ed3 commit a325e62

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

sycl/source/detail/graph_impl.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ class node_impl {
246246
printDotCG(Stream, Verbose);
247247
for (const auto &Dep : MPredecessors) {
248248
auto NodeDep = Dep.lock();
249-
Stream << " \"" << NodeDep->MCommandGroup.get() << "\" -> \""
250-
<< MCommandGroup.get() << "\"" << std::endl;
249+
Stream << " \"" << NodeDep.get() << "\" -> \"" << this << "\""
250+
<< std::endl;
251251
}
252252

253253
for (std::weak_ptr<node_impl> Succ : MSuccessors) {
@@ -261,14 +261,12 @@ class node_impl {
261261
/// @param Verbose If true, print additional information about the nodes such
262262
/// as kernel args or memory access where applicable.
263263
void printDotCG(std::ostream &Stream, bool Verbose) {
264-
sycl::detail::CG::CGTYPE CGType = MCommandGroup->getType();
264+
Stream << "\"" << this << "\" [style=bold, label=\"";
265265

266-
Stream << "\"" << MCommandGroup.get() << "\" [style=bold, label=\"";
267-
268-
Stream << "ID = " << MCommandGroup.get() << "\\n";
266+
Stream << "ID = " << this << "\\n";
269267
Stream << "TYPE = ";
270268

271-
switch (CGType) {
269+
switch (MCGType) {
272270
case sycl::detail::CG::CGTYPE::None:
273271
Stream << "None \\n";
274272
break;

sycl/test-e2e/Graph/Inputs/debug_print_graph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int main() {
5050
CGH.copy(AccA, DataB2D.data());
5151
});
5252

53-
add_node(Graph, Queue, [&](handler &CGH) { /* empty node */ });
53+
add_empty_node(Graph, Queue);
5454

5555
Graph.print_graph("graph.dot");
5656

0 commit comments

Comments
 (0)