public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/rocm-device-libs/files/, dev-libs/rocm-device-libs/
@ 2022-08-06 14:23 Benda XU
  0 siblings, 0 replies; 3+ messages in thread
From: Benda XU @ 2022-08-06 14:23 UTC (permalink / raw
  To: gentoo-commits

commit:     c42a36956f512554fb0992cf4fe2ac34e47de3cd
Author:     Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Wed Jun 15 06:48:50 2022 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Sat Aug  6 14:20:20 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c42a3695

dev-libs/rocm-device-libs: add 5.1.3

Drop llvm-roc dependency, depend on vanilla clang.
Correct bitcode path in test for unpatched clang.

Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 dev-libs/rocm-device-libs/Manifest                 |  1 +
 .../files/rocm-device-libs-5.1.3-llvm-link.patch   | 13 ++++++
 .../rocm-device-libs-5.1.3-test-bitcode-dir.patch  | 24 +++++++++++
 .../rocm-device-libs/rocm-device-libs-5.1.3.ebuild | 47 ++++++++++++++++++++++
 4 files changed, 85 insertions(+)

diff --git a/dev-libs/rocm-device-libs/Manifest b/dev-libs/rocm-device-libs/Manifest
index caad548c25f9..b9dc17091c0c 100644
--- a/dev-libs/rocm-device-libs/Manifest
+++ b/dev-libs/rocm-device-libs/Manifest
@@ -8,3 +8,4 @@ DIST rocm-device-libs-4.2.0.tar.gz 231971 BLAKE2B 292798ec29b6feb268928a41d7a321
 DIST rocm-device-libs-4.3.0.tar.gz 234910 BLAKE2B af306219df395f9c5e65e6e06dff976698b80009d3b0c330c396c3e9475dca124bee4c96ff31724763bf40b3fd611f1ef55a7fb675f5ef82b992e496bc3a2d6d SHA512 6e93b435d782a50f45d17bafb466ee05df88c39d665a8d796b68d588b6074629934c44afaae233fc84a238dc9c93d15917efeec7633349b4e894f3b3385bf57e
 DIST rocm-device-libs-4.5.2.tar.gz 244532 BLAKE2B fd13f3e518dc0922bb4e2a49863e3b86238158431189f4d4e9665f7e7b1adfa78ca96d915a3737b0da476cfbffcf0a0ad8840349a22062f59a83f59bc9edd05a SHA512 5da2efd685c279ebb1bf67e27e1a8febb20dcdcf33136667b9bf2ca0d3684b366237358269a0c221dd602af37503aa766842cd1932b2711b562c1fc94cd2ae70
 DIST rocm-device-libs-5.0.2.tar.gz 242099 BLAKE2B 3fc2afc3a837557da04bcd5673656c08d0b5ebf48fd6568a4b1687d157dc4b08e3b5cd219a7bf3c2ed82ca1391477c32c42b4e594d07ad47ef429061be351af9 SHA512 1c37401641080e511f325cddb62490c8827d1bcef7f2198449246afbd391162ed3294c24b0529e1b3669129e29544989e2cf12d46c90fea8d880c52cfdca5a72
+DIST rocm-device-libs-5.1.3.tar.gz 242862 BLAKE2B 68d66de897f461e9f876de5fe2214803d4c00665651dea6af0952f0ce579c6704a5ec41b08971fa613ade309a0a85cb611b56b592dc2a25e247183e634ea3378 SHA512 cc3dfb8d4b4841ba777355c537175259d0019159ff462358320674b85082cccd99f6462f60fee66228ddfb88fade043445c1bac62504aa1462ba61b7e2751de7

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
new file mode 100644
index 000000000000..9e6dc38921e2
--- /dev/null
+++ b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-llvm-link.patch
@@ -0,0 +1,13 @@
+https://bugs.gentoo.org/851702#c4
+Adapt to libLLVM.so instead of the seperated libs
+===================================================================
+--- ROCm-Device-Libs-rocm-5.0.2.orig/utils/prepare-builtins/CMakeLists.txt
++++ ROCm-Device-Libs-rocm-5.0.2/utils/prepare-builtins/CMakeLists.txt
+@@ -26,5 +26,5 @@ set_target_properties(prepare-builtins P
+   CXX_STANDARD_REQUIRED Yes
+   CXX_EXTENSIONS No)
+ llvm_update_compile_flags(prepare-builtins)
+-llvm_map_components_to_libnames(llvm_libs support core bitreader bitwriter)
+-target_link_libraries(prepare-builtins ${llvm_libs})
++llvm_map_components_to_libnames(llvm_libs support)
++target_link_libraries(prepare-builtins ${llvm_libs} LLVM)

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
new file mode 100644
index 000000000000..9047f8ef90e5
--- /dev/null
+++ b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.1.3-test-bitcode-dir.patch
@@ -0,0 +1,24 @@
+lib/amdgcn/bitcode is not among the default bitcode dirs of clang
+Add --rocm-device-lib-path to the clang argument
+Excerpt from https://salsa.debian.org/rocm-team/rocm-device-libs/-/blob/d2014eed680ccce5f9bd61ff4fc28a89682575f3/debian/patches/cmake-amdgcn-bitcode.patch
+==============================================
+--- rocm-device-libs.orig/test/constant_folding/RunConstantFoldTest.cmake
++++ rocm-device-libs/test/constant_folding/RunConstantFoldTest.cmake
+@@ -16,6 +16,7 @@
+   -target amdgcn-amd-amdhsa -mcpu=${TEST_CPU}
+   -Xclang -finclude-default-header
+   --rocm-path=${BINARY_DIR}
++  --rocm-device-lib-path=${AMDGCN_BITCODES}
+   -mllvm -amdgpu-simplify-libcall=0
+   -o ${OUTPUT_FILE} ${INPUT_FILE}
+   RESULT_VARIABLE CLANG_RESULT
+--- rocm-device-libs.orig/test/constant_folding/CMakeLists.txt
++++ rocm-device-libs/test/constant_folding/CMakeLists.txt
+@@ -30,6 +30,7 @@
+      -DFILECHECK_BIN=${FILECHECK_BIN}
+      -DOUTPUT_FILE=output.${name}.ll
+      -DINPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${name}.cl
++     -DAMDGCN_BITCODES=${PROJECT_BINARY_DIR}/lib/amdgcn/bitcode
+      -DTEST_CPU=gfx900
+      -P ${CMAKE_CURRENT_SOURCE_DIR}/RunConstantFoldTest.cmake)
+ endfunction()

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
new file mode 100644
index 000000000000..61871fbface9
--- /dev/null
+++ b/dev-libs/rocm-device-libs/rocm-device-libs-5.1.3.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake llvm
+
+LLVM_MAX_SLOT=14
+
+if [[ ${PV} == *9999 ]] ; then
+	EGIT_REPO_URI="https://github.com/RadeonOpenCompute/ROCm-Device-Libs/"
+	inherit git-r3
+	S="${WORKDIR}/${P}/src"
+else
+	SRC_URI="https://github.com/RadeonOpenCompute/ROCm-Device-Libs/archive/rocm-${PV}.tar.gz -> ${P}.tar.gz"
+	S="${WORKDIR}/ROCm-Device-Libs-rocm-${PV}"
+	KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Radeon Open Compute Device Libraries"
+HOMEPAGE="https://github.com/RadeonOpenCompute/ROCm-Device-Libs"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="sys-devel/clang:${LLVM_MAX_SLOT}"
+DEPEND="${RDEPEND}"
+
+CMAKE_BUILD_TYPE=Release
+
+PATCHES=( "${FILESDIR}/${PN}-5.1.3-test-bitcode-dir.patch"
+	"${FILESDIR}/${PN}-5.1.3-llvm-link.patch" )
+
+src_prepare() {
+	sed -e "s:amdgcn/bitcode:lib/amdgcn/bitcode:" -i "${S}/cmake/OCL.cmake" || die
+	sed -e "s:amdgcn/bitcode:lib/amdgcn/bitcode:" -i "${S}/cmake/Packages.cmake" || die
+	cmake_src_prepare
+}
+
+src_configure() {
+	local mycmakeargs=(
+		-DLLVM_DIR="$(get_llvm_prefix "${LLVM_MAX_SLOT}")"
+	)
+	cmake_src_configure
+}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/rocm-device-libs/files/, dev-libs/rocm-device-libs/
@ 2023-09-03  6:31 罗百科
  0 siblings, 0 replies; 3+ messages in thread
