c_josie_overlay

dev-libs/rocm-opencl-runtime: add 10.1 ebuild; fah-client-bin: add rocm-opencl flag

Bump the tree's rocm-opencl-runtime 7.2.0 ebuild to therock-10.1
(source = the same clr.tar.gz dev-util/hip uses), installs
libamdocl64.so* + /etc/OpenCL/vendors/amdocl64.icd. The 6.2.4
lib-version patch dry-runs clean against the 10.1 source.

sci-biology/fah-client-bin gains a rocm-opencl flag (mirrors webui)
that RDEPENDs on it, the single switch for F@H GPU folding on AMD.

6788225244a1f7a18e05b98f82edc11d965ee246
cjosie <administrator@josie-c.com> · 2026-10-14T23:57 · browse files at this commit

parents: 5fcd122

diff --git a/dev-libs/rocm-opencl-runtime/Manifest b/dev-libs/rocm-opencl-runtime/Manifest
new file mode 100644
index 0000000..adf14d9
--- /dev/null
+++ b/dev-libs/rocm-opencl-runtime/Manifest
@@ -0,0 +1 @@
+DIST rocm-clr-10.1.tar.gz 2640985 BLAKE2B 2ca57f75dc766427d919e46b4787baf3cb1f2ad870658b07fac539afaab07c1191a7e661bd8d9d29006ba3cbad9eecc26d4a703c32ff3b3dd6f21e5fa58dae30 SHA512 9b8677e66b026ea4f82bba3ec1f9c984ddddf0e3ad4a7498c0c8bf5493647668de59dfdec8ca07025f5a4d5ae054ceeca30a49389a4c493c90b57393aec75d4e
diff --git a/dev-libs/rocm-opencl-runtime/files/rocm-opencl-runtime-6.2.4-fix-lib-version.patch b/dev-libs/rocm-opencl-runtime/files/rocm-opencl-runtime-6.2.4-fix-lib-version.patch
new file mode 100644
index 0000000..17c6ebc
--- /dev/null
+++ b/dev-libs/rocm-opencl-runtime/files/rocm-opencl-runtime-6.2.4-fix-lib-version.patch
@@ -0,0 +1,13 @@
+There is no ROCM_LIBPATCH_VERSION outside of AMD farm.
+Upstream bug: https://github.com/ROCm/clr/issues/112
+--- a/opencl/amdocl/CMakeLists.txt
++++ b/opencl/amdocl/CMakeLists.txt
+@@ -66,6 +66,8 @@ set(AMDOCL_LIB_VERSION_MAJOR "2")
+ set(AMDOCL_LIB_VERSION_MINOR "1")
+ if(DEFINED ENV{ROCM_LIBPATCH_VERSION})
+   set(AMDOCL_LIB_VERSION_PATCH "${AMDOCL_LIB_VERSION_MAJOR}.${AMDOCL_LIB_VERSION_MINOR}.$ENV{ROCM_LIBPATCH_VERSION}")
++else()
++  set(AMDOCL_LIB_VERSION_PATCH "${AMDOCL_LIB_VERSION_MAJOR}.${AMDOCL_LIB_VERSION_MINOR}")
+ endif()
+ 
+ set_target_properties(amdocl PROPERTIES
diff --git a/dev-libs/rocm-opencl-runtime/metadata.xml b/dev-libs/rocm-opencl-runtime/metadata.xml
new file mode 100644
index 0000000..68e21ef
--- /dev/null
+++ b/dev-libs/rocm-opencl-runtime/metadata.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="person" proxied="yes">
+		<email>lockalsash@gmail.com</email>
+		<name>Sv. Lockal</name>
+		<description>Primary maintainer</description>
+	</maintainer>
+	<maintainer type="person" proxied="yes">
+		<email>xgreenlandforwyy@gmail.com</email>
+		<name>Yiyang Wu</name>
+	</maintainer>
+	<maintainer type="person" proxied="yes">
+		<email>negril.nx+gentoo@gmail.com</email>
+		<name>Paul Zander</name>
+		<description>General GPGPU stuff</description>
+	</maintainer>
+	<maintainer type="project" proxied="proxy">
+		<email>sci@gentoo.org</email>
+		<name>Gentoo Science Project</name>
+	</maintainer>
+	<upstream>
+		<remote-id type="github">ROCm/rocm-systems</remote-id>
+	</upstream>
+</pkgmetadata>
diff --git a/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-10.1.ebuild b/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-10.1.ebuild
new file mode 100644
index 0000000..aa18e09
--- /dev/null
+++ b/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-10.1.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ROCM_SKIP_GLOBALS=1
+inherit cmake edo flag-o-matic rocm
+
+DESCRIPTION="Radeon Open Compute OpenCL Compatible Runtime"
+HOMEPAGE="https://github.com/ROCm/rocm-systems/tree/develop/projects/clr"
+
+SRC_URI="https://github.com/ROCm/rocm-systems/releases/download/therock-${PV}/clr.tar.gz -> rocm-clr-${PV}.tar.gz"
+S="${WORKDIR}/clr"
+
+LICENSE="Apache-2.0 MIT"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+IUSE="debug test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	dev-libs/rocr-runtime:${SLOT}
+	dev-libs/rocm-comgr:${SLOT}
+	dev-libs/rocm-device-libs:${SLOT}
+	>=virtual/opencl-3
+	media-libs/mesa[-opencl]
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	>=dev-build/rocm-cmake-6.0
+	media-libs/glew
+	test? ( >=x11-apps/mesa-progs-8.5.0[X] )
+"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-6.2.4-fix-lib-version.patch"
+)
+
+src_prepare() {
+	# Compatibility with CMake < 3.10 will be removed
+	sed -e "/cmake_minimum_required/ s/3\.5/3.10/" \
+		-i opencl/khronos/icd/CMakeLists.txt opencl/khronos/headers/opencl2.2/tests/CMakeLists.txt || die
+	cmake_src_prepare
+}
+
+src_configure() {
+	# -Werror=strict-aliasing
+	# https://bugs.gentoo.org/856088
+	# https://github.com/ROCm/clr/issues/64
+	#
+	# Do not trust it for LTO either
+	append-flags -fno-strict-aliasing
+	filter-lto
+
+	# Fix ld.lld linker error: https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/issues/155
+	append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
+
+	# Reported upstream: https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/issues/120
+	append-cflags -fcommon
+
+	local mycmakeargs=(
+		-Wno-dev
+		-DROCM_PATH="${EPREFIX}/usr"
+		-DBUILD_TESTS=$(usex test ON OFF)
+		-DEMU_ENV=ON
+		-DBUILD_ICD=ON
+		-DCLR_BUILD_OCL=ON
+		-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON
+	)
+	cmake_src_configure
+}
+
+src_install() {
+	insinto /etc/OpenCL/vendors
+	doins opencl/config/amdocl64.icd
+
+	cd "${BUILD_DIR}"/opencl || die
+	insinto /usr/lib64
+	doins amdocl/libamdocl64.so*
+	doins tools/cltrace/libcltrace.so
+}
+
+src_test() {
+	check_amdgpu
+	cd "${BUILD_DIR}"/tests/ocltst || die
+	export OCL_ICD_FILENAMES="${BUILD_DIR}"/amdocl/libamdocl64.so
+	local instruction1="Please start an X server using amdgpu driver (not Xvfb!),"
+	local instruction2="and export OCLGL_DISPLAY=\${DISPLAY} OCLGL_XAUTHORITY=\${XAUTHORITY} before reruning the test."
+	if [[ -n ${OCLGL_DISPLAY+x} ]]; then
+		export DISPLAY=${OCLGL_DISPLAY}
+		export XAUTHORITY=${OCLGL_XAUTHORITY}
+		ebegin "Running oclgl test under DISPLAY ${OCLGL_DISPLAY}"
+		if ! glxinfo | grep "OpenGL vendor string: AMD"; then
+			ewarn "${instruction1}"
+			ewarn "${instruction2}"
+			die "This display does not have AMD OpenGL vendor!"
+		fi
+		./ocltst -m $(realpath liboclgl.so) -A ogl.exclude
+		eend $? || die "oclgl test failed"
+	else
+		ewarn "${instruction1}"
+		ewarn "${instruction2}"
+		die "\${OCLGL_DISPLAY} not set."
+	fi
+	edob ./ocltst -m $(realpath liboclruntime.so) -A oclruntime.exclude
+	edob ./ocltst -m $(realpath liboclperf.so) -A oclperf.exclude
+}
diff --git a/sci-biology/fah-client-bin/fah-client-bin-8.5.6.ebuild b/sci-biology/fah-client-bin/fah-client-bin-8.5.6.ebuild
index 4438c8b..f9f9647 100644
--- a/sci-biology/fah-client-bin/fah-client-bin-8.5.6.ebuild
+++ b/sci-biology/fah-client-bin/fah-client-bin-8.5.6.ebuild
@@ -16,7 +16,7 @@ S="${WORKDIR}"
 LICENSE="GPL-3+"
 SLOT="0"
 KEYWORDS="~amd64"
