Skip to content

Commit 1f65a36

Browse files
jpsamaroovchuravy
andauthored
[New package] Add ROCmCompilerSupport 4.0.0 (#3283)
Co-authored-by: Valentin Churavy <[email protected]>
1 parent 9509a32 commit 1f65a36

File tree

4 files changed

+127
-0
lines changed

4 files changed

+127
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Note that this script can accept some limited command-line arguments, run
2+
# `julia build_tarballs.jl --help` to see a usage message.
3+
using BinaryBuilder, Pkg
4+
5+
name = "ROCmCompilerSupport"
6+
version = v"4.0.0"
7+
8+
# Collection of sources required to build
9+
sources = [
10+
ArchiveSource("https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/archive/rocm-$(version).tar.gz",
11+
"f389601fb70b2d9a60d0e2798919af9ddf7b8376a2e460141507fe50073dfb31"), # 4.0.0
12+
DirectorySource("./bundled"),
13+
]
14+
15+
# Bash recipe for building across all platforms
16+
script = raw"""
17+
ln -s ${bindir}/../tools/* ${bindir}/
18+
19+
cd ${WORKSPACE}/srcdir/ROCm-CompilerSupport*/lib/comgr
20+
21+
# first manually build bc2h utility
22+
cd cmake && mkdir bc2h && cd bc2h
23+
cp ../bc2h.cmake CMakeLists.txt
24+
CC=$HOSTCC cmake -DCMAKE_C_COMPILER=$HOSTCC .
25+
make
26+
cd ../..
27+
28+
# then build everything else
29+
atomic_patch -p1 $WORKSPACE/srcdir/patches/disable-1031.patch
30+
atomic_patch -p1 $WORKSPACE/srcdir/patches/disable-tests.patch
31+
atomic_patch -p1 $WORKSPACE/srcdir/patches/disable-bc2h.patch
32+
mkdir build && cd build
33+
cp ../cmake/bc2h/bc2h .
34+
# TODO: -DROCM_DIR=${prefix}
35+
cmake -DCMAKE_PREFIX_PATH=${prefix} \
36+
-DCMAKE_INSTALL_PREFIX=${prefix} \
37+
-DCMAKE_BUILD_TYPE=Release \
38+
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN%.*}_clang.cmake \
39+
-DLLVM_DIR="${prefix}/lib/cmake/llvm" \
40+
-DClang_DIR="${prefix}/lib/cmake/clang" \
41+
-DLLD_DIR="${prefix}/lib/cmake/ldd" \
42+
..
43+
PATH=../cmake/bc2h:$PATH make -j${nproc}
44+
make install
45+
46+
find $WORKSPACE/destdir/bin -type l -delete
47+
"""
48+
49+
# These are the platforms we will build for by default, unless further
50+
# platforms are passed in on the command line
51+
platforms = [
52+
# TODO: cxx03
53+
Platform("x86_64", "linux"; libc="glibc", cxxstring_abi="cxx11"),
54+
Platform("x86_64", "linux"; libc="musl", cxxstring_abi="cxx11"),
55+
]
56+
57+
# The products that we will ensure are always built
58+
products = [
59+
LibraryProduct(["libamd_comgr"], :libamd_comgr; dont_dlopen=true),
60+
]
61+
62+
# Dependencies that must be installed before this package can be built
63+
dependencies = [
64+
Dependency("hsa_rocr_jll"),
65+
Dependency("ROCmDeviceLibs_jll"),
66+
BuildDependency(PackageSpec(; name="LLVM_full_jll", version=v"11.0.1")),
67+
]
68+
69+
# Build the tarballs, and possibly a `build.jl` as well.
70+
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies,
71+
preferred_gcc_version=v"8", preferred_llvm_version=v"11")
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
diff --git a/src/comgr-metadata.cpp b/src/comgr-metadata.cpp
2+
index 239a759..0fb1df2 100644
3+
--- a/src/comgr-metadata.cpp
4+
+++ b/src/comgr-metadata.cpp
5+
@@ -374,8 +374,6 @@ getNoteIsaName(StringRef VendorName, StringRef ArchitectureName,
6+
NoteIsaName = "amdgcn-amd-amdhsa--gfx1012";
7+
else if (OldName == "AMD:AMDGPU:10:3:0")
8+
NoteIsaName = "amdgcn-amd-amdhsa--gfx1030";
9+
- else if (OldName == "AMD:AMDGPU:10:3:1")
10+
- NoteIsaName = "amdgcn-amd-amdhsa--gfx1031";
11+
else
12+
return AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT;
13+
14+
@@ -589,9 +587,6 @@ static amd_comgr_status_t getElfIsaNameV3(const ELFObjectFile<ELFT> *Obj,
15+
case ELF::EF_AMDGPU_MACH_AMDGCN_GFX1030:
16+
ElfIsaName += "gfx1030";
17+
break;
18+
- case ELF::EF_AMDGPU_MACH_AMDGCN_GFX1031:
19+
- ElfIsaName += "gfx1031";
20+
- break;
21+
default:
22+
return AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT;
23+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index bf38bfc..d8f68ec 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -149,7 +149,9 @@ configure_file(
6+
${CMAKE_CURRENT_SOURCE_DIR}/include/amd_comgr.h.in
7+
${CMAKE_CURRENT_BINARY_DIR}/include/amd_comgr.h @ONLY)
8+
9+
-include(bc2h)
10+
+#include(bc2h)
11+
+add_executable(bc2h IMPORTED)
12+
+set_target_properties(bc2h PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/bc2h)
13+
include(opencl_pch)
14+
include(DeviceLibs)
15+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index bf38bfc..8cc6908 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -291,13 +291,6 @@ if (NOT UNIX)
6+
PRIVATE version)
7+
endif()
8+
9+
-enable_testing()
10+
-add_custom_target(check-comgr COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS amd_comgr)
11+
-if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
12+
- set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-comgr)
13+
-endif()
14+
-add_subdirectory(test)
15+
-
16+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
17+
# Add packaging directives for amd_comgr
18+
set(CPACK_PACKAGE_NAME comgr)

0 commit comments

Comments
 (0)