summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenda Xu <heroxbd@gentoo.org>2023-11-18 22:54:50 +0800
committerBenda Xu <heroxbd@gentoo.org>2023-12-14 23:01:47 +0800
commit5297819d6d04e8608d329a12afa05dd68ea4f10f (patch)
treec769483e0d38d04669d94df43b3698bd0507f4bc /dev-util/hip
parentrocm.eclass: add ROCM_SKIP_GLOBALS for the USE-flags exposure. (diff)
downloadgentoo-5297819d6d04e8608d329a12afa05dd68ea4f10f.tar.gz
gentoo-5297819d6d04e8608d329a12afa05dd68ea4f10f.tar.bz2
gentoo-5297819d6d04e8608d329a12afa05dd68ea4f10f.zip
dev-util/hip: include test suit.
The dev-util/hip upstream has separated its test cases into a full git repository with an independent build system. To run the test cases, we have to call cmake twice in every src_* phase. I come up with a wrapper to hack CMAKE_USE_DIR and BUILD_DIR values. Ignore vulkan tests before someone could figure out how to properly run them. Reference: https://github.com/ROCm-Developer-Tools/HIP/issues/3292 Closes: https://github.com/gentoo/gentoo/pull/33906 Signed-off-by: Benda Xu <heroxbd@gentoo.org>
Diffstat (limited to 'dev-util/hip')
-rw-r--r--dev-util/hip/Manifest1
-rw-r--r--dev-util/hip/files/hip-test-5.7.0-rocm_agent_enumerator-location.patch15
-rw-r--r--dev-util/hip/hip-5.7.1-r1.ebuild75
3 files changed, 82 insertions, 9 deletions
diff --git a/dev-util/hip/Manifest b/dev-util/hip/Manifest
index d84cbf43fe2e..13df1e2aaa2d 100644
--- a/dev-util/hip/Manifest
+++ b/dev-util/hip/Manifest
@@ -4,6 +4,7 @@ DIST rocclr-5.1.3.tar.gz 618606 BLAKE2B 02b7732ddd03c0883bee49c56466cd21c649159f
DIST rocclr-5.3.3.tar.gz 625944 BLAKE2B 0cdbc1415a355e1d56628834846aaa8587c9827eeea59f4312b788e868265dcb42197181fd5ef411416da2e11662c7f665f578aa750ab88c3a5405bcc58ee449 SHA512 3f85532cffc09c2ca8e7cd1770263d1c1a38633ed2bc5cfe62072e12a6f8f669db400519950718be31f6b77693d372e2ef905f06c7f02e126aa9ff7d2da97924
DIST rocclr-5.4.3.tar.gz 640557 BLAKE2B 9ab91bab7ffb06c9c0d1c2ae79533fccc597071dda289ac375e32eb2965c638a7029951d2a49d46eeead9d7d242fe3a0cedb3e444d877af1bbf0e2d801c91e11 SHA512 c1d1a2ca08c2d762a221c04d394469aa7aff46086151333b145e0db9a7c7eb3dbbf8b9693e50d816aa9a13c16b4ebacf5ff3d5d8ff3393a8a764728ef5172d3a
DIST rocclr-5.5.1.tar.gz 634330 BLAKE2B e6383a6b6b09f274a944d66effd345e38a191ec73ee5c5240f8ec8bb62a4df97b80835ce57f8f78c3834602b9da425b49289b5c7cd7e4c7071147ff409c6a6c9 SHA512 4c12011d22a4f14d9e93250b2a38716eb973139afa1adbbbd51c0e0ed13c0b7c1f45a37c71ef937c5fdabf09e928d7913ca3332fc61b7a2c10d21421306a228f
+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-hip-5.1.3.tar.gz 967696 BLAKE2B 15cb52b5934b84acf515fe9c83b7c8982e00a23e20af933bdd2c4bc5b56fd42b08c8a08e840c85d2e0a8386d5a0e9c110504f68499989de1aaad00e9a5efcf43 SHA512 6b6fd6c12d73788df1711b12326b97fc7a184f319e0db114947b7967b75f2ee131f81e42e43a4981456b507221a6013133731120409f90214e13304299ccbc24
DIST rocm-hip-5.3.3.tar.gz 1151858 BLAKE2B 5f460b2078c850b3eb4414fcec4a6f951a3b282aa9828f77ba5d5adfdc0ee8d2e62c856e112a154c340daaf7dad49f4871412edd7b38f7fae2e6b17840ee144b SHA512 e747cc10e78cd09009cac762f0e060be13f3447af7ec2a4a2889cbdc09cd76ecb1b5b58c89f09a3b45a8296c2c71e1c55baf113e58a5a12434af3de7168b8d87
diff --git a/dev-util/hip/files/hip-test-5.7.0-rocm_agent_enumerator-location.patch b/dev-util/hip/files/hip-test-5.7.0-rocm_agent_enumerator-location.patch
new file mode 100644
index 000000000000..1d967212ac9a
--- /dev/null
+++ b/dev-util/hip/files/hip-test-5.7.0-rocm_agent_enumerator-location.patch
@@ -0,0 +1,15 @@
+In Gentoo rocm_agent_enumerator is installed by rocminfo and is in PATH.
+
+--- catch/CMakeLists.txt~ 2023-11-18 13:56:08.000000000 +0800
++++ catch/CMakeLists.txt 2023-11-18 13:59:28.136170638 +0800
+@@ -182,9 +182,8 @@
+ # rocm_agent_enumerator
+ if(NOT DEFINED OFFLOAD_ARCH_STR
+ AND NOT DEFINED ENV{HCC_AMDGPU_TARGET}
+- AND EXISTS "${ROCM_PATH}/bin/rocm_agent_enumerator"
+ AND HIP_PLATFORM STREQUAL "amd" AND UNIX)
+- execute_process(COMMAND ${ROCM_PATH}/bin/rocm_agent_enumerator
++ execute_process(COMMAND rocm_agent_enumerator
+ OUTPUT_VARIABLE HIP_GPU_ARCH
+ RESULT_VARIABLE ROCM_AGENT_ENUM_RESULT)
+ # Trim out gfx000
diff --git a/dev-util/hip/hip-5.7.1-r1.ebuild b/dev-util/hip/hip-5.7.1-r1.ebuild
index 8eb15a833e66..2bc703093df9 100644
--- a/dev-util/hip/hip-5.7.1-r1.ebuild
+++ b/dev-util/hip/hip-5.7.1-r1.ebuild
@@ -5,21 +5,26 @@ EAPI=8
DOCS_BUILDER="doxygen"
DOCS_DEPEND="media-gfx/graphviz"
+ROCM_SKIP_GLOBALS=1
-inherit cmake docs llvm
+inherit cmake docs llvm rocm
LLVM_MAX_SLOT=17
+TEST_PV=5.7.0 # No hip-test-5.7.1 release
+
DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability"
HOMEPAGE="https://github.com/ROCm-Developer-Tools/hipamd"
SRC_URI="https://github.com/ROCm-Developer-Tools/clr/archive/refs/tags/rocm-${PV}.tar.gz -> rocm-clr-${PV}.tar.gz
- https://github.com/ROCm-Developer-Tools/HIP/archive/refs/tags/rocm-${PV}.tar.gz -> hip-${PV}.tar.gz"
+ https://github.com/ROCm-Developer-Tools/HIP/archive/refs/tags/rocm-${PV}.tar.gz -> hip-${PV}.tar.gz
+ test? ( https://github.com/ROCm-Developer-Tools/hip-tests/archive/refs/tags/rocm-${TEST_PV}.tar.gz )"
KEYWORDS="~amd64"
LICENSE="MIT"
SLOT="0/$(ver_cut 1-2)"
-IUSE="debug"
+RESTRICT="!test? ( test )"
+IUSE="debug test"
DEPEND="
dev-util/hipcc
@@ -45,18 +50,35 @@ PATCHES=(
S="${WORKDIR}/clr-rocm-${PV}/"
+hip_test_wrapper() {
+ local S="${WORKDIR}/hip-tests-rocm-${TEST_PV}/catch"
+ local CMAKE_USE_DIR="${S}"
+ local BUILD_DIR="${S}_build"
+ cd "${S}" || die
+ $@
+}
+
+src_prepare() {
+ # https://github.com/ROCm-Developer-Tools/HIP/commit/405d029422ba8bb6be5a233d5eebedd2ad2e8bd3
+ # https://github.com/ROCm-Developer-Tools/clr/commit/ab6d34ae773f4d151e04170c0f4e46c1135ddf3e
+ # Migrated to hip-test, but somehow the change is not applied to the tarball.
+ rm -rf "${WORKDIR}"/HIP-rocm-${PV}/tests || die
+ sed -e '/tests.*cmake/d' -i hipamd/CMakeLists.txt || die
+
+ cmake_src_prepare
+
+ if use test; then
+ PATCHES=${FILESDIR}/hip-test-5.7.0-rocm_agent_enumerator-location.patch \
+ hip_test_wrapper cmake_src_prepare
+ fi
+}
+
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
@@ -70,10 +92,45 @@ src_configure() {
)
cmake_src_configure
+
+ if use test; then
+ local mycmakeargs=(
+ -DROCM_PATH="${BUILD_DIR}"/hipamd
+ -DHIP_PLATFORM=amd
+ )
+ hip_test_wrapper cmake_src_configure
+ fi
}
src_compile() {
cmake_src_compile
+
+ if use test; then
+ HIP_PATH="${BUILD_DIR}"/hipamd \
+ 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() {