1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# Copyright 2013-2023 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 ComposableKernel(CMakePackage):
"""Composable Kernel: Performance Portable Programming Model
for Machine Learning Tensor Operators."""
homepage = "https://github.com/ROCmSoftwarePlatform/composable_kernel"
git = "https://github.com/ROCmSoftwarePlatform/composable_kernel.git"
url = "https://github.com/ROCmSoftwarePlatform/composable_kernel/archive/refs/tags/rocm-5.7.1.tar.gz"
maintainers("srekolam", "afzpatel")
version("master", branch="develop")
version("5.7.1", sha256="75f66e023c2e31948e91fa26366eaeac72d871fc2e5188361d4465179f13876e")
version("5.7.0", sha256="d9624dbaef04e0138f9f73596c49b4fe9ded69974bae7236354baa32649bf21a")
version("5.6.1", commit="f5ec04f091fa5c48c67d7bacec36a414d0be06a5")
version("5.6.0", commit="f5ec04f091fa5c48c67d7bacec36a414d0be06a5")
version("5.5.1", commit="ac9e01e2cc3721be24619807adc444e1f59a9d25")
version("5.5.0", commit="8b76b832420a3d69708401de6607a033163edcce")
version("5.4.3", commit="bb3d9546f186e39cefedc3e7f01d88924ba20168")
version("5.4.0", commit="236bd148b98c7f1ec61ee850fcc0c5d433576305")
amdgpu_targets = ROCmPackage.amdgpu_targets
variant(
"amdgpu_target",
values=auto_or_any_combination_of(*amdgpu_targets),
sticky=True,
description="set gpu targets",
)
depends_on("python", type="build")
depends_on("z3", type="build")
depends_on("zlib", type="build")
depends_on("ncurses+termlib", type="build")
depends_on("bzip2", type="build")
depends_on("sqlite", type="build")
depends_on("half", type="build")
depends_on("pkgconfig", type="build")
depends_on("cmake@3.16:", type="build")
for ver in ["master", "5.7.1", "5.7.0", "5.6.1", "5.6.0", "5.5.1", "5.5.0", "5.4.3", "5.4.0"]:
depends_on("hip@" + ver, when="@" + ver)
depends_on("llvm-amdgpu@" + ver, when="@" + ver)
depends_on("rocm-cmake@" + ver, when="@" + ver, type="build")
def setup_build_environment(self, env):
env.set("CXX", self.spec["hip"].hipcc)
def cmake_args(self):
spec = self.spec
args = [
self.define(
"CMAKE_CXX_COMPILER", "{0}/bin/clang++".format(spec["llvm-amdgpu"].prefix)
),
self.define("CMAKE_C_COMPILER", "{0}/bin/clang".format(spec["llvm-amdgpu"].prefix)),
self.define("HIP_PATH", spec["hip"].prefix),
self.define("HIP_ROOT_DIR", "{0}".format(spec["hip"].prefix)),
self.define("CMAKE_CXX_FLAGS", "-O3"),
self.define("CMAKE_BUILD_TYPE", "Release"),
]
if "auto" not in self.spec.variants["amdgpu_target"]:
args.append(self.define_from_variant("AMDGPU_TARGETS", "amdgpu_target"))
if self.spec.satisfies("@5.6.0:"):
args.append(self.define("INSTANCES_ONLY", "ON"))
return args
def build(self, spec, prefix):
with working_dir(self.build_directory):
# only instances is necessary to build and install
if self.spec.satisfies("@5.6.0:"):
make()
else:
make("instances")
|