diff options
author | afzpatel <122491982+afzpatel@users.noreply.github.com> | 2024-03-27 22:05:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 21:05:50 -0500 |
commit | b9cbd156745d45a2e8ec1f9900f4d135f140c767 (patch) | |
tree | 06b42504f7817b77529652c863a939d166ffd563 /var | |
parent | b8f633246aa975d8724233575a98346f9d59b4f2 (diff) | |
download | spack-b9cbd156745d45a2e8ec1f9900f4d135f140c767.tar.gz spack-b9cbd156745d45a2e8ec1f9900f4d135f140c767.tar.bz2 spack-b9cbd156745d45a2e8ec1f9900f4d135f140c767.tar.xz spack-b9cbd156745d45a2e8ec1f9900f4d135f140c767.zip |
hipcc: new package for HIP (#43245)
* initial commit to add hipcc package
* restore setup_dependent_package
Diffstat (limited to 'var')
4 files changed, 76 insertions, 35 deletions
diff --git a/var/spack/repos/builtin/packages/hip/0014-remove-compiler-rt-linkage-for-host.6.0.patch b/var/spack/repos/builtin/packages/hip/0014-remove-compiler-rt-linkage-for-host.6.0.patch index 597baa2e5d..3dc0e6ac0c 100644 --- a/var/spack/repos/builtin/packages/hip/0014-remove-compiler-rt-linkage-for-host.6.0.patch +++ b/var/spack/repos/builtin/packages/hip/0014-remove-compiler-rt-linkage-for-host.6.0.patch @@ -28,34 +28,3 @@ index 7ad3001..aaf6ad0 100755 endif() ############################# -diff --git a/hipcc/bin/hipcc.pl b/hipcc/bin/hipcc.pl -index 513a427..cd2d6ac 100755 ---- a/hipcc/bin/hipcc.pl -+++ b/hipcc/bin/hipcc.pl -@@ -160,11 +160,14 @@ if ($HIP_PLATFORM eq "amd") { - if($isWindows) { - $execExtension = ".exe"; - } -- $HIPCC=get_normalized_path("$HIP_CLANG_PATH/clang++" . $execExtension); -+ # llvm_path is set inside the hip recipe -+ $LLVM_PATH= $ENV{'LLVM_PATH'}; -+ $HIPCC="${LLVM_PATH}/bin/clang++" . $execExtension; - - # If $HIPCC clang++ is not compiled, use clang instead - if ( ! -e $HIPCC ) { -- $HIPCC=get_normalized_path("$HIP_CLANG_PATH/clang" . $execExtension); -+ $LLVM_PATH= $ENV{'LLVM_PATH'}; -+ $HIPCC="${LLVM_PATH}/bin/clang" . $execExtension; - $HIPLDFLAGS = "--driver-mode=g++"; - } - # to avoid using dk linker or MSVC linker -@@ -484,7 +487,8 @@ if($HIP_PLATFORM eq "amd"){ - $targetsStr = $ENV{HCC_AMDGPU_TARGET}; - } elsif (not $isWindows) { - # Else try using rocm_agent_enumerator -- $ROCM_AGENT_ENUM = "${ROCM_PATH}/bin/rocm_agent_enumerator"; -+ $ROCMINFO_PATH = $ENV{'ROCMINFO_PATH'} // $ROCMINFO_PATH; -+ $ROCM_AGENT_ENUM = "${ROCMINFO_PATH}/bin/rocm_agent_enumerator"; - $targetsStr = `${ROCM_AGENT_ENUM} -t GPU`; - $targetsStr =~ s/\n/,/g; - } diff --git a/var/spack/repos/builtin/packages/hip/package.py b/var/spack/repos/builtin/packages/hip/package.py index ffc1c1bece..91e303579d 100644 --- a/var/spack/repos/builtin/packages/hip/package.py +++ b/var/spack/repos/builtin/packages/hip/package.py @@ -107,6 +107,9 @@ class Hip(CMakePackage): # ref https://github.com/ROCm/HIP/pull/2202 depends_on("numactl", when="@3.7.0:") + for ver in ["6.0.0", "6.0.2"]: + depends_on("hipcc", when=f"@{ver}") + # roc-obj-ls requirements depends_on("perl-file-which") depends_on("perl-uri-encode") @@ -215,8 +218,6 @@ class Hip(CMakePackage): # Add hipcc sources thru the below for d_version, d_shasum in [ - ("6.0.2", "d6209b14fccdd00d7231dec4b4f962aa23914b9dde389ba961370e8ba918bde5"), - ("6.0.0", "e9cfaaecaf0e6ed363946439197f340c115e8e1189f96dbd716cf20245c29255"), ("5.7.1", "d47d27ef2b5de7f49cdfd8547832ac9b437a32e6fc6f0e9c1646f4b704c90aee"), ("5.7.0", "9f839bf7226e5e26f3150f8ba6eca507ab9a668e68b207736301b3bb9040c973"), ("5.6.1", "5800fac92b841ef6f52acda78d9bf86f83970bec0fb848a6265d239bdb7eb51a"), @@ -502,6 +503,7 @@ class Hip(CMakePackage): if self.spec.satisfies("@5.6:"): with working_dir("clr/hipamd/bin"): filter_file("^#!/usr/bin/perl", f"#!{perl}", "roc-obj-extract", "roc-obj-ls") + if self.spec.satisfies("@5.6:5.7"): with working_dir("hipcc/bin"): filter_shebang("hipconfig") @@ -510,7 +512,7 @@ class Hip(CMakePackage): if self.spec.satisfies("@:5.5"): with working_dir("bin"): filter_file(" -lnuma", f" -L{numactl} -lnuma", "hipcc") - elif self.spec.satisfies("@5.6:"): + elif self.spec.satisfies("@5.6:5.7"): with working_dir("hipcc/src"): filter_file(" -lnuma", f" -L{numactl} -lnuma", "hipBin_amd.h") @@ -540,10 +542,13 @@ class Hip(CMakePackage): if "@5.6.0:" in self.spec: args.append(self.define("ROCCLR_PATH", self.stage.source_path + "/clr/rocclr")) args.append(self.define("AMD_OPENCL_PATH", self.stage.source_path + "/clr/opencl")) - args.append(self.define("HIPCC_BIN_DIR", self.stage.source_path + "/hipcc/bin")), args.append(self.define("CLR_BUILD_HIP", True)), args.append(self.define("CLR_BUILD_OCL", False)), args.append(self.define("HIP_LLVM_ROOT", self.spec["llvm-amdgpu"].prefix)) + if "@5.6:5.7" in self.spec: + args.append(self.define("HIPCC_BIN_DIR", self.stage.source_path + "/hipcc/bin")), + if "@6.0:" in self.spec: + args.append(self.define("HIPCC_BIN_DIR", self.spec["hipcc"].prefix.bin)), return args test_src_dir_old = "samples" diff --git a/var/spack/repos/builtin/packages/hipcc/0014-remove-compiler-rt-linkage-for-host.6.0.patch b/var/spack/repos/builtin/packages/hipcc/0014-remove-compiler-rt-linkage-for-host.6.0.patch new file mode 100644 index 0000000000..e49f055204 --- /dev/null +++ b/var/spack/repos/builtin/packages/hipcc/0014-remove-compiler-rt-linkage-for-host.6.0.patch @@ -0,0 +1,31 @@ +diff --git a/bin/hipcc.pl b/bin/hipcc.pl +index 513a427..cd2d6ac 100755 +--- a/bin/hipcc.pl ++++ b/bin/hipcc.pl +@@ -160,11 +160,14 @@ if ($HIP_PLATFORM eq "amd") { + if($isWindows) { + $execExtension = ".exe"; + } +- $HIPCC=get_normalized_path("$HIP_CLANG_PATH/clang++" . $execExtension); ++ # llvm_path is set inside the hip recipe ++ $LLVM_PATH= $ENV{'LLVM_PATH'}; ++ $HIPCC="${LLVM_PATH}/bin/clang++" . $execExtension; + + # If $HIPCC clang++ is not compiled, use clang instead + if ( ! -e $HIPCC ) { +- $HIPCC=get_normalized_path("$HIP_CLANG_PATH/clang" . $execExtension); ++ $LLVM_PATH= $ENV{'LLVM_PATH'}; ++ $HIPCC="${LLVM_PATH}/bin/clang" . $execExtension; + $HIPLDFLAGS = "--driver-mode=g++"; + } + # to avoid using dk linker or MSVC linker +@@ -484,7 +487,8 @@ if($HIP_PLATFORM eq "amd"){ + $targetsStr = $ENV{HCC_AMDGPU_TARGET}; + } elsif (not $isWindows) { + # Else try using rocm_agent_enumerator +- $ROCM_AGENT_ENUM = "${ROCM_PATH}/bin/rocm_agent_enumerator"; ++ $ROCMINFO_PATH = $ENV{'ROCMINFO_PATH'} // $ROCMINFO_PATH; ++ $ROCM_AGENT_ENUM = "${ROCMINFO_PATH}/bin/rocm_agent_enumerator"; + $targetsStr = `${ROCM_AGENT_ENUM} -t GPU`; + $targetsStr =~ s/\n/,/g; + } diff --git a/var/spack/repos/builtin/packages/hipcc/package.py b/var/spack/repos/builtin/packages/hipcc/package.py new file mode 100644 index 0000000000..da04d1d694 --- /dev/null +++ b/var/spack/repos/builtin/packages/hipcc/package.py @@ -0,0 +1,36 @@ +# Copyright 2013-2024 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) + + +from spack.hooks.sbang import filter_shebang +from spack.package import * + + +class Hipcc(CMakePackage): + """HIPCC: HIP compiler driver""" + + homepage = "https://github.com/ROCm/hipcc" + git = "https://github.com/ROCm/hipcc.git" + url = "https://github.com/ROCm/HIPCC/archive/refs/tags/rocm-6.0.2.tar.gz" + + maintainers("srekolam", "renjithravindrankannath", "afzpatel") + + license("MIT") + + version("6.0.2", sha256="d6209b14fccdd00d7231dec4b4f962aa23914b9dde389ba961370e8ba918bde5") + version("6.0.0", sha256="e9cfaaecaf0e6ed363946439197f340c115e8e1189f96dbd716cf20245c29255") + version("5.7.1", sha256="d47d27ef2b5de7f49cdfd8547832ac9b437a32e6fc6f0e9c1646f4b704c90aee") + version("5.7.0", sha256="9f839bf7226e5e26f3150f8ba6eca507ab9a668e68b207736301b3bb9040c973") + + depends_on("numactl") + + patch("0014-remove-compiler-rt-linkage-for-host.6.0.patch", when="@6.0:") + + def patch(self): + numactl = self.spec["numactl"].prefix.lib + with working_dir("bin"): + filter_shebang("hipconfig") + with working_dir("src"): + filter_file(" -lnuma", f" -L{numactl} -lnuma", "hipBin_amd.h") |