From 77d1bb6f8d47023aa21aaee830bf3229837233d1 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 5 Mar 2025 01:46:50 +0000 Subject: gentoo auto-resync : 05:03:2025 - 01:46:50 --- dev-util/hip/Manifest | 8 +- dev-util/hip/hip-6.3.0.ebuild | 255 ------------------------------------------ dev-util/hip/hip-6.3.3.ebuild | 255 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 259 insertions(+), 259 deletions(-) delete mode 100644 dev-util/hip/hip-6.3.0.ebuild create mode 100644 dev-util/hip/hip-6.3.3.ebuild (limited to 'dev-util/hip') diff --git a/dev-util/hip/Manifest b/dev-util/hip/Manifest index 99c6eaccf54f..e1bff71a67cb 100644 --- a/dev-util/hip/Manifest +++ b/dev-util/hip/Manifest @@ -21,21 +21,21 @@ AUX hip-test-6.3.0-hipcc-system-install.patch 581 BLAKE2B c84f259404b1eb7cd616b2 DIST hip-5.7.1.tar.gz 553774 BLAKE2B f88c235f688d3a662ec6cb4ad7fe3f82c0015015997871609cc30ab5b2f7fcb9709a08683d77194e45a6dbbe1d24c6355b128d2ecf655f1dea3468711c64e0a3 SHA512 68fa8753725b53c999d102d254c6b1dba53af4e00d6a48db93d10213cc02eec30b4a39c66e773d4f625dd9636cf8b0c5faa05b69fac27cf5a6b19dd3ddd2b905 DIST hip-6.1.1.tar.gz 247192 BLAKE2B c40bb483fb61b3037693f456e546046598df7e0dd81a1f1c8d222ab0d9c0752092ce85c8533bd355f883dda5ce1f32f7ff2b2a58cebac50d53e0e7f4d85ca3ae SHA512 3e6162938294a74af51bc2161ada38dc4ba19614e182238f320f2052a9025be6ea413e40f00cb80f4e86696793d6c4431e2417ea798a2330886a3f3e66aedf0d DIST hip-6.1.2.tar.gz 247193 BLAKE2B e343bdf233752e40cdefa0c2bbd56858bbb471155045ae1adcf651ddff2ed40dc7c7069998a35e9b26324fdf1c972e13e1222406bc52ae2591c23a45611864c5 SHA512 771f6494c7ff0ddb7d22193dfdbb3fb9461f6e4be347ecb879bb84c5a01a95fb4c4d3f7a0f039265d5369f6c6a5b66949af7bc91ed220f5e81a5b15ec98a68eb -DIST hip-6.3.0.tar.gz 1486630 BLAKE2B 97759fa9cbedf9c87dba85b7e3caf030a6f72429aaf63651bfb9fd208a6f6b03e564f5dd973b94dfc07c6b6aea8296c1f9de6a049565a010c14319dc29f2db7a SHA512 86f7c1c18d3ebd14b4e0f6a5b662017145634dd672142ed9d60b4c2310f356b0d7480748b273f3652a4e2fdeaa6a4185a69cd6d45a462c73028a6741c11f092d DIST hip-6.3.2.tar.gz 1486601 BLAKE2B 033a02c9b4bdcfcd8d23281df74f061e557b0027e95a76431a5b7f56922306a317d36896619bfb5106103cb34ac2369b85fd603c7dfd9e4f2a6cc1537b168f81 SHA512 839d19d47326c56ae5f44b39a2f62c215692cf9ddbc292becb3ce5b5d1784d92c98ce8f73bc1a294a2cd7c875568b38c9e2053b3646513516b31a9ab1e91d688 +DIST hip-6.3.3.tar.gz 1486598 BLAKE2B 998b28786c0b156cd1c23a01ce284206d1ad5cad1f207676b9d40994dc4f60d16a1f0804cfa287622826d78871ee19d2b5aa78dc29a69fe54ab50f08652bfd26 SHA512 70544467c5c262fab1e9415f5e77d0ec3b4635b6fa104de5d7ab2da0e2ca88fe40ce716068e50eaa17a807516cd41e2c0af22bcada3a1f7de50aa88283850e38 DIST hip-test-6.1.1.tar.gz 1080605 BLAKE2B 7eddf648be31365479baa0cd4fd1c060a682a6b44d923cac1c4840c0768782db2fef4e5d97318ef0423be1e5c85b1a0cc6b9d324db789dad28be17f64ab38cae SHA512 0dd679c5b94a59e192bea5789f4448b53ac23c8a03b24a347758b1d70ff692483fd4aaea0b19345eb6ffb82a4492ed21958398b53ae6244a244a660dfa33412f DIST hip-test-6.1.2.tar.gz 1080493 BLAKE2B ff501ab92c1d3207e330f5e9630e3300aa52f7c2acfae2173a964a2843952db90eea2b4ecf5db1ec6ba65d7764750b9eae3f2a9641d1a3fc71d5172e3a7264a8 SHA512 09fa4243c8b73ddbe163ff4c60f0f8f4182f1a37071e9747bf95ecdc219ba3a0407bdf1e2391481f537b223565a38f16e918667194666558a469d94f88a1e236 -DIST hip-test-6.3.0.tar.gz 1446413 BLAKE2B c24c352eb16fc54099329edd94a88f59270c92d87b12f86ca4728ae0afdefe6b774bb59927d7c9ec74bd291ef3754a676ad446574abc01170dd7bdc3e5fcb084 SHA512 b10a437a1eb7a8caa80234b9f9d21fbd1442e9f5c0d0bcb237c10743f40a40aef2675128c97f9592af256bad08c93fcc3288e4a289a7efcc626302aba77f149f DIST hip-test-6.3.2.tar.gz 1446861 BLAKE2B c82f8b52807bdae7ea32bd85cccaaea8e01fda440c36ef68603c3cac5d31032b10a21e3828702fec556fa8c262797f08cc2395e042d5db8c6ae601968d47ed8a SHA512 aa162ab73e0ef2b739a8652cdd34eb4fbef130d75ac7aaece030263d820ef0abfb124a10692937da529ac523c386ba2b8241c9a205c820b41e6b7090770653e2 +DIST hip-test-6.3.3.tar.gz 1446849 BLAKE2B 474194bd7cef54af85eab0bc8fdfbe2360a9a22ab27f9014ebbb22f03952bfc014d682e2a0cbf90fcd365b4295df266a64419deebbce38aa7b5b7af9c979cc20 SHA512 65bde402804e95a09142bc2a9866bbef14068b63d09236d70086e15c3927ef29fb75d0859a90aa4bc75ebe03f94da85284b233fb41b95246bb45d1d8fee172ed DIST rocm-5.7.0.tar.gz 845881 BLAKE2B 08255edc1407e5ef85895336b11496319695318fce265565728ad75175b5e1dfab98f696fee2d27e60c48e862f721fad4c53118cc70b807353fff5f97ed72ac2 SHA512 72420e16c7cfe9687e030331838666dabaa43d686bdad1d109431e44db99070a2cf6dd64b59e3275019abedd6612f6008c798a79275e7225b6b122fb9f644660 DIST rocm-clr-5.7.1.tar.gz 2008647 BLAKE2B 3db0760d6f83504e60caf88a2dd5e0bc02c7db9d6f263ad0eb2cfc79aa0f88a3699c412844a0158a796d9d02e79660287e791edad787d814eefffea4fd2298b4 SHA512 d79323481d82fc02c12a32cdcc0d14437d512af023e7737db0387b7eecb27fe6e4ae7c71d6adce57932a04bb24c880440d9dc10aeb5af11a4f2ca64d44330965 DIST rocm-clr-6.1.1.tar.gz 2031034 BLAKE2B b0485bb015d31986f4988d1db0c029c826856e50b5bb1b58fac2097c14b3966668f1b8d41ec198889e27ac860497a8b3c081ec31d52390d5c9ff5db092bf7cce SHA512 86925e8b9a9e77b06a57daefbc7279887b4ef7c6a79c3717bc2f2d3bf29926281c60063fd17e21c65d7def520d9f579bf88f69051d053a38750ba968f69ca3fc DIST rocm-clr-6.1.2.tar.gz 2031283 BLAKE2B d51d32a77794ea97f1a3817786c9fd6b482106b665eea6e2c9b4c11e4dce19a3486386eb5ba111554c2d82c30e2a93add7502eed5768caf3fb709fb5fbb2e71b SHA512 e97224451864efe0084c4117f54893c9624a6a9f365a0b4abad08fd9635f008dea742dc589429fbb714e1b8177d06362c0f5a741f6c4a050d0fd4d48da72d54b -DIST rocm-clr-6.3.0.tar.gz 2093572 BLAKE2B 14f75f9f5dc4000a2abf28e523659def8cd96112c9c8b95abb634c33433077faa3ddab3fbe659e0ed2e1f309f63a93b7eb03fa6f246b4cea06ca8c512c13308a SHA512 f005baaf2a8f63946811db990e2d373906b31a4085a51427d407c9e4c1d877a14aeb713190a285953cadb960b5517570941c60e2f998adb2b1f9833f1d2f5925 DIST rocm-clr-6.3.2.tar.gz 2095677 BLAKE2B 2f1122a2058f8ba358fe48a46473f23c46a5413fef16515f103c21a8ae13bb76522fbe587cb9c9e6e3dd06f968402b6a881391823c80381c0c41072597c845ac SHA512 5bade294dc6fc60bf459bfd7124c354f2b0079167d3c8776a9e3d6d8320bb9b1a2a0770a466987e164994293024bf47de158ba207f077968dfccb7bf20fb884b +DIST rocm-clr-6.3.3.tar.gz 2095704 BLAKE2B bdb315fc9f1f9c76aa2a345bd48a600c81f3b72eb68fee8862b5e155e7519bef6f6421698a43358c6fe0200bb0b6924ff819860d9a91a5c07fc3e9d44eeb1b16 SHA512 94d2959b981b324e0dae2d06e86c72cd01fa495de081666bcec2445c02bada22aa60e94ecac0ee63e70e52275f92caeefcb6dc96a3f0fba593896be7b0d8ab42 EBUILD hip-5.7.1-r2.ebuild 5478 BLAKE2B 0f74b620566350e7e4dbc3be3f1c1a475f961521a2c6e00d254578cc681e174a6614ca0001067887f18c9fbd806adc95c07f4e72408c5e941cb57ef0d1934b0d SHA512 d575b6cb55b4468112b44be981029808d35620b0480709e644f6bd821d240650ecec31fbaedb6270faed8a648b8509b2a571500418171235e6a1874def6e8269 EBUILD hip-6.1.1.ebuild 6720 BLAKE2B 85e752a8d1c409fff2bfed9ea139a9130e4de5c953ceb5a6c1e57f784da42d5326434f72fdf04db4a1592e23b3f7dfc48aaf7738492bfaa50a5a7cac65bf185f SHA512 2567f8f8566289f782c322eb6701ad1bd750150cadd29ea0cd061e184e3ba5fcf4a78550457c6e4b92db9c5743ca40c6e201cbb120fc9f546aa3e7b6e0c26478 EBUILD hip-6.1.2.ebuild 6728 BLAKE2B 2353a8dd93b3bccc1f78119b257209ce4bd53f51ebe07d4867b8df3fab43bd3dfb22f025b216f2b9f37cfdf787f7275c4b8c30e2897d6c1345ff13bd4980049c SHA512 9606245500e1c82bff0b6b0e33eaed4ae2bbc68874af66dc4d27f1830f889c225642f52ab9a565a9bc4720d2a02102389676f44565d49fe0ce5d381cb469ca2b -EBUILD hip-6.3.0.ebuild 6901 BLAKE2B ba577f9729928d15c232dcabbd9eb8a4a52e954a46656d012505c853bf8c0fe94bcda4793e1b19b8aefae5b0a9b1b1ba11821f76aa069914268c77cd950fe104 SHA512 b5b17cea0a25aff604c0a5be1487d46aa4e20257b478f1ceb63c702f2dc8709a4e8a63078544f37cead4a40b0efac2ee9eb008ec6dd6837fb4b30fb81175e31e EBUILD hip-6.3.2.ebuild 6901 BLAKE2B bafbe22b008205f56977028d86316d38d1df0326d5f8176b677abd01f0b339c5ab1c5dcb054ac0626f41ef8cd6464d49a7d7b41d648fb267a5d7025adee9b91c SHA512 bafae25c570d242635358f629934a9e455d5e541135a533b45963f90e996e291d34029122e6cd18a8b9f475cd3d0a1536e98279740f25920ef61954766e53c95 +EBUILD hip-6.3.3.ebuild 6901 BLAKE2B bafbe22b008205f56977028d86316d38d1df0326d5f8176b677abd01f0b339c5ab1c5dcb054ac0626f41ef8cd6464d49a7d7b41d648fb267a5d7025adee9b91c SHA512 bafae25c570d242635358f629934a9e455d5e541135a533b45963f90e996e291d34029122e6cd18a8b9f475cd3d0a1536e98279740f25920ef61954766e53c95 MISC metadata.xml 1076 BLAKE2B 816a3628360882d89e2bc64f7b5be6442ad4fb0866b6a8291c4701a03e626d9482b93980b34e5ab21c37bda025359978b471d09e2d4817ceeb209d83afaecbfe SHA512 009079d56a9fb1c3212dc4e67dd88bc16bbc6350bb832912543b2a1e6747c77d13021e7a94da9a4c9371722828214b308246e7ad58406276126cdf6e44281506 diff --git a/dev-util/hip/hip-6.3.0.ebuild b/dev-util/hip/hip-6.3.0.ebuild deleted file mode 100644 index 44e28cebea57..000000000000 --- a/dev-util/hip/hip-6.3.0.ebuild +++ /dev/null @@ -1,255 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -DOCS_BUILDER="doxygen" -DOCS_DEPEND="media-gfx/graphviz" -ROCM_SKIP_GLOBALS=1 - -LLVM_COMPAT=( 19 ) - -inherit cmake docs flag-o-matic llvm-r1 rocm - -TEST_PV=${PV} - -DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability" -HOMEPAGE="https://github.com/ROCm/clr" -SRC_URI=" - https://github.com/ROCm/clr/archive/refs/tags/rocm-${PV}.tar.gz -> rocm-clr-${PV}.tar.gz - https://github.com/ROCm/HIP/archive/refs/tags/rocm-${PV}.tar.gz -> hip-${PV}.tar.gz - test? ( - https://github.com/ROCm/hip-tests/archive/refs/tags/rocm-${TEST_PV}.tar.gz -> hip-test-${TEST_PV}.tar.gz - ) -" -S="${WORKDIR}/clr-rocm-${PV}/" -TEST_S="${WORKDIR}/hip-tests-rocm-${TEST_PV}/catch" -HIP_S="${WORKDIR}/HIP-rocm-${PV}" - -LICENSE="MIT" -SLOT="0/$(ver_cut 1-2)" -KEYWORDS="~amd64" - -IUSE="debug +hip opencl test video_cards_amdgpu video_cards_nvidia" - -# some tests are broken -RESTRICT="test" - -REQUIRED_USE=" - || ( hip opencl ) - ^^ ( video_cards_amdgpu video_cards_nvidia ) -" - -DEPEND=" - video_cards_amdgpu? ( - dev-util/rocminfo:${SLOT} - dev-libs/rocm-comgr:${SLOT} - dev-libs/rocr-runtime:${SLOT} - ) - video_cards_nvidia? ( - dev-libs/hipother:${SLOT} - ) - x11-base/xorg-proto - virtual/opengl -" -BDEPEND=" - video_cards_amdgpu? ( - dev-util/hipcc:${SLOT}[${LLVM_USEDEP}] - ) - test? ( - media-libs/freeglut - ) -" -RDEPEND="${DEPEND} - opencl? ( - !dev-libs/opencl-icd-loader - !dev-libs/rocm-opencl-runtime - !dev-util/clinfo - !dev-util/opencl-headers - ) - video_cards_amdgpu? ( - dev-util/hipcc:${SLOT}[${LLVM_USEDEP}] - dev-libs/rocm-device-libs:${SLOT} - dev-libs/roct-thunk-interface:${SLOT} - ) -" - -PATCHES=( - "${FILESDIR}/${PN}-5.7.1-no_asan_doc.patch" - "${FILESDIR}/${PN}-6.3.0-install.patch" - "${FILESDIR}/${PN}-6.1.1-fix-musl.patch" - "${FILESDIR}/${PN}-6.2.4-libcxx.patch" - "${FILESDIR}/${PN}-6.3.0-no-isystem-usr-include.patch" - "${FILESDIR}/${PN}-6.3.0-clr-fix-libcxx.patch" -) - -hip_test_wrapper() { - local CMAKE_USE_DIR="${TEST_S}" - local BUILD_DIR="${TEST_S}_build" - cd "${TEST_S}" || die - "${@}" -} - -src_prepare() { - # NOTE We do this head stand to safe the patch size. - # NOTE Adjust when we drop 5.7.1 - sed \ - -e 's:kAmdgcnTargetTriple:AMDGCN_TARGET_TRIPLE:g' \ - -i hipamd/src/hip_code_object.cpp || die - eapply "${FILESDIR}/${PN}-5.7.1-extend-isa-compatibility-check.patch" - sed \ - -e 's:AMDGCN_TARGET_TRIPLE:kAmdgcnTargetTriple:g' \ - -i hipamd/src/hip_code_object.cpp || die - - pushd "${HIP_S}" >/dev/null || die - eapply "${FILESDIR}/${PN}-6.3.0-hip-fix-libcxx.patch" - - # hipamd is itself built by cmake, and should never provide a - # FindHIP.cmake module. But the reality is some package relies on it. - # Set HIP and HIP Clang paths directly, don't search using heuristics - sed -e "s:# Search for HIP installation:set(HIP_ROOT_DIR \"${EPREFIX}/usr\"):" \ - -e "s:#Set HIP_CLANG_PATH:set(HIP_CLANG_PATH \"$(get_llvm_prefix -d)/bin\"):" \ - -i "cmake/FindHIP.cmake" || die - popd >/dev/null || die - - sed -e "s/ -Werror//g" -i "hipamd/src/CMakeLists.txt" || die - - cmake_src_prepare - - if use test; then - local PATCHES=( - "${FILESDIR}"/hip-test-6.3.0-hipcc-system-install.patch - "${FILESDIR}"/hip-test-5.7.1-remove-incompatible-flag.patch - "${FILESDIR}"/hip-test-6.1.1-fix-musl.patch - ) - sed -e "s/-Werror //" -e "s/-Wall -Wextra //" -i "${TEST_S}/CMakeLists.txt" || die - - hip_test_wrapper cmake_src_prepare - fi -} - -src_configure() { - # -Werror=strict-aliasing - # https://bugs.gentoo.org/858383 - # https://github.com/ROCm/clr/issues/64 - # - # Do not trust it for LTO either - append-flags -fno-strict-aliasing - filter-lto - - use debug && CMAKE_BUILD_TYPE="Debug" - - # Fix ld.lld linker error: https://github.com/ROCm/HIP/issues/3382 - # See also: https://github.com/gentoo/gentoo/pull/29097 - append-ldflags $(test-flags-CCLD -Wl,--undefined-version) - - local mycmakeargs=( - -DCMAKE_PREFIX_PATH="$(get_llvm_prefix)" - -DCMAKE_SKIP_RPATH=ON - -D__HIP_ENABLE_PCH=OFF - - -DCLR_BUILD_HIP="$(usex hip)" - -DCLR_BUILD_OCL="$(usex opencl)" - - -DHIP_COMMON_DIR="${HIP_S}" - -DHIP_ENABLE_ROCPROFILER_REGISTER=OFF - -DHIPCC_BIN_DIR="${EPREFIX}/usr/bin" - -DROCM_PATH="${EPREFIX}/usr" - -DUSE_PROF_API=OFF - -DFILE_REORG_BACKWARD_COMPATIBILITY=OFF - - -DOpenGL_GL_PREFERENCE="GLVND" - -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON - ) - - if use video_cards_amdgpu; then - mycmakeargs+=( - -DHIP_PLATFORM="amd" - ) - elif use video_cards_nvidia; then - mycmakeargs+=( - -DHIPNV_DIR="${EPREFIX}/usr" - -DHIP_PLATFORM="nvidia" - ) - fi - - cmake_src_configure - - if use test; then - local mycmakeargs=( - -DCMAKE_MODULE_PATH="${TEST_S}/external/Catch2/cmake/Catch2" - -DROCM_PATH="${EPREFIX}/usr" - -DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON - -Wno-dev - - # 1) Use custom build of hipamd instead of system one - # 2) Build fails with libc++: https://github.com/llvm/llvm-project/issues/119076 - -DCMAKE_CXX_FLAGS="-I${BUILD_DIR}/hipamd/include -stdlib=libstdc++" - -DCMAKE_EXE_LINKER_FLAGS="-L${BUILD_DIR}/hipamd/lib" - ) - if use video_cards_amdgpu; then - mycmakeargs+=( - -DHIP_PLATFORM="amd" - ) - elif use video_cards_nvidia; then - mycmakeargs+=( - -DHIP_PLATFORM="nvidia" - ) - fi - hip_test_wrapper cmake_src_configure - fi -} - -src_compile() { - cmake_src_compile - - if use test; then - hip_test_wrapper cmake_src_compile build_tests - fi -} - -src_test() { - check_amdgpu - export LD_LIBRARY_PATH="${BUILD_DIR}/hipamd/lib" - - # TODO: research how to test Vulkan-related features. - local CMAKE_SKIP_TESTS=( - Unit_hipExternalMemoryGetMappedBuffer_Vulkan_Positive_Read_Write - Unit_hipExternalMemoryGetMappedBuffer_Vulkan_Negative_Parameters - Unit_hipImportExternalMemory_Vulkan_Negative_Parameters - Unit_hipWaitExternalSemaphoresAsync_Vulkan_Positive_Binary_Semaphore - Unit_hipWaitExternalSemaphoresAsync_Vulkan_Positive_Multiple_Semaphores - Unit_hipWaitExternalSemaphoresAsync_Vulkan_Negative_Parameters - Unit_hipSignalExternalSemaphoresAsync_Vulkan_Positive_Binary_Semaphore - Unit_hipSignalExternalSemaphoresAsync_Vulkan_Positive_Multiple_Semaphores - Unit_hipSignalExternalSemaphoresAsync_Vulkan_Negative_Parameters - Unit_hipImportExternalSemaphore_Vulkan_Negative_Parameters - Unit_hipDestroyExternalSemaphore_Vulkan_Negative_Parameters - ) - - MAKEOPTS="-j1" hip_test_wrapper cmake_src_test -} - -src_install() { - cmake_src_install - - # add version file that is required by some libraries - mkdir "${ED}"/usr/include/rocm-core || die - cat <<-EOF > "${ED}"/usr/include/rocm-core/rocm_version.h || die - #pragma once - #define ROCM_VERSION_MAJOR $(ver_cut 1) - #define ROCM_VERSION_MINOR $(ver_cut 2) - #define ROCM_VERSION_PATCH $(ver_cut 3) - #define ROCM_BUILD_INFO "$(ver_cut 1-3).0-9999-unknown" - EOF - - dosym -r /usr/include/rocm-core/rocm_version.h /usr/include/rocm_version.h - - if use video_cards_nvidia; then - newenvd - 99hipconfig <<-EOF - HIP_PLATFORM="nvidia" - HIP_RUNTIME="cuda" - CUDA_PATH="${EPREFIX}/opt/cuda" - EOF - fi -} diff --git a/dev-util/hip/hip-6.3.3.ebuild b/dev-util/hip/hip-6.3.3.ebuild new file mode 100644 index 000000000000..de84397fe9fc --- /dev/null +++ b/dev-util/hip/hip-6.3.3.ebuild @@ -0,0 +1,255 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DOCS_BUILDER="doxygen" +DOCS_DEPEND="media-gfx/graphviz" +ROCM_SKIP_GLOBALS=1 + +LLVM_COMPAT=( 19 ) + +inherit cmake docs flag-o-matic llvm-r1 rocm + +TEST_PV=${PV} + +DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability" +HOMEPAGE="https://github.com/ROCm/clr" +SRC_URI=" + https://github.com/ROCm/clr/archive/refs/tags/rocm-${PV}.tar.gz -> rocm-clr-${PV}.tar.gz + https://github.com/ROCm/HIP/archive/refs/tags/rocm-${PV}.tar.gz -> hip-${PV}.tar.gz + test? ( + https://github.com/ROCm/hip-tests/archive/refs/tags/rocm-${TEST_PV}.tar.gz -> hip-test-${TEST_PV}.tar.gz + ) +" +S="${WORKDIR}/clr-rocm-${PV}/" +TEST_S="${WORKDIR}/hip-tests-rocm-${TEST_PV}/catch" +HIP_S="${WORKDIR}/HIP-rocm-${PV}" + +LICENSE="MIT" +SLOT="0/$(ver_cut 1-2)" +KEYWORDS="~amd64" + +IUSE="debug +hip opencl test video_cards_amdgpu video_cards_nvidia" + +# some tests are broken +RESTRICT="test" + +REQUIRED_USE=" + || ( hip opencl ) + ^^ ( video_cards_amdgpu video_cards_nvidia ) +" + +DEPEND=" + video_cards_amdgpu? ( + dev-util/rocminfo:${SLOT} + dev-libs/rocm-comgr:${SLOT} + dev-libs/rocr-runtime:${SLOT} + ) + video_cards_nvidia? ( + dev-libs/hipother:${SLOT} + ) + x11-base/xorg-proto + virtual/opengl +" +BDEPEND=" + video_cards_amdgpu? ( + dev-util/hipcc:${SLOT}[${LLVM_USEDEP}] + ) + test? ( + media-libs/freeglut + ) +" +RDEPEND="${DEPEND} + opencl? ( + !dev-libs/opencl-icd-loader + !dev-libs/rocm-opencl-runtime + !dev-util/clinfo + !dev-util/opencl-headers + ) + video_cards_amdgpu? ( + dev-util/hipcc:${SLOT}[${LLVM_USEDEP}] + dev-libs/rocm-device-libs:${SLOT} + dev-libs/roct-thunk-interface:${SLOT} + ) +" + +PATCHES=( + "${FILESDIR}/${PN}-5.7.1-no_asan_doc.patch" + "${FILESDIR}/${PN}-6.3.0-install.patch" + "${FILESDIR}/${PN}-6.1.1-fix-musl.patch" + "${FILESDIR}/${PN}-6.2.4-libcxx.patch" + "${FILESDIR}/${PN}-6.3.0-no-isystem-usr-include.patch" + "${FILESDIR}/${PN}-6.3.0-clr-fix-libcxx.patch" +) + +hip_test_wrapper() { + local CMAKE_USE_DIR="${TEST_S}" + local BUILD_DIR="${TEST_S}_build" + cd "${TEST_S}" || die + "${@}" +} + +src_prepare() { + # NOTE We do this head stand to safe the patch size. + # NOTE Adjust when we drop 5.7.1 + sed \ + -e 's:kAmdgcnTargetTriple:AMDGCN_TARGET_TRIPLE:g' \ + -i hipamd/src/hip_code_object.cpp || die + eapply "${FILESDIR}/${PN}-5.7.1-extend-isa-compatibility-check.patch" + sed \ + -e 's:AMDGCN_TARGET_TRIPLE:kAmdgcnTargetTriple:g' \ + -i hipamd/src/hip_code_object.cpp || die + + pushd "${HIP_S}" >/dev/null || die + eapply "${FILESDIR}/${PN}-6.3.0-hip-fix-libcxx.patch" + + # hipamd is itself built by cmake, and should never provide a + # FindHIP.cmake module. But the reality is some package relies on it. + # Set HIP and HIP Clang paths directly, don't search using heuristics + sed -e "s:# Search for HIP installation:set(HIP_ROOT_DIR \"${EPREFIX}/usr\"):" \ + -e "s:#Set HIP_CLANG_PATH:set(HIP_CLANG_PATH \"$(get_llvm_prefix -d)/bin\"):" \ + -i "cmake/FindHIP.cmake" || die + popd >/dev/null || die + + sed -e "s/ -Werror//g" -i "hipamd/src/CMakeLists.txt" || die + + cmake_src_prepare + + if use test; then + local PATCHES=( + "${FILESDIR}"/hip-test-6.3.0-hipcc-system-install.patch + "${FILESDIR}"/hip-test-5.7.1-remove-incompatible-flag.patch + "${FILESDIR}"/hip-test-6.1.1-fix-musl.patch + ) + sed -e "s/-Werror //" -e "s/-Wall -Wextra //" -i "${TEST_S}/CMakeLists.txt" || die + + hip_test_wrapper cmake_src_prepare + fi +} + +src_configure() { + # -Werror=strict-aliasing + # https://bugs.gentoo.org/858383 + # https://github.com/ROCm/clr/issues/64 + # + # Do not trust it for LTO either + append-flags -fno-strict-aliasing + filter-lto + + use debug && CMAKE_BUILD_TYPE="Debug" + + # Fix ld.lld linker error: https://github.com/ROCm/HIP/issues/3382 + # See also: https://github.com/gentoo/gentoo/pull/29097 + append-ldflags $(test-flags-CCLD -Wl,--undefined-version) + + local mycmakeargs=( + -DCMAKE_PREFIX_PATH="$(get_llvm_prefix)" + -DCMAKE_SKIP_RPATH=ON + -D__HIP_ENABLE_PCH=OFF + + -DCLR_BUILD_HIP="$(usex hip)" + -DCLR_BUILD_OCL="$(usex opencl)" + + -DHIP_COMMON_DIR="${HIP_S}" + -DHIP_ENABLE_ROCPROFILER_REGISTER=OFF + -DHIPCC_BIN_DIR="${EPREFIX}/usr/bin" + -DROCM_PATH="${EPREFIX}/usr" + -DUSE_PROF_API=OFF + -DFILE_REORG_BACKWARD_COMPATIBILITY=OFF + + -DOpenGL_GL_PREFERENCE="GLVND" + -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON + ) + + if use video_cards_amdgpu; then + mycmakeargs+=( + -DHIP_PLATFORM="amd" + ) + elif use video_cards_nvidia; then + mycmakeargs+=( + -DHIPNV_DIR="${EPREFIX}/usr" + -DHIP_PLATFORM="nvidia" + ) + fi + + cmake_src_configure + + if use test; then + local mycmakeargs=( + -DCMAKE_MODULE_PATH="${TEST_S}/external/Catch2/cmake/Catch2" + -DROCM_PATH="${EPREFIX}/usr" + -DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON + -Wno-dev + + # 1) Use custom build of hipamd instead of system one + # 2) Build fails with libc++: https://github.com/llvm/llvm-project/issues/119076 + -DCMAKE_CXX_FLAGS="-I${BUILD_DIR}/hipamd/include -stdlib=libstdc++" + -DCMAKE_EXE_LINKER_FLAGS="-L${BUILD_DIR}/hipamd/lib" + ) + if use video_cards_amdgpu; then + mycmakeargs+=( + -DHIP_PLATFORM="amd" + ) + elif use video_cards_nvidia; then + mycmakeargs+=( + -DHIP_PLATFORM="nvidia" + ) + fi + hip_test_wrapper cmake_src_configure + fi +} + +src_compile() { + cmake_src_compile + + if use test; then + hip_test_wrapper cmake_src_compile build_tests + fi +} + +src_test() { + check_amdgpu + export LD_LIBRARY_PATH="${BUILD_DIR}/hipamd/lib" + + # TODO: research how to test Vulkan-related features. + local CMAKE_SKIP_TESTS=( + Unit_hipExternalMemoryGetMappedBuffer_Vulkan_Positive_Read_Write + Unit_hipExternalMemoryGetMappedBuffer_Vulkan_Negative_Parameters + Unit_hipImportExternalMemory_Vulkan_Negative_Parameters + Unit_hipWaitExternalSemaphoresAsync_Vulkan_Positive_Binary_Semaphore + Unit_hipWaitExternalSemaphoresAsync_Vulkan_Positive_Multiple_Semaphores + Unit_hipWaitExternalSemaphoresAsync_Vulkan_Negative_Parameters + Unit_hipSignalExternalSemaphoresAsync_Vulkan_Positive_Binary_Semaphore + Unit_hipSignalExternalSemaphoresAsync_Vulkan_Positive_Multiple_Semaphores + Unit_hipSignalExternalSemaphoresAsync_Vulkan_Negative_Parameters + Unit_hipImportExternalSemaphore_Vulkan_Negative_Parameters + Unit_hipDestroyExternalSemaphore_Vulkan_Negative_Parameters + ) + + MAKEOPTS="-j1" hip_test_wrapper cmake_src_test +} + +src_install() { + cmake_src_install + + # add version file that is required by some libraries + mkdir "${ED}"/usr/include/rocm-core || die + cat <<-EOF > "${ED}"/usr/include/rocm-core/rocm_version.h || die + #pragma once + #define ROCM_VERSION_MAJOR $(ver_cut 1) + #define ROCM_VERSION_MINOR $(ver_cut 2) + #define ROCM_VERSION_PATCH $(ver_cut 3) + #define ROCM_BUILD_INFO "$(ver_cut 1-3).0-9999-unknown" + EOF + + dosym -r /usr/include/rocm-core/rocm_version.h /usr/include/rocm_version.h + + if use video_cards_nvidia; then + newenvd - 99hipconfig <<-EOF + HIP_PLATFORM="nvidia" + HIP_RUNTIME="cuda" + CUDA_PATH="${EPREFIX}/opt/cuda" + EOF + fi +} -- cgit v1.2.3