diff options
author | YiyangWu <xgreenlandforwyy@gmail.com> | 2021-07-15 23:19:15 +0800 |
---|---|---|
committer | Benda Xu <heroxbd@gentoo.org> | 2021-08-13 13:08:09 +0800 |
commit | 7f9224da75c864396af5693c2e5b3dbbd0f529c1 (patch) | |
tree | 64d53a975732f20018c3b5b0cc522b311e8b983b /dev-util/hip | |
parent | x11-libs/pango: fix DEPEND (diff) | |
download | gentoo-7f9224da75c864396af5693c2e5b3dbbd0f529c1.tar.gz gentoo-7f9224da75c864396af5693c2e5b3dbbd0f529c1.tar.bz2 gentoo-7f9224da75c864396af5693c2e5b3dbbd0f529c1.zip |
dev-util/hip: bump version to 4.2.0
Update hip-3.5.1-config-cmake-in.patch to 4.2.0
lpl_ca removed, so hip-3.9.0-lpl_ca-add-include.patch not used
fill version into hipvars.pm at src_prepare
fix sandbox violation issue
remove linker flag -rpath in hipcc
correct profiling api header location and profile use flag settings
Closes: https://bugs.gentoo.org/799257
Closes: https://github.com/gentoo/gentoo/pull/21655
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
Signed-off-by: Benda Xu <heroxbd@gentoo.org>
Diffstat (limited to 'dev-util/hip')
-rw-r--r-- | dev-util/hip/Manifest | 1 | ||||
-rw-r--r-- | dev-util/hip/files/hip-4.2.0-cancel-hcc-header-removal.patch | 18 | ||||
-rw-r--r-- | dev-util/hip/files/hip-4.2.0-config-cmake-in.patch | 15 | ||||
-rw-r--r-- | dev-util/hip/files/hipvars.pm | 7 | ||||
-rw-r--r-- | dev-util/hip/hip-4.1.0-r1.ebuild | 2 | ||||
-rw-r--r-- | dev-util/hip/hip-4.2.0.ebuild | 108 |
6 files changed, 148 insertions, 3 deletions
diff --git a/dev-util/hip/Manifest b/dev-util/hip/Manifest index fb6e7126f26d..272ac83deb99 100644 --- a/dev-util/hip/Manifest +++ b/dev-util/hip/Manifest @@ -1,2 +1,3 @@ DIST rocm-hip-4.0.0.tar.gz 1012154 BLAKE2B 02343239a5b27c42dafd241f2c9b6f5195c50f78bfd717ae72bcb16d384bd6cf97ff6f2b86bfcf323aaaf022d6897f46d0987826c80d6f6279be4cb4792e15be SHA512 cf840dbe28a9a15e3be14351bfa22d3c81e1654813a7aee55f53e71b2ee183f8dd0de14a79791617fabb5b357cadbf2ce2f476f78884b2843d30f206d65088f6 DIST rocm-hip-4.1.0.tar.gz 954215 BLAKE2B c4b75ab2158e6921be1c34820ab5d1a5e2eb36112834b0143c50023caa27de384e0497f4837947cc7fe05554c6c95201340b1979eb916b31ebb4ffec8c923735 SHA512 420ffd7b79e2b4506873cbfc56e96395f8ed9d9375ce28df51626601199d4d8dca6920528e255d39a48ad66ee11f4b653f3b9f659df489d32b21886fb86c64b5 +DIST rocm-hip-4.2.0.tar.gz 918281 BLAKE2B 45c28289c8ff9e600bfd9daff8af162c897fcfdf41ce65d91d1761d58253d87a6385fd4a15e818619ca39d3413479bf043ab2758fead349a243105e979b64f7c SHA512 e620507321c949ded2eab6159099eef0eab267eb686b6ee0ed86022fffaa51fb8714a7f344b79acf76c876c55919360905d1bb3a7c00a87f40174774d6682ce8 diff --git a/dev-util/hip/files/hip-4.2.0-cancel-hcc-header-removal.patch b/dev-util/hip/files/hip-4.2.0-cancel-hcc-header-removal.patch new file mode 100644 index 000000000000..08e0f3a3d4e3 --- /dev/null +++ b/dev-util/hip/files/hip-4.2.0-cancel-hcc-header-removal.patch @@ -0,0 +1,18 @@ +hcc now deprecated by ROCm upstream. They use cmake to delete hcc headers for upgrating hip on other distros, +but Gentoo don't need this and the following code causes sandbox violation (#799257). + +github.com/ROCm-Developer-Tools/HIP/commit/c2adc70d4df3d30ef0db84d47be14b99b01aa340 introduce these lines. + +--- orig/CMakeLists.txt ++++ HIP-rocm-4.2.0/CMakeLists.txt +@@ -333,10 +333,6 @@ if(NOT ${INSTALL_SOURCE} EQUAL 0) + endif() + install(DIRECTORY bin DESTINATION . USE_SOURCE_PERMISSIONS) + +- # The following two lines will be removed after upstream updation +- install(CODE "MESSAGE(\"Removing ${CMAKE_INSTALL_PREFIX}/include\")") +- install(CODE "file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/include)") +- + install(DIRECTORY include DESTINATION .) + install(DIRECTORY cmake DESTINATION .) + endif() diff --git a/dev-util/hip/files/hip-4.2.0-config-cmake-in.patch b/dev-util/hip/files/hip-4.2.0-config-cmake-in.patch new file mode 100644 index 000000000000..12644828af78 --- /dev/null +++ b/dev-util/hip/files/hip-4.2.0-config-cmake-in.patch @@ -0,0 +1,15 @@ +since _IMPORT_PREFIX=/opt/gentoo/usr/lib/hip, INTERFACE_INCLUDE_DIRECTORIES should change + +--- orig/hip-config.cmake.in ++++ HIP-rocm-4.2.0/hip-config.cmake.in +@@ -185,8 +185,8 @@ if(HIP_RUNTIME MATCHES "rocclr") + + if(NOT WIN32) + set_target_properties(hip::device PROPERTIES +- INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../include" +- INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../include" ++ INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" ++ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" + ) + endif() + endif() diff --git a/dev-util/hip/files/hipvars.pm b/dev-util/hip/files/hipvars.pm index 3f5c88409e0a..4c614080a119 100644 --- a/dev-util/hip/files/hipvars.pm +++ b/dev-util/hip/files/hipvars.pm @@ -1,9 +1,10 @@ #!/usr/bin/perl -w package hipvars; -$HIP_BASE_VERSION_MAJOR = "4"; -$HIP_BASE_VERSION_MINOR = "1"; +$HIP_BASE_VERSION_MAJOR = "@HIP_BASE_VERSION_MAJOR@"; +$HIP_BASE_VERSION_MINOR = "@HIP_BASE_VERSION_MINOR@"; +$isWindows = 0; $HIP_PATH='/usr/lib/hip'; $ROCM_PATH='/usr'; $CUDA_PATH='/opt/cuda'; @@ -15,5 +16,5 @@ $HIP_COMPILER = "clang"; $HIP_RUNTIME = "rocclr"; $HIP_VERSION_MAJOR = $HIP_BASE_VERSION_MAJOR; $HIP_VERSION_MINOR = $HIP_BASE_VERSION_MINOR; -$HIP_VERSION_PATCH = "0"; +$HIP_VERSION_PATCH = "@HIP_VERSION_PATCH@"; $HIP_VERSION="$HIP_VERSION_MAJOR.$HIP_VERSION_MINOR.$HIP_VERSION_PATCH"; diff --git a/dev-util/hip/hip-4.1.0-r1.ebuild b/dev-util/hip/hip-4.1.0-r1.ebuild index 827305877f9f..15d5bfcd3e35 100644 --- a/dev-util/hip/hip-4.1.0-r1.ebuild +++ b/dev-util/hip/hip-4.1.0-r1.ebuild @@ -59,6 +59,8 @@ src_prepare() { hprefixify $(grep -rl --exclude-dir=build/ "/usr" "${S}") cp "$(prefixify_ro "${FILESDIR}"/hipvars.pm)" bin/ || 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)," -i bin/hipvars.pm || die } src_configure() { diff --git a/dev-util/hip/hip-4.2.0.ebuild b/dev-util/hip/hip-4.2.0.ebuild new file mode 100644 index 000000000000..20017c515343 --- /dev/null +++ b/dev-util/hip/hip-4.2.0.ebuild @@ -0,0 +1,108 @@ +# 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:${SLOT} + dev-util/rocminfo:${SLOT} + =sys-devel/llvm-roc-${PV}*[runtime] + profile? ( dev-util/roctracer:${SLOT} )" +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}/${PN}-4.1.0-DisableTest.patch" + "${FILESDIR}/${PN}-3.9.0-add-include-directories.patch" + "${FILESDIR}/${PN}-4.2.0-config-cmake-in.patch" + "${FILESDIR}/${PN}-3.5.1-hip_vector_types.patch" + "${FILESDIR}/${PN}-4.2.0-cancel-hcc-header-removal.patch" +) + +S="${WORKDIR}/HIP-rocm-${PV}" + +src_prepare() { + cmake_src_prepare + 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 + + # remove forcing set USE_PROF_API to 1 + sed -e '/set(USE_PROF_API "1")/d' -i rocclr/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 "/FLAGS .= \" -isystem \$HSA_PATH/d" \ + -e "s:\$ENV{'DEVICE_LIB_PATH'}:'/usr/lib/amdgcn/bitcode':" \ + -e "/rpath/s,--rpath=[^ ]*,," \ + -i bin/hipcc || 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}") + + cp "$(prefixify_ro "${FILESDIR}"/hipvars.pm)" bin/ || 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)," -i bin/hipvars.pm || die +} + +src_configure() { + strip-flags + 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="${EPREFIX}/usr/lib/llvm/roc" + -DCMAKE_BUILD_TYPE=${buildtype} + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/hip" + -DBUILD_HIPIFY_CLANG=OFF + -DHIP_PLATFORM=rocclr + -DHIP_COMPILER=clang + -DROCM_PATH="${EPREFIX}/usr" + -DHSA_PATH="${EPREFIX}/usr" + -DUSE_PROF_API=$(usex profile 1 0) + -DPROF_API_HEADER_PATH="${EPREFIX}"/usr/include/roctracer/ext + -DROCclr_DIR="${EPREFIX}"/usr/include/rocclr + ) + + cmake_src_configure +} + +src_install() { + echo "PATH=${EPREFIX}/usr/lib/hip/bin" >> 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 + + rm "${ED}/usr/lib/hip/include/hip/hcc_detail" || die +} |