From 010253430f3c94bcbf0665811899d304653d1f63 Mon Sep 17 00:00:00 2001 From: kjayapra-amd Date: Fri, 7 Feb 2025 14:51:33 -0500 Subject: [PATCH] SWDEV-516303 - Remove SDMA retainer logic to select the engine. Change-Id: I818129444131825cdb87e06cb495afa3e5cdb683 [ROCm/clr commit: 1f583a687090577b4c2544d98f64c595b1215338] --- projects/clr/rocclr/device/rocm/rocblit.cpp | 18 ++---------------- projects/clr/rocclr/device/rocm/rocblit.hpp | 2 -- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/projects/clr/rocclr/device/rocm/rocblit.cpp b/projects/clr/rocclr/device/rocm/rocblit.cpp index 0634120106..1471cc4187 100644 --- a/projects/clr/rocclr/device/rocm/rocblit.cpp +++ b/projects/clr/rocclr/device/rocm/rocblit.cpp @@ -32,8 +32,7 @@ DmaBlitManager::DmaBlitManager(VirtualGPU& gpu, Setup setup) : HostBlitManager(gpu, setup), MinSizeForPinnedTransfer(dev().settings().pinnedMinXferSize_), completeOperation_(false), - context_(nullptr), - sdmaEngineRetainCount_(0) { + context_(nullptr) { dev().getSdmaRWMasks(&sdmaEngineReadMask_, &sdmaEngineWriteMask_); } @@ -489,16 +488,9 @@ inline bool DmaBlitManager::rocrCopyBuffer(address dst, hsa_agent_t& dstAgent, if ((srcAgent.handle == dev().getCpuAgent().handle) && (dstAgent.handle != dev().getCpuAgent().handle)) { engine = HwQueueEngine::SdmaWrite; - // Track the HtoD copies and increment the count. The last used SDMA engine might be busy - // and using it everytime can cause contention. When the count exceeds the threshold, - // reset it so as to check the engine status and fetch the new mask. - sdmaEngineRetainCount_ = (sdmaEngineRetainCount_ > kRetainCountThreshold) - ? 0 : (sdmaEngineRetainCount_ + 1); } else if ((srcAgent.handle != dev().getCpuAgent().handle) && (dstAgent.handle == dev().getCpuAgent().handle)) { engine = HwQueueEngine::SdmaRead; - // Track the DtoH copies and decrement the count. - sdmaEngineRetainCount_--; } if (engine == HwQueueEngine::Unknown && forceSDMA) { @@ -510,13 +502,7 @@ inline bool DmaBlitManager::rocrCopyBuffer(address dst, hsa_agent_t& dstAgent, hsa_signal_t active = gpu().Barriers().ActiveSignal(kInitSignalValueOne, gpu().timestamp()); if (!kUseRegularCopyApi && engine != HwQueueEngine::Unknown) { - if (sdmaEngineRetainCount_ > 0) { - // Check if there a recently used SDMA engine for the stream - copyMask = gpu().getLastUsedSdmaEngine(); - ClPrint(amd::LOG_DEBUG, amd::LOG_COPY, "Last copy mask 0x%x", copyMask); - copyMask &= (engine == HwQueueEngine::SdmaRead ? - sdmaEngineReadMask_ : sdmaEngineWriteMask_); - } + copyMask = gpu().getLastUsedSdmaEngine(); if (copyMask == 0) { // Check SDMA engine status status = hsa_amd_memory_copy_engine_status(dstAgent, srcAgent, &freeEngineMask); diff --git a/projects/clr/rocclr/device/rocm/rocblit.hpp b/projects/clr/rocclr/device/rocm/rocblit.hpp index 5153523b6d..4d9e295f38 100644 --- a/projects/clr/rocclr/device/rocm/rocblit.hpp +++ b/projects/clr/rocclr/device/rocm/rocblit.hpp @@ -240,8 +240,6 @@ class DmaBlitManager : public device::HostBlitManager { const size_t MinSizeForPinnedTransfer; bool completeOperation_; //!< DMA blit manager must complete operation amd::Context* context_; //!< A dummy context - mutable int64_t sdmaEngineRetainCount_; //!< Keeps track of memcopies to either get the last - //!< used SDMA engine or fetch the new mask uint32_t sdmaEngineReadMask_; //!< SDMA Engine Read Mask uint32_t sdmaEngineWriteMask_; //!< SDMA Engine Write Mask