summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorsrekolam <67086238+srekolam@users.noreply.github.com>2020-08-12 17:36:35 -0700
committerGitHub <noreply@github.com>2020-08-12 19:36:35 -0500
commitad060c7870675ccb82c537fd983fd6bc28f7f4e8 (patch)
tree4a210580b58067986c492ed0304331c0c8bf9e50 /var
parent25a0d89b58c977b4882da09b865b3e58191f5a71 (diff)
downloadspack-ad060c7870675ccb82c537fd983fd6bc28f7f4e8.tar.gz
spack-ad060c7870675ccb82c537fd983fd6bc28f7f4e8.tar.bz2
spack-ad060c7870675ccb82c537fd983fd6bc28f7f4e8.tar.xz
spack-ad060c7870675ccb82c537fd983fd6bc28f7f4e8.zip
Spack recipes for ROCm software components-Phase1 (#17422)
* Spack recipes for ROCm Stage 1 Build components * fix flake8 errors * fixes for flake8 errors * Add a patch for cmake 3.x suport * Fix rpath issue where hsa-rocr-dev does not allow it to be filled in by spack * Remove inherited cmake args from comgr * Make hsakmt-roct compile: no -Werror because with const cast in numa, and actually add the numa dependency * Remove redundant cmake args which is inherited * Fix some dependencies * Fix some python 2.x compatibilities * Add amd gpu targets to rocfft * Make comgr a link dep of rocm-dbgapi and remove redundant cmake args * Remove redundant cmake args * Remove more redundant cmake args * Final redundant args * Use cmake 3.x instead of a fixed version * Remove random variable * Use installed rocclr instead of nonexisting directory * Don't build outside the staging folder * Deploy some missing cmake target file * Formatting * Fix target list * Properly handle the rocclr dependency * Formatting * Fix vermin test * Make all 3.5.0 package depend exactly on eachother * Add a few missing link dependencies * Fix flake8 * Remove some other redundant flags * Add gcc install prefix for gcc builds of llvm-amdgpu * review changes for the spack recipes * Do not hard-code versions * Fix atmi install - no more relative rpaths outside of install directory (required patch) - fix build -> link dependencies - remove unused build dependency * Fix flake8 errors * Remove unused variable and make things python 2.x compatible * Fix flake8 * Move compiler config from rocfft -> hipcc * Remove redundant dependency on fftw-api * Remove redundant import * Avoid hitting the ROCM_PATH variable altogether with a patch; also just fill in all variables * Add missing deps z3, zlib and ncurses+termlib to llvm-amdgpu * Fix perl shebang and add dep * Fix typo and patch HIP_CLANG_ROOT detection in hip's cmake files * fixing build failure due z3 and adding zlib for rocgdb * new changes to add z3,curses dependency for llvm-amdgpu * fix flake8 error Co-authored-by: root <root@localhost.localdomain> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/atmi/0001-Remove-relative-link-paths-to-external-libraries.patch29
-rw-r--r--var/spack/repos/builtin/packages/atmi/package.py42
-rw-r--r--var/spack/repos/builtin/packages/comgr/package.py34
-rw-r--r--var/spack/repos/builtin/packages/hip/0001-Make-it-possible-to-specify-the-package-folder-of-ro.patch27
-rw-r--r--var/spack/repos/builtin/packages/hip/0002-Fix-detection-of-HIP_CLANG_ROOT.patch28
-rw-r--r--var/spack/repos/builtin/packages/hip/package.py83
-rw-r--r--var/spack/repos/builtin/packages/hsa-rocr-dev/0001-Do-not-set-an-explicit-rpath-by-default-since-packag.patch28
-rw-r--r--var/spack/repos/builtin/packages/hsa-rocr-dev/package.py33
-rw-r--r--var/spack/repos/builtin/packages/hsakmt-roct/package.py33
-rw-r--r--var/spack/repos/builtin/packages/llvm-amdgpu/fix-system-zlib-ncurses.patch60
-rw-r--r--var/spack/repos/builtin/packages/llvm-amdgpu/package.py45
-rw-r--r--var/spack/repos/builtin/packages/rocclr/opengl.patch49
-rw-r--r--var/spack/repos/builtin/packages/rocclr/package.py53
-rw-r--r--var/spack/repos/builtin/packages/rocfft/package.py45
-rw-r--r--var/spack/repos/builtin/packages/rocgdb/package.py57
-rw-r--r--var/spack/repos/builtin/packages/rocm-bandwidth-test/package.py27
-rw-r--r--var/spack/repos/builtin/packages/rocm-cmake/package.py26
-rw-r--r--var/spack/repos/builtin/packages/rocm-dbgapi/package.py29
-rw-r--r--var/spack/repos/builtin/packages/rocm-debug-agent/package.py36
-rw-r--r--var/spack/repos/builtin/packages/rocm-device-libs/package.py33
-rw-r--r--var/spack/repos/builtin/packages/rocm-opencl/package.py53
-rw-r--r--var/spack/repos/builtin/packages/rocm-smi-lib/package.py30
-rw-r--r--var/spack/repos/builtin/packages/rocm-smi/package.py34
-rw-r--r--var/spack/repos/builtin/packages/rocminfo/package.py26
-rw-r--r--var/spack/repos/builtin/packages/rocprofiler-dev/package.py43
-rw-r--r--var/spack/repos/builtin/packages/roctracer-dev/package.py44
26 files changed, 1027 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/atmi/0001-Remove-relative-link-paths-to-external-libraries.patch b/var/spack/repos/builtin/packages/atmi/0001-Remove-relative-link-paths-to-external-libraries.patch
new file mode 100644
index 0000000000..193cfab620
--- /dev/null
+++ b/var/spack/repos/builtin/packages/atmi/0001-Remove-relative-link-paths-to-external-libraries.patch
@@ -0,0 +1,29 @@
+From 7445b29108ea2f0b3f28f947a1ca627575173292 Mon Sep 17 00:00:00 2001
+From: Harmen Stoppels <harmenstoppels@gmail.com>
+Date: Fri, 7 Aug 2020 13:24:00 +0200
+Subject: [PATCH] Remove relative link paths to external libraries
+
+---
+ src/runtime/core/CMakeLists.txt | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/src/runtime/core/CMakeLists.txt b/src/runtime/core/CMakeLists.txt
+index 29abffb..f2cd4b4 100644
+--- a/src/runtime/core/CMakeLists.txt
++++ b/src/runtime/core/CMakeLists.txt
+@@ -109,12 +109,6 @@ target_link_libraries(
+ ${amd_comgr_LIBRARIES}
+ ${LIBELF_LIBRARIES}
+ ${ROCM_LIBRARIES}
+- -L${ROCM_LIBRARIES_DIR}/../hsa/lib
+- -L${ROCM_LIBRARIES_DIR}
+- -Wl,--enable-new-dtags
+- -Wl,-rpath,\$ORIGIN
+- -Wl,-rpath,\$ORIGIN/../../hsa/lib
+- -Wl,-rpath,\$ORIGIN/../../lib
+ )
+
+ # set output dir for .h files
+--
+2.25.1
+
diff --git a/var/spack/repos/builtin/packages/atmi/package.py b/var/spack/repos/builtin/packages/atmi/package.py
new file mode 100644
index 0000000000..c6063b3fde
--- /dev/null
+++ b/var/spack/repos/builtin/packages/atmi/package.py
@@ -0,0 +1,42 @@
+# Copyright 2013-2020 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 import *
+
+
+class Atmi(CMakePackage):
+ """Asynchronous Task and Memory Interface, or ATMI, is a runtime framework
+ and programming model for heterogeneous CPU-GPU systems. It provides a
+ consistent, declarative API to create task graphs on CPUs and GPUs
+ (integrated and discrete)."""
+
+ homepage = "https://github.com/RadeonOpenCompute/atmi"
+ url = "https://github.com/RadeonOpenCompute/atmi/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='3fb57d2e583fab82bd0582d0c2bccff059ca91122c18ac49a7770a8bb041a37b')
+
+ variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type')
+ depends_on('cmake@3:', type='build')
+ depends_on('libelf@0.8:', type='link', when='@3.5:')
+
+ for ver in ['3.5.0']:
+ depends_on('comgr@' + ver, type='link', when='@' + ver)
+ depends_on('hsa-rocr-dev@' + ver, type='link', when='@' + ver)
+
+ root_cmakelists_dir = 'src'
+
+ patch('0001-Remove-relative-link-paths-to-external-libraries.patch')
+
+ def cmake_args(self):
+ return [
+ '-DROCM_VERSION={0}'.format(self.spec.version)
+ ]
+
+ @run_after('install')
+ def install_stub(self):
+ install('include/atmi_interop_hsa.h', self.prefix.include)
diff --git a/var/spack/repos/builtin/packages/comgr/package.py b/var/spack/repos/builtin/packages/comgr/package.py
new file mode 100644
index 0000000000..04af80ada6
--- /dev/null
+++ b/var/spack/repos/builtin/packages/comgr/package.py
@@ -0,0 +1,34 @@
+# Copyright 2013-2020 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 import *
+
+
+class Comgr(CMakePackage):
+ """This provides various Lightning Compiler related services. It currently
+ contains one library, the Code Object Manager (Comgr)"""
+
+ homepage = "https://github.com/RadeonOpenCompute/ROCm-CompilerSupport"
+ url = "https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='25c963b46a82d76d55b2302e0e18aac8175362656a465549999ad13d07b689b9')
+
+ variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type')
+
+ depends_on('cmake@3:', type='build')
+
+ for ver in ['3.5.0']:
+ depends_on('llvm-amdgpu@' + ver, type='build', when='@' + ver)
+ depends_on('rocm-device-libs@' + ver, type='build', when='@' + ver)
+ depends_on('rocm-cmake@' + ver, type='build', when='@' + ver)
+
+ depends_on('zlib', type='link')
+ depends_on('z3', type='link')
+ depends_on('ncurses', type='link')
+
+ root_cmakelists_dir = 'lib/comgr'
diff --git a/var/spack/repos/builtin/packages/hip/0001-Make-it-possible-to-specify-the-package-folder-of-ro.patch b/var/spack/repos/builtin/packages/hip/0001-Make-it-possible-to-specify-the-package-folder-of-ro.patch
new file mode 100644
index 0000000000..53f2bea672
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hip/0001-Make-it-possible-to-specify-the-package-folder-of-ro.patch
@@ -0,0 +1,27 @@
+From cf5f9124a629e0594c71daa6ea12ee823bf6a9fb Mon Sep 17 00:00:00 2001
+From: Harmen Stoppels <harmenstoppels@gmail.com>
+Date: Fri, 7 Aug 2020 23:09:43 +0200
+Subject: [PATCH] Make it possible to specify the package folder of
+ rocm_agent_enumerator from the command line
+
+---
+ bin/hipcc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/bin/hipcc b/bin/hipcc
+index 8c0a4796..48192ed1 100755
+--- a/bin/hipcc
++++ b/bin/hipcc
+@@ -684,7 +684,8 @@ if($HIP_PLATFORM eq "hcc" or $HIP_PLATFORM eq "clang"){
+ $targetsStr = $ENV{HCC_AMDGPU_TARGET};
+ } else {
+ # Else try using rocm_agent_enumerator
+- $ROCM_AGENT_ENUM = "${ROCM_PATH}/bin/rocm_agent_enumerator";
++ $ROCMINFO_PATH = $ENV{'ROCMINFO_PATH'} // $ROCM_PATH;
++ $ROCM_AGENT_ENUM = "${ROCMINFO_PATH}/bin/rocm_agent_enumerator";
+ $targetsStr = `${ROCM_AGENT_ENUM} -t GPU`;
+ $targetsStr =~ s/\n/,/g;
+ }
+--
+2.25.1
+
diff --git a/var/spack/repos/builtin/packages/hip/0002-Fix-detection-of-HIP_CLANG_ROOT.patch b/var/spack/repos/builtin/packages/hip/0002-Fix-detection-of-HIP_CLANG_ROOT.patch
new file mode 100644
index 0000000000..61ad05873a
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hip/0002-Fix-detection-of-HIP_CLANG_ROOT.patch
@@ -0,0 +1,28 @@
+From 4f324ddc12f358de47ea0ef1872c61b1dc4c46e2 Mon Sep 17 00:00:00 2001
+From: Harmen Stoppels <harmenstoppels@gmail.com>
+Date: Mon, 10 Aug 2020 15:00:06 +0200
+Subject: [PATCH] Fix detection of HIP_CLANG_ROOT
+
+---
+ hip-config.cmake.in | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/hip-config.cmake.in b/hip-config.cmake.in
+index 859e2fa0..4baafbde 100644
+--- a/hip-config.cmake.in
++++ b/hip-config.cmake.in
+@@ -58,8 +58,9 @@ if(HIP_COMPILER STREQUAL "clang")
+ execute_process(COMMAND ${HIP_CXX_COMPILER} --version
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE HIP_CLANG_CXX_COMPILER_VERSION_OUTPUT)
+- if(HIP_CLANG_CXX_COMPILER_VERSION_OUTPUT MATCHES "InstalledDir:[\t\r\n][\t\r\n]*([^\t\r\n])")
+- set(HIP_CLANG_ROOT ${CMAKE_MATCH_1})
++ if(HIP_CLANG_CXX_COMPILER_VERSION_OUTPUT MATCHES "InstalledDir: ([^\t\r\n]+)")
++ # InstalledDir points to the bin/ directory, so the root is the parent dir
++ get_filename_component(HIP_CLANG_ROOT ${CMAKE_MATCH_1} DIRECTORY)
+ else()
+ set(HIP_CLANG_ROOT /opt/rocm/llvm)
+ endif()
+--
+2.25.1
+
diff --git a/var/spack/repos/builtin/packages/hip/package.py b/var/spack/repos/builtin/packages/hip/package.py
new file mode 100644
index 0000000000..80eb95c5f5
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hip/package.py
@@ -0,0 +1,83 @@
+# Copyright 2013-2020 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 import *
+
+
+class Hip(CMakePackage):
+ """HIP is a C++ Runtime API and Kernel Language that allows developers to
+ create portable applications for AMD and NVIDIA GPUs from
+ single source code."""
+
+ homepage = "https://github.com/ROCm-Developer-Tools/HIP"
+ url = "https://github.com/ROCm-Developer-Tools/HIP/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='ae8384362986b392288181bcfbe5e3a0ec91af4320c189bd83c844ed384161b3')
+
+ depends_on('cmake@3:', type='build')
+ depends_on('perl@5.10:', type=('build', 'run'))
+
+ depends_on('rocclr@3.5.0', when='@3.5.0')
+ depends_on('hsakmt-roct@3.5.0', type='build', when='@3.5.0')
+ depends_on('hsa-rocr-dev@3.5.0', type='link', when='@3.5.0')
+ depends_on('comgr@3.5.0', type='build', when='@3.5.0')
+ depends_on('llvm-amdgpu@3.5.0', type='build', when='@3.5.0')
+ depends_on('rocm-device-libs', type='build')
+ depends_on('rocminfo@3.5.0', type='build', when='@3.5.0')
+
+ # Note: the ROCm ecosystem expects `lib/` and `bin/` folders with symlinks
+ # in the parent directory of the package, which is incompatible with spack.
+ # In hipcc the ROCM_PATH variable is used to point to the parent directory
+ # of the package. With the following patch we should never hit code that
+ # uses the ROCM_PATH variable again; just to be sure we set it to an empty
+ # string.
+ patch('0001-Make-it-possible-to-specify-the-package-folder-of-ro.patch', when='@3.5.0')
+
+ # See https://github.com/ROCm-Developer-Tools/HIP/pull/2141
+ patch('0002-Fix-detection-of-HIP_CLANG_ROOT.patch', when='@3.5.0')
+
+ def setup_dependent_build_environment(self, env, dependent_spec):
+ env.set('ROCM_PATH', '')
+ env.set('HIP_COMPILER', 'clang')
+ env.set('HIP_PLATFORM', 'hcc')
+ env.set('HIP_CLANG_PATH', self.spec['llvm-amdgpu'].prefix.bin)
+ env.set('HSA_PATH', self.spec['hsa-rocr-dev'].prefix)
+ env.set('ROCMINFO_PATH', self.spec['rocminfo'].prefix)
+ env.set('DEVICE_LIB_PATH', self.spec['rocm-device-libs'].prefix.lib)
+
+ def setup_dependent_package(self, module, dependent_spec):
+ self.spec.hipcc = join_path(self.prefix.bin, 'hipcc')
+
+ def patch(self):
+ filter_file(
+ 'INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../include"',
+ 'INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"',
+ 'hip-config.cmake.in', string=True)
+
+ @run_before('install')
+ def filter_sbang(self):
+ perl = self.spec['perl'].command
+ kwargs = {'ignore_absent': False, 'backup': False, 'string': False}
+
+ with working_dir('bin'):
+ match = '^#!/usr/bin/perl'
+ substitute = "#!{perl}".format(perl=perl)
+ files = [
+ 'hipify-perl', 'hipcc', 'extractkernel',
+ 'hipconfig', 'hipify-cmakefile'
+ ]
+ filter_file(match, substitute, *files, **kwargs)
+
+ def cmake_args(self):
+ args = [
+ '-DHIP_COMPILER=clang',
+ '-DHIP_PLATFORM=rocclr',
+ '-DHSA_PATH={0}'.format(self.spec['hsa-rocr-dev'].prefix),
+ '-DLIBROCclr_STATIC_DIR={0}/lib'.format(self.spec['rocclr'].prefix)
+ ]
+ return args
diff --git a/var/spack/repos/builtin/packages/hsa-rocr-dev/0001-Do-not-set-an-explicit-rpath-by-default-since-packag.patch b/var/spack/repos/builtin/packages/hsa-rocr-dev/0001-Do-not-set-an-explicit-rpath-by-default-since-packag.patch
new file mode 100644
index 0000000000..6b73f81635
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hsa-rocr-dev/0001-Do-not-set-an-explicit-rpath-by-default-since-packag.patch
@@ -0,0 +1,28 @@
+From 905b812fffdf109f767e1dc079ac1d32d5cf5838 Mon Sep 17 00:00:00 2001
+From: Harmen Stoppels <harmenstoppels@gmail.com>
+Date: Wed, 5 Aug 2020 17:44:05 +0200
+Subject: [PATCH] Do not set an explicit rpath by default, since package
+ managers cannot override them
+
+---
+ src/CMakeLists.txt | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 7174044..10c6fcc 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -114,7 +114,9 @@ include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}/libamdhsacode )
+ add_definitions ( -DROCR_BUILD_ID=${PACKAGE_VERSION_STRING} )
+
+ ## Set RUNPATH - ../../lib covers use of the legacy symlink in /hsa/lib/
+-set(CMAKE_INSTALL_RPATH "$ORIGIN;$ORIGIN/../../lib;$ORIGIN/../../lib64;$ORIGIN/../lib64")
++if (NOT CMAKE_INSTALL_RPATH)
++ set(CMAKE_INSTALL_RPATH "$ORIGIN;$ORIGIN/../../lib;$ORIGIN/../../lib64;$ORIGIN/../lib64")
++endif ()
+
+ ## ------------------------- Linux Compiler and Linker options -------------------------
+ set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -fexceptions -fno-rtti -fvisibility=hidden -Wno-error=sign-compare -Wno-sign-compare -Wno-write-strings -Wno-conversion-null -fno-math-errno -fno-threadsafe-statics -fmerge-all-constants -fms-extensions -Wno-error=comment -Wno-comment -Wno-error=pointer-arith -Wno-pointer-arith -Wno-error=unused-variable -Wno-error=unused-function" )
+--
+2.25.1
+
diff --git a/var/spack/repos/builtin/packages/hsa-rocr-dev/package.py b/var/spack/repos/builtin/packages/hsa-rocr-dev/package.py
new file mode 100644
index 0000000000..af355f241d
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hsa-rocr-dev/package.py
@@ -0,0 +1,33 @@
+# Copyright 2013-2020 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 import *
+
+
+class HsaRocrDev(CMakePackage):
+ """This repository includes the user mode API nterfaces and libraries
+ necessary for host applications to launch computer kernels to available
+ HSA ROCm kernel agents.AMD Heterogeneous System Architecture HSA -
+ Linux HSA Runtime for Boltzmann (ROCm) platforms."""
+
+ homepage = "https://github.com/RadeonOpenCompute/ROCR-Runtime"
+ url = "https://github.com/RadeonOpenCompute/ROCR-Runtime/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='52c12eec3e3404c0749c70f156229786ee0c3e6d3c979aed9bbaea500fa1f3b8')
+
+ variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type')
+
+ for ver in ['3.5.0']:
+ depends_on('hsakmt-roct@' + ver, type=('link', 'run'), when='@' + ver)
+ depends_on('libelf@0.8:', type='link', when="@" + ver)
+
+ depends_on('cmake@3:', type="build")
+
+ patch('0001-Do-not-set-an-explicit-rpath-by-default-since-packag.patch', when='@3.5.0')
+
+ root_cmakelists_dir = 'src'
diff --git a/var/spack/repos/builtin/packages/hsakmt-roct/package.py b/var/spack/repos/builtin/packages/hsakmt-roct/package.py
new file mode 100644
index 0000000000..89ffe616a0
--- /dev/null
+++ b/var/spack/repos/builtin/packages/hsakmt-roct/package.py
@@ -0,0 +1,33 @@
+# Copyright 2013-2020 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 import *
+
+
+class HsakmtRoct(CMakePackage):
+ """This is a thunk python recipe to build and install Thunk Interface.
+ Thunk Interface is a user-mode API interfaces used to interact
+ with the ROCk driver."""
+
+ homepage = "https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface"
+ url = "https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='d9f458c16cb62c3c611328fd2f2ba3615da81e45f3b526e45ff43ab4a67ee4aa')
+
+ variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type')
+
+ depends_on('cmake@3:', type='build')
+ depends_on('numactl')
+
+ install_targets = ['install', 'install-dev']
+
+ def cmake_args(self):
+ args = [
+ '-DBUILD_SHARED_LIBS="on"',
+ ]
+ return args
diff --git a/var/spack/repos/builtin/packages/llvm-amdgpu/fix-system-zlib-ncurses.patch b/var/spack/repos/builtin/packages/llvm-amdgpu/fix-system-zlib-ncurses.patch
new file mode 100644
index 0000000000..64d429a7e9
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm-amdgpu/fix-system-zlib-ncurses.patch
@@ -0,0 +1,60 @@
+From 0f5e8e4368199ab993470dc4e7df5d91b806c557 Mon Sep 17 00:00:00 2001
+From: Harmen Stoppels <harmenstoppels@gmail.com>
+Date: Tue, 11 Aug 2020 15:06:24 +0200
+Subject: [PATCH] Use find_library for zlib and ncurses
+
+find_library makes it easier to use a non-system version of zlib and
+ncurses, since it respects *_ROOT and CMAKE_PREFIX_PATH.
+---
+ llvm/cmake/config-ix.cmake | 28 ++++++++++------------------
+ 1 file changed, 10 insertions(+), 18 deletions(-)
+
+diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
+index 612ce5bdbcb..e748e5ef8c1 100644
+--- a/llvm/cmake/config-ix.cmake
++++ b/llvm/cmake/config-ix.cmake
+@@ -120,15 +120,11 @@ endif()
+ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
+ set(HAVE_LIBZ 0)
+ if(LLVM_ENABLE_ZLIB)
+- foreach(library z zlib_static zlib)
+- string(TOUPPER ${library} library_suffix)
+- check_library_exists(${library} compress2 "" HAVE_LIBZ_${library_suffix})
+- if(HAVE_LIBZ_${library_suffix})
+- set(HAVE_LIBZ 1)
+- set(ZLIB_LIBRARIES "${library}")
+- break()
+- endif()
+- endforeach()
++ find_library(FIND_ZLIB NAMES z zlib_static zlib)
++ if(FIND_ZLIB)
++ set(HAVE_LIBZ 1)
++ set(ZLIB_LIBRARIES "${FIND_ZLIB}")
++ endif()
+ endif()
+
+ # Don't look for these libraries on Windows.
+@@ -141,15 +137,11 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
+ endif()
+ if(LLVM_ENABLE_TERMINFO)
+ set(HAVE_TERMINFO 0)
+- foreach(library terminfo tinfo curses ncurses ncursesw)
+- string(TOUPPER ${library} library_suffix)
+- check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix})
+- if(HAVE_TERMINFO_${library_suffix})
+- set(HAVE_TERMINFO 1)
+- set(TERMINFO_LIBS "${library}")
+- break()
+- endif()
+- endforeach()
++ find_library(FIND_TERMINFO NAMES terminfo tinfo curses ncurses ncursesw)
++ if(FIND_TERMINFO)
++ set(HAVE_TERMINFO 1)
++ set(TERMINFO_LIBS "${FIND_TERMINFO}")
++ endif()
+ else()
+ set(HAVE_TERMINFO 0)
+ endif()
+--
+2.25.1
+
diff --git a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py
new file mode 100644
index 0000000000..acd384441e
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py
@@ -0,0 +1,45 @@
+# Copyright 2013-2020 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 import *
+
+
+class LlvmAmdgpu(CMakePackage):
+ """Toolkit for the construction of highly optimized compilers,
+ optimizers, and run-time environments."""
+
+ homepage = "https://github.com/RadeonOpenCompute/llvm-project"
+ url = "https://github.com/RadeonOpenCompute/llvm-project/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='4878fa85473b24d88edcc89938441edc85d2e8a785e567b7bd7ce274ecc2fd9c')
+
+ variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type')
+
+ depends_on('cmake@3:', type='build')
+ depends_on('python', type='build')
+ depends_on('z3', type='link')
+ depends_on('zlib', type='link')
+ depends_on('ncurses+termlib', type='link')
+
+ patch('fix-system-zlib-ncurses.patch')
+
+ root_cmakelists_dir = 'llvm'
+
+ install_targets = ['clang-tidy', 'install']
+
+ def cmake_args(self):
+ args = [
+ '-DLLVM_ENABLE_PROJECTS=clang;lld;clang-tools-extra;compiler-rt',
+ '-DLLVM_ENABLE_ASSERTIONS=1'
+ ]
+
+ if self.compiler.name == "gcc":
+ gcc_prefix = ancestor(self.compiler.cc, 2)
+ args.append("-DGCC_INSTALL_PREFIX=" + gcc_prefix)
+
+ return args
diff --git a/var/spack/repos/builtin/packages/rocclr/opengl.patch b/var/spack/repos/builtin/packages/rocclr/opengl.patch
new file mode 100644
index 0000000000..fc9bacee50
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocclr/opengl.patch
@@ -0,0 +1,49 @@
+From 98df37fc36b6276c26532e86e89be7e389745f4e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Torsten=20Ke=C3=9Fler?= <t.kessler@posteo.de>
+Date: Sun, 19 Jul 2020 11:58:24 +0200
+Subject: [PATCH] Fix search for OpenCL include dirs
+
+---
+ CMakeLists.txt | 26 +++++++++-----------------
+ 1 file changed, 9 insertions(+), 17 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 122277ee..02ca4644 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -53,26 +53,18 @@ find_package(amd_comgr REQUIRED CONFIG
+ )
+ message(STATUS "Code Object Manager found at ${amd_comgr_DIR}.")
+
+-# FIXME: Use find_package(OpenCL)
+-find_library( OpenCL REQUIRED CONFIG
+- PATHS
+- /opt/rocm
++find_path(OPENCL_INCLUDE_DIR
++ NAMES OpenCL/cl.h CL/cl.h
++ PATH_SUFFIXES include opencl/include inc include/x86_64 include/x64
++ PATHS ${OPENCL_DIR}
++ DOC "OpenCL include header OpenCL/cl.h or CL/cl.h"
+ )
+
+-if( NOT OPENCL_DIR )
+- find_path(OPENCL_INCLUDE_DIR
+- NAMES OpenCL/cl.h CL/cl.h
+- PATH_SUFFIXES include opencl/include inc include/x86_64 include/x64
+- PATHS /opt/rocm
+- DOC "OpenCL include header OpenCL/cl.h or CL/cl.h"
+- )
+-
+- if( NOT OPENCL_INCLUDE_DIR )
+- unset(OPENCL_INCLUDE_DIR CACHE)
+- set(OPENCL_INCLUDE_DIR "" CACHE PATH "" FORCE )
+- endif()
+- message(STATUS "Opencl found at ${OPENCL_INCLUDE_DIR}.")
++if( NOT OPENCL_INCLUDE_DIR )
++ unset(OPENCL_INCLUDE_DIR CACHE)
++ set(OPENCL_INCLUDE_DIR "" CACHE PATH "" FORCE )
+ endif()
++message(STATUS "Opencl found at ${OPENCL_INCLUDE_DIR}.")
+
+
+
diff --git a/var/spack/repos/builtin/packages/rocclr/package.py b/var/spack/repos/builtin/packages/rocclr/package.py
new file mode 100644
index 0000000000..732e28e7f6
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocclr/package.py
@@ -0,0 +1,53 @@
+# Copyright 2013-2020 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 import *
+
+
+class Rocclr(CMakePackage):
+ """ROCclr is a virtual device interface that compute runtimes interact
+ with to different backends such as ROCr or PAL This abstraction allows
+ runtimes to work on Windows as well as on Linux without much effort."""
+
+ homepage = "https://github.com/ROCm-Developer-Tools/ROCclr"
+ url = "https://github.com/ROCm-Developer-Tools/ROCclr/archive/roc-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='87c1ee9f02b8aa487b628c543f058198767c474cec3d21700596a73c028959e1')
+
+ depends_on('cmake@3:', type='build')
+ for ver in ['3.5.0']:
+ depends_on('hsakmt-roct@' + ver, type='build', when='@' + ver)
+ depends_on('hsa-rocr-dev@' + ver, type='build', when='@' + ver)
+ depends_on('comgr@' + ver, type='build', when='@' + ver)
+ depends_on('mesa~llvm@18.3:', type='link', when='@' + ver)
+
+ patch('opengl.patch', when='@3.5.0')
+
+ resource(name='opencl-on-vdi',
+ url='https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/archive/roc-3.5.0.tar.gz',
+ sha256='511b617d5192f2d4893603c1a02402b2ac9556e9806ff09dd2a91d398abf39a0',
+ expand=True,
+ destination='',
+ placement='opencl-on-vdi')
+
+ @run_after('install')
+ def deploy_missing_files(self):
+ # the amdrocclr_staticTargets.cmake file is generated but not installed
+ # and when we install it by hand, we have to fix the path to the static
+ # library libamdrocclr_static.a from build dir to prefix lib dir.
+ cmakefile = join_path(self.build_directory,
+ 'amdrocclr_staticTargets.cmake')
+ filter_file(self.build_directory, self.prefix.lib, cmakefile)
+ install(cmakefile, self.prefix.lib)
+
+ def cmake_args(self):
+ args = [
+ '-DUSE_COMGR_LIBRARY=yes',
+ '-DOPENCL_DIR={0}/opencl-on-vdi'.format(self.stage.source_path)
+ ]
+ return args
diff --git a/var/spack/repos/builtin/packages/rocfft/package.py b/var/spack/repos/builtin/packages/rocfft/package.py
new file mode 100644
index 0000000000..0300649cae
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocfft/package.py
@@ -0,0 +1,45 @@
+# Copyright 2013-2020 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 import *
+
+
+class Rocfft(CMakePackage):
+ """Radeon Open Compute FFT library"""
+
+ homepage = "https://github.com/ROCmSoftwarePlatform/rocFFT/"
+ url = "https://github.com/ROCmSoftwarePlatform/rocfft/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='629f02cfecb7de5ad2517b6a8aac6ed4de60d3a9c620413c4d9db46081ac2c88')
+
+ amdgpu_targets = (
+ 'gfx701', 'gfx801', 'gfx802', 'gfx803',
+ 'gfx900', 'gfx906', 'gfx908', 'gfx1010',
+ 'gfx1011', 'gfx1012'
+ )
+
+ variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type')
+ variant('amdgpu_target', default='gfx701', multi=True, values=amdgpu_targets)
+
+ depends_on('cmake@3:', type='build')
+ depends_on('rocm-cmake@3.5.0', type='build', when='@3.5.0')
+ depends_on('rocm-device-libs@3.5.0', type='build', when='@3.5.0')
+
+ depends_on('hip@3.5.0', type=('build', 'link'), when='@3.5.0')
+ depends_on('comgr@3.5.0', type='build', when='@3.5.0')
+
+ def setup_build_environment(self, env):
+ env.set('CXX', self.spec['hip'].hipcc)
+
+ def cmake_args(self):
+ archs = ",".join(self.spec.variants['amdgpu_target'].value)
+
+ args = [
+ '-DCMAKE_CXX_FLAGS=--amdgpu-target={0}'.format(archs),
+ ]
+ return args
diff --git a/var/spack/repos/builtin/packages/rocgdb/package.py b/var/spack/repos/builtin/packages/rocgdb/package.py
new file mode 100644
index 0000000000..927c6c3a68
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocgdb/package.py
@@ -0,0 +1,57 @@
+# Copyright 2013-2020 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 import *
+
+
+class Rocgdb(AutotoolsPackage):
+ """This is ROCgdb, the ROCm source-level debugger for Linux,
+ based on GDB, the GNU source-level debugger."""
+
+ homepage = "https://github.com/ROCm-Developer-Tools/ROCgdb/"
+ url = "https://github.com/ROCm-Developer-Tools/ROCgdb/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='cf36d956e84c7a5711b71f281a44b0a9708e13e941d8fca0247d01567e7ee7d1')
+ depends_on('cmake@3:', type='build')
+ depends_on('texinfo', type='build')
+ depends_on('bison', type='build')
+ depends_on('flex', type='build')
+ depends_on('libunwind', type='build')
+ depends_on('expat', type='build')
+ depends_on('python', type='build')
+ depends_on('zlib', type='link')
+ for ver in ['3.5.0']:
+ depends_on('rocm-dbgapi@' + ver, type='link', when='@' + ver)
+ depends_on('comgr@' + ver, type='link', when='@' + ver)
+
+ build_directory = 'spack-build'
+
+ def configure_args(self):
+ # Generic options to compile GCC
+ options = [
+ # Distributor options
+ '--program-prefix=roc',
+ '--enable-64-bit-bfd',
+ '--with-bugurl=https://github.com/ROCm-Developer-Tools/ROCgdb/issues',
+ '--with-pkgversion=-ROCm',
+ '--enable-targets=x86_64-linux-gnu,amdgcn-amd-amdhsa',
+ '--disable-ld',
+ '--disable-gas',
+ '--disable-gdbserver',
+ '--disable-sim',
+ '--enable-tui',
+ '--disable-gdbtk',
+ '--disable-shared',
+ '--with-expat',
+ '--with-system-zlib'
+ '--without-guile',
+ '--with-babeltrace',
+ '--with-lzma',
+ '--with-python'
+ ]
+ return options
diff --git a/var/spack/repos/builtin/packages/rocm-bandwidth-test/package.py b/var/spack/repos/builtin/packages/rocm-bandwidth-test/package.py
new file mode 100644
index 0000000000..c7e61a0227
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocm-bandwidth-test/package.py
@@ -0,0 +1,27 @@
+# Copyright 2013-2020 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 import *
+
+
+class RocmBandwidthTest(CMakePackage):
+ """Test to measure PciE bandwidth on ROCm platforms"""
+
+ homepage = "https://github.com/RadeonOpenCompute/rocm_bandwidth_test"
+ url = "https://github.com/RadeonOpenCompute/rocm_bandwidth_test/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='fbb63fb8713617fd167d9c1501acbd92a6b189ee8e1a8aed668fa6666baae389')
+
+ variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type')
+
+ depends_on('cmake@3:', type='build')
+ for ver in ['3.5.0']:
+ depends_on('hsa-rocr-dev@' + ver, type='link', when='@' + ver)
+ depends_on('hsakmt-roct@' + ver, type='build', when='@' + ver)
+
+ build_targets = ['package']
diff --git a/var/spack/repos/builtin/packages/rocm-cmake/package.py b/var/spack/repos/builtin/packages/rocm-cmake/package.py
new file mode 100644
index 0000000000..e67384248f
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocm-cmake/package.py
@@ -0,0 +1,26 @@
+# Copyright 2013-2020 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 import *
+
+
+class RocmCmake(CMakePackage):
+ """ROCM cmake modules provides cmake modules for common build tasks
+ needed for the ROCM software stack"""
+
+ homepage = "https://github.com/RadeonOpenCompute/rocm-cmake"
+ url = "https://github.com/RadeonOpenCompute/rocm-cmake/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='5fc09e168879823160f5fdf4fd1ace2702d36545bf733e8005ed4ca18c3e910f')
+
+ variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type')
+
+ depends_on('cmake@3:', type='build')
+
+ def cmake_args(self):
+ return ['-DROCM_DISABLE_LDCONFIG=ON']
diff --git a/var/spack/repos/builtin/packages/rocm-dbgapi/package.py b/var/spack/repos/builtin/packages/rocm-dbgapi/package.py
new file mode 100644
index 0000000000..33f6c0e66f
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocm-dbgapi/package.py
@@ -0,0 +1,29 @@
+# Copyright 2013-2020 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 import *
+
+
+class RocmDbgapi(CMakePackage):
+ """The AMD Debugger API is a library that provides all the support
+ necessary for a debugger and other tools to perform low level
+ control of the execution and inspection of execution state of
+ AMD's commercially available GPU architectures."""
+
+ homepage = "https://github.com/ROCm-Developer-Tools/ROCdbgapi"
+ url = "https://github.com/ROCm-Developer-Tools/ROCdbgapi/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='eeba0592bc79b90e5b874bba18fd003eab347e8a3cc80343708f8d19e047e87b')
+
+ depends_on('cmake@3:', type='build')
+ depends_on('hsa-rocr-dev@3.5.0', type='build', when='@3.5.0')
+ depends_on('comgr@3.5.0', type=('build', 'link'), when='@3.5.0')
+
+ def patch(self):
+ filter_file(r'(<INSTALL_INTERFACE:include>)', r'\1 {0}/include'.
+ format(self.spec['hsa-rocr-dev'].prefix), 'CMakeLists.txt')
diff --git a/var/spack/repos/builtin/packages/rocm-debug-agent/package.py b/var/spack/repos/builtin/packages/rocm-debug-agent/package.py
new file mode 100644
index 0000000000..5df5dcb477
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocm-debug-agent/package.py
@@ -0,0 +1,36 @@
+# Copyright 2013-2020 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 import *
+
+
+class RocmDebugAgent(CMakePackage):
+ """Radeon Open Compute (ROCm) debug agent"""
+
+ homepage = "https://github.com/ROCm-Developer-Tools/rocr_debug_agent"
+ url = "https://github.com/ROCm-Developer-Tools/rocr_debug_agent/archive/roc-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='203ccb18d2ac508aae40bf364923f67375a08798b20057e574a0c5be8039f133')
+
+ variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type')
+
+ depends_on('cmake@3:', type='build')
+ for ver in ['3.5.0']:
+ depends_on('hsa-rocr-dev@' + ver, type='link', when='@' + ver)
+ depends_on('hsakmt-roct@' + ver, type='link', when='@' + ver)
+ depends_on("elfutils", type='link', when='@' + ver)
+
+ root_cmakelists_dir = 'src'
+
+ def cmake_args(self):
+ spec = self.spec
+ args = [
+ '-DCMAKE_PREFIX_PATH={0}/include/hsa;{1}/include,'.
+ format(spec['hsa-rocr-dev'].prefix, spec['hsakmt-roct'].prefix)
+ ]
+ return args
diff --git a/var/spack/repos/builtin/packages/rocm-device-libs/package.py b/var/spack/repos/builtin/packages/rocm-device-libs/package.py
new file mode 100644
index 0000000000..3d6a46f5d3
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocm-device-libs/package.py
@@ -0,0 +1,33 @@
+# Copyright 2013-2020 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 import *
+
+
+class RocmDeviceLibs(CMakePackage):
+ """set of AMD specific device-side language runtime libraries"""
+
+ homepage = "https://github.com/RadeonOpenCompute/ROCm-Device-Libs"
+ url = "https://github.com/RadeonOpenCompute/ROCm-Device-Libs/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='dce3a4ba672c4a2da4c2260ee4dc96ff6dd51877f5e7e1993cb107372a35a378')
+
+ variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type')
+
+ depends_on('cmake@3:', type='build')
+ for ver in ['3.5.0']:
+ depends_on('llvm-amdgpu@' + ver, type='build', when='@' + ver)
+ depends_on('rocm-cmake@' + ver, type='build', when='@' + ver)
+
+ def cmake_args(self):
+ spec = self.spec
+ args = ['-DLLVM_DIR={0}'.format(spec['llvm-amdgpu'].prefix),
+ '-DCMAKE_C_COMPILER={0}/bin/clang'.format(
+ spec['llvm-amdgpu'].prefix),
+ ]
+ return args
diff --git a/var/spack/repos/builtin/packages/rocm-opencl/package.py b/var/spack/repos/builtin/packages/rocm-opencl/package.py
new file mode 100644
index 0000000000..e761e7481a
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocm-opencl/package.py
@@ -0,0 +1,53 @@
+# Copyright 2013-2020 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 import *
+
+
+class RocmOpencl(CMakePackage):
+ """OpenCL: Open Computing Language on ROCclr"""
+
+ homepage = "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime"
+ url = "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/archive/roc-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='511b617d5192f2d4893603c1a02402b2ac9556e9806ff09dd2a91d398abf39a0')
+ depends_on('cmake@3:', type='build')
+ depends_on('rocclr@3.5.0', type='build', when='@3.5.0')
+ depends_on('comgr@3.5.0', type='build', when='@3.5.0')
+ depends_on('mesa~llvm@18.3:', type='link')
+
+ def flag_handler(self, name, flags):
+ # The includes are messed up in ROCm 3.5.0:
+ # ROCM-OpenCL-Runtime uses flat includes
+ # and the find_package(ROCclr) bit it
+ # commented out. So instead we provide
+ # all the includes...
+
+ if self.spec.satisfies('@3.5.0') and name in ('cflags', 'cxxflags'):
+ rocclr = self.spec['rocclr'].prefix.include
+ extra_includes = [
+ 'include',
+ 'compiler/lib',
+ 'compiler/lib/include',
+ 'elf/utils/libelf',
+ 'elf/utils/common'
+ ]
+
+ for p in extra_includes:
+ flag = '-I {0}'.format(join_path(rocclr, p))
+ flags.append(flag)
+
+ return (flags, None, None)
+
+ def cmake_args(self):
+
+ args = [
+ '-DUSE_COMGR_LIBRARY=yes',
+ '-DROCclr_DIR={0}'.format(self.spec['rocclr'].prefix),
+ '-DLIBROCclr_STATIC_DIR={0}/lib'.format(self.spec['rocclr'].prefix)
+ ]
+ return args
diff --git a/var/spack/repos/builtin/packages/rocm-smi-lib/package.py b/var/spack/repos/builtin/packages/rocm-smi-lib/package.py
new file mode 100644
index 0000000000..1adf05a626
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocm-smi-lib/package.py
@@ -0,0 +1,30 @@
+# Copyright 2013-2020 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 import *
+from os import popen
+
+
+class RocmSmiLib(CMakePackage):
+ """It is a C library for Linux that provides a user space interface
+ for applications to monitor and control GPU applications."""
+
+ homepage = "https://github.com/RadeonOpenCompute/rocm_smi_lib"
+ url = "https://github.com/RadeonOpenCompute/rocm_smi_lib/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='a5d2ec3570d018b60524f0e589c4917f03d26578443f94bde27a170c7bb21e6e')
+
+ variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type')
+ depends_on('cmake@3:', type='build')
+
+ @run_after('install')
+ def post_install(self):
+ popen('cp -R {0}/rocm_smi/lib {1}'.format(self.prefix, self.prefix))
+ popen('cp -R {0}/rocm_smi/include {1}'.format(self.prefix,
+ self.prefix))
+ popen('rm -R {0}/rocm_smi'.format(self.prefix))
diff --git a/var/spack/repos/builtin/packages/rocm-smi/package.py b/var/spack/repos/builtin/packages/rocm-smi/package.py
new file mode 100644
index 0000000000..bbd0210172
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocm-smi/package.py
@@ -0,0 +1,34 @@
+# Copyright 2013-2020 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 import *
+from os import popen
+
+
+class RocmSmi(MakefilePackage):
+ """This tool exposes functionality for clock and temperature
+ management of your ROCm enabled system"""
+
+ homepage = "https://github.com/RadeonOpenCompute/ROC-smi"
+ url = "https://github.com/RadeonOpenCompute/ROC-smi/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+ version('3.5.0', sha256='4f46e947c415a4ac12b9f6989f15a42afe32551706b4f48476fba3abf92e8e7c')
+
+ variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type')
+
+ phases = ['edit', 'build']
+
+ @run_after('build')
+ def post_build(self):
+ popen('cp -R {0}/rocm_smi.py {1}'.format(self.build_directory, prefix))
+ popen('ln -srf {0}/rocm_smi.py {1}/rocm-smi'.format(prefix, prefix))
+
+ popen('mkdir -p {0}/smi-test/tests'.format(prefix))
+ popen('cp -R {0}/tests/ {1}/smi-test/'.format(self.build_directory,
+ prefix))
+ popen('cp -R {0}/test-rocm-smi.sh {1}/smi-test'.format(
+ self.build_directory, prefix))
diff --git a/var/spack/repos/builtin/packages/rocminfo/package.py b/var/spack/repos/builtin/packages/rocminfo/package.py
new file mode 100644
index 0000000000..97fe98ff5b
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocminfo/package.py
@@ -0,0 +1,26 @@
+# Copyright 2013-2020 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 import *
+
+
+class Rocminfo(CMakePackage):
+ """Radeon Open Compute (ROCm) Runtime rocminfo tool"""
+
+ homepage = "https://github.com/RadeonOpenCompute/rocminfo"
+ url = "https://github.com/RadeonOpenCompute/rocminfo/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='1d113f06b7c9b60d0e92b2c12c0c704a565696867496fe7038e5dddd510567b7')
+
+ depends_on('cmake@3:', type='build')
+ depends_on('hsakmt-roct@3.5.0', type='build', when='@3.5.0')
+ depends_on('hsa-rocr-dev@3.5.0', type='build', when='@3.5.0')
+
+ def cmake_args(self):
+ args = ['-DROCM_DIR={0}'.format(self.spec['hsa-rocr-dev'].prefix)]
+ return args
diff --git a/var/spack/repos/builtin/packages/rocprofiler-dev/package.py b/var/spack/repos/builtin/packages/rocprofiler-dev/package.py
new file mode 100644
index 0000000000..5bf2f74b00
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rocprofiler-dev/package.py
@@ -0,0 +1,43 @@
+# Copyright 2013-2020 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 import *
+
+
+class RocprofilerDev(CMakePackage):
+ """ROCPROFILER library for AMD HSA runtime API extension support"""
+
+ homepage = "https://github.com/ROCm-Developer-Tools/rocprofiler"
+ url = "https://github.com/ROCm-Developer-Tools/rocprofiler/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='c42548dd467b7138be94ad68c715254eb56a9d3b670ccf993c43cd4d43659937')
+
+ depends_on('cmake@3:', type='build')
+ depends_on('hsakmt-roct@3.5.0:', type='build', when='@3.5.0:')
+ depends_on('hsa-rocr-dev@3.5.0:', type='link', when='@3.5.0:')
+ depends_on('rocminfo@3.5.0:', type='build', when='@3.5.0:')
+
+ resource(name='roctracer-dev',
+ url='https://github.com/ROCm-Developer-Tools/roctracer/archive/rocm-3.5.0.tar.gz',
+ sha256='7af5326c9ca695642b4265232ec12864a61fd6b6056aa7c4ecd9e19c817f209e',
+ expand=True,
+ destination='',
+ placement='roctracer')
+
+ def patch(self):
+ filter_file('${HSA_RUNTIME_LIB_PATH}/../include',
+ '${HSA_RUNTIME_LIB_PATH}/../include ${HSA_KMT_LIB_PATH}/..\
+ /include', 'test/CMakeLists.txt', string=True)
+
+ def cmake_args(self):
+ args = ['-DPROF_API_HEADER_PATH={0}/roctracer/inc/ext'.format(
+ self.stage.source_path),
+ '-DROCM_ROOT_DIR:STRING={0}/include'.format(
+ self.spec['hsakmt-roct'].prefix)
+ ]
+ return args
diff --git a/var/spack/repos/builtin/packages/roctracer-dev/package.py b/var/spack/repos/builtin/packages/roctracer-dev/package.py
new file mode 100644
index 0000000000..5709ef487d
--- /dev/null
+++ b/var/spack/repos/builtin/packages/roctracer-dev/package.py
@@ -0,0 +1,44 @@
+# Copyright 2013-2020 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 import *
+
+
+class RoctracerDev(CMakePackage):
+ """ROC-tracer library: Runtimes Generic Callback/Activity APIs.
+ The goal of the implementation is to provide a generic independent from
+ specific runtime profiler to trace API and asyncronous activity."""
+
+ homepage = "https://github.com/ROCm-Developer-Tools/roctracer"
+ url = "https://github.com/ROCm-Developer-Tools/roctracer/archive/rocm-3.5.0.tar.gz"
+
+ maintainers = ['srekolam', 'arjun-raj-kuppala']
+
+ version('3.5.0', sha256='7af5326c9ca695642b4265232ec12864a61fd6b6056aa7c4ecd9e19c817f209e')
+
+ depends_on('cmake@3:', type='build')
+ depends_on('hsakmt-roct@3.5.0:', type='build', when='@3.5.0:')
+ depends_on('hsa-rocr-dev@3.5.0:', type='build', when='@3.5.0:')
+ depends_on('rocminfo@3.5.0:', type='build', when='@3.5.0:')
+ depends_on('hip@3.5.0:', type='build', when='@3.5.0:')
+
+ def setup_build_environment(self, build_env):
+ spec = self.spec
+ build_env.set("HIP_PATH", spec['hip'].prefix)
+
+ def patch(self):
+ filter_file('${CMAKE_PREFIX_PATH}/hsa',
+ '${HSA_RUNTIME_INC_PATH}', 'src/CMakeLists.txt',
+ string=True)
+
+ def cmake_args(self):
+ args = ['-DHIP_VDI=1',
+ '-DCMAKE_MODULE_PATH={0}/cmake_modules'.format(
+ self.stage.source_path),
+ '-DHSA_RUNTIME_HSA_INC_PATH={0}/include'.format(
+ self.spec['hsa-rocr-dev'].prefix)
+ ]
+ return args