summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSreenivasa Murthy Kolam <67086238+srekolam@users.noreply.github.com>2022-05-16 16:19:35 -0700
committerGitHub <noreply@github.com>2022-05-16 16:19:35 -0700
commit22b999fcd4695da54bc5544bb6dcbf3c5b0a04a4 (patch)
tree6a96fb354382a636071a4c715df3ee4f4de380f6
parent1df7de62ca4740be24539f2411b7d8a250dcaf85 (diff)
downloadspack-22b999fcd4695da54bc5544bb6dcbf3c5b0a04a4.tar.gz
spack-22b999fcd4695da54bc5544bb6dcbf3c5b0a04a4.tar.bz2
spack-22b999fcd4695da54bc5544bb6dcbf3c5b0a04a4.tar.xz
spack-22b999fcd4695da54bc5544bb6dcbf3c5b0a04a4.zip
Add miopentensile-new recipe for ROCm-5.0.0 . ROCm-5.1.0 release (#29313)
* miopentensile-new recipe for rocm-5.0.0 release * fix style checks * update the version for 5.1.0 release, avoid git download
-rw-r--r--var/spack/repos/builtin/packages/miopen-tensile/0002-Improve-compilation-by-using-local-tensile-path.patch48
-rw-r--r--var/spack/repos/builtin/packages/miopen-tensile/package.py71
2 files changed, 119 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/miopen-tensile/0002-Improve-compilation-by-using-local-tensile-path.patch b/var/spack/repos/builtin/packages/miopen-tensile/0002-Improve-compilation-by-using-local-tensile-path.patch
new file mode 100644
index 0000000000..be92505c18
--- /dev/null
+++ b/var/spack/repos/builtin/packages/miopen-tensile/0002-Improve-compilation-by-using-local-tensile-path.patch
@@ -0,0 +1,48 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e98d74d..de8740e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -55,7 +55,7 @@ macro(add_library NAME)
+ endif()
+ endmacro()
+ find_package(hip)
+-
++set( Tensile_TEST_LOCAL_PATH "" CACHE PATH "Use local Tensile directory instead of fetching a GitHub branch" )
+ if(CMAKE_CXX_COMPILER MATCHES ".*/hcc$")
+ set(TENSILE_USE_LLVM ON CACHE BOOL "Use LLVM for parsing config files.")
+ set(TENSILE_USE_MSGPACK OFF CACHE BOOL "Use msgpack for parsing config files.")
+@@ -79,11 +79,30 @@ endif()
+ # set(MIOPEN_TENSILE_SRC dev)
+ # endif()
+ # Use the virtual-env setup and download package from specified repo:
+-virtualenv_install(wheel)
+-virtualenv_install("git+https://github.com/ROCmSoftwarePlatform/Tensile.git@${MIOPEN_TENSILE_TAG}")
+-list(APPEND CMAKE_PREFIX_PATH ${VIRTUALENV_HOME_DIR})
+
+-find_package(Tensile REQUIRED COMPONENTS HIP)
++option(BUILD_USING_LOCAL_TENSILE "Build as a shared library" ON )
++
++if (WIN32)
++ set( Tensile_ROOT "${CMAKE_BINARY_DIR}/virtualenv/Lib/site-packages/Tensile" )
++endif()
++
++include(virtualenv)
++if (BUILD_USING_LOCAL_TENSILE)
++ virtualenv_install(${Tensile_TEST_LOCAL_PATH})
++ message (STATUS "using local Tensile from ${Tensile_TEST_LOCAL_PATH}, copied to ${Tensile_ROOT}")
++else()
++ # Use the virtual-env setup and download package from specified repot:
++ set( tensile_fork "ROCmSoftwarePlatform" CACHE STRING "Tensile fork to use" )
++ virtualenv_install("git+https://github.com/${tensile_fork}/Tensile.git@${MIOPEN_TENSILE_TAG}")
++ message (STATUS "using GIT Tensile fork=${tensile_fork} from branch=${MIOPEN_TENSILE_TAG}")
++endif()
++message(STATUS "Adding ${VIRTUALENV_HOME_DIR} to CMAKE_PREFIX_PATH")
++list(APPEND CMAKE_PREFIX_PATH ${VIRTUALENV_HOME_DIR})
++if (TENSILE_VERSION)
++ find_package(Tensile ${TENSILE_VERSION} EXACT REQUIRED HIP LLVM PATHS "${INSTALLED_TENSILE_PATH}")
++else()
++ find_package(Tensile 4.28.0 EXACT REQUIRED HIP LLVM PATHS "${INSTALLED_TENSILE_PATH}")
++endif()
+
+ set_target_properties( TensileHost PROPERTIES POSITION_INDEPENDENT_CODE ON )
+
diff --git a/var/spack/repos/builtin/packages/miopen-tensile/package.py b/var/spack/repos/builtin/packages/miopen-tensile/package.py
new file mode 100644
index 0000000000..64a72061f9
--- /dev/null
+++ b/var/spack/repos/builtin/packages/miopen-tensile/package.py
@@ -0,0 +1,71 @@
+# Copyright 2013-2022 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 MiopenTensile(CMakePackage):
+ """MIOpenTensile provides host-callable interfaces to Tensile library.
+ MIOpenTensile supports one programming model: HIP"""
+
+ homepage = "https://github.com/ROCmSoftwarePlatform/MIOpenTensile"
+ git = "https://github.com/ROCmSoftwarePlatform/MIOpenTensile.git"
+ url = "https://github.com/ROCmSoftwarePlatform/MIOpentensile/archive/rocm-5.0.0.tar.gz"
+
+ maintainers = ['srekolam']
+
+ version('5.1.0', sha256='f1ae57bd4df8c154357b3f17caf0cfd5f80ba16ffff67bf6219a56f1eb5f897d')
+ version('5.0.2', sha256='7b85a6a37d0905b0a3baa8361fd71a5a32ad90f3a562fd5e1af7e2ba68099fa6')
+ version('5.0.0', sha256='276ada52e2e8431851296a60df538e0171f8a1c4e9894de8954ffa9306cda2d8')
+ version('4.5.2', sha256='eae14b20aec5ad57815c85d0571b7aecc3704696147f3cdbe34287e88da0c9e9')
+ version('4.5.0', sha256='5f181f536040c0612bf889600f75951e7ec031ae5c4cb9c2c44f6ac3b15b004b')
+
+ tensile_architecture = ('all', 'gfx906', 'gfx908', 'gfx803', 'gfx900')
+
+ variant('tensile_architecture', default='all', values=tensile_architecture, multi=True)
+ variant('build_type', default='Release', values=("Release", "Debug", "RelWithDebInfo"), description='CMake build type')
+
+ patch('0002-Improve-compilation-by-using-local-tensile-path.patch', when='@4.5.0:')
+
+ depends_on('cmake@3.5:', type='build')
+ depends_on('msgpack-c@3:')
+ depends_on('python@3.6:', type='build')
+ depends_on('py-virtualenv', type='build')
+ depends_on('perl-file-which', type='build')
+ depends_on('py-pyyaml', type='build')
+ depends_on('py-wheel', type='build')
+ depends_on('py-msgpack', type='build')
+ depends_on('py-pip', type='build')
+
+ resource(name='Tensile',
+ git='https://github.com/ROCmSoftwarePlatform/Tensile.git',
+ commit='9cbabb07f81e932b9c98bf5ae48fbd7fcef615cf',
+ when='@4.5.0:')
+
+ for ver in ['4.5.0', '4.5.2', '5.0.0', '5.0.2', '5.1.0']:
+ depends_on('rocm-cmake@%s:' % ver, type='build', when='@' + ver)
+ depends_on('hip@' + ver, when='@' + ver)
+ depends_on('llvm-amdgpu@' + ver, when='@' + ver)
+ depends_on('rocminfo@' + ver, when='@' + ver)
+
+ def setup_build_environment(self, env):
+ env.set('CXX', self.spec['hip'].hipcc)
+
+ def cmake_args(self):
+ arch = self.spec.variants['tensile_architecture'].value
+ tensile_path = join_path(self.stage.source_path, 'Tensile')
+ args = [
+ self.define('TENSILE_USE_MSGPACK', 'ON'),
+ self.define('COMPILER', 'hipcc'),
+ self.define('TENSILE_USE_LLVM', 'OFF'),
+ self.define('CODE_OBJECT_VERSION', 'V3'),
+ self.define('TENSILE_LIBRARY_FORMAT', 'msgpack'),
+ self.define('MIOPEN_TENSILE_SRC', 'asm_full'),
+ self.define('Tensile_TEST_LOCAL_PATH', tensile_path)
+ ]
+ args.append(self.define('Tensile_ARCHITECTURE', arch))
+
+ return args