From 91e2cd5d67c53754801c7025c40dfa2250728a49 Mon Sep 17 00:00:00 2001 From: "Xie.AlexBin" Date: Mon, 6 Mar 2023 14:32:40 -0500 Subject: [PATCH] SWDEV-339709 - Device Atomic test failed Code change for Linux Change-Id: I002881c188b9de351618a06ee8b5ce2aa5d9fd95 --- rocclr/device/rocm/rocmemory.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rocclr/device/rocm/rocmemory.cpp b/rocclr/device/rocm/rocmemory.cpp index 664bc62b63..0e0b021c99 100644 --- a/rocclr/device/rocm/rocmemory.cpp +++ b/rocclr/device/rocm/rocmemory.cpp @@ -352,6 +352,7 @@ bool Memory::pinSystemMemory(void* hostPtr, size_t size) { } void Memory::syncCacheFromHost(VirtualGPU& gpu, device::Memory::SyncFlags syncFlags) { + amd::ScopedLock lock(owner()->lockMemoryOps()); // If the last writer was another GPU, then make a writeback if (!isHostMemDirectAccess() && (owner()->getLastWriter() != nullptr) && (&dev() != owner()->getLastWriter())) { @@ -407,7 +408,6 @@ void Memory::syncCacheFromHost(VirtualGPU& gpu, device::Memory::SyncFlags syncFl syncFlagsTmp.skipEntire_ = syncFlags.skipEntire_; } - amd::ScopedLock lock(owner()->lockMemoryOps()); for (auto& sub : owner()->subBuffers()) { //! \note Don't allow subbuffer's allocation in the worker thread. //! It may cause a system lock, because possible resource @@ -462,6 +462,8 @@ void Memory::syncCacheFromHost(VirtualGPU& gpu, device::Memory::SyncFlags syncFl } } + gpu.releaseGpuMemoryFence(); + // Should never fail assert(result && "Memory synchronization failed!"); }