diff options
-rw-r--r-- | var/spack/repos/builtin/packages/hip/0017-Set-PARAMETERS_MIN_ALIGNMENT-to-the-native-alignment.patch | 63 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/hip/package.py | 16 |
2 files changed, 15 insertions, 64 deletions
diff --git a/var/spack/repos/builtin/packages/hip/0017-Set-PARAMETERS_MIN_ALIGNMENT-to-the-native-alignment.patch b/var/spack/repos/builtin/packages/hip/0017-Set-PARAMETERS_MIN_ALIGNMENT-to-the-native-alignment.patch deleted file mode 100644 index cabc64fd2a..0000000000 --- a/var/spack/repos/builtin/packages/hip/0017-Set-PARAMETERS_MIN_ALIGNMENT-to-the-native-alignment.patch +++ /dev/null @@ -1,63 +0,0 @@ -diff --git a/clr/rocclr/platform/kernel.hpp b/clr/rocclr/platform/kernel.hpp -index 8cb3b7f..d441b18 100644 ---- a/clr/rocclr/platform/kernel.hpp -+++ b/clr/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<address>(this) + alignUp(sizeof(KernelParameters), 16); -+ values_ = reinterpret_cast<address>(this) + alignUp(sizeof(KernelParameters), PARAMETERS_MIN_ALIGNMENT); - memoryObjOffset_ = signature_.paramsSize(); - memoryObjects_ = reinterpret_cast<amd::Memory**>(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<address>(this) + alignUp(sizeof(KernelParameters), 16); -+ values_ = reinterpret_cast<address>(this) + alignUp(sizeof(KernelParameters), PARAMETERS_MIN_ALIGNMENT); - memoryObjOffset_ = signature_.paramsSize(); - memoryObjects_ = reinterpret_cast<amd::Memory**>(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); -diff --git a/clr/rocclr/utils/flags.hpp b/clr/rocclr/utils/flags.hpp -index df12fe6..88848e5 100644 ---- a/clr/rocclr/utils/flags.hpp -+++ b/clr/rocclr/utils/flags.hpp -@@ -52,7 +52,7 @@ debug(size_t, CPU_MEMORY_GUARD_PAGE_SIZE, 64, \ - "Size in KB of CPU memory guard page") \ - debug(size_t, CPU_MEMORY_ALIGNMENT_SIZE, 256, \ - "Size in bytes for the default alignment for guarded memory on CPU") \ --debug(size_t, PARAMETERS_MIN_ALIGNMENT, 16, \ -+debug(size_t, PARAMETERS_MIN_ALIGNMENT, NATIVE_ALIGNMENT_SIZE, \ - "Minimum alignment required for the abstract parameters stack") \ - debug(size_t, MEMOBJ_BASE_ADDR_ALIGN, 4*Ki, \ - "Alignment of the base address of any allocate memory object") \ -diff --git a/clr/rocclr/utils/macros.hpp b/clr/rocclr/utils/macros.hpp -index 02fef75..e2110eb 100644 ---- a/clr/rocclr/utils/macros.hpp -+++ b/clr/rocclr/utils/macros.hpp -@@ -126,6 +126,14 @@ - #define IS_WINDOWS false - #endif - -+#if defined(__AVX512F__) -+#define NATIVE_ALIGNMENT_SIZE 64 -+#elif defined(__AVX__) -+#define NATIVE_ALIGNMENT_SIZE 32 -+#else -+#define NATIVE_ALIGNMENT_SIZE 16 -+#endif -+ - #define IF_LEFT_true(x) x - #define IF_LEFT_false(x) - #define IF_RIGHT_true(x) diff --git a/var/spack/repos/builtin/packages/hip/package.py b/var/spack/repos/builtin/packages/hip/package.py index b646ddd5cd..d972fa4d76 100644 --- a/var/spack/repos/builtin/packages/hip/package.py +++ b/var/spack/repos/builtin/packages/hip/package.py @@ -198,6 +198,21 @@ class Hip(CMakePackage): when=f"@{d_version}", ) + # For avx build, the start address of values_ buffer in KernelParameters is not + # correct as it is computed based on 16-byte alignment. + patch( + "https://github.com/ROCm/clr/commit/c4f773db0b4ccbbeed4e3d6c0f6bff299c2aa3f0.patch?full_index=1", + sha256="5bb9b0e08888830ccf3a0a658529fe25f4ee62b5b8890f349bf2cc914236eb2f", + working_dir="clr", + when="@5.7:", + ) + patch( + "https://github.com/ROCm/clr/commit/7868876db742fb4d44483892856a66d2993add03.patch?full_index=1", + sha256="7668b2a710baf4cb063e6b00280fb75c4c3e0511575e8298a9c7ae5143f60b33", + working_dir="clr", + when="@5.7:", + ) + # Add hipcc sources thru the below for d_version, d_shasum in [ ("6.0.2", "d6209b14fccdd00d7231dec4b4f962aa23914b9dde389ba961370e8ba918bde5"), @@ -262,7 +277,6 @@ class Hip(CMakePackage): patch("0014-Remove-compiler-rt-linkage-for-host-for-5.7.0.patch", when="@5.7.0:5.7") patch("0014-remove-compiler-rt-linkage-for-host.6.0.patch", when="@6.0:") patch("0015-reverting-operator-mixup-fix-for-slate.patch", when="@5.6:6.0") - patch("0017-Set-PARAMETERS_MIN_ALIGNMENT-to-the-native-alignment.patch", when="@5.7:6.0") patch("0018-reverting-hipMemoryType-with-memoryType.patch", when="@6.0") # See https://github.com/ROCm/HIP/pull/3206 |