From: 罗百科 @ 2023-09-03  6:31 UTC (permalink / raw
  To: gentoo-commits

commit:     d7990695d7b7abe9d36542ba3408326eed66a6a3
Author:     Patrick Lauer <patrick <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  3 06:16:46 2023 +0000
Commit:     罗百科 <patrick <AT> gentoo <DOT> org>
CommitDate: Sun Sep  3 06:31:23 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d7990695

dev-libs/rocm-device-libs: add 5.5.1

Signed-off-by: Patrick Lauer <patrick <AT> gentoo.org>

 dev-libs/rocm-device-libs/Manifest                 |  2 +
 .../rocm-device-libs-5.5.0-test-bitcode-dir.patch  | 20 +++++++++
 .../rocm-device-libs-5.5.1-fix-llvm-link.patch     | 13 ++++++
 .../rocm-device-libs/rocm-device-libs-5.5.1.ebuild | 49 ++++++++++++++++++++++
 4 files changed, 84 insertions(+)

diff --git a/dev-libs/rocm-device-libs/Manifest b/dev-libs/rocm-device-libs/Manifest
index 2b7764830070..1662b990ec35 100644
--- a/dev-libs/rocm-device-libs/Manifest
+++ b/dev-libs/rocm-device-libs/Manifest
@@ -1,3 +1,5 @@
 DIST rocm-device-libs-5.1.3.tar.gz 242862 BLAKE2B 68d66de897f461e9f876de5fe2214803d4c00665651dea6af0952f0ce579c6704a5ec41b08971fa613ade309a0a85cb611b56b592dc2a25e247183e634ea3378 SHA512 cc3dfb8d4b4841ba777355c537175259d0019159ff462358320674b85082cccd99f6462f60fee66228ddfb88fade043445c1bac62504aa1462ba61b7e2751de7
 DIST rocm-device-libs-5.3.3.tar.gz 245690 BLAKE2B 475c0d818b8b0f090a8daeca2910cd4002e4cdf505d020327f46eb5f864a26937a6a3dfe4ff7b188ebda0f936b1c396f2163bb27b9e2a62c5976e60fa60856ac SHA512 8f6f2fc1534e348e02ba30a25cfc6017f8eab768968b5d0344a5ea7d65c4f0a874072f9e53919c74545814330602ef7c190753c7ff019137230e02f58a5d3a5d
 DIST rocm-device-libs-5.4.3.tar.gz 246095 BLAKE2B eb749346c96d465a5f22831968ccbd71f02749e6aa0d9c2becc0f378641ca0f65c1a131bfd3ed226f838b4208091fcc920b1e31b427adbd69a42881898668e6a SHA512 67b904363a3cff6c15bbd032cbc72cb5cd5f82acaa68c74391dbcf415266e8f35486a496b69b69e1fc0721e0e4e21fb6a6b9c180a46cb59cdcf53916be846ca4
+DIST rocm-device-libs-5.5.0.tar.gz 245903 BLAKE2B 3f9f2e7ed4055a02b10fde9cb2310daefae33cab90f262c60e20734e1cef3e1b4b7def19bafcdb4642e7936615ea88037d230905302c64aecf4fafe44d63a66f SHA512 817a3fe680a2e25115330d94bec9a667c1acbbdff7775c7edc4cf4a9f97ac63d9a5d2684394812572cd505c55215485f477712968fc96bb3748b1c1020e93cfe
+DIST rocm-device-libs-5.5.1.tar.gz 245900 BLAKE2B f713b1f12c7be33a4854d79791f592b8e89e2bc463769ec8cdd807483f0e5ca93d7fc852b6cf41d5ad0401d07adc97de9fb1fa54b77af83f665e282d6c0a43e7 SHA512 0138ddc94ce4a81202bdafccbbecef8145c6ddf82c3a14d92bb80b2bed3d3b73898f84279cef89110c50a9cc51e32de1323cc11a1f97c5da4f7f843b393425d0

diff --git a/dev-libs/rocm-device-libs/files/rocm-device-libs-5.5.0-test-bitcode-dir.patch b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.5.0-test-bitcode-dir.patch
new file mode 100644
index 000000000000..79b61d1517e0
--- /dev/null
+++ b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.5.0-test-bitcode-dir.patch
@@ -0,0 +1,20 @@
+--- rocm-device-libs.orig/test/compile/CMakeLists.txt	2023-05-02 15:23:15.413157017 -0000
++++ rocm-device-libs/test/compile/CMakeLists.txt	2023-05-02 15:32:10.411515448 -0000
+@@ -30,6 +30,7 @@
+      -DFILECHECK_BIN=${FILECHECK_BIN}
+      -DOUTPUT_FILE=output.${name}.${test_cpu}.s
+      -DINPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${func_name}.cl
++     -DAMDGCN_BITCODES=${PROJECT_BINARY_DIR}/lib/amdgcn/bitcode
+      -DTEST_CPU=${test_cpu}
+      -DEXTRA_CHECK_PREFIX=${extra_check_prefixes}
+      -P ${script})
+--- rocm-device-libs.orig/test/compile/RunConstantFoldTest.cmake	2023-02-01 15:17:33.000000000 -0000
++++ rocm-device-libs/test/compile/RunConstantFoldTest.cmake	2023-05-02 15:33:44.634752384 -0000
+@@ -16,6 +16,7 @@
+   -target amdgcn-amd-amdhsa -mcpu=${TEST_CPU}
+   -Xclang -finclude-default-header
+   --rocm-path=${BINARY_DIR}
++  --rocm-device-lib-path=${AMDGCN_BITCODES}
+   -mllvm -amdgpu-simplify-libcall=0
+   -o ${OUTPUT_FILE} ${INPUT_FILE}
+   RESULT_VARIABLE CLANG_RESULT

