From 055e05a12abacfa532be6af0fbaeed52eb4d9057 Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Sat, 8 Jun 2024 02:56:54 +0100 Subject: [PATCH] SWDEV-466601 - Fix invalid mem acccess in kernarg readback path Change-Id: I4654ae592adc8cf9c687136d45eb1b28d99c7ae1 --- hipamd/src/hip_graph_internal.cpp | 4 ++-- rocclr/device/rocm/rocvirtual.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hipamd/src/hip_graph_internal.cpp b/hipamd/src/hip_graph_internal.cpp index ad89254cb8..291aabda89 100644 --- a/hipamd/src/hip_graph_internal.cpp +++ b/hipamd/src/hip_graph_internal.cpp @@ -438,11 +438,11 @@ hipError_t GraphExec::CaptureAQLPackets() { } else if (kernArgImpl == KernelArgImpl::DeviceKernelArgsReadback && kernarg_pool_size_graph_ != 0) { address dev_ptr = kernarg_pool_graph_ + kernarg_pool_size_graph_; - auto kSentinel = *reinterpret_cast(dev_ptr); + 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/rocclr/device/rocm/rocvirtual.cpp b/rocclr/device/rocm/rocvirtual.cpp index 15ce6ab942..e5590cd4f0 100644 --- a/rocclr/device/rocm/rocvirtual.cpp +++ b/rocclr/device/rocm/rocvirtual.cpp @@ -3246,7 +3246,7 @@ 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); } } }