From c4f773db0b4ccbbeed4e3d6c0f6bff299c2aa3f0 Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Mon, 13 Nov 2023 11:38:13 +0000 Subject: [PATCH] SWDEV-428244 - Fixed the computation of the start address of KernelParameters.values_ For avx build, the start address of values_ buffer in KernelParameters is not correct as it is computed based on 16-byte alignment. Change-Id: I3b28ae02d2c9c0517d4a348d95ae8c6721bec83d --- rocclr/platform/kernel.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rocclr/platform/kernel.hpp b/rocclr/platform/kernel.hpp index 8cb3b7f7b5..d441b18b0d 100644 --- a/rocclr/platform/kernel.hpp +++ b/rocclr/platform/kernel.hpp @@ -159,7 +159,7 @@ class KernelParameters : protected HeapObject { deviceKernelArgs_(false) { totalSize_ = signature.paramsSize() + (signature.numMemories() + signature.numSamplers() + signature.numQueues()) * sizeof(void*); - values_ = reinterpret_cast
(this) + alignUp(sizeof(KernelParameters), 16); + values_ = reinterpret_cast
(this) + alignUp(sizeof(KernelParameters), PARAMETERS_MIN_ALIGNMENT); memoryObjOffset_ = signature_.paramsSize(); memoryObjects_ = reinterpret_cast(values_ + memoryObjOffset_); samplerObjOffset_ = memoryObjOffset_ + signature_.numMemories() * sizeof(amd::Memory*); @@ -183,7 +183,7 @@ class KernelParameters : protected HeapObject { execNewVcop_(rhs.execNewVcop_), execPfpaVcop_(rhs.execPfpaVcop_), deviceKernelArgs_(false) { - values_ = reinterpret_cast
(this) + alignUp(sizeof(KernelParameters), 16); + values_ = reinterpret_cast
(this) + alignUp(sizeof(KernelParameters), PARAMETERS_MIN_ALIGNMENT); memoryObjOffset_ = signature_.paramsSize(); memoryObjects_ = reinterpret_cast(values_ + memoryObjOffset_); samplerObjOffset_ = memoryObjOffset_ + signature_.numMemories() * sizeof(amd::Memory*); @@ -220,7 +220,7 @@ class KernelParameters : protected HeapObject { //! Allocate memory for this instance as well as the required storage for // the values_, defined_, and rawPointer_ arrays. void* operator new(size_t size, const KernelSignature& signature) { - size_t requiredSize = alignUp(size, 16) + signature.paramsSize() + + size_t requiredSize = alignUp(size, PARAMETERS_MIN_ALIGNMENT) + signature.paramsSize() + (signature.numMemories() + signature.numSamplers() + signature.numQueues()) * sizeof(void*); return AlignedMemory::allocate(requiredSize, PARAMETERS_MIN_ALIGNMENT);