diff --git a/dev-libs/rocm-device-libs/files/rocm-device-libs-5.5.1-fix-llvm-link.patch b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.5.1-fix-llvm-link.patch
new file mode 100644
index 000000000000..f965045b7e7b
--- /dev/null
+++ b/dev-libs/rocm-device-libs/files/rocm-device-libs-5.5.1-fix-llvm-link.patch
@@ -0,0 +1,13 @@
+https://bugs.gentoo.org/851702#c4
+Adapt to libLLVM.so instead of the seperated libs
+===================================================================
+--- ROCm-Device-Libs-rocm-5.0.2.orig/utils/prepare-builtins/CMakeLists.txt
++++ ROCm-Device-Libs-rocm-5.0.2/utils/prepare-builtins/CMakeLists.txt
+@@ -26,5 +26,5 @@ set_target_properties(prepare-builtins P
+   CXX_STANDARD_REQUIRED Yes
+   CXX_EXTENSIONS No)
+ llvm_update_compile_flags(prepare-builtins)
+-llvm_map_components_to_libnames(llvm_libs support core bitreader bitwriter)
+-target_link_libraries(prepare-builtins ${llvm_libs})
++llvm_map_components_to_libnames(llvm_libs support)
++target_link_libraries(prepare-builtins LLVM)

