hipcc: new package for HIP (#43245)
* initial commit to add hipcc package * restore setup_dependent_package
This commit is contained in:
parent
b8f633246a
commit
b9cbd15674
4 changed files with 76 additions and 35 deletions
|
@ -28,34 +28,3 @@ index 7ad3001..aaf6ad0 100755
|
||||||
endif()
|
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;
|
|
||||||
}
|
|
||||||
|
|
|
@ -107,6 +107,9 @@ class Hip(CMakePackage):
|
||||||
# ref https://github.com/ROCm/HIP/pull/2202
|
# ref https://github.com/ROCm/HIP/pull/2202
|
||||||
depends_on("numactl", when="@3.7.0:")
|
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
|
# roc-obj-ls requirements
|
||||||
depends_on("perl-file-which")
|
depends_on("perl-file-which")
|
||||||
depends_on("perl-uri-encode")
|
depends_on("perl-uri-encode")
|
||||||
|
@ -215,8 +218,6 @@ class Hip(CMakePackage):
|
||||||
|
|
||||||
# Add hipcc sources thru the below
|
# Add hipcc sources thru the below
|
||||||
for d_version, d_shasum in [
|
for d_version, d_shasum in [
|
||||||
("6.0.2", "d6209b14fccdd00d7231dec4b4f962aa23914b9dde389ba961370e8ba918bde5"),
|
|
||||||
("6.0.0", "e9cfaaecaf0e6ed363946439197f340c115e8e1189f96dbd716cf20245c29255"),
|
|
||||||
("5.7.1", "d47d27ef2b5de7f49cdfd8547832ac9b437a32e6fc6f0e9c1646f4b704c90aee"),
|
("5.7.1", "d47d27ef2b5de7f49cdfd8547832ac9b437a32e6fc6f0e9c1646f4b704c90aee"),
|
||||||
("5.7.0", "9f839bf7226e5e26f3150f8ba6eca507ab9a668e68b207736301b3bb9040c973"),
|
("5.7.0", "9f839bf7226e5e26f3150f8ba6eca507ab9a668e68b207736301b3bb9040c973"),
|
||||||
("5.6.1", "5800fac92b841ef6f52acda78d9bf86f83970bec0fb848a6265d239bdb7eb51a"),
|
("5.6.1", "5800fac92b841ef6f52acda78d9bf86f83970bec0fb848a6265d239bdb7eb51a"),
|
||||||
|
@ -502,6 +503,7 @@ def patch(self):
|
||||||
if self.spec.satisfies("@5.6:"):
|
if self.spec.satisfies("@5.6:"):
|
||||||
with working_dir("clr/hipamd/bin"):
|
with working_dir("clr/hipamd/bin"):
|
||||||
filter_file("^#!/usr/bin/perl", f"#!{perl}", "roc-obj-extract", "roc-obj-ls")
|
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"):
|
with working_dir("hipcc/bin"):
|
||||||
filter_shebang("hipconfig")
|
filter_shebang("hipconfig")
|
||||||
|
|
||||||
|
@ -510,7 +512,7 @@ def patch(self):
|
||||||
if self.spec.satisfies("@:5.5"):
|
if self.spec.satisfies("@:5.5"):
|
||||||
with working_dir("bin"):
|
with working_dir("bin"):
|
||||||
filter_file(" -lnuma", f" -L{numactl} -lnuma", "hipcc")
|
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"):
|
with working_dir("hipcc/src"):
|
||||||
filter_file(" -lnuma", f" -L{numactl} -lnuma", "hipBin_amd.h")
|
filter_file(" -lnuma", f" -L{numactl} -lnuma", "hipBin_amd.h")
|
||||||
|
|
||||||
|
@ -540,10 +542,13 @@ def cmake_args(self):
|
||||||
if "@5.6.0:" in self.spec:
|
if "@5.6.0:" in self.spec:
|
||||||
args.append(self.define("ROCCLR_PATH", self.stage.source_path + "/clr/rocclr"))
|
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("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_HIP", True)),
|
||||||
args.append(self.define("CLR_BUILD_OCL", False)),
|
args.append(self.define("CLR_BUILD_OCL", False)),
|
||||||
args.append(self.define("HIP_LLVM_ROOT", self.spec["llvm-amdgpu"].prefix))
|
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
|
return args
|
||||||
|
|
||||||
test_src_dir_old = "samples"
|
test_src_dir_old = "samples"
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
36
var/spack/repos/builtin/packages/hipcc/package.py
Normal file
36
var/spack/repos/builtin/packages/hipcc/package.py
Normal file
|
@ -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")
|
Loading…
Reference in a new issue