Changes for ROCm-5.2.0 changes and new recipe rocwmma (#31667)

* Changes for ROCm-5.2.0 changes and new recipe rocwmma

* modify the maintainers for hipify-clang

* address review comments

* update the rocwmma new recipe as per latest syntax

* fix style errors

* modify the patch file to provide the details about the patch

* fix style errors
This commit is contained in:
Sreenivasa Murthy Kolam 2022-08-25 10:00:02 -07:00 committed by GitHub
parent 507e06b5d2
commit f0df4b653d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 148 additions and 11 deletions

View file

@ -0,0 +1,38 @@
From 5af7f4a3dcb24d935208b3d598ea7e864b729fb7 Mon Sep 17 00:00:00 2001
From: sreenivasa murthy kolam <sreenivasamurthy.kolam@amd.com>
Date: Sat, 13 Aug 2022 04:51:21 +0000
Subject: [PATCH] install hipify-clang in bin dir and llvm-clangs headers in
the include headers this will fix the issue
https://github.com/spack/spack/issues/30711
---
CMakeLists.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6ba9a54..b624f81 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -101,16 +101,16 @@ endif()
set(HIPIFY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX})
-install(TARGETS hipify-clang DESTINATION ${CMAKE_INSTALL_PREFIX})
+install(TARGETS hipify-clang DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/bin/
- DESTINATION ${CMAKE_INSTALL_PREFIX}
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
USE_SOURCE_PERMISSIONS
PATTERN "hipify-perl"
PATTERN "*.sh")
install(
DIRECTORY ${LLVM_DIR}/../../clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}/
- DESTINATION ${CMAKE_INSTALL_PREFIX}
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/include
COMPONENT clang-resource-headers
FILES_MATCHING
PATTERN "*.h"
--
2.18.4

View file

@ -15,10 +15,11 @@ class HipifyClang(CMakePackage):
url = "https://github.com/ROCm-Developer-Tools/HIPIFY/archive/rocm-5.1.3.tar.gz"
tags = ["rocm"]
maintainers = ["srekolam", "arjun-raj-kuppala"]
maintainers = ["srekolam", "renjithravindrankannath"]
version("master", branch="master")
version("5.2.0", sha256="dcd5f44daceb984bb654a209e78debf81e1cdeaf9202444a1e110b45ad6c3f4f")
version("5.1.3", sha256="6354b08b8ab2f4c481398fb768652bae00bb78c4cec7a11d5f6c7e4cb831ddf1")
version("5.1.0", sha256="ba792294cbdcc880e0f02e38ee352dff8d4a2c183430e13d1c5ed176bd46cfc5")
version("5.0.2", sha256="812bccfeb044483a1c7df89f45843afcb28d8146f348c792f082b693cbff3984")
@ -82,6 +83,10 @@ class HipifyClang(CMakePackage):
values=("Release", "Debug", "RelWithDebInfo"),
description="CMake build type",
)
# the patch was added to install the targets in the correct directory structure
# this will fix the issue https://github.com/spack/spack/issues/30711
patch("0001-install-hipify-clang-in-bin-dir-and-llvm-clangs-head.patch", when="@5.1.0:")
depends_on("cmake@3.5:", type="build")
for ver in [
@ -101,6 +106,7 @@ class HipifyClang(CMakePackage):
"5.0.2",
"5.1.0",
"5.1.3",
"5.2.0",
"master",
]:
depends_on("llvm-amdgpu@" + ver, when="@" + ver)

View file

