summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2020-12-02 15:58:58 +0100
committerGitHub <noreply@github.com>2020-12-02 15:58:58 +0100
commitb0baf429889ca22eaf8e7028ecb0061918c03dbd (patch)
tree1180c9c903738d0650409ad3999aaa156df1b876 /lib
parente575a38d967cd20c44fa4eb515d543f0a21127ec (diff)
downloadspack-b0baf429889ca22eaf8e7028ecb0061918c03dbd.tar.gz
spack-b0baf429889ca22eaf8e7028ecb0061918c03dbd.tar.bz2
spack-b0baf429889ca22eaf8e7028ecb0061918c03dbd.tar.xz
spack-b0baf429889ca22eaf8e7028ecb0061918c03dbd.zip
Fix hipcc once more (#20095)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/rocm.py (renamed from lib/spack/spack/build_systems/hip.py)47
-rw-r--r--lib/spack/spack/pkgkit.py2
2 files changed, 22 insertions, 27 deletions
diff --git a/lib/spack/spack/build_systems/hip.py b/lib/spack/spack/build_systems/rocm.py
index da44f1428d..0107c6376b 100644
--- a/lib/spack/spack/build_systems/hip.py
+++ b/lib/spack/spack/build_systems/rocm.py
@@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-# Troubleshooting advice for +hip builds:
+# Troubleshooting advice for +rocm builds:
#
# 1. When building with clang, go your compilers.yaml,
# add an entry for the amd version of clang, as below.
@@ -73,9 +73,11 @@
from spack.package import PackageBase
from spack.directives import depends_on, variant, conflicts
+import spack.variant
-class HipPackage(PackageBase):
- """Auxiliary class which contains HIP variant, dependencies and conflicts
+
+class ROCmPackage(PackageBase):
+ """Auxiliary class which contains ROCm variant, dependencies and conflicts
and is meant to unify and facilitate its usage. Closely mimics CudaPackage.
Maintainers: dtaller
@@ -86,24 +88,26 @@ class HipPackage(PackageBase):
amdgpu_targets = (
'gfx701', 'gfx801', 'gfx802', 'gfx803',
'gfx900', 'gfx906', 'gfx908', 'gfx1010',
- 'gfx1011', 'gfx1012', 'none'
+ 'gfx1011', 'gfx1012'
)
- variant('hip', default=False, description='Enable HIP support')
+ variant('rocm', default=False, description='Enable ROCm support')
- # possible amd gpu targets for hip builds
- variant('amdgpu_target', default='none', values=amdgpu_targets)
+ # possible amd gpu targets for rocm builds
+ variant('amdgpu_target',
+ description='AMD GPU architecture',
+ values=spack.variant.any_combination_of(*amdgpu_targets))
- depends_on('llvm-amdgpu', when='+hip')
- depends_on('hsa-rocr-dev', when='+hip')
- depends_on('hip', when='+hip')
+ depends_on('llvm-amdgpu', when='+rocm')
+ depends_on('hsa-rocr-dev', when='+rocm')
+ depends_on('hip', when='+rocm')
- # need amd gpu type for hip builds
- conflicts('amdgpu_target=none', when='+hip')
+ # need amd gpu type for rocm builds
+ conflicts('amdgpu_target=none', when='+rocm')
- # Make sure non-'none' amdgpu_targets cannot be used without +hip
- for value in amdgpu_targets[:-1]:
- conflicts('~hip', when='amdgpu_target=' + value)
+ # Make sure amdgpu_targets cannot be used without +rocm
+ for value in amdgpu_targets:
+ conflicts('~rocm', when='amdgpu_target=' + value)
# https://github.com/ROCm-Developer-Tools/HIP/blob/master/bin/hipcc
# It seems that hip-clang does not (yet?) accept this flag, in which case
@@ -111,17 +115,8 @@ class HipPackage(PackageBase):
# hip package file. But I will leave this here for future development.
@staticmethod
def hip_flags(amdgpu_target):
- return '--amdgpu-target={0}'.format(amdgpu_target)
-
- # https://llvm.org/docs/AMDGPUUsage.html
- # Possible architectures (not including 'none' option)
- @staticmethod
- def amd_gputargets_list():
- return (
- 'gfx701', 'gfx801', 'gfx802', 'gfx803',
- 'gfx900', 'gfx906', 'gfx908', 'gfx1010',
- 'gfx1011', 'gfx1012'
- )
+ archs = ",".join(amdgpu_target)
+ return '--amdgpu-target={0}'.format(archs)
# HIP version vs Architecture
diff --git a/lib/spack/spack/pkgkit.py b/lib/spack/spack/pkgkit.py
index da519f2e16..2673d2dbd5 100644
--- a/lib/spack/spack/pkgkit.py
+++ b/lib/spack/spack/pkgkit.py
@@ -20,7 +20,7 @@ from spack.build_systems.aspell_dict import AspellDictPackage
from spack.build_systems.autotools import AutotoolsPackage
from spack.build_systems.cmake import CMakePackage
from spack.build_systems.cuda import CudaPackage
-from spack.build_systems.hip import HipPackage
+from spack.build_systems.rocm import ROCmPackage
from spack.build_systems.qmake import QMakePackage
from spack.build_systems.maven import MavenPackage
from spack.build_systems.scons import SConsPackage