diff --git a/dev-libs/rocm-device-libs/rocm-device-libs-5.5.1.ebuild b/dev-libs/rocm-device-libs/rocm-device-libs-5.5.1.ebuild
new file mode 100644
index 000000000000..6d104bcdde4e
--- /dev/null
+++ b/dev-libs/rocm-device-libs/rocm-device-libs-5.5.1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake llvm
+
+LLVM_MAX_SLOT=16
+
+if [[ ${PV} == *9999 ]] ; then
+	EGIT_REPO_URI="https://github.com/RadeonOpenCompute/ROCm-Device-Libs/"
+	inherit git-r3
+	S="${WORKDIR}/${P}/src"
+else
+	SRC_URI="https://github.com/RadeonOpenCompute/ROCm-Device-Libs/archive/rocm-${PV}.tar.gz -> ${P}.tar.gz"
+	S="${WORKDIR}/ROCm-Device-Libs-rocm-${PV}"
+	KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Radeon Open Compute Device Libraries"
+HOMEPAGE="https://github.com/RadeonOpenCompute/ROCm-Device-Libs"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="sys-devel/clang:${LLVM_MAX_SLOT}"
+DEPEND="${RDEPEND}"
+
+CMAKE_BUILD_TYPE=Release
+
+PATCHES=(
+	"${FILESDIR}/${PN}-5.4.3-Revert-Update-counters-for-gfx11.patch"
+	"${FILESDIR}/${PN}-5.5.1-fix-llvm-link.patch"
+	)
+
+src_prepare() {
+	sed -e "s:amdgcn/bitcode:lib/amdgcn/bitcode:" -i "${S}/cmake/OCL.cmake" || die
+	sed -e "s:amdgcn/bitcode:lib/amdgcn/bitcode:" -i "${S}/cmake/Packages.cmake" || die
+	cmake_src_prepare
+}
+
+src_configure() {
+	local mycmakeargs=(
+		-DLLVM_DIR="$(get_llvm_prefix "${LLVM_MAX_SLOT}")"
+	)
+	cmake_src_configure
+}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/rocm-device-libs/files/, dev-libs/rocm-device-libs/
@ 2024-07-28  8:00 Patrick Lauer
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick Lauer @ 2024-07-28  8:00 UTC (permalink / raw
  To: gentoo-commits

commit:     365f43025d18775f1d70b9ef6e30a2403cf80fe6
Author:     Patrick Lauer <patrick <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 28 07:57:38 2024 +0000
Commit:     Patrick Lauer <patrick <AT> gentoo <DOT> org>
CommitDate: Sun Jul 28 08:00:39 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=365f4302

dev-libs/rocm-device-libs: add 6.1.2

Signed-off-by: Patrick Lauer <patrick <AT> gentoo.org>

 dev-libs/rocm-device-libs/Manifest                 |   1 +
 .../files/rocm-device-libs-6.1.2-fix-build.patch   | 152 +++++++++++++++++++++
 .../rocm-device-libs/rocm-device-libs-6.1.2.ebuild |  84 ++++++++++++
 3 files changed, 237 insertions(+)

diff --git a/dev-libs/rocm-device-libs/Manifest b/dev-libs/rocm-device-libs/Manifest
index a3682ad63840..91369c2cd3ee 100644
--- a/dev-libs/rocm-device-libs/Manifest
+++ b/dev-libs/rocm-device-libs/Manifest
@@ -1,4 +1,5 @@
 DIST llvm-project-rocm-6.1.1.tar.gz 196027084 BLAKE2B 3ef0b6e3c47c66fd80289373e6ff8aaff44751f9b380addfae73a18dc388093c0535f230b0cc7528724bc43f6992e2ae6decd3d0d3c700893ca95a6166b7b8dc SHA512 e320d4eeaa6f61ed1cdbf653d67fe887d3ce9dc0d6743b4713502e1cb5318ab8afbe1ee71f8cba07635c54ce532df6683de40ade0e5be4a52e50ce25a9b70818
+DIST llvm-project-rocm-6.1.2.tar.gz 195992927 BLAKE2B d821f29f2f1f7c1ff414c63a710281f16d2a394b21f3365d01b86710cc09ed27e514b49fb744bf6a36b38815afa56cc26d44f0238f38479a0c2db9bf9989f389 SHA512 5f7e5dbe5976141de35e96e603624bd9d5a2c08b0690ba9fcd81d1b32f540f94bb9f4b74539e2838fd60ae1312dbe5e0b429ba80a03871782cdf3bd834940ce0
 DIST rocm-device-libs-5.1.3.tar.gz 242862 BLAKE2B 68d66de897f461e9f876de5fe2214803d4c00665651dea6af0952f0ce579c6704a5ec41b08971fa613ade309a0a85cb611b56b592dc2a25e247183e634ea3378 SHA512 cc3dfb8d4b4841ba777355c537175259d0019159ff462358320674b85082cccd99f6462f60fee66228ddfb88fade043445c1bac62504aa1462ba61b7e2751de7
 DIST rocm-device-libs-5.3.3.tar.gz 245690 BLAKE2B 475c0d818b8b0f090a8daeca2910cd4002e4cdf505d020327f46eb5f864a26937a6a3dfe4ff7b188ebda0f936b1c396f2163bb27b9e2a62c5976e60fa60856ac SHA512 8f6f2fc1534e348e02ba30a25cfc6017f8eab768968b5d0344a5ea7d65c4f0a874072f9e53919c74545814330602ef7c190753c7ff019137230e02f58a5d3a5d
 DIST rocm-device-libs-5.4.3.tar.gz 246095 BLAKE2B eb749346c96d465a5f22831968ccbd71f02749e6aa0d9c2becc0f378641ca0f65c1a131bfd3ed226f838b4208091fcc920b1e31b427adbd69a42881898668e6a SHA512 67b904363a3cff6c15bbd032cbc72cb5cd5f82acaa68c74391dbcf415266e8f35486a496b69b69e1fc0721e0e4e21fb6a6b9c180a46cb59cdcf53916be846ca4

diff --git a/dev-libs/rocm-device-libs/files/rocm-device-libs-6.1.2-fix-build.patch b/dev-libs/rocm-device-libs/files/rocm-device-libs-6.1.2-fix-build.patch
new file mode 100644
index 000000000000..e717627893b9
--- /dev/null
+++ b/dev-libs/rocm-device-libs/files/rocm-device-libs-6.1.2-fix-build.patch
@@ -0,0 +1,152 @@
+commit 83ef5b48800a47cc30b3d4bcfdf31de9c3bd0dc8
+Author: Patrick Lauer <patrick@gentoo.org>
+Date:   Sun Jul 28 07:43:54 2024 +0000
+
+    Revert "ockl: Don't use wave32 ballot builtin"
+    
+    This reverts commit 066a0b2716b7ade96a2b3e79e5ddcd0c110e9f98.
+
+diff --git a/ockl/src/dm.cl b/ockl/src/dm.cl
+index 18efc54203b7..a3f06c448aee 100644
+--- a/ockl/src/dm.cl
++++ b/ockl/src/dm.cl
+@@ -287,14 +287,9 @@ first(__global void * v)
+     return __builtin_astype(w2, __global void *);
+ }
+ 
+-// Read val from one active lane whose predicate is one.
+-// If no lanes have the predicate set, return none
+-// This is like first, except that first may not have its predicate set
++REQUIRES_WAVE64
+ static uint
+-elect_uint(int pred, uint val, uint none)
+-{
+-  // Pretend wave32 doesn't exist. The wave64 ballot works, and the high half
+-  // will fold out as 0.
++elect_uint_wave64(int pred, uint val, uint none) {
+     uint ret = none;
+ 
+     ulong mask = __builtin_amdgcn_ballot_w64(pred != 0);
+@@ -306,14 +301,51 @@ elect_uint(int pred, uint val, uint none)
+     return ret;
+ }
+ 
+-// Count the number of nonzero arguments across the wave
++REQUIRES_WAVE32
+ static uint
+-votes(bool b)
++elect_uint_wave32(int pred, uint val, uint none) {
++    uint ret = none;
++    uint mask = __builtin_amdgcn_ballot_w32(pred != 0);
++    if (mask != 0U) {
++        uint l = __ockl_ctz_u32(mask);
++        ret = __builtin_amdgcn_ds_bpermute(l << 2, val);
++    }
++
++    return ret;
++}
++
++// Read val from one active lane whose predicate is one.
++// If no lanes have the predicate set, return none
++// This is like first, except that first may not have its predicate set
++static uint
++elect_uint(int pred, uint val, uint none)
++{
++    return __oclc_wavefrontsize64 ?  elect_uint_wave64(pred, val, none) : elect_uint_wave32(pred, val, none);
++}
++
++REQUIRES_WAVE64
++static uint
++votes_wave64(bool b)
+ {
+     ulong mask = __builtin_amdgcn_ballot_w64(b);
+     return __builtin_popcountl(mask);
+ }
+ 
++REQUIRES_WAVE32
++static uint
++votes_wave32(bool b)
++{
++    uint mask = __builtin_amdgcn_ballot_w32(b);
++    return __builtin_popcount(mask);
++}
++
++// Count the number of nonzero arguments across the wave
++static uint
++votes(bool b)
++{
++    return __oclc_wavefrontsize64 ?  votes_wave64(b) : votes_wave32(b);
++}
++
+ // The kind of the smallest block that can hold sz bytes
+ static uint
+ size_to_kind(uint sz)
+diff --git a/ockl/src/wfaas.cl b/ockl/src/wfaas.cl
+index 3861a5bb3eab..4dab97cea5f7 100644
+--- a/ockl/src/wfaas.cl
++++ b/ockl/src/wfaas.cl
+@@ -21,25 +21,60 @@ static int optimizationBarrierHack(int in_val)
+     return out_val;
+ }
+ 
++REQUIRES_WAVE32
++static bool wfany_impl_w32(int e) {
++    return __builtin_amdgcn_ballot_w32(e) != 0;
++}
++
++REQUIRES_WAVE64
++static bool wfany_impl_w64(int e) {
++    return __builtin_amdgcn_ballot_w64(e) != 0;
++}
++
+ ATTR bool
+ OCKL_MANGLE_I32(wfany)(int e)
+ {
+     e = optimizationBarrierHack(e);
+-    return __builtin_amdgcn_ballot_w64(e) != 0;
++    return __oclc_wavefrontsize64 ?
++        wfany_impl_w64(e) : wfany_impl_w32(e);
++}
++
++REQUIRES_WAVE32
++static bool wfall_impl_w32(int e) {
++    return __builtin_amdgcn_ballot_w32(e) == __builtin_amdgcn_read_exec_lo();
++}
++
++REQUIRES_WAVE64
++static bool wfall_impl_w64(int e) {
++    return __builtin_amdgcn_ballot_w64(e) == __builtin_amdgcn_read_exec();
+ }
+ 
+ ATTR bool
+ OCKL_MANGLE_I32(wfall)(int e)
+ {
+     e = optimizationBarrierHack(e);
+-    return __builtin_amdgcn_ballot_w64(e) == __builtin_amdgcn_read_exec();
++    return __oclc_wavefrontsize64 ?
++        wfall_impl_w64(e) : wfall_impl_w32(e);
++}
++
++
++REQUIRES_WAVE32
++static bool wfsame_impl_w32(int e) {
++    uint u = __builtin_amdgcn_ballot_w32(e);
++    return (u == 0) | (u == __builtin_amdgcn_read_exec_lo());
++}
++
++REQUIRES_WAVE64
++static bool wfsame_impl_w64(int e) {
++    ulong u = __builtin_amdgcn_ballot_w64(e);
++    return (u == 0UL) | (u == __builtin_amdgcn_read_exec());
+ }
+ 
+ ATTR bool
+ OCKL_MANGLE_I32(wfsame)(int e)
+ {
+     e = optimizationBarrierHack(e);
+-    ulong u = __builtin_amdgcn_ballot_w64(e);
+-    return (u == 0UL) | (u == __builtin_amdgcn_read_exec());
++    return __oclc_wavefrontsize64 ?
++        wfsame_impl_w64(e) : wfsame_impl_w32(e);
+ }
+ 

