Skip to content

Commit

Permalink
rocm-compilersupport: update to 6.0.0
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Zhao <git@gzgz.dev>
  • Loading branch information
GZGavinZhao committed Apr 7, 2024
1 parent 1bd9af7 commit 507a817
Show file tree
Hide file tree
Showing 13 changed files with 303 additions and 2,126 deletions.
2 changes: 2 additions & 0 deletions packages/r/rocm-compilersupport/abi_symbols
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ libamd_comgr.so.2:amd_comgr_index_list_metadata
libamd_comgr.so.2:amd_comgr_iterate_map_metadata
libamd_comgr.so.2:amd_comgr_iterate_symbols
libamd_comgr.so.2:amd_comgr_lookup_code_object
libamd_comgr.so.2:amd_comgr_map_name_expression_to_symbol_name
libamd_comgr.so.2:amd_comgr_metadata_lookup
libamd_comgr.so.2:amd_comgr_populate_mangled_names
libamd_comgr.so.2:amd_comgr_populate_name_expression_map
libamd_comgr.so.2:amd_comgr_release_data
libamd_comgr.so.2:amd_comgr_set_data
libamd_comgr.so.2:amd_comgr_set_data_from_file_slice
Expand Down
2 changes: 1 addition & 1 deletion packages/r/rocm-compilersupport/abi_used_libs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ld-linux-x86-64.so.2
libLLVM-16.so
libc.so.6
libgcc_s.so.1
libm.so.6
libncursesw.so.6
libstdc++.so.6
libz.so.1
libzstd.so.1
2,106 changes: 198 additions & 1,908 deletions packages/r/rocm-compilersupport/abi_used_symbols

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
From 3419d519fca9b03ba82dde037cc4600348a9d71d Mon Sep 17 00:00:00 2001
From: Gavin Zhao <git@gzgz.dev>
Date: Tue, 20 Feb 2024 15:04:20 -0500
Subject: [PATCH] Extend ROCm-CompilerSupport HIP ISA compatibility

Inspired by a similar patch by @cgmb to clr/hipamd.

Signed-off-by: Gavin Zhao <git@gzgz.dev>
---
lib/comgr/src/comgr-metadata.cpp | 45 +++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/lib/comgr/src/comgr-metadata.cpp b/lib/comgr/src/comgr-metadata.cpp
index a3375b4..0769c87 100644
--- a/lib/comgr/src/comgr-metadata.cpp
+++ b/lib/comgr/src/comgr-metadata.cpp
@@ -923,6 +923,48 @@ static constexpr const char *CLANG_OFFLOAD_BUNDLER_MAGIC =
static constexpr size_t OffloadBundleMagicLen =
strLiteralLength(CLANG_OFFLOAD_BUNDLER_MAGIC);

