summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorafzpatel <122491982+afzpatel@users.noreply.github.com>2024-04-29 14:48:03 -0400
committerGitHub <noreply@github.com>2024-04-29 11:48:03 -0700
commit2df4b307d717d3289538b223dab0f42a339de5f9 (patch)
treeec2e3953b7f4f172942a229dfbb16e1db33c2aed
parent3c57440c1033a18b8ced8a644fd29363747615cd (diff)
downloadspack-2df4b307d717d3289538b223dab0f42a339de5f9.tar.gz
spack-2df4b307d717d3289538b223dab0f42a339de5f9.tar.bz2
spack-2df4b307d717d3289538b223dab0f42a339de5f9.tar.xz
spack-2df4b307d717d3289538b223dab0f42a339de5f9.zip
hipblaslt: new package (#43846)
* initial commit to add hipblaslt package * remove master and update patch * add docstring comment
-rw-r--r--var/spack/repos/builtin/packages/hipblaslt/001_Set_LLVM_Paths_And_Add_Includes.patch70
-rw-r--r--var/spack/repos/builtin/packages/hipblaslt/package.py65
2 files changed, 135 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/hipblaslt/001_Set_LLVM_Paths_And_Add_Includes.patch b/var/spack/repos/builtin/packages/hipblaslt/001_Set_LLVM_Paths_And_Add_Includes.patch
new file mode 100644
index 0000000000..27eb39effd
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hipblaslt/001_Set_LLVM_Paths_And_Add_Includes.patch
@@ -0,0 +1,70 @@
+diff --git a/clients/gtest/CMakeLists.txt b/clients/gtest/CMakeLists.txt
+index 825bdca..f817e12 100644
+--- a/clients/gtest/CMakeLists.txt
++++ b/clients/gtest/CMakeLists.txt
+@@ -53,6 +53,7 @@ target_include_directories( hipblaslt-test
+ $<BUILD_INTERFACE:${BLAS_INCLUDE_DIR}>
+ $<BUILD_INTERFACE:${BLIS_INCLUDE_DIR}> # may be blank if not used
+ $<BUILD_INTERFACE:${GTEST_INCLUDE_DIRS}>
++ $<BUILD_INTERFACE:${HIPBLAS_INCLUDE_DIRS}>
+ )
+ message("BLIS_INCLUDE_DIR=" ${BLIS_INCLUDE_DIR})
+ target_link_libraries( hipblaslt-test PRIVATE ${BLAS_LIBRARY} ${GTEST_BOTH_LIBRARIES} roc::hipblaslt )
+diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
+index 3252da0..1b8d628 100644
+--- a/library/CMakeLists.txt
++++ b/library/CMakeLists.txt
+@@ -72,6 +72,8 @@ include(src/CMakeLists.txt)
+ # Create hipBLASLt library
+ add_library(hipblaslt ${hipblaslt_source} ${hipblaslt_headers_public})
+ add_library(roc::hipblaslt ALIAS hipblaslt)
++target_include_directories( hipblaslt PRIVATE ${HIPBLAS_INCLUDE_DIRS} )
++target_include_directories( hipblaslt PRIVATE ${MSGPACK_DIR}/include )
+
+ # Target compile definitions
+ if(NOT BUILD_CUDA)
+diff --git a/tensilelite/Tensile/Common.py b/tensilelite/Tensile/Common.py
+index 0f862b8..0baeb55 100644
+--- a/tensilelite/Tensile/Common.py
++++ b/tensilelite/Tensile/Common.py
+@@ -270,6 +270,8 @@ globalParameters["LazyLibraryLoading"] = False # Load library and code object fi
+
+ globalParameters["UseUserArgs"] = False
+
++globalParameters["LLVMPath"] = os.environ.get("LLVM_PATH")
++
+ # Save a copy - since pytest doesn't re-run this initialization code and YAML files can override global settings - odd things can happen
+ defaultGlobalParameters = deepcopy(globalParameters)
+
+@@ -1471,7 +1473,7 @@ def assignGlobalParameters( config ):
+ if os.name == "nt":
+ globalParameters["AssemblerPath"] = locateExe(globalParameters["ROCmBinPath"], "clang++.exe")
+ else:
+- globalParameters["AssemblerPath"] = locateExe(os.path.join(globalParameters["ROCmPath"], "llvm/bin"), "clang++")
++ globalParameters["AssemblerPath"] = locateExe(os.path.join(globalParameters["LLVMPath"], "bin"), "clang++")
+
+ globalParameters["ROCmSMIPath"] = locateExe(globalParameters["ROCmBinPath"], "rocm-smi")
+
+@@ -1483,7 +1485,7 @@ def assignGlobalParameters( config ):
+ if os.name == "nt":
+ globalParameters["ClangOffloadBundlerPath"] = locateExe(globalParameters["ROCmBinPath"], "clang-offload-bundler.exe")
+ else:
+- globalParameters["ClangOffloadBundlerPath"] = locateExe(os.path.join(globalParameters["ROCmPath"], "llvm/bin"), "clang-offload-bundler")
++ globalParameters["ClangOffloadBundlerPath"] = locateExe(os.path.join(globalParameters["LLVMPath"], "bin"), "clang-offload-bundler")
+
+ if "ROCmAgentEnumeratorPath" in config:
+ globalParameters["ROCmAgentEnumeratorPath"] = config["ROCmAgentEnumeratorPath"]
+diff --git a/tensilelite/Tensile/Ops/gen_assembly.sh b/tensilelite/Tensile/Ops/gen_assembly.sh
+index 7b16069..1392cab 100644
+--- a/tensilelite/Tensile/Ops/gen_assembly.sh
++++ b/tensilelite/Tensile/Ops/gen_assembly.sh
+@@ -32,7 +32,9 @@ if ! [ -z ${ROCM_PATH+x} ]; then
+ rocm_path=${ROCM_PATH}
+ fi
+
+-toolchain=${rocm_path}/llvm/bin/clang++
++$LLVM_PATH=$ENV{'LLVM_PATH'};
++
++toolchain=${LLVM_PATH}/bin/clang++
+
+ . ${venv}/bin/activate
diff --git a/var/spack/repos/builtin/packages/hipblaslt/package.py b/var/spack/repos/builtin/packages/hipblaslt/package.py
new file mode 100644
index 0000000000..36df9a0ca8
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hipblaslt/package.py
@@ -0,0 +1,65 @@
+# 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.package import *
+
+
+class Hipblaslt(CMakePackage):
+ """hipBLASLt is a library that provides general matrix-matrix operations with a flexible API
+ and extends functionalities beyond a traditional BLAS library"""
+
+ homepage = "https://github.com/ROCm/hipBLASLt"
+ url = "https://github.com/ROCm/hipBLASLt/archive/refs/tags/rocm-6.0.2.tar.gz"
+ git = "https://github.com/ROCm/hipBLASLt.git"
+
+ maintainers("srekolam", "afzpatel", "renjithravindrankannath")
+
+ license("MIT")
+
+ version("6.0.2", sha256="e281a1a7760fab8c3e0baafe17950cf43c422184e3226e3c14eb06e50c69d421")
+ version("6.0.0", sha256="6451b6fdf7f24787628190bbe8f2208c929546b68b692d8355d2f18bea7ca7db")
+
+ amdgpu_targets = ROCmPackage.amdgpu_targets
+
+ variant(
+ "amdgpu_target",
+ description="AMD GPU architecture",
+ values=auto_or_any_combination_of(*amdgpu_targets),
+ sticky=True,
+ )
+ variant("asan", default=False, description="Build with address-sanitizer enabled or disabled")
+
+ for ver in ["6.0.0", "6.0.2"]:
+ depends_on(f"hip@{ver}", when=f"@{ver}")
+ depends_on(f"hipblas@{ver}", when=f"@{ver}")
+ depends_on(f"rocm-openmp-extras@{ver}", type="test", when=f"@{ver}")
+
+ depends_on("msgpack-c")
+ depends_on("py-joblib")
+ depends_on("googletest@1.10.0:", type="test")
+ depends_on("netlib-lapack@3.7.1:", type="test")
+ depends_on("py-pyyaml", type="test")
+
+ # Sets the proper for clang++ and clang-offload-blunder.
+ # Also adds hipblas and msgpack include directories
+ patch("001_Set_LLVM_Paths_And_Add_Includes.patch")
+
+ def setup_build_environment(self, env):
+ env.set("CXX", self.spec["hip"].hipcc)
+
+ def cmake_args(self):
+ args = [
+ self.define("Tensile_CODE_OBJECT_VERSION", "V3"),
+ self.define("MSGPACK_DIR", self.spec["msgpack-c"].prefix),
+ self.define_from_variant("ADDRESS_SANITIZER", "asan"),
+ self.define("BUILD_CLIENTS_TESTS", self.run_tests),
+ ]
+ if "auto" not in self.spec.variants["amdgpu_target"]:
+ args.append(self.define_from_variant("AMDGPU_TARGETS", "amdgpu_target"))
+ if self.run_tests:
+ args.append(
+ self.define("ROCM_OPENMP_EXTRAS_DIR", self.spec["rocm-openmp-extras"].prefix)
+ )
+ return args