From 26f79803004cb53e92cf2f0e889de89979385aa9 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 19 Nov 2022 13:00:31 +0000 Subject: gentoo auto-resync : 19:11:2022 - 13:00:31 --- dev-util/hip/Manifest | 3 +- .../files/hip-5.1.3-llvm-15-noinline-keyword.patch | 21 +++ dev-util/hip/hip-5.1.3-r1.ebuild | 172 -------------------- dev-util/hip/hip-5.1.3-r2.ebuild | 173 +++++++++++++++++++++ 4 files changed, 196 insertions(+), 173 deletions(-) create mode 100644 dev-util/hip/files/hip-5.1.3-llvm-15-noinline-keyword.patch delete mode 100644 dev-util/hip/hip-5.1.3-r1.ebuild create mode 100644 dev-util/hip/hip-5.1.3-r2.ebuild (limited to 'dev-util/hip') diff --git a/dev-util/hip/Manifest b/dev-util/hip/Manifest index 9b879c5ab38f..51aa893c6411 100644 --- a/dev-util/hip/Manifest +++ b/dev-util/hip/Manifest @@ -16,6 +16,7 @@ AUX hip-5.0.2-set-build-id.patch 741 BLAKE2B 9d4668ab770fd1ebc93a19a3ddc2916e8fe AUX hip-5.1.3-clang-include-path.patch 564 BLAKE2B 8cdfbd9eba9c5e642a8e85aa269b0e369ef11a90c30771e0b1ef21d1ff1bfbb6d9f27cc03693b22b39347d939a11994ffbe4dd2f9edc5583811fff273c304307 SHA512 e6d8dda10155a6d269435f37bf8d4fa25b503861450d474cc01c21ea582857caa9ed26ca04e513b12708ae60348cd32296aaf39c805ee3f925e7d6590cae658c AUX hip-5.1.3-correct-sample-install-location.patch 537 BLAKE2B 924010e903cf7a27591930f5533bc41591ea7821b1f5f73bbbe5d5659a78a712699bb3be94ec5e473a0a5e0d11140850f7bb8e00f7775688adaa79deb7f2597f SHA512 91d89d403eef7ba460e648f5415f654601147920a81f650c40928733d5dbb8a99ebc00530052bf22bec67d9d325bde867c08e7d24e1e05b734b9e31a909030f7 AUX hip-5.1.3-fix-hip_prof_gen.patch 1480 BLAKE2B caa3fa9840a8add5a25daaeb6f26eed9da3fe55686f6343e31b836a0b2e12999cd45d9220469cde036c7914f672b6cc46695fce1bfe4a8d6d35c836cdc14e413 SHA512 a588238cb12dc973acc6513bead68439b10b49214d5dceb81a0498510f79269b79897a02dd9e2ee1ef396a762d49310fd0a406d7f8b6c0e85faeba0f69b1de23 +AUX hip-5.1.3-llvm-15-noinline-keyword.patch 829 BLAKE2B 39b859e90acacd2eccdd60b690e1d882b63cfa66ff1b12effe447b18de72ffd61dd32983552f9ae39b384c3bbfbbcfd59ff2bb47943c1340bf6c1df5cb7d4075 SHA512 1933e883f84451e8512669572ea03dd25c916c6baeafac27b07e3d4a5e89165952a64afaceade4546e7e2d4473aba9811ac21131f283f9680d35e777ad9659a7 AUX hip-5.1.3-remove-cmake-doxygen-commands.patch 896 BLAKE2B 35640516bf416760db69b736d72c1e78efdbad8a930d621fdaffd13c5c250f5d80a6975c1e4c368389ce8059aee964c36645f420d0844141d09463637ba0bccb SHA512 b1288e1f4b7553c5bf0fe38a46fbdf269ca5c01fd8e0e225b9454d4916092601d565c57eaf9f716e06fee816e41cb3a948884060551b5a9d71da9b1a050765f9 AUX hip-5.1.3-rocm-path.patch 564 BLAKE2B ad554063a11d58ce5acfa8c8980bac2668d199b059bc2555d4cea40fbc53b6334daaea448d99cc391cee246d8318a450efdef669db2ee164a4db3a55d7d8e193 SHA512 eaa03f4d2394f61dcedde376de6c398625d284a7ac0c94ff2484929efdf298f455c796b96f16bf3989de6593a9a026a7681620b5ca13ce403aba4a32e5a38226 AUX hipvars-5.0.2.pm 590 BLAKE2B b67de8f86bc53d9fbcd50a9cfa9759feb0145f3b3e40360cc322676411e038ff21b8f81265ba27d099e51c3dc55230f87c477cbadfba2b48c08978216f2fbd81 SHA512 0becd625e6f34d687338e25ca4697e68a735a1df60a4c2c53f577e7999a34bc07041f513632f9534aa4b35da2cf50b02c96187f69fd183bff893343257aa85b9 @@ -47,5 +48,5 @@ EBUILD hip-4.3.0-r1.ebuild 3782 BLAKE2B b3f7e96b664662e9cdae955993251af254cd44f6 EBUILD hip-4.3.0-r2.ebuild 3978 BLAKE2B 16ffbeddfdd5c6d0338e5be1fd609272bb4d00e1a5d1530a00a75d82a5882f52fc0bfd97b14bf9042affa4af4617507a5cd1b8d8f90a1f4c8744028ab63b7f38 SHA512 e664a11e69cc4a7629a8f088992d2e26517635d1f4e685d8dac69e74e6f94e8c1f782f09d0f54308b73c134021579a624bfa2ba8ecac3c470ab81cb317dcb67a EBUILD hip-4.3.0.ebuild 3761 BLAKE2B 7fdd7e65a7b1b246ad94a1e5ee37e7c3199f9dcc02df575e774fdbacf9690ac7609f53c122eff5dd87cddf9afd9c4f52d66a5502b3ec311fd6e9db5f3889a895 SHA512 07d8317cae9f7b2f4c179938477eb00ff8d0a136c730bd18582a835c23a8d9934d03824c2bb520c53cb1c2525e26618236b12dfcbfe520612a60c191a1d2947b EBUILD hip-5.0.2-r3.ebuild 4915 BLAKE2B fb73c3d4c911b33f9790aff42a71698e0e37828a6ae18874d627df2032971ff23f58d1c0a33cabd7ffa910e29e49b1bd958f5cae4c5fc31d2cdbb3d0f96ea4e9 SHA512 a5380504fb55e43fb6b9588d1f326293770836d824a789d85e2a6110cac5a252e2c089098755c64cfe6642af909a5ad87be71140a626f4e8f7f919a11fdf56d4 -EBUILD hip-5.1.3-r1.ebuild 6360 BLAKE2B 17517f80975904747b851887acda76a3ac2dd026062b9faa37691809191be2d839aa3d9e3b47f83228a5903ad988e13608f3d96b4eae5e6f907eec719af33c0d SHA512 68111a62f42fc4a5806df44edff06bad86b2032dc0eb3c47151396f5713d37225ff426f9ca45b4b80a3ca885eb532956753e59006b575b3d6b9f613338a1dcc1 +EBUILD hip-5.1.3-r2.ebuild 6418 BLAKE2B 33b992783bdae4f93a3fb7a6b0692d64ed89ea98a2ed016b39bb5a3056bf78788ceef2dae295bc22fbbe84f07cf168033d3283dddf7683b090d31b4fa8be323b SHA512 fe661d237ca26ddb16002d95eba6436247d1e82bf0e3bad5c125da93cb16926f0de4094cc6d2a7d86f74d61e26ffb7380ed3d6315378da50e045525599d95e9b MISC metadata.xml 597 BLAKE2B cca1b105463e26741aa4bf95c9d85dd582df075795646f633ed5f0d39bace0b07be98f771aa8eb1b89984788249837303b67617e92c4076eb7601611cd2abf6d SHA512 42767156ae0e89b3ce438bfb163161b543e15114838a5c14b4b1c889fe799e44dd9bf9684ee685798a1fc5d2d4c520d3c42c9c74a88178a079ccb634148e0738 diff --git a/dev-util/hip/files/hip-5.1.3-llvm-15-noinline-keyword.patch b/dev-util/hip/files/hip-5.1.3-llvm-15-noinline-keyword.patch new file mode 100644 index 000000000000..de61356a5cc6 --- /dev/null +++ b/dev-util/hip/files/hip-5.1.3-llvm-15-noinline-keyword.patch @@ -0,0 +1,21 @@ +LLVM 15 adds __noinline__ as a keyword to match behaviour of GCC 12. + +When this macro is left in, it can cause the expression __attribute__((__noinline__)) to be expanded incorrectly. + +When the __noinline__ keyword is available disable the macro. + +Ref: https://reviews.llvm.org/D124866 + https://bugs.gentoo.org/85712 +=================================================================== +--- a/include/hip/amd_detail/host_defines.h ++++ b/include/hip/amd_detail/host_defines.h +@@ -47,7 +47,9 @@ THE SOFTWARE. + #define __constant__ __attribute__((constant)) + #endif // !__CLANG_HIP_RUNTIME_WRAPPER_INCLUDED__ + ++#if !defined(__has_feature) || !__has_feature(cuda_noinline_keyword) + #define __noinline__ __attribute__((noinline)) ++#endif + #define __forceinline__ inline __attribute__((always_inline)) + + #if __HIP_NO_IMAGE_SUPPORT diff --git a/dev-util/hip/hip-5.1.3-r1.ebuild b/dev-util/hip/hip-5.1.3-r1.ebuild deleted file mode 100644 index 27d78bc64fc7..000000000000 --- a/dev-util/hip/hip-5.1.3-r1.ebuild +++ /dev/null @@ -1,172 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -PYTHON_COMPAT=( python3_{8..11} ) -DOCS_BUILDER="doxygen" -DOCS_DEPEND="media-gfx/graphviz" - -inherit cmake docs llvm prefix python-any-r1 - -LLVM_MAX_SLOT=14 - -DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability" -HOMEPAGE="https://github.com/ROCm-Developer-Tools/hipamd" -SRC_URI="https://github.com/ROCm-Developer-Tools/hipamd/archive/rocm-${PV}.tar.gz -> rocm-hipamd-${PV}.tar.gz - https://github.com/ROCm-Developer-Tools/HIP/archive/rocm-${PV}.tar.gz -> rocm-hip-${PV}.tar.gz - https://github.com/ROCm-Developer-Tools/ROCclr/archive/rocm-${PV}.tar.gz -> rocclr-${PV}.tar.gz - https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/archive/rocm-${PV}.tar.gz -> rocm-opencl-runtime-${PV}.tar.gz - profile? ( https://github.com/ROCm-Developer-Tools/roctracer/archive/refs/tags/rocm-${PV}.tar.gz -> rocm-tracer-${PV}.tar.gz - https://github.com/ROCm-Developer-Tools/hipamd/files/8991181/hip_prof_str_diff.gz -> ${P}-update-header.patch.gz - )" - -KEYWORDS="~amd64" -LICENSE="MIT" -SLOT="0/$(ver_cut 1-2)" - -IUSE="debug profile" - -DEPEND=" - >=dev-util/rocminfo-5 - sys-devel/clang:${LLVM_MAX_SLOT} - dev-libs/rocm-comgr:${SLOT} - virtual/opengl -" -RDEPEND="${DEPEND} - dev-perl/URI-Encode - sys-devel/clang-runtime:= - >=dev-libs/roct-thunk-interface-5" -BDEPEND="profile? ( $(python_gen_any_dep ' - dev-python/CppHeaderParser[${PYTHON_USEDEP}] - ') ) -" - -PATCHES=( - "${FILESDIR}/${PN}-5.0.1-DisableTest.patch" - "${FILESDIR}/${PN}-4.2.0-config-cmake-in.patch" - "${FILESDIR}/${PN}-5.0.1-hip_vector_types.patch" - "${FILESDIR}/${PN}-4.2.0-cancel-hcc-header-removal.patch" - "${FILESDIR}/${PN}-5.0.2-set-build-id.patch" - "${FILESDIR}/${PN}-5.1.3-fix-hip_prof_gen.patch" - "${FILESDIR}/${PN}-5.1.3-correct-sample-install-location.patch" - "${FILESDIR}/${PN}-5.1.3-remove-cmake-doxygen-commands.patch" - "${FILESDIR}/0001-SWDEV-316128-HIP-surface-API-support.patch" -) - -python_check_deps() { - if use profile; then - python_has_version "dev-python/CppHeaderParser[${PYTHON_USEDEP}]" - fi -} - -S="${WORKDIR}/hipamd-rocm-${PV}" -HIP_S="${WORKDIR}"/HIP-rocm-${PV} -OCL_S="${WORKDIR}"/ROCm-OpenCL-Runtime-rocm-${PV} -CLR_S="${WORKDIR}"/ROCclr-rocm-${PV} -RTC_S="${WORKDIR}"/roctracer-rocm-${PV} -DOCS_DIR="${HIP_S}"/docs/doxygen-input -DOCS_CONFIG_NAME=doxy.cfg - -src_prepare() { - cmake_src_prepare - use profile && eapply "${WORKDIR}/${P}-update-header.patch" - - eapply_user - - # Use Gentoo slot number, otherwise git hash is attempted in vain. - sed -e "/set (HIP_LIB_VERSION_STRING/cset (HIP_LIB_VERSION_STRING ${SLOT#*/})" -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 CMakeLists.txt || die - - # correctly find HIP_CLANG_INCLUDE_PATH using cmake - local LLVM_PREFIX="$(get_llvm_prefix "${LLVM_MAX_SLOT}")" - local CLANG_RESOURCE_DIR=$("${LLVM_PREFIX}/bin/clang" -print-resource-dir) - sed -e "/set(HIP_CLANG_ROOT/s:\"\${ROCM_PATH}/llvm\":${LLVM_PREFIX}:" -i hip-config.cmake.in || die - - # correct libs and cmake install dir - sed -e "/LIB_INSTALL_DIR/s:PREFIX}/lib:PREFIX}/$(get_libdir):" \ - -e "/\${HIP_COMMON_DIR}/s:cmake DESTINATION .):cmake/ DESTINATION share/cmake/Modules):" -i CMakeLists.txt || die - sed -e "/LIBRARY DESTINATION/s:lib:$(get_libdir):" -i src/CMakeLists.txt || die - - sed -e "/\.hip/d" \ - -e "s,DESTINATION lib,DESTINATION $(get_libdir),g" \ - -e "/cmake DESTINATION/d" \ - -e "/CPACK_RESOURCE_FILE_LICENSE/d" -i packaging/CMakeLists.txt || die - - pushd ${HIP_S} || die - eapply "${FILESDIR}/${PN}-5.1.3-clang-include-path.patch" - eapply "${FILESDIR}/${PN}-5.1.3-rocm-path.patch" - eapply "${FILESDIR}/${PN}-5.0.2-correct-ldflag.patch" - # 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 "/FLAGS .= \" -isystem \$HSA_PATH/d" \ - -e "/HIP.*FLAGS.*isystem.*HIP_INCLUDE_PATH/d" \ - -e "s:\$ENV{'DEVICE_LIB_PATH'}:'/usr/lib/amdgcn/bitcode':" \ - -e "s:\$ENV{'HIP_LIB_PATH'}:'/usr/$(get_libdir)':" \ - -e "/rpath/s,--rpath=[^ ]*,," \ - -e "s,\$HIP_CLANG_PATH/../lib/clang/\$HIP_CLANG_VERSION/,${CLANG_RESOURCE_DIR}/,g" \ - -i bin/hipcc.pl || 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}") - hprefixify $(grep -rl --exclude-dir=build/ "/usr" "${HIP_S}") - - cp "$(prefixify_ro "${FILESDIR}"/hipvars-5.1.3.pm)" bin/hipvars.pm || die "failed to replace hipvars.pm" - sed -e "s,@HIP_BASE_VERSION_MAJOR@,$(ver_cut 1)," -e "s,@HIP_BASE_VERSION_MINOR@,$(ver_cut 2)," \ - -e "s,@HIP_VERSION_PATCH@,$(ver_cut 3)," \ - -e "s,@CLANG_INCLUDE_PATH@,${CLANG_RESOURCE_DIR}/include," \ - -e "s,@CLANG_PATH@,${LLVM_PREFIX}/bin," -i bin/hipvars.pm || die - - sed -e "/HIP_CLANG_INCLUDE_SEARCH_PATHS/s,\${_IMPORT_PREFIX}.*/include,${CLANG_RESOURCE_DIR}/include," -i hip-lang-config.cmake.in || die - popd || die - sed -e "/HIP_CLANG_INCLUDE_SEARCH_PATHS/s,\${HIP_CLANG_ROOT}.*/include,${CLANG_RESOURCE_DIR}/include," -i hip-config.cmake.in || die -} - -src_configure() { - use debug && CMAKE_BUILD_TYPE="Debug" - - # 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="$(get_llvm_prefix "${LLVM_MAX_SLOT}")" - -DCMAKE_BUILD_TYPE=${buildtype} - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" - -DCMAKE_SKIP_RPATH=ON - -DBUILD_HIPIFY_CLANG=OFF - -DHIP_PLATFORM=amd - -DHIP_COMPILER=clang - -DROCM_PATH="${EPREFIX}/usr" - -DUSE_PROF_API=$(usex profile 1 0) - -DROCCLR_PATH=${CLR_S} - -DHIP_COMMON_DIR=${HIP_S} - -DAMD_OPENCL_PATH=${OCL_S} - ) - - use profile && mycmakeargs+=( -DPROF_API_HEADER_PATH="${RTC_S}"/inc/ext ) - - cmake_src_configure -} - -src_compile() { - HIP_PATH=${HIP_S} docs_compile - cmake_src_compile -} - -src_install() { - - cmake_src_install - - rm "${ED}/usr/include/hip/hcc_detail" || die - - # Don't install .hipInfo and .hipVersion to bin/lib - rm "${ED}/usr/lib/.hipInfo" "${ED}/usr/bin/.hipVersion" || die -} diff --git a/dev-util/hip/hip-5.1.3-r2.ebuild b/dev-util/hip/hip-5.1.3-r2.ebuild new file mode 100644 index 000000000000..6ed8327cb213 --- /dev/null +++ b/dev-util/hip/hip-5.1.3-r2.ebuild @@ -0,0 +1,173 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{8..11} ) +DOCS_BUILDER="doxygen" +DOCS_DEPEND="media-gfx/graphviz" + +inherit cmake docs llvm prefix python-any-r1 + +LLVM_MAX_SLOT=15 + +DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability" +HOMEPAGE="https://github.com/ROCm-Developer-Tools/hipamd" +SRC_URI="https://github.com/ROCm-Developer-Tools/hipamd/archive/rocm-${PV}.tar.gz -> rocm-hipamd-${PV}.tar.gz + https://github.com/ROCm-Developer-Tools/HIP/archive/rocm-${PV}.tar.gz -> rocm-hip-${PV}.tar.gz + https://github.com/ROCm-Developer-Tools/ROCclr/archive/rocm-${PV}.tar.gz -> rocclr-${PV}.tar.gz + https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/archive/rocm-${PV}.tar.gz -> rocm-opencl-runtime-${PV}.tar.gz + profile? ( https://github.com/ROCm-Developer-Tools/roctracer/archive/refs/tags/rocm-${PV}.tar.gz -> rocm-tracer-${PV}.tar.gz + https://github.com/ROCm-Developer-Tools/hipamd/files/8991181/hip_prof_str_diff.gz -> ${P}-update-header.patch.gz + )" + +KEYWORDS="~amd64" +LICENSE="MIT" +SLOT="0/$(ver_cut 1-2)" + +IUSE="debug profile" + +DEPEND=" + >=dev-util/rocminfo-5 + sys-devel/clang:${LLVM_MAX_SLOT} + dev-libs/rocm-comgr:${SLOT} + virtual/opengl +" +RDEPEND="${DEPEND} + dev-perl/URI-Encode + sys-devel/clang-runtime:= + >=dev-libs/roct-thunk-interface-5" +BDEPEND="profile? ( $(python_gen_any_dep ' + dev-python/CppHeaderParser[${PYTHON_USEDEP}] + ') ) +" + +PATCHES=( + "${FILESDIR}/${PN}-5.0.1-DisableTest.patch" + "${FILESDIR}/${PN}-4.2.0-config-cmake-in.patch" + "${FILESDIR}/${PN}-5.0.1-hip_vector_types.patch" + "${FILESDIR}/${PN}-4.2.0-cancel-hcc-header-removal.patch" + "${FILESDIR}/${PN}-5.0.2-set-build-id.patch" + "${FILESDIR}/${PN}-5.1.3-fix-hip_prof_gen.patch" + "${FILESDIR}/${PN}-5.1.3-correct-sample-install-location.patch" + "${FILESDIR}/${PN}-5.1.3-remove-cmake-doxygen-commands.patch" + "${FILESDIR}/0001-SWDEV-316128-HIP-surface-API-support.patch" + "${FILESDIR}/${PN}-5.1.3-llvm-15-noinline-keyword.patch" +) + +python_check_deps() { + if use profile; then + python_has_version "dev-python/CppHeaderParser[${PYTHON_USEDEP}]" + fi +} + +S="${WORKDIR}/hipamd-rocm-${PV}" +HIP_S="${WORKDIR}"/HIP-rocm-${PV} +OCL_S="${WORKDIR}"/ROCm-OpenCL-Runtime-rocm-${PV} +CLR_S="${WORKDIR}"/ROCclr-rocm-${PV} +RTC_S="${WORKDIR}"/roctracer-rocm-${PV} +DOCS_DIR="${HIP_S}"/docs/doxygen-input +DOCS_CONFIG_NAME=doxy.cfg + +src_prepare() { + cmake_src_prepare + use profile && eapply "${WORKDIR}/${P}-update-header.patch" + + eapply_user + + # Use Gentoo slot number, otherwise git hash is attempted in vain. + sed -e "/set (HIP_LIB_VERSION_STRING/cset (HIP_LIB_VERSION_STRING ${SLOT#*/})" -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 CMakeLists.txt || die + + # correctly find HIP_CLANG_INCLUDE_PATH using cmake + local LLVM_PREFIX="$(get_llvm_prefix "${LLVM_MAX_SLOT}")" + local CLANG_RESOURCE_DIR=$("${LLVM_PREFIX}/bin/clang" -print-resource-dir) + sed -e "/set(HIP_CLANG_ROOT/s:\"\${ROCM_PATH}/llvm\":${LLVM_PREFIX}:" -i hip-config.cmake.in || die + + # correct libs and cmake install dir + sed -e "/LIB_INSTALL_DIR/s:PREFIX}/lib:PREFIX}/$(get_libdir):" \ + -e "/\${HIP_COMMON_DIR}/s:cmake DESTINATION .):cmake/ DESTINATION share/cmake/Modules):" -i CMakeLists.txt || die + sed -e "/LIBRARY DESTINATION/s:lib:$(get_libdir):" -i src/CMakeLists.txt || die + + sed -e "/\.hip/d" \ + -e "s,DESTINATION lib,DESTINATION $(get_libdir),g" \ + -e "/cmake DESTINATION/d" \ + -e "/CPACK_RESOURCE_FILE_LICENSE/d" -i packaging/CMakeLists.txt || die + + pushd ${HIP_S} || die + eapply "${FILESDIR}/${PN}-5.1.3-clang-include-path.patch" + eapply "${FILESDIR}/${PN}-5.1.3-rocm-path.patch" + eapply "${FILESDIR}/${PN}-5.0.2-correct-ldflag.patch" + # 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 "/FLAGS .= \" -isystem \$HSA_PATH/d" \ + -e "/HIP.*FLAGS.*isystem.*HIP_INCLUDE_PATH/d" \ + -e "s:\$ENV{'DEVICE_LIB_PATH'}:'/usr/lib/amdgcn/bitcode':" \ + -e "s:\$ENV{'HIP_LIB_PATH'}:'/usr/$(get_libdir)':" \ + -e "/rpath/s,--rpath=[^ ]*,," \ + -e "s,\$HIP_CLANG_PATH/../lib/clang/\$HIP_CLANG_VERSION/,${CLANG_RESOURCE_DIR}/,g" \ + -i bin/hipcc.pl || 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}") + hprefixify $(grep -rl --exclude-dir=build/ "/usr" "${HIP_S}") + + cp "$(prefixify_ro "${FILESDIR}"/hipvars-5.1.3.pm)" bin/hipvars.pm || die "failed to replace hipvars.pm" + sed -e "s,@HIP_BASE_VERSION_MAJOR@,$(ver_cut 1)," -e "s,@HIP_BASE_VERSION_MINOR@,$(ver_cut 2)," \ + -e "s,@HIP_VERSION_PATCH@,$(ver_cut 3)," \ + -e "s,@CLANG_INCLUDE_PATH@,${CLANG_RESOURCE_DIR}/include," \ + -e "s,@CLANG_PATH@,${LLVM_PREFIX}/bin," -i bin/hipvars.pm || die + + sed -e "/HIP_CLANG_INCLUDE_SEARCH_PATHS/s,\${_IMPORT_PREFIX}.*/include,${CLANG_RESOURCE_DIR}/include," -i hip-lang-config.cmake.in || die + popd || die + sed -e "/HIP_CLANG_INCLUDE_SEARCH_PATHS/s,\${HIP_CLANG_ROOT}.*/include,${CLANG_RESOURCE_DIR}/include," -i hip-config.cmake.in || die +} + +src_configure() { + use debug && CMAKE_BUILD_TYPE="Debug" + + # 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="$(get_llvm_prefix "${LLVM_MAX_SLOT}")" + -DCMAKE_BUILD_TYPE=${buildtype} + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" + -DCMAKE_SKIP_RPATH=ON + -DBUILD_HIPIFY_CLANG=OFF + -DHIP_PLATFORM=amd + -DHIP_COMPILER=clang + -DROCM_PATH="${EPREFIX}/usr" + -DUSE_PROF_API=$(usex profile 1 0) + -DROCCLR_PATH=${CLR_S} + -DHIP_COMMON_DIR=${HIP_S} + -DAMD_OPENCL_PATH=${OCL_S} + ) + + use profile && mycmakeargs+=( -DPROF_API_HEADER_PATH="${RTC_S}"/inc/ext ) + + cmake_src_configure +} + +src_compile() { + HIP_PATH=${HIP_S} docs_compile + cmake_src_compile +} + +src_install() { + + cmake_src_install + + rm "${ED}/usr/include/hip/hcc_detail" || die + + # Don't install .hipInfo and .hipVersion to bin/lib + rm "${ED}/usr/lib/.hipInfo" "${ED}/usr/bin/.hipVersion" || die +} -- cgit v1.2.3