summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreugeneswalker <38933153+eugeneswalker@users.noreply.github.com>2024-06-07 10:37:52 -0700
committerGitHub <noreply@github.com>2024-06-07 11:37:52 -0600
commit4aebef900c59a74ce629a6910669106412225a2f (patch)
treeea1bb671d6592f1e178264f3d1cc550b117d6748
parent59c5bef16500c7092a72432b305ca7b10ecf0e76 (diff)
downloadspack-4aebef900c59a74ce629a6910669106412225a2f.tar.gz
spack-4aebef900c59a74ce629a6910669106412225a2f.tar.bz2
spack-4aebef900c59a74ce629a6910669106412225a2f.tar.xz
spack-4aebef900c59a74ce629a6910669106412225a2f.zip
sundials+rocm: patch hip platform for rocm 5.7-6 (#44617)
-rw-r--r--var/spack/repos/builtin/packages/sundials/package.py4
-rw-r--r--var/spack/repos/builtin/packages/sundials/sundials-hip-platform.patch33
2 files changed, 37 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/sundials/package.py b/var/spack/repos/builtin/packages/sundials/package.py
index ce4ac7afef..7f7c6c0f1c 100644
--- a/var/spack/repos/builtin/packages/sundials/package.py
+++ b/var/spack/repos/builtin/packages/sundials/package.py
@@ -284,6 +284,10 @@ class Sundials(CMakePackage, CudaPackage, ROCmPackage):
# ==========================================================================
# Patches
# ==========================================================================
+ # https://github.com/LLNL/sundials/pull/434
+ # https://github.com/LLNL/sundials/pull/437
+ patch("sundials-hip-platform.patch", when="@7.0.0 +rocm")
+
# https://github.com/spack/spack/issues/29526
patch("nvector-pic.patch", when="@6.1.0:6.2.0 +rocm")
diff --git a/var/spack/repos/builtin/packages/sundials/sundials-hip-platform.patch b/var/spack/repos/builtin/packages/sundials/sundials-hip-platform.patch
new file mode 100644
index 0000000000..c4092c9385
--- /dev/null
+++ b/var/spack/repos/builtin/packages/sundials/sundials-hip-platform.patch
@@ -0,0 +1,33 @@
+diff -ruN spack-src/cmake/SundialsSetupHIP.cmake spack-src-patched/cmake/SundialsSetupHIP.cmake
+--- spack-src/cmake/SundialsSetupHIP.cmake 2024-02-29 22:47:30.000000000 +0000
++++ spack-src-patched/cmake/SundialsSetupHIP.cmake 2024-06-07 15:22:57.920619263 +0000
+@@ -32,9 +32,9 @@
+
+ if(NOT DEFINED HIP_PLATFORM)
+ if(NOT DEFINED ENV{HIP_PLATFORM})
+- set(HIP_PLATFORM "hcc" CACHE STRING "HIP platform (hcc, nvcc)")
++ set(HIP_PLATFORM "amd" CACHE STRING "HIP platform (amd, nvidia)")
+ else()
+- set(HIP_PLATFORM "$ENV{HIP_PLATFORM}" CACHE STRING "HIP platform (hcc, nvcc)")
++ set(HIP_PLATFORM "$ENV{HIP_PLATFORM}" CACHE STRING "HIP platform (amd, nvidia)")
+ endif()
+ endif()
+
+diff -ruN spack-src/include/sundials/sundials_hip_policies.hpp spack-src-patched/include/sundials/sundials_hip_policies.hpp
+--- spack-src/include/sundials/sundials_hip_policies.hpp 2024-02-29 22:47:30.000000000 +0000
++++ spack-src-patched/include/sundials/sundials_hip_policies.hpp 2024-06-07 15:23:15.752724851 +0000
+@@ -27,10 +27,12 @@
+ namespace sundials {
+ namespace hip {
+
+-#if defined(__HIP_PLATFORM_HCC__)
++#if defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)
+ constexpr const sunindextype WARP_SIZE = 64;
+-#elif defined(__HIP_PLATFORM_NVCC__)
++#elif defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVDIA__)
+ constexpr const sunindextype WARP_SIZE = 32;
++#else
++#error "Unknown HIP_PLATFORM, report to github.com/LLNL/sundials/issues"
+ #endif
+ constexpr const sunindextype MAX_BLOCK_SIZE = 1024;
+ constexpr const sunindextype MAX_WARPS = MAX_BLOCK_SIZE / WARP_SIZE;