From 8d30df5ccf56491561b1b034004f0c5fcf71bd32 Mon Sep 17 00:00:00 2001 From: anusha GodavarthySurya Date: Mon, 25 Oct 2021 21:46:46 -0700 Subject: [PATCH] SWDEV-307915 - hipHccModuleLaunchKernel correct event timing Change-Id: I397a3d6cf0cf8639666befb9ed7a357c6753741c --- hipamd/src/hip_event.hpp | 3 ++- hipamd/src/hip_module.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hipamd/src/hip_event.hpp b/hipamd/src/hip_event.hpp index 6fdb67ef1d..7f5e7352fe 100644 --- a/hipamd/src/hip_event.hpp +++ b/hipamd/src/hip_event.hpp @@ -98,12 +98,13 @@ class Event { hipError_t recordCommand(amd::Command*& command, amd::HostQueue* queue); hipError_t enqueueRecordCommand(hipStream_t stream, amd::Command* command, bool record); hipError_t addMarker(hipStream_t stream, amd::Command* command, bool record); - void BindCommand(amd::Command& command) { + void BindCommand(amd::Command& command, bool record) { amd::ScopedLock lock(lock_); if (event_ != nullptr) { event_->release(); } event_ = &command.event(); + recorded_ = record; command.retain(); } diff --git a/hipamd/src/hip_module.cpp b/hipamd/src/hip_module.cpp index 3d8658b778..af2d627f78 100644 --- a/hipamd/src/hip_module.cpp +++ b/hipamd/src/hip_module.cpp @@ -390,7 +390,7 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX, if (startEvent != nullptr) { hip::Event* eStart = reinterpret_cast(startEvent); - status = eStart->addMarker(hStream, nullptr, false); + status = eStart->addMarker(hStream, nullptr, true); if (status != hipSuccess) { return status; } @@ -400,7 +400,7 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f, uint32_t globalWorkSizeX, if (stopEvent != nullptr) { hip::Event* eStop = reinterpret_cast(stopEvent); - eStop->BindCommand(*command); + eStop->BindCommand(*command, true); } command->release();