dev-util/hip - 10.0.0 (inode64-overlay)

Search

Install

Install this version:

emerge -a =dev-util/hip-10.0.0

If this version is masked, you can unmask it using the autounmask tool or standard emerge options:

autounmask =dev-util/hip-10.0.0

Or alternatively:

emerge --autounmask-write -a =dev-util/hip-10.0.0

Package Information

Description:
C++ Heterogeneous-Compute Interface for Portability
Homepage:
https://github.com/ROCm/rocm-systems/tree/develop/projects/clr
License:
MIT

Ebuild Details

Version EAPI Keywords Slot
10.0.0 8 ~amd64 0/$(ver_cut 1-2)
View Raw Ebuild
# Copyright 1999-2026 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=( 23 )

inherit cmake docs flag-o-matic llvm-r2 rocm

ROCM_SYSTEMS_COMMIT=6b0e43f341195e203754e08f850e437ff2fc09f9

DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability"
HOMEPAGE="https://github.com/ROCm/rocm-systems/tree/develop/projects/clr"
SRC_URI="https://github.com/ROCm/rocm-systems/archive/${ROCM_SYSTEMS_COMMIT}.tar.gz -> rocm-systems-${ROCM_SYSTEMS_COMMIT}.tar.gz"
S="${WORKDIR}/rocm-systems-${ROCM_SYSTEMS_COMMIT}/projects/clr"
TEST_S="${WORKDIR}/rocm-systems-${ROCM_SYSTEMS_COMMIT}/projects/hip-tests/catch"
HIP_S="${WORKDIR}/rocm-systems-${ROCM_SYSTEMS_COMMIT}/projects/hip"

LICENSE="MIT"
SLOT="0/$(ver_cut 1-2)"
KEYWORDS="~amd64"

IUSE="debug +hip numa opencl +profile test video_cards_amdgpu"

# many tests are broken; also tests run against installed version, not built one
RESTRICT="test"

REQUIRED_USE="
	|| ( hip opencl )
	video_cards_amdgpu
"

DEPEND="
	video_cards_amdgpu? (
		dev-util/rocminfo:${SLOT}
		profile? ( dev-util/rocprofiler-register:${SLOT} )
		dev-libs/rocm-comgr:${SLOT}
		dev-libs/rocr-runtime:${SLOT}
	)
	x11-base/xorg-proto
	virtual/opengl[X]
	numa? ( sys-process/numactl )
"
BDEPEND="
	video_cards_amdgpu? (
		dev-util/hipcc:${SLOT}
	)
	test? (
		media-libs/freeglut
		$(llvm_gen_dep "
			dev-util/spirv-llvm-translator:\${LLVM_SLOT}
		")
	)
"
RDEPEND="${DEPEND}
	~dev-libs/rocm-core-${PV}
	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}
		dev-libs/rocm-device-libs:${SLOT}
		dev-libs/roct-thunk-interface:${SLOT}
	)
"

PATCHES=(
	"${FILESDIR}/${PN}-6.3.0-no-isystem-usr-include.patch"
	"${FILESDIR}/${PN}-6.3.0-clr-fix-libcxx.patch"
	"${FILESDIR}/${PN}-7.0.2-fix-libcxx-noinline.patch"
	"${FILESDIR}/${PN}-7.1.0-no-hipother-install.patch"
	"${FILESDIR}/${PN}-10.0.0-fix-overaligned-allocation.patch"
)

QA_FLAGS_IGNORED="usr/lib.*/libhiprtc-builtins.*"

hip_test_wrapper() {
	local CMAKE_USE_DIR="${TEST_S}"
	local BUILD_DIR="${TEST_S}_build"
	cd "${TEST_S}" || die
	"${@}"
}

