diff --git a/rocclr/device/rocm/rocvirtual.cpp b/rocclr/device/rocm/rocvirtual.cpp index bdd14f8af1..337166e74b 100644 --- a/rocclr/device/rocm/rocvirtual.cpp +++ b/rocclr/device/rocm/rocvirtual.cpp @@ -131,7 +131,7 @@ void Timestamp::checkGpuTime() { } // Avoid profiling data for the sync barrier, in tiny performance tests the first call // to ROCr is very slow and that also affects the overall performance of the callback thread - if (command().GetBatchHead() == nullptr || command().profilingInfo().marker_ts_ > 0) { + if (command().GetBatchHead() == nullptr || command().profilingInfo().marker_ts_) { hsa_amd_profiling_dispatch_time_t time = {}; if (it->engine_ == HwQueueEngine::Compute) { hsa_amd_profiling_get_dispatch_time(gpu()->gpu_device(), it->signal_, &time); @@ -447,7 +447,7 @@ hsa_signal_t VirtualGPU::HwQueueTracker::ActiveSignal( // Update the current command/marker with HW event prof_signal->retain(); ts->command().SetHwEvent(prof_signal); - } else if (ts->command().profilingInfo().marker_ts_ > 0 ) { + } else if (ts->command().profilingInfo().marker_ts_) { // Update the current command/marker with HW event prof_signal->retain(); ts->command().SetHwEvent(prof_signal); @@ -3114,7 +3114,7 @@ void VirtualGPU::submitMarker(amd::Marker& vcmd) { } else { profilingBegin(vcmd); if (timestamp_ != nullptr) { - uint32_t releaseFlags = vcmd.profilingInfo().marker_ts_; + int32_t releaseFlags = vcmd.getEventScope(); if (ROC_EVENT_NO_FLUSH && releaseFlags == Device::CacheState::kCacheStateIgnore) { dispatchBarrierPacket(kNopPacketHeader, false); } else if (releaseFlags == Device::CacheState::kCacheStateAgent) { diff --git a/rocclr/platform/command.cpp b/rocclr/platform/command.cpp index cdc09f4215..8005ea5352 100644 --- a/rocclr/platform/command.cpp +++ b/rocclr/platform/command.cpp @@ -50,7 +50,8 @@ Event::Event(HostQueue& queue) notify_event_(nullptr), device_(&queue.device()), profilingInfo_(IS_PROFILER_ON || queue.properties().test(CL_QUEUE_PROFILING_ENABLE) || - Agent::shouldPostEventEvents()) { + Agent::shouldPostEventEvents()), + event_scope_(Device::kCacheStateInvalid) { notified_.clear(); } @@ -60,7 +61,8 @@ Event::Event() status_(CL_SUBMITTED), hw_event_(nullptr), notify_event_(nullptr), - device_(nullptr) { + device_(nullptr), + event_scope_(Device::kCacheStateInvalid) { notified_.clear(); } @@ -366,7 +368,7 @@ void Command::enqueue() { EnableProfiling(); } - if (isMarker && (profilingInfo().marker_ts_ == 0)) { + if (isMarker && (!profilingInfo().marker_ts_)) { // Update batch head for the current marker. Hence the status of all commands can be // updated upon the marker completion SetBatchHead(queue_->GetSubmittionBatch()); @@ -420,7 +422,7 @@ NDRangeKernelCommand::NDRangeKernelCommand(HostQueue& queue, const EventWaitList profilingInfo_.enabled_ = true; profilingInfo_.clear(); profilingInfo_.callback_ = nullptr; - profilingInfo_.marker_ts_ = 1; + profilingInfo_.marker_ts_ = true; } kernel_.retain(); } diff --git a/rocclr/platform/command.hpp b/rocclr/platform/command.hpp index 4ea2636ddc..3bdcbdbb77 100644 --- a/rocclr/platform/command.hpp +++ b/rocclr/platform/command.hpp @@ -97,12 +97,14 @@ class Event : public RuntimeObject { void* hw_event_; //!< HW event ID associated with SW event Event* notify_event_; //!< Notify event, which should contain HW signal const Device* device_; //!< Device, this event associated with + int32_t event_scope_; //!< 2 - system scope, 1 - device scope, + //!< 0 - ignore, -1 - invalid protected: static const EventWaitList nullWaitList; struct ProfilingInfo { - ProfilingInfo(bool enabled = false) : enabled_(enabled), waves_(0), marker_ts_(0) { + ProfilingInfo(bool enabled = false) : enabled_(enabled), waves_(0), marker_ts_(false) { if (enabled) { clear(); callback_ = nullptr; @@ -116,8 +118,8 @@ class Event : public RuntimeObject { bool enabled_; //!< Profiling enabled for the wave limiter uint32_t waves_; //!< The number of waves used in a dispatch ProfilingCallback* callback_; - uint32_t marker_ts_; //!< Marker with release scope - //!< 5 - system scope, 3 - device scope, 1 - no scopes + bool marker_ts_; //!< TS marker + void clear() { queued_ = 0ULL; submitted_ = 0ULL; @@ -224,6 +226,12 @@ class Event : public RuntimeObject { //! Returns notify even associated with the current command Event* NotifyEvent() const { return notify_event_; } + + //! Get release scope of the event + int32_t getEventScope() const { return event_scope_; } + + //! Set release scope for the event + void setEventScope(int32_t scope) { event_scope_ = scope; } }; /*! \brief An operation that is submitted to a command queue.