From 14d54a7b2939a457e84aab54fc8fabc613f74c35 Mon Sep 17 00:00:00 2001 From: Sarbojit Sarkar Date: Mon, 22 Feb 2021 00:42:18 -0500 Subject: [PATCH] SWDEV-254329 - Fix for profiler ON/OFF Change-Id: Iea72ae96ebe7ed95322dfc39d785ac326b47f6dc --- rocclr/platform/command.cpp | 2 +- rocclr/platform/command.hpp | 6 ++---- rocclr/utils/flags.cpp | 1 + rocclr/utils/flags.hpp | 1 + 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rocclr/platform/command.cpp b/rocclr/platform/command.cpp index 405383a621..c5af772111 100644 --- a/rocclr/platform/command.cpp +++ b/rocclr/platform/command.cpp @@ -45,7 +45,7 @@ namespace amd { Event::Event(HostQueue& queue) : callbacks_(NULL), status_(CL_INT_MAX), - profilingInfo_(queue.properties().test(CL_QUEUE_PROFILING_ENABLE) || + profilingInfo_(IS_PROFILER_ON || queue.properties().test(CL_QUEUE_PROFILING_ENABLE) || Agent::shouldPostEventEvents()) { notified_.clear(); } diff --git a/rocclr/platform/command.hpp b/rocclr/platform/command.hpp index 4ae045c724..e2f97553ae 100644 --- a/rocclr/platform/command.hpp +++ b/rocclr/platform/command.hpp @@ -99,10 +99,8 @@ class Event : public RuntimeObject { struct ProfilingInfo { ProfilingInfo(bool enabled = false) : enabled_(enabled), waves_(0), marker_ts_(false) { - if (enabled) { - clear(); - callback_ = nullptr; - } + clear(); + callback_ = nullptr; } uint64_t queued_; diff --git a/rocclr/utils/flags.cpp b/rocclr/utils/flags.cpp index 5485262b63..2685736776 100644 --- a/rocclr/utils/flags.cpp +++ b/rocclr/utils/flags.cpp @@ -82,6 +82,7 @@ namespace amd { #endif // __APPLE__ bool IS_HIP = false; +std::atomic_bool IS_PROFILER_ON(false); #if defined(WITH_GPU_DEVICE) bool IS_LEGACY = true; diff --git a/rocclr/utils/flags.hpp b/rocclr/utils/flags.hpp index 9d5e217b99..6ce9b27a44 100644 --- a/rocclr/utils/flags.hpp +++ b/rocclr/utils/flags.hpp @@ -265,6 +265,7 @@ release(cstring, AMD_LOG_LEVEL_FILE, "", \ namespace amd { extern bool IS_HIP; +extern std::atomic_bool IS_PROFILER_ON; extern bool IS_LEGACY;