diff options
Diffstat (limited to 'dev-util/hip')
-rw-r--r-- | dev-util/hip/Manifest | 1 | ||||
-rw-r--r-- | dev-util/hip/hip-4.0.0-r1.ebuild | 116 |
2 files changed, 117 insertions, 0 deletions
diff --git a/dev-util/hip/Manifest b/dev-util/hip/Manifest index 4f0e3eb82290..f4c4f08ed5b0 100644 --- a/dev-util/hip/Manifest +++ b/dev-util/hip/Manifest @@ -5,5 +5,6 @@ AUX hip-3.9.0-DisableTest.patch 4560 BLAKE2B ef1bf5fcd19d8c1db722206afaf5bf8197e AUX hip-3.9.0-add-include-directories.patch 468 BLAKE2B 4c787a6ffe0beada2ab431b2262edc51b814e57d599f783b884da84a6f1b919ceeab561ee09eccd54338ae55118e2d45133b248fd20b5163eba548d49f79d1ca SHA512 1fe35858c526c891e5efd9ecf7a166c3a67d7a4874ab6f7eb34c6ed6652d0e21a7290829a3a5063682a7229af3ef63c180e198172c3bc69be6550547806249e3 AUX hip-3.9.0-lpl_ca-add-include.patch 418 BLAKE2B 7d1439e51b1c5e20fcb1768c5f33b22d1d6bec5cf36242cbaf030a9a83bd404cb02c95d6ddba2ada6740bb2c1006da3c1507927ab561e29cd47f1a7e64aed1a4 SHA512 511684b5f0f70f67371e34674933dd4cf1992d11406a77a1aa695b68880a031812b8ba7e399abb61a84e8e07d8f814c93c412c51952d4c27443a01c3a62ce276 DIST rocm-hip-4.0.0.tar.gz 1012154 BLAKE2B 02343239a5b27c42dafd241f2c9b6f5195c50f78bfd717ae72bcb16d384bd6cf97ff6f2b86bfcf323aaaf022d6897f46d0987826c80d6f6279be4cb4792e15be SHA512 cf840dbe28a9a15e3be14351bfa22d3c81e1654813a7aee55f53e71b2ee183f8dd0de14a79791617fabb5b357cadbf2ce2f476f78884b2843d30f206d65088f6 +EBUILD hip-4.0.0-r1.ebuild 3817 BLAKE2B c01eb20493f27e9650d1cad3413b7fa14ef799d67e8b02de235d1e37a4f6633c8f0f6ea73fa8f075d0a10ffb2dbe0ccba4a65c4a505e665be7d657d5c773641a SHA512 2b5b58f13d832572f547f5ba4e67daf62b180523424e1e4605e96d1b7d834b700f8aebc95b047ab08ba36e16098aa07ddf7f9c91654672b00edc863bb5c25d68 EBUILD hip-4.0.0.ebuild 3451 BLAKE2B c219b26871ab9197ddd75a4d8e03bdb2d6f9c12cc9d8bd4b29e1babceb3572afb5f859288c395952befd8520fdf2875703566a4dd7280045f98f309af8c3756b SHA512 d7b82a954d9dfde559e48dcad266aa7d3cb204442045ea2c3eaeafa7513f0f549ca3a656d5d823e636600e3b9112fd276fbfb9e9ebac74f01024327de76276dd MISC metadata.xml 582 BLAKE2B 2b99c57a359c2ede87080fe4205b41092abedb50c63f4d6124c4741f765f8167322ce901f27db5a34fb9822852db043d13bbe0e5884916ce845a3337719b25f2 SHA512 da4a80f011b027d3a56743fe0196f5c85a79bd9a1bec6749ab908a8a372008ffd2b47198dc9913d5343e6c9ec7e7a05823727f6fae0608130542ffbb2fb3e357 diff --git a/dev-util/hip/hip-4.0.0-r1.ebuild b/dev-util/hip/hip-4.0.0-r1.ebuild new file mode 100644 index 000000000000..9252cfffc779 --- /dev/null +++ b/dev-util/hip/hip-4.0.0-r1.ebuild @@ -0,0 +1,116 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +inherit cmake flag-o-matic prefix + +DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability" +HOMEPAGE="https://github.com/ROCm-Developer-Tools/HIP" +SRC_URI="https://github.com/ROCm-Developer-Tools/HIP/archive/rocm-${PV}.tar.gz -> rocm-hip-${PV}.tar.gz" + +KEYWORDS="~amd64" +LICENSE="MIT" +SLOT="0/$(ver_cut 1-2)" + +IUSE="debug profile" + +# Don't strip to prevent some tests from failing. +RESTRICT="strip" + +DEPEND=">=dev-libs/rocclr-$(ver_cut 1-2) + >=dev-util/rocminfo-$(ver_cut 1-2) + =sys-devel/llvm-roc-${PV}*[runtime]" +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}/${PN}-3.9.0-DisableTest.patch" + "${FILESDIR}/${PN}-3.9.0-add-include-directories.patch" + "${FILESDIR}/${PN}-3.5.1-config-cmake-in.patch" + "${FILESDIR}/${PN}-3.5.1-hip_vector_types.patch" + "${FILESDIR}/${PN}-3.5.1-detect_offload-arch_for_clang-roc.patch" + "${FILESDIR}/${PN}-3.9.0-lpl_ca-add-include.patch" +) + +S="${WORKDIR}/HIP-rocm-${PV}" + +src_prepare() { + cmake_src_prepare + eapply_user + + # Use Gentoo version number, otherwise git hash is attempted in vain. + sed -e "/set (HIP_LIB_VERSION_STRING/cset (HIP_LIB_VERSION_STRING ${PVR})" -i CMakeLists.txt || die + + # disable PCH, because it results in a build error in ROCm 4.0.0 + sed -e "s:option(__HIP_ENABLE_PCH:#option(__HIP_ENABLE_PCH:" -i "${S}/CMakeLists.txt" || die + + # "hcc" is deprecated and not installed, new platform is "rocclr"; + # Setting HSA_PATH to "/usr" results in setting "-isystem /usr/include" + # which makes "stdlib.h" not found when using "#include_next" in header files; + sed -e "/HIP_PLATFORM.*HIP_COMPILER.*clang/s:hcc:rocclr:" \ + -e "/FLAGS .= \" -isystem \$HSA_PATH/d" \ + -e "s:\$ENV{'DEVICE_LIB_PATH'}:'/usr/lib/amdgcn/bitcode':" \ + -i bin/hipcc || die + + # replace hcc remnants with modern rocclr. + sed -e "/HIP_PLATFORM.*STREQUAL/s:hcc:rocclr:" -i cmake/FindHIP/run_hipcc.cmake || die + + # correctly find HIP_CLANG_INCLUDE_PATH using cmake + sed -e "/set(HIP_CLANG_ROOT/s:\"\${ROCM_PATH}/llvm\":/usr/lib/llvm/roc:" -i hip-config.cmake.in || die + + # change --hip-device-lib-path to "/usr/lib/amdgcn/bitcode", must align with "dev-libs/rocm-device-libs" + sed -e "s:\${AMD_DEVICE_LIBS_PREFIX}/lib:/usr/lib/amdgcn/bitcode:" \ + -i "${S}/hip-config.cmake.in" || die + + einfo "prefixing hipcc and its utils..." + hprefixify $(grep -rl --exclude-dir=build/ "/usr" "${S}") +} + +src_configure() { + strip-flags + if ! use debug; then + append-cflags "-DNDEBUG" + append-cxxflags "-DNDEBUG" + buildtype="Release" + else + buildtype="Debug" + fi + + # TODO: Currently a GENTOO configuration is build, + # this is also used in the cmake configuration files + # which will be installed to find HIP; + # Other ROCm packages expect a "RELEASE" configuration, + # see "hipBLAS" + local mycmakeargs=( + -DCMAKE_PREFIX_PATH="${EPREFIX}/usr/lib/llvm/roc" + -DCMAKE_BUILD_TYPE=${buildtype} + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/hip" + -DBUILD_HIPIFY_CLANG=OFF + -DHIP_PLATFORM=rocclr + -DHIP_RUNTIME=ROCclr + -DHIP_COMPILER=clang + -DROCM_PATH="${EPREFIX}/usr" + -DHSA_PATH="${EPREFIX}/usr" + -DUSE_PROF_API=$(usex profile 1 0) + -DROCclr_DIR="${EPREFIX}"/usr/include/rocclr + ) + + cmake_src_configure +} + +src_install() { + echo "HSA_PATH=${EPREFIX}/usr" > 99hip || die + echo "ROCM_PATH=${EPREFIX}/usr" >> 99hip || die + echo "HIP_PLATFORM=rocclr" >> 99hip || die + echo "HIP_RUNTIME=ROCclr" >> 99hip || die + echo "HIP_COMPILER=clang" >> 99hip || die + echo "HIP_CLANG_PATH=${EPREFIX}/usr/lib/llvm/roc/bin" >> 99hip || die + + echo "PATH=${EPREFIX}/usr/lib/hip/bin" >> 99hip || die + echo "HIP_PATH=${EPREFIX}/usr/lib/hip" >> 99hip || die + echo "LDPATH=${EPREFIX}/usr/lib/hip/lib" >> 99hip || die + echo "ROOTPATH=${EPREFIX}/usr/lib/hip/bin" >> 99hip || die + + doenvd 99hip + + cmake_src_install +} |