From cc0b04cc6015fc1b570edb0c0b1e552b94f52c1a Mon Sep 17 00:00:00 2001 From: Saleel Kudchadker Date: Thu, 25 Jan 2024 02:10:15 +0000 Subject: [PATCH] SWDEV-301667 - Reset profiler correlation_id_ - The correlation_id had random junk values which we were inserting in the dispatch AQL packet even when no profiler was attached but if we had a valid timestamp. - Also make sure we dont even write the reserved2 field in the AQL packet if no profiler attached. Change-Id: Icdb7493198c1bb5e2d786a97e027288660854cd7 [ROCm/clr commit: 9a6ddae7b2839d1a8edf78b61406e68b08a02192] --- projects/clr/rocclr/device/rocm/rocvirtual.cpp | 3 ++- projects/clr/rocclr/platform/command.cpp | 4 +++- projects/clr/rocclr/platform/command.hpp | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/clr/rocclr/device/rocm/rocvirtual.cpp b/projects/clr/rocclr/device/rocm/rocvirtual.cpp index 42eb546eab..5abbb6c280 100644 --- a/projects/clr/rocclr/device/rocm/rocvirtual.cpp +++ b/projects/clr/rocclr/device/rocm/rocvirtual.cpp @@ -865,7 +865,8 @@ bool VirtualGPU::dispatchGenericAqlPacket( // If profiling is enabled, store the correlation ID in the dispatch packet. The profiler can // retrieve this correlation ID to attribute waves to specific dispatch locations. - if (std::is_same::value) { + if (std::is_same::value && + activity_prof::IsEnabled(OP_ID_DISPATCH)) { auto dispatchPacket = reinterpret_cast(packet); dispatchPacket->reserved2 = timestamp_->command().profilingInfo().correlation_id_; } diff --git a/projects/clr/rocclr/platform/command.cpp b/projects/clr/rocclr/platform/command.cpp index 052b1f09e5..7e078c9a68 100644 --- a/projects/clr/rocclr/platform/command.cpp +++ b/projects/clr/rocclr/platform/command.cpp @@ -158,7 +158,9 @@ bool Event::setStatus(int32_t status, uint64_t timeStamp) { releaseResources(); } - if (profilingInfo().enabled_) activity_prof::ReportActivity(command()); + if (profilingInfo().enabled_ && activity_prof::IsEnabled(OP_ID_DISPATCH)) { + activity_prof::ReportActivity(command()); + } // Broadcast all the waiters. if (referenceCount() > 1) { diff --git a/projects/clr/rocclr/platform/command.hpp b/projects/clr/rocclr/platform/command.hpp index 854be3f2b6..cbd837a2d6 100644 --- a/projects/clr/rocclr/platform/command.hpp +++ b/projects/clr/rocclr/platform/command.hpp @@ -126,6 +126,7 @@ class Event : public RuntimeObject { submitted_ = 0ULL; start_ = 0ULL; end_ = 0ULL; + correlation_id_ = 0ULL; } } profilingInfo_;