+struct GfxPattern {
+ StringRef root;
+ StringRef suffixes;
+};
+
+static bool matches(const GfxPattern& p, const StringRef s) {
+ if (p.root.size() + 1 != s.size()) {
+ return false;
+ }
+ if (0 != std::memcmp(p.root.data(), s.data(), p.root.size())) {
+ return false;
+ }
+ return p.suffixes.find(s[p.root.size()]) != std::string::npos;
+}
+
+
+static bool isGfx900CompatibleProcessor(const StringRef processor) {
+ return matches(GfxPattern{"gfx90", "029c"}, processor);
+}
+
+static bool isGfx1030CompatibleProcessor(const StringRef processor) {
+ return matches(GfxPattern{"gfx103", "0123456"}, processor);
+}
+
+static bool isGfx1010CompatibleProcessor(const StringRef processor) {
+ return matches(GfxPattern{"gfx101", "0123456"}, processor);
+}
+
+static bool isProcessorsCompatible(const StringRef processor1, const StringRef processor2) {
+ if (processor1 == processor2) {
+ return true;
+ } else if (isGfx900CompatibleProcessor(processor1) && isGfx900CompatibleProcessor(processor2)) {
+ return true;
+ } else if (isGfx1030CompatibleProcessor(processor1) && isGfx1030CompatibleProcessor(processor2)) {
+ return true;
+ } else if (isGfx1010CompatibleProcessor(processor1) && isGfx1010CompatibleProcessor(processor2)) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
bool isCompatibleIsaName(StringRef IsaName, StringRef CodeObjectIsaName) {
if (IsaName == CodeObjectIsaName) {
return true;
@@ -938,7 +980,8 @@ bool isCompatibleIsaName(StringRef IsaName, StringRef CodeObjectIsaName) {
return false;
}

- if (CodeObjectIdent.Processor != IsaIdent.Processor) {
+ if (CodeObjectIdent.Processor != IsaIdent.Processor
+ && !isProcessorsCompatible(CodeObjectIdent.Processor, IsaIdent.Processor)) {
return false;
}

--
2.43.1

26 changes: 0 additions & 26 deletions packages/r/rocm-compilersupport/files/0001-None-std-nullopt.patch

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions packages/r/rocm-compilersupport/files/series

This file was deleted.

45 changes: 14 additions & 31 deletions packages/r/rocm-compilersupport/package.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name : rocm-compilersupport
version : 5.5.1
release : 5
version : 6.0.0
release : 6
source :
- https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/archive/refs/tags/rocm-5.5.1.tar.gz : 0fbb15fe5a95c2e141ccd360bc413e1feda283334781540a6e5095ab27fd8019
homepage : https://github.com/RadeonOpenCompute/ROCm-CompilerSupport
- https://github.com/ROCm/ROCm-CompilerSupport/archive/refs/tags/rocm-6.0.0.tar.gz : 04353d27a512642a5e5339532a39d0aabe44e0964985de37b150a2550385800a
homepage : https://github.com/ROCm/ROCm-CompilerSupport
license : NCSA
component : programming.devel
summary : The AMD Code Object Manager (Comgr)
Expand All @@ -13,34 +13,17 @@ clang : yes
builddeps :
- rocm-cmake
- rocm-device-libs-devel
- rocm-llvm
environment: |
declare -A rocm_vars
rocm_vars=(
["HIP_DEVICE_LIB_PATH"]="/usr/lib64/amdgcn/bitcode"
["HIP_CLANG_PATH"]="/usr/bin"
["HIP_COMPILER"]="clang"
["HIP_LIB_PATH"]="/usr/lib64"
["HIP_PATH"]="/usr"
["HIP_PLATFORM"]="amd"
["HIP_ROCCLR_HOME"]="/usr"
["ROCM_PATH"]="/usr"
)
for name in "${!rocm_vars[@]}"; do
echo "Setting $name to ${rocm_vars[$name]}";
export "$name"="${rocm_vars[$name]}";
export ROCM_CMAKE_FLAGS="$ROCM_CMAKE_FLAGS -D$name=${rocm_vars[$name]}";
done
export ROCM_PATH=/usr
export CMAKE_PREFIX_PATH=/usr/lib64/llvm-rocm
export HIP_DEVICE_LIB_PATH=/usr/lib64/amdgcn/bitcode
setup : |
%apply_patches
%cmake -S lib/comgr -DBUILD_TESTING=OFF \
-DFILE_REORG_BACKWARD_COMPATIBILITY=OFF \
%patch -p1 -i $pkgfiles/0001-Extend-ROCm-CompilerSupport-HIP-ISA-compatibility.patch
%cmake_ninja -L -S lib/comgr -DBUILD_TESTING=ON
build : |
%make
%ninja_build
install : |
%make_install
rm -r $installdir/usr/share
# Failing due to https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/issues/45
# check : |
# ctest --output-on-failure
%ninja_install
check : |
%ninja_check
16 changes: 10 additions & 6 deletions packages/r/rocm-compilersupport/pspec_x86_64.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<PISI>
<Source>
<Name>rocm-compilersupport</Name>
<Homepage>https://github.com/RadeonOpenCompute/ROCm-CompilerSupport</Homepage>
<Homepage>https://github.com/ROCm/ROCm-CompilerSupport</Homepage>
<Packager>
<Name>Gavin Zhao</Name>
<Email>me@gzgz.dev</Email>
Expand All @@ -21,7 +21,11 @@
<PartOf>programming.devel</PartOf>
<Files>
<Path fileType="library">/usr/lib64/libamd_comgr.so.2</Path>
<Path fileType="library">/usr/lib64/libamd_comgr.so.2.5</Path>
<Path fileType="library">/usr/lib64/libamd_comgr.so.2.6</Path>
<Path fileType="doc">/usr/share/doc/amd_comgr-asan/LICENSE.txt</Path>
<Path fileType="doc">/usr/share/doc/amd_comgr/LICENSE.txt</Path>
<Path fileType="doc">/usr/share/doc/amd_comgr/NOTICES.txt</Path>
<Path fileType="doc">/usr/share/doc/amd_comgr/README.md</Path>
</Files>
</Package>
<Package>
Expand All @@ -31,7 +35,7 @@
</Description>
<PartOf>programming.devel</PartOf>
<RuntimeDependencies>
<Dependency release="5">rocm-compilersupport</Dependency>
<Dependency release="6">rocm-compilersupport</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="header">/usr/include/amd_comgr/amd_comgr.h</Path>
Expand All @@ -43,9 +47,9 @@
</Files>
</Package>
<History>
<Update release="5">
<Date>2024-01-05</Date>
<Version>5.5.1</Version>
<Update release="6">
<Date>2024-02-20</Date>
<Version>6.0.0</Version>
<Comment>Packaging update</Comment>
<Name>Gavin Zhao</Name>
<Email>me@gzgz.dev</Email>
Expand Down

0 comments on commit 507a817

Please sign in to comment.