From 376da06e2f0789ddba9c14a80618a454ffd0455f Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Fri, 5 Jul 2024 13:01:49 +0100 Subject: [PATCH] SWDEV-469825 - Modified the kernel argument readback to use a pointer to volatile This change modifies the readback mechanism to use a pointer to volatile instead of a volatile pointer. This ensures that the compiler does not optimize away the read operation. Change-Id: I79ff925d615aa8cc4f950e8ff4b7e608fcb179a4 [ROCm/clr commit: ea50d2c0c2eb7d19652294a58074ea6563f22f0e] --- projects/clr/hipamd/src/hip_graph_internal.cpp | 4 ++-- projects/clr/rocclr/device/rocm/rocvirtual.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/clr/hipamd/src/hip_graph_internal.cpp b/projects/clr/hipamd/src/hip_graph_internal.cpp index fd6663a653..dce076a7ff 100644 --- a/projects/clr/hipamd/src/hip_graph_internal.cpp +++ b/projects/clr/hipamd/src/hip_graph_internal.cpp @@ -469,11 +469,11 @@ hipError_t GraphExec::CaptureAQLPackets() { kernarg_graph_.back().kernarg_pool_addr_ != 0) { address dev_ptr = kernarg_graph_.back().kernarg_pool_addr_ + kernarg_graph_.back().kernarg_pool_size_; - auto kSentinel = *reinterpret_cast(dev_ptr - 1); + auto kSentinel = *reinterpret_cast(dev_ptr - 1); _mm_sfence(); *(dev_ptr - 1) = kSentinel; _mm_mfence(); - kSentinel = *reinterpret_cast(dev_ptr - 1); + kSentinel = *reinterpret_cast(dev_ptr - 1); } } } diff --git a/projects/clr/rocclr/device/rocm/rocvirtual.cpp b/projects/clr/rocclr/device/rocm/rocvirtual.cpp index 793367e5f7..fa822ac3c1 100644 --- a/projects/clr/rocclr/device/rocm/rocvirtual.cpp +++ b/projects/clr/rocclr/device/rocm/rocvirtual.cpp @@ -3259,7 +3259,8 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, _mm_sfence(); *(argBuffer + argSize - 1) = *(parameters + argSize - 1); _mm_mfence(); - auto kSentinel = *reinterpret_cast(argBuffer + argSize - 1); + auto kSentinel = *reinterpret_cast( + argBuffer + argSize - 1); } } }