Skip to content

Commit 8157e06

Browse files
authored
[OMPT] Fix assertion in per-device-enabled tracing (#362)
OpenMP allows to disable trace events on a per-device basis. ROCm#340 at the latest introduced a bug which does not respect the disabling of specific trace events. This fix adds checks whether the required data has been set when creating the OMPT info before dispatching the actual operation on the plugins.
1 parent d35d1d2 commit 8157e06

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

offload/plugins-nextgen/common/OMPT/OmptProfiler.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ void llvm::omp::target::ompt::OmptProfilerTy::handleKernelCompletion(
9393
if (!isProfilingEnabled())
9494
return;
9595

96+
/// Empty data means no tracing in OMPT
97+
/// offload/include/OpenMP/OMPT/Interface.h line 492
98+
if (!Data)
99+
return;
100+
96101
DP("OMPT-Async: Time kernel for asynchronous execution (Plugin): Start %lu "
97102
"End %lu\n",
98103
StartNanos, EndNanos);
@@ -115,6 +120,11 @@ void llvm::omp::target::ompt::OmptProfilerTy::handleDataTransfer(
115120
if (!isProfilingEnabled())
116121
return;
117122

123+
/// Empty data means no tracing in OMPT
124+
/// offload/include/OpenMP/OMPT/Interface.h line 492
125+
if (!Data)
126+
return;
127+
118128
auto OmptEventInfo = reinterpret_cast<ompt::OmptEventInfoTy *>(Data);
119129
assert(OmptEventInfo && "Invalid OmptEventInfo");
120130
assert(OmptEventInfo->TraceRecord && "Invalid TraceRecord");

0 commit comments

Comments
 (0)