-IUSE="systemd webui"
+IUSE="systemd webui rocm-opencl"
 RESTRICT="bindist mirror strip"
 QA_PREBUILT="usr/bin/fah-client"
 
@@ -30,6 +30,7 @@ RDEPEND="
 	systemd? ( sys-apps/systemd )
 	!systemd? ( sys-auth/elogind )
 	webui? ( sci-biology/fah-web-control-bin )
+	rocm-opencl? ( dev-libs/rocm-opencl-runtime )
 "
 
 src_prepare() {
@@ -88,6 +89,9 @@ pkg_postinst() {
 	if use webui; then
 		elog "Local Web Control is installed at http://localhost:7396/"
 	fi
+	if use rocm-opencl; then
+		elog "The ROCm OpenCL runtime is installed; check that it is detected with: clinfo"
+	fi
 	elog "Control the client from your browser at https://v8-5.foldingathome.org/"
 	elog "or with fahctl. Start the service with:"
 	elog "(openrc)\trc-service fah-client start"
diff --git a/sci-biology/fah-client-bin/metadata.xml b/sci-biology/fah-client-bin/metadata.xml
index 75de9b6..8ba7833 100644
--- a/sci-biology/fah-client-bin/metadata.xml
+++ b/sci-biology/fah-client-bin/metadata.xml
@@ -10,5 +10,6 @@
 	</upstream>
 	<use>
 		<flag name="webui">Pull in sci-biology/fah-web-control-bin and point the client's built-in web server at the local Web Control</flag>
+		<flag name="rocm-opencl">Pull in dev-libs/rocm-opencl-runtime for OpenCL GPU folding on AMD GPUs</flag>
 	</use>
 </pkgmetadata>