1 |
commit: c42a36956f512554fb0992cf4fe2ac34e47de3cd |
2 |
Author: Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com> |
3 |
AuthorDate: Wed Jun 15 06:48:50 2022 +0000 |
4 |
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Aug 6 14:20:20 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c42a3695 |
7 |
|
8 |
dev-libs/rocm-device-libs: add 5.1.3 |
9 |
|
10 |
Drop llvm-roc dependency, depend on vanilla clang. |
11 |
Correct bitcode path in test for unpatched clang. |
12 |
|
13 |
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com> |
14 |
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org> |
15 |
|
16 |
dev-libs/rocm-device-libs/Manifest | 1 + |
17 |
.../files/rocm-device-libs-5.1.3-llvm-link.patch | 13 ++++++ |
18 |
.../rocm-device-libs-5.1.3-test-bitcode-dir.patch | 24 +++++++++++ |
19 |
.../rocm-device-libs/rocm-device-libs-5.1.3.ebuild | 47 ++++++++++++++++++++++ |
20 |
4 files changed, 85 insertions(+) |
21 |
|
22 |
diff --git a/dev-libs/rocm-device-libs/Manifest b/dev-libs/rocm-device-libs/Manifest |
23 |
index caad548c25f9..b9dc17091c0c 100644 |
24 |
--- a/dev-libs/rocm-device-libs/Manifest |
25 |
+++ b/dev-libs/rocm-device-libs/Manifest |
26 |
@@ -8,3 +8,4 @@ DIST rocm-device-libs-4.2.0.tar.gz 231971 BLAKE2B 292798ec29b6feb268928a41d7a321 |
27 |
DIST rocm-device-libs-4.3.0.tar.gz 234910 BLAKE2B af306219df395f9c5e65e6e06dff976698b80009d3b0c330c396c3e9475dca124bee4c96ff31724763bf40b3fd611f1ef55a7fb675f5ef82b992e496bc3a2d6d SHA512 6e93b435d782a50f45d17bafb466ee05df88c39d665a8d796b68d588b6074629934c44afaae233fc84a238dc9c93d15917efeec7633349b4e894f3b3385bf57e |
28 |
DIST rocm-device-libs-4.5.2.tar.gz 244532 BLAKE2B fd13f3e518dc0922bb4e2a49863e3b86238158431189f4d4e9665f7e7b1adfa78ca96d915a3737b0da476cfbffcf0a0ad8840349a22062f59a83f59bc9edd05a SHA512 5da2efd685c279ebb1bf67e27e1a8febb20dcdcf33136667b9bf2ca0d3684b366237358269a0c221dd602af37503aa766842cd1932b2711b562c1fc94cd2ae70 |
29 |
DIST rocm-device-libs-5.0.2.tar.gz 242099 BLAKE2B 3fc2afc3a837557da04bcd5673656c08d0b5ebf48fd6568a4b1687d157dc4b08e3b5cd219a7bf3c2ed82ca1391477c32c42b4e594d07ad47ef429061be351af9 SHA512 1c37401641080e511f325cddb62490c8827d1bcef7f2198449246afbd391162ed3294c24b0529e1b3669129e29544989e2cf12d46c90fea8d880c52cfdca5a72 |
30 |
+DIST rocm-device-libs-5.1.3.tar.gz 242862 BLAKE2B 68d66de897f461e9f876de5fe2214803d4c00665651dea6af0952f0ce579c6704a5ec41b08971fa613ade309a0a85cb611b56b592dc2a25e247183e634ea3378 SHA512 cc3dfb8d4b4841ba777355c537175259d0019159ff462358320674b85082cccd99f6462f60fee66228ddfb88fade043445c1bac62504aa1462ba61b7e2751de7 |
31 |
|
32 |
diff --git a/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-llvm-link.patch b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-llvm-link.patch |
33 |
new file mode 100644 |
34 |
index 000000000000..9e6dc38921e2 |
35 |
--- /dev/null |
36 |
+++ b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-llvm-link.patch |
37 |
@@ -0,0 +1,13 @@ |
38 |
+https://bugs.gentoo.org/851702#c4 |
39 |
+Adapt to libLLVM.so instead of the seperated libs |
40 |
+=================================================================== |
41 |
+--- ROCm-Device-Libs-rocm-5.0.2.orig/utils/prepare-builtins/CMakeLists.txt |
42 |
++++ ROCm-Device-Libs-rocm-5.0.2/utils/prepare-builtins/CMakeLists.txt |
43 |
+@@ -26,5 +26,5 @@ set_target_properties(prepare-builtins P |
44 |
+ CXX_STANDARD_REQUIRED Yes |
45 |
+ CXX_EXTENSIONS No) |
46 |
+ llvm_update_compile_flags(prepare-builtins) |
47 |
+-llvm_map_components_to_libnames(llvm_libs support core bitreader bitwriter) |
48 |
+-target_link_libraries(prepare-builtins ${llvm_libs}) |
49 |
++llvm_map_components_to_libnames(llvm_libs support) |
50 |
++target_link_libraries(prepare-builtins ${llvm_libs} LLVM) |
51 |
|
52 |
diff --git a/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-test-bitcode-dir.patch b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-test-bitcode-dir.patch |
53 |
new file mode 100644 |
54 |
index 000000000000..9047f8ef90e5 |
55 |
--- /dev/null |
56 |
+++ b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-test-bitcode-dir.patch |
57 |
@@ -0,0 +1,24 @@ |
58 |
+lib/amdgcn/bitcode is not among the default bitcode dirs of clang |
59 |
+Add --rocm-device-lib-path to the clang argument |
60 |
+Excerpt from https://salsa.debian.org/rocm-team/rocm-device-libs/-/blob/d2014eed680ccce5f9bd61ff4fc28a89682575f3/debian/patches/cmake-amdgcn-bitcode.patch |
61 |
+============================================== |
62 |
+--- rocm-device-libs.orig/test/constant_folding/RunConstantFoldTest.cmake |
63 |
++++ rocm-device-libs/test/constant_folding/RunConstantFoldTest.cmake |
64 |
+@@ -16,6 +16,7 @@ |
65 |
+ -target amdgcn-amd-amdhsa -mcpu=${TEST_CPU} |
66 |
+ -Xclang -finclude-default-header |
67 |
+ --rocm-path=${BINARY_DIR} |
68 |
++ --rocm-device-lib-path=${AMDGCN_BITCODES} |
69 |
+ -mllvm -amdgpu-simplify-libcall=0 |
70 |
+ -o ${OUTPUT_FILE} ${INPUT_FILE} |
71 |
+ RESULT_VARIABLE CLANG_RESULT |
72 |
+--- rocm-device-libs.orig/test/constant_folding/CMakeLists.txt |
73 |
++++ rocm-device-libs/test/constant_folding/CMakeLists.txt |
74 |
+@@ -30,6 +30,7 @@ |
75 |
+ -DFILECHECK_BIN=${FILECHECK_BIN} |
76 |
+ -DOUTPUT_FILE=output.${name}.ll |
77 |
+ -DINPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${name}.cl |
78 |
++ -DAMDGCN_BITCODES=${PROJECT_BINARY_DIR}/lib/amdgcn/bitcode |
79 |
+ -DTEST_CPU=gfx900 |
80 |
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/RunConstantFoldTest.cmake) |
81 |
+ endfunction() |
82 |
|
83 |
diff --git a/dev-libs/rocm-device-libs/rocm-device-libs-5.1.3.ebuild b/dev-libs/rocm-device-libs/rocm-device-libs-5.1.3.ebuild |
84 |
new file mode 100644 |
85 |
index 000000000000..61871fbface9 |
86 |
--- /dev/null |
87 |
+++ b/dev-libs/rocm-device-libs/rocm-device-libs-5.1.3.ebuild |
88 |
@@ -0,0 +1,47 @@ |
89 |
+# Copyright 1999-2022 Gentoo Authors |
90 |
+# Distributed under the terms of the GNU General Public License v2 |
91 |
+ |
92 |
+EAPI=8 |
93 |
+ |
94 |
+inherit cmake llvm |
95 |
+ |
96 |
+LLVM_MAX_SLOT=14 |
97 |
+ |
98 |
+if [[ ${PV} == *9999 ]] ; then |
99 |
+ EGIT_REPO_URI="https://github.com/RadeonOpenCompute/ROCm-Device-Libs/" |
100 |
+ inherit git-r3 |
101 |
+ S="${WORKDIR}/${P}/src" |
102 |
+else |
103 |
+ SRC_URI="https://github.com/RadeonOpenCompute/ROCm-Device-Libs/archive/rocm-${PV}.tar.gz -> ${P}.tar.gz" |
104 |
+ S="${WORKDIR}/ROCm-Device-Libs-rocm-${PV}" |
105 |
+ KEYWORDS="~amd64" |
106 |
+fi |
107 |
+ |
108 |
+DESCRIPTION="Radeon Open Compute Device Libraries" |
109 |
+HOMEPAGE="https://github.com/RadeonOpenCompute/ROCm-Device-Libs" |
110 |
+ |
111 |
+LICENSE="MIT" |
112 |
+SLOT="0/$(ver_cut 1-2)" |
113 |
+IUSE="test" |
114 |
+RESTRICT="!test? ( test )" |
115 |
+ |
116 |
+RDEPEND="sys-devel/clang:${LLVM_MAX_SLOT}" |
117 |
+DEPEND="${RDEPEND}" |
118 |
+ |
119 |
+CMAKE_BUILD_TYPE=Release |
120 |
+ |
121 |
+PATCHES=( "${FILESDIR}/${PN}-5.1.3-test-bitcode-dir.patch" |
122 |
+ "${FILESDIR}/${PN}-5.1.3-llvm-link.patch" ) |
123 |
+ |
124 |
+src_prepare() { |
125 |
+ sed -e "s:amdgcn/bitcode:lib/amdgcn/bitcode:" -i "${S}/cmake/OCL.cmake" || die |
126 |
+ sed -e "s:amdgcn/bitcode:lib/amdgcn/bitcode:" -i "${S}/cmake/Packages.cmake" || die |
127 |
+ cmake_src_prepare |
128 |
+} |
129 |
+ |
130 |
+src_configure() { |
131 |
+ local mycmakeargs=( |
132 |
+ -DLLVM_DIR="$(get_llvm_prefix "${LLVM_MAX_SLOT}")" |
133 |
+ ) |
134 |
+ cmake_src_configure |
135 |
+} |