@ -29,6 +29,7 @@
"64669ac448c439e89ec4b6e0506158e6d9b5a3edfae05882aee4c9bcd5f187b7",
"e69fe0c933cb30daafe49d9f1df71fe16f387e0287bba921995feeefdf9ac262",
"8bab3d621343f419b29043ac0cb56e062f114991dc3ec1e33e786f771deecc8f",
"20e21312816272222d1f427ea72a99a9a67077078552f5e2638a40860d161d25",
]
devlib = [
@ -45,6 +46,7 @@
"49cfa8f8fc276ba27feef40546788a2aabe259a924a97af8bef24e295d19aa5e",
"47dbcb41fb4739219cadc9f2b5f21358ed2f9895ce786d2f7a1b2c4fd044d30f",
"c41958560ec29c8bf91332b9f668793463904a2081c330c0d828bf2f91d4f04e",
"901674bc941115c72f82c5def61d42f2bebee687aefd30a460905996f838e16c",
]
llvm = [
@ -61,6 +63,7 @@
"99a14394b406263576ed3d8d10334de7c78d42b349109f375d178b11492eecaf",
"db5d45c4a7842a908527c1b7b8d4a40c688225a41d23cfa382eab23edfffdd10",
"d236a2064363c0278f7ba1bb2ff1545ee4c52278c50640e8bb2b9cfef8a2f128",
"0f892174111b78a02d1a00f8f46d9f80b9abb95513a7af38ecf2a5a0882fe87f",
]
flang = [
@ -77,6 +80,7 @@
"9b9a53150009ff58bd0ab665b970dbebc51be891343fd5dc8e77a2133ac44333",
"d95e36f3b93097ab6fb319c744ddc71cd94af0c358accc1e5224c2bbd431266d",
"d7847b5c6e1344dc0b4723dbe76a859257b4c242644dedb34e425f07738530d4",
"20f48cac9b58496230fa2428eba4e15ec0a6e92d429569b154a328b7a8c5da17",
]
extras = [
@ -93,6 +97,7 @@
"a4affb77bebaafb6f8d22c51d66aa6fa05381ec54cc1e14a4b10e0f3dc00157f",
"c3a2a83d8f586ee765df96a692ebe010631446f700273fa31738ea260dfc35f7",
"2e3151a47d77166d071213af2a1691487691aae0abd5c1718d818a6d7d09cb2d",
"817c2e8975e56a8875ff56f9d1ea34d5e7e50f1b541b7f1236e3e5c8d9eee47f",
]
versions = [
@ -109,6 +114,7 @@
"5.0.2",
"5.1.0",
"5.1.3",
"5.2.0",
]
versions_dict = dict() # type: Dict[str,Dict[str,str]]
components = ["aomp", "devlib", "llvm", "flang", "extras"]
@ -126,10 +132,11 @@ class RocmOpenmpExtras(Package):
"""OpenMP support for ROCm LLVM."""
homepage = tools_url + "/aomp"
url = tools_url + "/aomp/archive/rocm-5.1.3.tar.gz"
url = tools_url + "/aomp/archive/rocm-5.2.0.tar.gz"
tags = ["rocm"]
maintainers = ["srekolam", "arjun-raj-kuppala", "estewart08"]
maintainers = ["srekolam", "renjithravindrankannath", "estewart08"]
version("5.2.0", sha256=versions_dict["5.2.0"]["aomp"])
version("5.1.3", sha256=versions_dict["5.1.3"]["aomp"])
version("5.1.0", sha256=versions_dict["5.1.0"]["aomp"])
version("5.0.2", sha256=versions_dict["5.0.2"]["aomp"])
@ -166,6 +173,7 @@ class RocmOpenmpExtras(Package):
"5.0.2",
"5.1.0",
"5.1.3",
"5.2.0",
]:
depends_on("hsakmt-roct@" + ver, when="@" + ver)
depends_on("comgr@" + ver, when="@" + ver)
@ -258,13 +266,13 @@ def patch(self):
else:
plugin = "/plugins/amdgpu/CMakeLists.txt"
if self.spec.version < Version("5.2.0"):
filter_file(
"{ROCM_DIR}/amdgcn/bitcode",
"{DEVICE_LIBS_DIR}",
aomp_extras.format(src) + "/aompextras/CMakeLists.txt",
libomptarget.format(src) + "/deviceRTLs/amdgcn/CMakeLists.txt",
)
# Libm moved into llvm-project in 4.5.0
if self.spec.version < Version("4.5.0"):
filter_file(
@ -289,7 +297,7 @@ def patch(self):
libomptarget.format(src) + "/deviceRTLs/amdgcn/CMakeLists.txt",
)
if self.spec.version >= Version("4.5.0"):
if self.spec.version <= Version("5.1.3"):
filter_file(
"{ROCM_DIR}/amdgcn/bitcode",
"{DEVICE_LIBS_DIR}",

View file

@ -0,0 +1,85 @@
# 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)
import itertools
from spack.package import *
class Rocwmma(CMakePackage):
"""AMD's C++ library for accelerating mixed precision matrix multiplication
and accumulation (MFMA) operations leveraging specialized GPU matrix cores.
rocWMMA provides a C++ API to facilitate breaking down matrix multiply-accumulate
problems into fragments and using them in block-wise operations that are
distributed in parallel across GPU wavefronts. The API is a header library
of GPU device code meaning that matrix core acceleration may be compiled directly
into your kernel device code. This can benefit from compiler optimization in the
generation of kernel assembly, and does not incur additional overhead costs of
linking to external runtime libraries or having to launch separate kernels."""
homepage = "https://github.com/ROCmSoftwarePlatform/rocWMMA"
git = "https://github.com/ROCmSoftwarePlatform/rocWMMA.git"
url = "https://github.com/ROCmSoftwarePlatform/rocWMMA/archive/refs/tags/rocm-5.2.0.tar.gz"
tags = ["rocm"]
maintainers = ["srekolam"]
version("5.2.0", sha256="257ccd1cf2bc1d8064e72e78d276ef7446b2cb7e2dec05ff8331bb44eff2b7cb")
# gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+
# are only targets currently supported for @5.2.0
# releases
amdgpu_targets = ("gfx908:xnack-", "gfx90a", "gfx90a:xnack-", "gfx90a:xnack+")
variant("amdgpu_target", values=auto_or_any_combination_of(*amdgpu_targets))
variant(
"build_type",
default="Release",
values=("Release", "Debug", "RelWithDebInfo"),
description="CMake build type",
)
depends_on("cmake@3.16:", type="build", when="@5.2.0:")
depends_on("cmake@3.5:", type="build")
depends_on("googletest@1.10.0:", type="test")
for ver in ["5.2.0"]:
depends_on("rocm-cmake@%s:" % ver, type="build", when="@" + ver)
depends_on("llvm-amdgpu@" + ver, type="build", when="@" + ver)
depends_on("hip@" + ver, when="@" + ver)
depends_on("rocblas@" + ver, type="build", when="@" + ver)
depends_on("rocm-openmp-extras@" + ver, type="build", when="@" + ver)
for tgt in itertools.chain(["auto"], amdgpu_targets):
depends_on("rocblas amdgpu_target={0}".format(tgt), when="amdgpu_target={0}".format(tgt))
def setup_build_environment(self, env):
env.set("CXX", self.spec["hip"].hipcc)
def cmake_args(self):
args = [
self.define("ROCWMMA_BUILD_TESTS", "ON"),
self.define("ROCWMMA_BUILD_VALIDATION_TESTS", "ON"),
self.define("ROCWMMA_BUILD_BENCHMARK_TESTS", "ON"),
self.define("ROCWMMA_BUILD_SAMPLES", "ON"),
self.define("ROCWMMA_BUILD_DOCS", "OFF"),
self.define("ROCWMMA_BUILD_ASSEMBLY", "OFF"),
]
args.extend(
[
"-DOpenMP_CXX_FLAGS=-fopenmp=libomp",
"-DOpenMP_CXX_LIB_NAMES=libomp",
"-DOpenMP_libomp_LIBRARY={0}/lib/libomp.so".format(
self.spec["rocm-openmp-extras"].prefix
),
]
)
tgt = self.spec.variants["amdgpu_target"]
if "auto" not in tgt:
args.append(self.define_from_variant("AMDGPU_TARGETS", "amdgpu_target"))
return args