diff --git a/sci-libs/hipCUB/Manifest b/sci-libs/hipCUB/Manifest index fa73b33791b04..7b519c80e8410 100644 --- a/sci-libs/hipCUB/Manifest +++ b/sci-libs/hipCUB/Manifest @@ -2,4 +2,6 @@ DIST hipCUB-6.3.3.tar.gz 387580 BLAKE2B e0b605835be2b685c1cfa099a807e30fa061af8b DIST hipCUB-6.4.3.tar.gz 419173 BLAKE2B 7e1e707210191eee00aab01f8768a272f1fb5c35bb9e0635fe32ad50f4a8b56634d5f097f5eb2d1d5625f30f62450368a25a95ac2ba8fe85da2effd8efd669c9 SHA512 fb8018cf6200a468601149b6508b50944a27c3f7562012fef39e3a0ca13ed5ff597b1a3ad9e02273b70020ebd19ed10322e46d324f09fcf32a4f363e0ba72036 DIST hipCUB-7.0.2.tar.gz 442494 BLAKE2B 62357955317e612f49023db12f844ea04ed8c16930000ce805c5a4bdd9c53207b6a064a5770bfb74f01f06872f72f0649b8322dda704816e608c2691ab6526cc SHA512 2c26a622c82e53d5e06cfb45066aac4bb4f7702b96d7753eb9acc0266fb8bc9c3f3068dba2acf023b1644be95bbe48e3a554db053e446757651615f9bd5ef7a6 DIST hipCUB-7.1.0.tar.gz 471831 BLAKE2B edb368f37577600762a3c88d2af4c99e1696d033b66e6afb251e52b2bcc6baf8ed1375f75b69717421f449cada6a010eb652fceace5b408dbb3c6be004e8f7cc SHA512 165d08b75ef81becfce3c279f7ac8aaf0efee79d5d450450a8396b95f043b14716d8ac9c00047bec32ba21913b64ded51898e903959842fbf7d5a97328c7281a +DIST hipcub-10.1.0.tar.gz 471369 BLAKE2B 82f6f815a6a60c12ec3f25db5beca4a94dea501b66eb6c1c44845932bf33ffb38d9256ca3d0da2766801cca972ea268d6946610fac105e477a7225b53f5d923d SHA512 2fb9cc6e44ff67f9b9b7a251dcb2bb8b84f9cb2a1ad5b17697fb4567d979d205bf9c1d31087966df25dee07e78dc092fbbeefff7feccd100b22aa8632595ba7e DIST hipcub-7.2.0.tar.gz 472731 BLAKE2B e1ccb8e37edf5e79191ff9d5308714f582d7fcb8d8e3ebcc0fd1f5062fd87efa3b1edf9664e90d326bd5422f3029a17bdfef6f2d2d6f2e1be5b6eff79fb19367 SHA512 51249e1ff3cf801e6a843a4aac961e41be8e2c7d3fe1662d37f7e7d1d8cf6697bbd0899a7252649cae37bc0113458efd74f889fcb7bcd628471016543c5a7ea6 +DIST primbench-10.1.0.tar.gz 759781 BLAKE2B 5b9a302fcfd6ee7c46c61932a6cd771c5502ab07f0a117dc6abb3de6a98bcb33a9ca57332736b3bb3f526b9a974f1a41f4b1895d147575df35a3c6c2498aa750 SHA512 264bccd9bc53d38a68b1c1769e7b956bee6771eeb2532e1c296c757f8b9697ccc2b53bbf74f1579c3a22523707a31be087694ea858afefa91c06480ee93088a8 diff --git a/sci-libs/hipCUB/files/hipCUB-10.1.0-libcxx.patch b/sci-libs/hipCUB/files/hipCUB-10.1.0-libcxx.patch new file mode 100644 index 0000000000000..a2d630593b0bd --- /dev/null +++ b/sci-libs/hipCUB/files/hipCUB-10.1.0-libcxx.patch @@ -0,0 +1,48 @@ +Fix build of tests with libc++ + +- The exclusive_scan fallback for libstdc++ < 9 was selected by mistake + (GLIBCXX_RELEASE instead of _GLIBCXX_RELEASE), and not defined without + libstdc++. +- sparse_matrix.hpp has a global "using namespace std", which makes __all + in the HIP headers ambiguous with std::__all from libc++. Include it + after the HIP headers. +--- a/test/hipcub/test_hipcub_block_radix_rank.cpp ++++ b/test/hipcub/test_hipcub_block_radix_rank.cpp +@@ -605,7 +605,7 @@ void rank_with_prefix_sum_kernel(const KeyType* keys_input, + } + } + +-#if defined(_GLIBCXX_RELEASE) && (GLIBCXX_RELEASE < 9) ++#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) + + /** + * name this function fall_back_exclusive_scan to prevent +@@ -722,7 +722,7 @@ void test_radix_rank_with_prefix_sum_output() + + ++histogram[bit_rep]; + } +- #if defined(_WIN32) || (defined(_GLIBCXX_RELEASE) && (GLIBCXX_RELEASE >= 9)) ++ #if !defined(_GLIBCXX_RELEASE) || (_GLIBCXX_RELEASE >= 9) + std::exclusive_scan(histogram.begin(), + histogram.end(), + pfs_expected.begin() + pfs_offset, +--- a/test/hipcub/test_hipcub_device_spmv.cpp ++++ b/test/hipcub/test_hipcub_device_spmv.cpp +@@ -20,14 +20,15 @@ + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + // SOFTWARE. + +-#include "experimental/sparse_matrix.hpp" +- + #include + #include + + #include "common_test_header.hpp" + #include "test_utils_assertions.hpp" + ++// after the HIP headers: it has a global "using namespace std" ++#include "experimental/sparse_matrix.hpp" ++ + hipcub::CachingDeviceAllocator g_allocator; + + static constexpr float alpha_const = 1.0f; diff --git a/sci-libs/hipCUB/files/hipCUB-10.1.0-no-tests-install.patch b/sci-libs/hipCUB/files/hipCUB-10.1.0-no-tests-install.patch new file mode 100644 index 0000000000000..c8fe54afb0c42 --- /dev/null +++ b/sci-libs/hipCUB/files/hipCUB-10.1.0-no-tests-install.patch @@ -0,0 +1,33 @@ +Do not install tests +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -58,7 +58,6 @@ function(add_relative_test test_name test_target resource_group) + ENVIRONMENT "LLVM_PROFILE_FILE=${PROFILE_DIR}/profraw/hipcub-coverage_%m.profraw" + ) + endif() +- rocm_install(TARGETS ${test_target} COMPONENT tests) + file(APPEND "${INSTALL_TEST_FILE}" "add_test(${test_name} \"../${EXE_NAME}\")\n") + # Set the resource group for the test. This must correspond to a gfxID present in resources.json. + file(APPEND "${INSTALL_TEST_FILE}" "set_tests_properties([=[${test_name}]=] PROPERTIES RESOURCE_GROUPS \"1,${resource_group}:1\")\n") +@@ -174,21 +173,3 @@ else() + "${ROCM_LIBRARIES_ROOT}/shared/ctest/TestCategories.cmake - " + "skipping hipCUB test category labels") + endif() +- +- +-rocm_install( +- FILES "${INSTALL_TEST_FILE}" +- DESTINATION "${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}" +- COMPONENT tests +- RENAME "CTestTestfile.cmake" +-) +- +-# Install the executable using the standard install command instead of rocm_install +-# since we want to put it in a custom DESTINATION (rocm_install does not support +-# the DESTINATION option for TARGETS). +-set_property(TARGET generate_resource_spec APPEND PROPERTY INSTALL_RPATH "$ORIGIN/../../lib") +-install( +- TARGETS generate_resource_spec +- DESTINATION "${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}" +- COMPONENT tests +-) diff --git a/sci-libs/hipCUB/hipCUB-10.1.0.ebuild b/sci-libs/hipCUB/hipCUB-10.1.0.ebuild new file mode 100644 index 0000000000000..3bd30d0c97eb2 --- /dev/null +++ b/sci-libs/hipCUB/hipCUB-10.1.0.ebuild @@ -0,0 +1,79 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +ROCM_VERSION=${PV} + +inherit cmake rocm + +DESCRIPTION="Wrapper of rocPRIM or CUB for GPU parallel primitives" +HOMEPAGE="https://github.com/ROCm/rocm-libraries/tree/develop/projects/hipcub" +SRC_URI=" + https://github.com/ROCm/rocm-libraries/releases/download/therock-${PV%.0}/hipcub.tar.gz -> hipcub-${PV}.tar.gz + benchmark? ( + https://github.com/ROCm/rocm-libraries/releases/download/therock-${PV%.0}/primbench.tar.gz + -> primbench-${PV}.tar.gz + ) +" +S="${WORKDIR}/hipcub" + +LICENSE="BSD" +SLOT="0/$(ver_cut 1-2)" +KEYWORDS="~amd64" +IUSE="benchmark test" +REQUIRED_USE=" + benchmark? ( ${ROCM_REQUIRED_USE} ) + test? ( ${ROCM_REQUIRED_USE} ) +" +RESTRICT="!test? ( test )" + +RDEPEND=" + benchmark? ( dev-util/hip:${SLOT} ) +" +DEPEND=" + ${RDEPEND} + dev-util/hip:${SLOT} + sci-libs/rocPRIM:${SLOT} + test? ( dev-cpp/gtest ) +" + +PATCHES=( + "${FILESDIR}"/${PN}-10.1.0-no-tests-install.patch + "${FILESDIR}"/${PN}-10.1.0-libcxx.patch +) + +src_prepare() { + # primbench comes from its own tarball + if use benchmark; then + sed -e "s:\.\./\.\./\.\./shared/primbench:${WORKDIR}/primbench:" \ + -i benchmark/CMakeLists.txt || die + fi + + # the test writes to (and compares) vectors that are only reserve()d + sed -e "s/\(expected\|h_output\)\.reserve(extents_size)/\1.resize(extents_size)/" \ + -i test/hipcub/test_hipcub_device_for.cpp || die + + cmake_src_prepare +} + +src_configure() { + rocm_use_clang + + local mycmakeargs=( + -DGPU_TARGETS="$(get_amdgpu_flags)" + -DBUILD_TEST=$(usex test ON OFF) + -DBUILD_BENCHMARK=$(usex benchmark ON OFF) + ) + + cmake_src_configure +} + +src_test() { + check_amdgpu + # Expected time on gfx1100 (-j32) is 85s + # Inputs of 2^30..2^34 elements: either many GiB of memory, or kernels running for many + # seconds. On APUs both starve the display (gfx ring timeout, crashing the desktop session). + local -x GTEST_FILTER="-*LargeIndices*:*LargeSize*:HipcubDeviceRadixSort.SortKeysOver4G" + cmake_src_test +}