Skip to content

Commit 8c9545c

Browse files
committed
Fix roctx markers in wall clock and make timemory push/pops use respective callback category
1 parent d849b88 commit 8c9545c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

projects/rocprofiler-systems/source/lib/rocprof-sys/library/rocprofiler-sdk.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -651,15 +651,22 @@ tool_tracing_callback_start(CategoryT, rocprofiler_callback_tracing_record_t rec
651651
}
652652
default:
653653
{
654-
break;
654+
// A basic roctx marker region starts with roctxRangePushA ENTER and
655+
// ends with roctxRangePop EXIT.
656+
// Breaking instead of returning allows the roctxRangePop ENTER to be
657+
// processed, which timemory will link to the roctxRangePop EXIT. As
658+
// we do not push roctxRangePushA EXIT into timemory, it will think
659+
// that the roctxRangePushA ENTER is still active when it is in fact
660+
// not. This will cause the wall clock tree to be incorrect.
661+
return;
655662
}
656663
}
657664
}
658665
}
659666

660667
if(get_use_timemory())
661668
{
662-
tracing::push_timemory(category::rocm_marker_api{}, _name);
669+
tracing::push_timemory(CategoryT{}, _name);
663670
}
664671
}
665672

@@ -729,7 +736,7 @@ tool_tracing_callback_stop(
729736

730737
if(get_use_timemory())
731738
{
732-
tracing::pop_timemory(category::rocm_marker_api{}, _name);
739+
tracing::pop_timemory(CategoryT{}, _name);
733740
}
734741

735742
if(get_use_perfetto())
@@ -1069,7 +1076,7 @@ ompt_tracing_callback_start(rocprofiler_callback_tracing_record_t record,
10691076

10701077
if(get_use_timemory())
10711078
{
1072-
tracing::push_timemory(category::rocm_marker_api{}, _name);
1079+
tracing::push_timemory(category::rocm_ompt_api{}, _name);
10731080
}
10741081

10751082
if(get_use_perfetto())
@@ -1115,7 +1122,7 @@ ompt_tracing_callback_stop(
11151122

11161123
if(get_use_timemory())
11171124
{
1118-
tracing::pop_timemory(category::rocm_marker_api{}, _name);
1125+
tracing::pop_timemory(category::rocm_ompt_api{}, _name);
11191126
}
11201127

11211128
if(get_use_perfetto())

0 commit comments

Comments
 (0)