diff --git a/dev-libs/rocm-device-libs/rocm-device-libs-6.1.2.ebuild b/dev-libs/rocm-device-libs/rocm-device-libs-6.1.2.ebuild
new file mode 100644
index 000000000000..a6d5dd67438b
--- /dev/null
+++ b/dev-libs/rocm-device-libs/rocm-device-libs-6.1.2.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_COMPAT=( 18 )
+inherit cmake llvm-r1
+
+MY_P=llvm-project-rocm-${PV}
+components=( "amd/device-libs" )
+
+if [[ ${PV} == *9999 ]] ; then
+	EGIT_REPO_URI="https://github.com/ROCm/llvm-project"
+	inherit git-r3
+	S="${WORKDIR}/${P}/${components[0]}"
+else
+	SRC_URI="https://github.com/ROCm/llvm-project/archive/rocm-${PV}.tar.gz -> ${MY_P}.tar.gz"
+	S="${WORKDIR}/${MY_P}/${components[0]}"
+	KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Radeon Open Compute Device Libraries"
+HOMEPAGE="https://github.com/ROCm/ROCm-Device-Libs"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+	dev-build/rocm-cmake
+	$(llvm_gen_dep '
+		sys-devel/clang:${LLVM_SLOT}
+		sys-devel/lld:${LLVM_SLOT}
+	')
+"
+
+CMAKE_BUILD_TYPE=Release
+
+PATCHES=(
+	"${FILESDIR}/${PN}-5.5.0-test-bitcode-dir.patch"
+	"${FILESDIR}/${PN}-6.1.0-fix-llvm-link.patch"
+	"${FILESDIR}/${PN}-6.0.0-add-gws-attribute.patch"
+	"${FILESDIR}/${PN}-6.1.0-fix-test-failures.patch"
+	"${FILESDIR}/${PN}-6.1.0-fix-test-failures2.patch"
+	"${FILESDIR}/${PN}-6.1.2-fix-build.patch"
+)
+
+src_unpack() {
+	if [[ ${PV} == *9999 ]] ; then
+		git-r3_fetch
+		git-r3_checkout '' . '' "${components[@]}"
+	else
+		archive="${MY_P}.tar.gz"
+		ebegin "Unpacking from ${archive}"
+		tar -x -z -o \
+			-f "${DISTDIR}/${archive}" \
+			"${components[@]/#/${MY_P}/}" || die
+		eend ${?}
+	fi
+}
+
+src_prepare() {
+	sed -e "s:amdgcn/bitcode:lib/amdgcn/bitcode:" -i "${S}/cmake/OCL.cmake" || die
+	sed -e "s:amdgcn/bitcode:lib/amdgcn/bitcode:" -i "${S}/cmake/Packages.cmake" || die
+	cmake_src_prepare
+}
+
+src_configure() {
+	local mycmakeargs=(
+		-DLLVM_DIR="$(get_llvm_prefix)"
+	)
+	# do not trust CMake with autoselecting Clang, as it autoselects the latest one
+	# producing too modern LLVM bitcode and causing linker errors in other packages
+	CC="$(get_llvm_prefix)/bin/clang" CXX="$(get_llvm_prefix)/bin/clang++" cmake_src_configure
+}
+
+src_install() {
+	cmake_src_install
+	local CLANG_EXE="$(get_llvm_prefix)/bin/clang"
+	# install symlink, so that clang won't ask for "--rocm-device-lib-path" flag anymore
+	local bitcodedir="$("${CLANG_EXE}" -print-resource-dir)/$(get_libdir)/amdgcn/bitcode"
+	dosym -r "/usr/lib/amdgcn/bitcode" "${bitcodedir#${EPREFIX}}"
+}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-28  8:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-28  8:00 [gentoo-commits] repo/gentoo:master commit in: dev-libs/rocm-device-libs/files/, dev-libs/rocm-device-libs/ Patrick Lauer
  -- strict thread matches above, loose matches on Subject: below --
2023-09-03  6:31 罗百科
2022-08-06 14:23 Benda XU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox