From 89133a7301df32112c2c74a326a2c1e00feecd77 Mon Sep 17 00:00:00 2001 From: German Andryeyev Date: Thu, 23 Apr 2020 15:01:02 -0400 Subject: [PATCH] SWDEV-232807 [ROCm][TCT][HIP] cooperative stream test case is failing. Make sure lockXfer() in the blit manager returns a valid value. Port the latest PAL backend logic into the ROCr backend. This change doesn't fix the issue, reported in the ticket. Change-Id: I54101a824f49a2dcfbbf5414cb5b3af41745306d --- rocclr/device/rocm/rocblit.cpp | 9 +-------- rocclr/device/rocm/rocblit.hpp | 4 +++- rocclr/device/rocm/rocvirtual.cpp | 6 +++--- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/rocclr/device/rocm/rocblit.cpp b/rocclr/device/rocm/rocblit.cpp index 2ce45b5ab4..bf689b420a 100755 --- a/rocclr/device/rocm/rocblit.cpp +++ b/rocclr/device/rocm/rocblit.cpp @@ -707,7 +707,7 @@ KernelBlitManager::KernelBlitManager(VirtualGPU& gpu, Setup setup) program_(nullptr), constantBuffer_(nullptr), xferBufferSize_(0), - lockXferOps_(nullptr) { + lockXferOps_("Transfer Ops Lock", true) { for (uint i = 0; i < BlitTotal; ++i) { kernels_[i] = nullptr; } @@ -733,8 +733,6 @@ KernelBlitManager::~KernelBlitManager() { if (nullptr != constantBuffer_) { constantBuffer_->release(); } - - delete lockXferOps_; } bool KernelBlitManager::create(amd::Device& device) { @@ -797,11 +795,6 @@ bool KernelBlitManager::createProgram(Device& device) { return false; } - lockXferOps_ = new amd::Monitor("Transfer Ops Lock", true); - if (nullptr == lockXferOps_) { - return false; - } - return result; } diff --git a/rocclr/device/rocm/rocblit.hpp b/rocclr/device/rocm/rocblit.hpp index 96059190f4..a9a15abc20 100755 --- a/rocclr/device/rocm/rocblit.hpp +++ b/rocclr/device/rocm/rocblit.hpp @@ -396,6 +396,8 @@ class KernelBlitManager : public DmaBlitManager { bool RunGwsInit(uint32_t value //!< Initial value for GWS resource ) const; + virtual amd::Monitor* lockXfer() const { return &lockXferOps_; } + private: static const size_t MaxXferBuffers = 2; static const uint TransferSplitSize = 1; @@ -448,7 +450,7 @@ class KernelBlitManager : public DmaBlitManager { amd::Kernel* kernels_[BlitTotal]; //!< GPU kernels for blit amd::Memory* constantBuffer_; //!< An internal CB for blits size_t xferBufferSize_; //!< Transfer buffer size - amd::Monitor* lockXferOps_; //!< Lock transfer operation + mutable amd::Monitor lockXferOps_; //!< Lock transfer operation }; static const char* BlitName[KernelBlitManager::BlitTotal] = { diff --git a/rocclr/device/rocm/rocvirtual.cpp b/rocclr/device/rocm/rocvirtual.cpp index c2b41410ef..615824f77f 100644 --- a/rocclr/device/rocm/rocvirtual.cpp +++ b/rocclr/device/rocm/rocvirtual.cpp @@ -2300,15 +2300,15 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, const */ void VirtualGPU::submitKernel(amd::NDRangeKernelCommand& vcmd) { if (vcmd.cooperativeGroups() || vcmd.cooperativeMultiDeviceGroups()) { + // Wait for the execution on the current queue, since the coop groups will use the device queue + releaseGpuMemoryFence(); + // Get device queue for exclusive GPU access VirtualGPU* queue = dev().xferQueue(); // Lock the queue, using the blit manager lock amd::ScopedLock lock(queue->blitMgr().lockXfer()); - // Wait for the execution on the current queue, since the coop groups will use the device queue - releaseGpuMemoryFence(); - queue->profilingBegin(vcmd); if (vcmd.cooperativeGroups()) {