src_prepare() {
	pushd "${HIP_S}" >/dev/null || die

	# 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

	# LLVM 23 represents the private GPU address space with the language-level
	# opencl_private attribute.  Keep the OCML declarations type-compatible
	# with Clang's __clang_hip_math.h wrappers.
	sed -e 's/__attribute__((address_space(5)))/__attribute__((opencl_private))/g' \
		-i hipamd/include/hip/amd_detail/math_fwd.h || die

	# do not install /usr/share/doc/${P}-asan
	sed -e "/asan COMPONENT asan/d" -i hipamd/packaging/CMakeLists.txt || die

	sed -e "s/@HIP_INSTALLS_HIPCC@/ON/g" -i hipamd/hip-config.cmake.in || die

	# skip installation of hipcc: installed via dev-util/hipcc
	sed -e "s/NOT \${HIPCC_BIN_DIR}/INSTALL_HIPCC AND NOT \${HIPCC_BIN_DIR}/" \
		-i "hipamd/CMakeLists.txt" || die

	sed -e "/cmake_minimum_required/ s/3\.[35]/3.10/" \
		-i opencl/khronos/icd/CMakeLists.txt \
		-i opencl/khronos/headers/opencl2.2/tests/CMakeLists.txt || die

	cmake_src_prepare

	if use test; then
		local PATCHES=()
		sed -e "s/-Werror //" -e "s/-Wall -Wextra //" -i "${TEST_S}/CMakeLists.txt" || die

		# policy not supported by CMake 4.0; and not needed
		sed -e '/cmake_policy(SET CMP0037 OLD)/d' -i "${TEST_S}/CMakeLists.txt" || die

		sed -e "s:/opt/rocm/bin:${EPREFIX}/usr/bin:" \
			-i "${TEST_S}/hipTestMain/hip_test_context.cc" || 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="$(usex profile)"
		-DHIPCC_BIN_DIR="${EPREFIX}/usr/bin"
		-DROCM_PATH="${EPREFIX}/usr"

		-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON
	)

	if use video_cards_amdgpu; then
		mycmakeargs+=(
			-DHIP_PLATFORM="amd"
			-DOpenGL_GL_PREFERENCE="GLVND"
			-DUSE_PROF_API=OFF
			# clr 7.2.3 dropped its find_package(NUMA), so cmake silently
			# ignores these; kept aligned with ::gentoo in case upstream
			# restores NUMA detection — verified inert 2026-05-08.
			-DCMAKE_DISABLE_FIND_PACKAGE_NUMA="$(usex !numa)"
			-DCMAKE_REQUIRE_FIND_PACKAGE_NUMA="$(usex numa)"
		)
	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"
			)
		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"
	export ROCM_PATH="${EPREFIX}/usr"

	# 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
	)

	hip_test_wrapper cmake_src_test -j1
}

USE Flags

Manage flags for this package: euse -i <flag> -p dev-util/hip | euse -E <flag> -p dev-util/hip | euse -D <flag> -p dev-util/hip

Global/Standard Flags

hip
Default: Enabled (+)
profile
Default: Enabled (+)

Inherited Eclasses

Dependencies

DEPEND

	video_cards_amdgpu? (
		dev-util/rocminfo:0/$(ver_cut 1-2)
		profile? ( dev-util/rocprofiler-register:0/$(ver_cut 1-2) )
		dev-libs/rocm-comgr:0/$(ver_cut 1-2)
		dev-libs/rocr-runtime:0/$(ver_cut 1-2)
	)
	x11-base/xorg-proto
	virtual/opengl[X]
	numa? ( sys-process/numactl )

RDEPEND

	video_cards_amdgpu? (
		dev-util/rocminfo:0/$(ver_cut 1-2)
		profile? ( dev-util/rocprofiler-register:0/$(ver_cut 1-2) )
		dev-libs/rocm-comgr:0/$(ver_cut 1-2)
		dev-libs/rocr-runtime:0/$(ver_cut 1-2)
	)
	x11-base/xorg-proto
	virtual/opengl[X]
	numa? ( sys-process/numactl )

	~dev-libs/rocm-core-10.0.0
	opencl? (
		!dev-libs/opencl-icd-loader
		!dev-libs/rocm-opencl-runtime
		!dev-util/clinfo
		!dev-util/opencl-headers
	)
	video_cards_amdgpu? (
		dev-util/hipcc:0/$(ver_cut 1-2)
		dev-libs/rocm-device-libs:0/$(ver_cut 1-2)
		dev-libs/roct-thunk-interface:0/$(ver_cut 1-2)
	)

BDEPEND

	video_cards_amdgpu? (
		dev-util/hipcc:${SLOT}
	)
	test? (
		media-libs/freeglut
		$(llvm_gen_dep 

Manifest for 10.0.0

Type File Size Source URLs
DIST rocm-systems-6b0e43f341195e203754e08f850e437ff2fc09f9.tar.gz 211666901 bytes https://github.com/ROCm/rocm-systems/archive/6b0e43f341195e203754e08f850e437ff2fc09f9.tar.gz