summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/hip
diff options
context:
space:
mode:
Diffstat (limited to 'var/spack/repos/builtin/packages/hip')
-rw-r--r--var/spack/repos/builtin/packages/hip/0003-Improve-compilation-without-git-repo.3.10.0.patch56
-rw-r--r--var/spack/repos/builtin/packages/hip/0003-Improve-compilation-without-git-repo.3.9.0.patch56
-rw-r--r--var/spack/repos/builtin/packages/hip/0004-Drop-clang-rt-builtins-linking-on-hip-host.3.10.0.patch32
-rw-r--r--var/spack/repos/builtin/packages/hip/0004-Drop-clang-rt-builtins-linking-on-hip-host.3.9.0.patch35
-rw-r--r--var/spack/repos/builtin/packages/hip/package.py53
5 files changed, 212 insertions, 20 deletions
diff --git a/var/spack/repos/builtin/packages/hip/0003-Improve-compilation-without-git-repo.3.10.0.patch b/var/spack/repos/builtin/packages/hip/0003-Improve-compilation-without-git-repo.3.10.0.patch
new file mode 100644
index 0000000000..d7f1a8dff3
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hip/0003-Improve-compilation-without-git-repo.3.10.0.patch
@@ -0,0 +1,56 @@
+From 3a05d9ee5af2d318d27ee4b8e81542e2c81b9d5a Mon Sep 17 00:00:00 2001
+From: Harmen Stoppels <harmenstoppels@gmail.com>
+Date: Mon, 11 Jan 2021 16:38:14 +0100
+Subject: [PATCH] Improve compilation without git repo
+
+---
+ CMakeLists.txt | 17 +++++++++--------
+ 1 file changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7831bb4d..c0c7a536 100755
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -42,9 +42,17 @@ string(REPLACE "." ";" VERSION_LIST ${HIP_BASE_VERSION})
+ list(GET VERSION_LIST 0 HIP_VERSION_MAJOR)
+ list(GET VERSION_LIST 1 HIP_VERSION_MINOR)
+
+-find_package(Git)
++# only look for git when we have a git repo
++if (IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git")
++ find_package(Git)
++endif()
+
+ # FIXME: Two different version strings used.
++
++set(HIP_PACKAGING_VERSION_PATCH "0")
++set(HIP_VERSION_GITDATE "0")
++set(HIP_VERSION_PATCH "0")
++
+ if(GIT_FOUND)
+ # get date information based on UTC
+ # use the last two digits of year + week number + day in the week as HIP_VERSION_GITDATE
+@@ -88,9 +96,6 @@ if(GIT_FOUND)
+ else()
+ set(HIP_PACKAGING_VERSION_PATCH ${HIP_VERSION_GITDATE}.${HIP_VERSION_GITCOUNT}-${HIP_VERSION_GITHASH})
+ endif()
+-else()
+- # FIXME: Some parts depend on this being set.
+- set(HIP_PACKAGING_VERSION_PATCH "0")
+ endif()
+
+ ## Debian package specific variables
+@@ -488,10 +493,6 @@ endif()
+ # Generate .hipVersion
+ file(WRITE "${PROJECT_BINARY_DIR}/.hipVersion" ${_versionInfo})
+
+-if(NOT DEFINED HIP_VERSION_GITDATE)
+- set(HIP_VERSION_GITDATE 0)
+-endif()
+-
+ # Build doxygen documentation
+ find_program(DOXYGEN_EXE doxygen)
+ if(DOXYGEN_EXE)
+--
+2.25.1
+
diff --git a/var/spack/repos/builtin/packages/hip/0003-Improve-compilation-without-git-repo.3.9.0.patch b/var/spack/repos/builtin/packages/hip/0003-Improve-compilation-without-git-repo.3.9.0.patch
new file mode 100644
index 0000000000..2bb5074df2
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hip/0003-Improve-compilation-without-git-repo.3.9.0.patch
@@ -0,0 +1,56 @@
+From db2a538d9beaef9092dff19c36ed8a2e291bc69a Mon Sep 17 00:00:00 2001
+From: Harmen Stoppels <harmenstoppels@gmail.com>
+Date: Mon, 11 Jan 2021 16:38:14 +0100
+Subject: [PATCH 1/2] Improve compilation without git repo
+
+---
+ CMakeLists.txt | 17 +++++++++--------
+ 1 file changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7f5bdad9..ca0e7ed4 100755
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -44,9 +44,17 @@ string(REPLACE "." ";" VERSION_LIST ${HIP_BASE_VERSION})
+ list(GET VERSION_LIST 0 HIP_VERSION_MAJOR)
+ list(GET VERSION_LIST 1 HIP_VERSION_MINOR)
+
+-find_package(Git)
++# only look for git when we have a git repo
++if (IS_DIRECTORY "${PROJECT_SOURCE_DIR}/.git")
++ find_package(Git)
++endif()
+
+ # FIXME: Two different version strings used.
++
++set(HIP_PACKAGING_VERSION_PATCH "0")
++set(HIP_VERSION_GITDATE "0")
++set(HIP_VERSION_PATCH "0")
++
+ if(GIT_FOUND)
+ # get date information based on UTC
+ # use the last two digits of year + week number + day in the week as HIP_VERSION_GITDATE
+@@ -90,9 +98,6 @@ if(GIT_FOUND)
+ else()
+ set(HIP_PACKAGING_VERSION_PATCH ${HIP_VERSION_GITDATE}.${HIP_VERSION_GITCOUNT}-${HIP_VERSION_GITHASH})
+ endif()
+-else()
+- # FIXME: Some parts depend on this being set.
+- set(HIP_PACKAGING_VERSION_PATCH "0")
+ endif()
+
+ add_to_config(_versionInfo HIP_VERSION_MAJOR)
+@@ -447,10 +452,6 @@ endif()
+ # Generate .hipVersion
+ file(WRITE "${PROJECT_BINARY_DIR}/.hipVersion" ${_versionInfo})
+
+-if(NOT DEFINED HIP_VERSION_GITDATE)
+- set(HIP_VERSION_GITDATE 0)
+-endif()
+-
+ # Generate hip_version.h
+ set(_versionInfoHeader
+ "// Auto-generated by cmake\n
+--
+2.25.1
+
diff --git a/var/spack/repos/builtin/packages/hip/0004-Drop-clang-rt-builtins-linking-on-hip-host.3.10.0.patch b/var/spack/repos/builtin/packages/hip/0004-Drop-clang-rt-builtins-linking-on-hip-host.3.10.0.patch
new file mode 100644
index 0000000000..a930858378
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hip/0004-Drop-clang-rt-builtins-linking-on-hip-host.3.10.0.patch
@@ -0,0 +1,32 @@
+From 8b266132ee180ff8cc17b394ba64850f207a3dab Mon Sep 17 00:00:00 2001
+From: Harmen Stoppels <harmenstoppels@gmail.com>
+Date: Tue, 12 Jan 2021 12:26:44 +0100
+Subject: [PATCH] Drop clang rt builtins linking on hip::host
+
+Ref this comment
+https://github.com/ROCm-Developer-Tools/HIP/pull/2217#discussion_r555402581:
+
+> Yea, this should only be linked on hip::device as I believe its needed
+> for __fp16 support on the GPU. If users need this on the host-side,
+> then they should explicitly add it.
+---
+ hip-config.cmake.in | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/hip-config.cmake.in b/hip-config.cmake.in
+index 6dfbd527..0ac1b659 100644
+--- a/hip-config.cmake.in
++++ b/hip-config.cmake.in
+@@ -206,9 +206,6 @@ if(HIP_COMPILER STREQUAL "clang")
+ endif()
+
+ # Add support for __fp16 and _Float16, explicitly link with compiler-rt
+- set_property(TARGET hip::host APPEND PROPERTY
+- INTERFACE_LINK_LIBRARIES -L${HIP_CLANG_INCLUDE_PATH}/../lib/linux -lclang_rt.builtins-x86_64
+- )
+ set_property(TARGET hip::device APPEND PROPERTY
+ INTERFACE_LINK_LIBRARIES -L${HIP_CLANG_INCLUDE_PATH}/../lib/linux -lclang_rt.builtins-x86_64
+ )
+--
+2.25.1
+
diff --git a/var/spack/repos/builtin/packages/hip/0004-Drop-clang-rt-builtins-linking-on-hip-host.3.9.0.patch b/var/spack/repos/builtin/packages/hip/0004-Drop-clang-rt-builtins-linking-on-hip-host.3.9.0.patch
new file mode 100644
index 0000000000..936b333277
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hip/0004-Drop-clang-rt-builtins-linking-on-hip-host.3.9.0.patch
@@ -0,0 +1,35 @@
+From 053bb794c57424fc47d53d8914bca1dc8d776a34 Mon Sep 17 00:00:00 2001
+From: Harmen Stoppels <harmenstoppels@gmail.com>
+Date: Tue, 12 Jan 2021 12:26:44 +0100
+Subject: [PATCH 2/2] Drop clang rt builtins linking on hip::host
+
+Ref this comment
+https://github.com/ROCm-Developer-Tools/HIP/pull/2217#discussion_r555402581:
+
+> Yea, this should only be linked on hip::device as I believe its needed
+> for __fp16 support on the GPU. If users need this on the host-side,
+> then they should explicitly add it.
+---
+ hip-config.cmake.in | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/hip-config.cmake.in b/hip-config.cmake.in
+index ba340134..4daff392 100644
+--- a/hip-config.cmake.in
++++ b/hip-config.cmake.in
+@@ -204,12 +204,6 @@ if(HIP_COMPILER STREQUAL "clang")
+ endif()
+
+ # Add support for __fp16 and _Float16, explicitly link with compiler-rt
+- set_property(TARGET hip::host APPEND PROPERTY
+- INTERFACE_COMPILE_OPTIONS -L${HIP_CLANG_INCLUDE_PATH}/../lib/linux -lclang_rt.builtins-x86_64
+- )
+- set_property(TARGET hip::host APPEND PROPERTY
+- INTERFACE_LINK_LIBRARIES -L${HIP_CLANG_INCLUDE_PATH}/../lib/linux -lclang_rt.builtins-x86_64
+- )
+ set_property(TARGET hip::device APPEND PROPERTY
+ INTERFACE_COMPILE_OPTIONS -L${HIP_CLANG_INCLUDE_PATH}/../lib/linux -lclang_rt.builtins-x86_64
+ )
+--
+2.25.1
+
diff --git a/var/spack/repos/builtin/packages/hip/package.py b/var/spack/repos/builtin/packages/hip/package.py
index d983244a0e..ac992785dc 100644
--- a/var/spack/repos/builtin/packages/hip/package.py
+++ b/var/spack/repos/builtin/packages/hip/package.py
@@ -1,4 +1,4 @@
-# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
@@ -13,10 +13,12 @@ class Hip(CMakePackage):
single source code."""
homepage = "https://github.com/ROCm-Developer-Tools/HIP"
- url = "https://github.com/ROCm-Developer-Tools/HIP/archive/rocm-3.8.0.tar.gz"
+ url = "https://github.com/ROCm-Developer-Tools/HIP/archive/rocm-4.0.0.tar.gz"
maintainers = ['srekolam', 'arjun-raj-kuppala']
+ version('4.0.0', sha256='d7b78d96cec67c55b74ea3811ce861b16d300410bc687d0629e82392e8d7c857')
+ version('3.10.0', sha256='0082c402f890391023acdfd546760f41cb276dffc0ffeddc325999fd2331d4e8')
version('3.9.0', sha256='25ad58691456de7fd9e985629d0ed775ba36a2a0e0b21c086bd96ba2fb0f7ed1')
version('3.8.0', sha256='6450baffe9606b358a4473d5f3e57477ca67cff5843a84ee644bcf685e75d839')
version('3.7.0', sha256='757b392c3beb29beea27640832fbad86681dbd585284c19a4c2053891673babd')
@@ -24,9 +26,9 @@ class Hip(CMakePackage):
depends_on('cmake@3:', type='build')
depends_on('perl@5.10:', type=('build', 'run'))
- depends_on('mesa~llvm@18.3:')
+ depends_on('mesa18~llvm@18.3:')
- for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0']:
+ for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0']:
depends_on('hip-rocclr@' + ver, type='build', when='@' + ver)
depends_on('hsakmt-roct@' + ver, type='build', when='@' + ver)
depends_on('hsa-rocr-dev@' + ver, type='link', when='@' + ver)
@@ -47,7 +49,15 @@ class Hip(CMakePackage):
patch('0001-Make-it-possible-to-specify-the-package-folder-of-ro.patch', when='@3.5.0:')
# See https://github.com/ROCm-Developer-Tools/HIP/pull/2141
- patch('0002-Fix-detection-of-HIP_CLANG_ROOT.patch', when='@3.5.0:')
+ patch('0002-Fix-detection-of-HIP_CLANG_ROOT.patch', when='@:3.9.0')
+
+ # See https://github.com/ROCm-Developer-Tools/HIP/pull/2218
+ patch('0003-Improve-compilation-without-git-repo.3.9.0.patch', when='@3.9.0')
+ patch('0003-Improve-compilation-without-git-repo.3.10.0.patch', when='@3.10.0:4.0.0')
+
+ # See https://github.com/ROCm-Developer-Tools/HIP/pull/2219
+ patch('0004-Drop-clang-rt-builtins-linking-on-hip-host.3.9.0.patch', when='@3.9.0')
+ patch('0004-Drop-clang-rt-builtins-linking-on-hip-host.3.10.0.patch', when='@3.10.0:4.0.0')
def get_rocm_prefix_info(self):
# External packages in Spack do not currently contain dependency
@@ -73,15 +83,18 @@ class Hip(CMakePackage):
'llvm-amdgpu': fallback_prefix.llvm,
'hsa-rocr-dev': fallback_prefix.hsa,
'rocminfo': fallback_prefix.bin,
- 'rocm-device-libs': fallback_prefix,
- 'device_lib_path': fallback_prefix
+ 'rocm-device-libs': fallback_prefix.lib,
+ 'device_lib_path': fallback_prefix.lib
}
else:
mydict = dict((name, self.spec[name].prefix)
for name in ('llvm-amdgpu', 'hsa-rocr-dev',
'rocminfo', 'rocm-device-libs'))
mydict['rocm-path'] = self.spec.prefix
- device_lib_path = mydict['rocm-device-libs'].amdgcn.bitcode
+ if '@:3.8.0' in self.spec:
+ device_lib_path = mydict['rocm-device-libs'].lib
+ else:
+ device_lib_path = mydict['rocm-device-libs'].amdgcn.bitcode
mydict['device_lib_path'] = device_lib_path
return mydict
@@ -101,6 +114,10 @@ class Hip(CMakePackage):
env.set('ROCMINFO_PATH', rocm_prefixes['rocminfo'])
env.set('DEVICE_LIB_PATH', rocm_prefixes['device_lib_path'])
env.set('HIP_PATH', rocm_prefixes['rocm-path'])
+ # this guy is used in comgr, see the following file:
+ # https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/blob/rocm-4.0.0/lib/comgr/src/comgr-env.cpp
+ # it's necessary on runtime when using hiprtcCreateProgram and such
+ env.set('LLVM_PATH', rocm_prefixes['llvm-amdgpu'])
env.set('HIPCC_COMPILE_FLAGS_APPEND',
'--rocm-path={0}'.format(rocm_prefixes['device_lib_path']))
@@ -127,16 +144,6 @@ class Hip(CMakePackage):
'INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"',
'hip-config.cmake.in', string=True)
- def flag_handler(self, name, flags):
- if name == 'cxxflags' and '@3.7.0:' in self.spec:
- incl = self.spec['hip-rocclr'].prefix.include
- flags.append('-I {0}/compiler/lib/include'.format(incl))
- flags.append('-I {0}/elf'.format(incl))
-
- return (flags, None, None)
-
- @run_before('install')
- def filter_sbang(self):
perl = self.spec['perl'].command
kwargs = {'ignore_absent': False, 'backup': False, 'string': False}
@@ -149,8 +156,6 @@ class Hip(CMakePackage):
]
filter_file(match, substitute, *files, **kwargs)
- @run_before('install')
- def filter_numactl(self):
if '@3.7.0:' in self.spec:
numactl = self.spec['numactl'].prefix.lib
kwargs = {'ignore_absent': False, 'backup': False, 'string': False}
@@ -160,6 +165,14 @@ class Hip(CMakePackage):
substitute = " -L{numactl} -lnuma".format(numactl=numactl)
filter_file(match, substitute, 'hipcc', **kwargs)
+ def flag_handler(self, name, flags):
+ if name == 'cxxflags' and '@3.7.0:' in self.spec:
+ incl = self.spec['hip-rocclr'].prefix.include
+ flags.append('-I {0}/compiler/lib/include'.format(incl))
+ flags.append('-I {0}/elf'.format(incl))
+
+ return (flags, None, None)
+
def cmake_args(self):
args = [
'-DHIP_COMPILER=clang',