From ad67ed374cb408ab2ee80ff6eb3bf2e663ee8387 Mon Sep 17 00:00:00 2001 From: "Sv. Lockal" Date: Wed, 14 Oct 2026 13:53:33 +0800 Subject: [PATCH] dev-libs/rocm-opencl-runtime: add 10.1.0 Bug: https://bugs.gentoo.org/984016 Signed-off-by: Sv. Lockal Part-of: https://github.com/gentoo/gentoo/pull/46894 Signed-off-by: Sam James --- dev-libs/rocm-opencl-runtime/Manifest | 1 + ...cm-opencl-runtime-10.1.0-aligned-new.patch | 25 ++++ .../rocm-opencl-runtime-10.1.0.ebuild | 121 ++++++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 dev-libs/rocm-opencl-runtime/files/rocm-opencl-runtime-10.1.0-aligned-new.patch create mode 100644 dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-10.1.0.ebuild diff --git a/dev-libs/rocm-opencl-runtime/Manifest b/dev-libs/rocm-opencl-runtime/Manifest index 2ff84dbd9dce9..b74a0376177c2 100644 --- a/dev-libs/rocm-opencl-runtime/Manifest +++ b/dev-libs/rocm-opencl-runtime/Manifest @@ -1,3 +1,4 @@ +DIST rocm-clr-10.1.0.tar.gz 2640985 BLAKE2B 2ca57f75dc766427d919e46b4787baf3cb1f2ad870658b07fac539afaab07c1191a7e661bd8d9d29006ba3cbad9eecc26d4a703c32ff3b3dd6f21e5fa58dae30 SHA512 9b8677e66b026ea4f82bba3ec1f9c984ddddf0e3ad4a7498c0c8bf5493647668de59dfdec8ca07025f5a4d5ae054ceeca30a49389a4c493c90b57393aec75d4e DIST rocm-clr-6.3.3.tar.gz 2095704 BLAKE2B bdb315fc9f1f9c76aa2a345bd48a600c81f3b72eb68fee8862b5e155e7519bef6f6421698a43358c6fe0200bb0b6924ff819860d9a91a5c07fc3e9d44eeb1b16 SHA512 94d2959b981b324e0dae2d06e86c72cd01fa495de081666bcec2445c02bada22aa60e94ecac0ee63e70e52275f92caeefcb6dc96a3f0fba593896be7b0d8ab42 DIST rocm-clr-6.4.3.tar.gz 2126045 BLAKE2B eadeaa050e684373883faadfbf42d6b4152979154587afb1a2583bf9ddfb3ff9ab9787a433c8f380ac52012732ff2f68892ab256ec76f32557c164e9551745af SHA512 38daec86ea9c8e60f420b4eec5e96d88a4e51585dcbb7352bec27f0c712f4b856f413c42e2585c031a81e8046065d76763c624500ba786ae0e9133278f00418c DIST rocm-clr-7.0.2.tar.gz 2171932 BLAKE2B b14c1e7f42e7bf0e7b3514095495524ae572f65fa28780ef74853540d2f2952f97e0d82be09f70756a860592e7ae0ef738239a34715dee79d9a293d02ce7337e SHA512 eb80cd47c8a3e3fa8948cc58c6b8b158b2e2ae49f70a63f7040fe59a309bdd4f29334f6edc7950d13932c50162884288e27e2308b85293f68739402547d7ad36 diff --git a/dev-libs/rocm-opencl-runtime/files/rocm-opencl-runtime-10.1.0-aligned-new.patch b/dev-libs/rocm-opencl-runtime/files/rocm-opencl-runtime-10.1.0-aligned-new.patch new file mode 100644 index 0000000000000..f7a79eda6c44b --- /dev/null +++ b/dev-libs/rocm-opencl-runtime/files/rocm-opencl-runtime-10.1.0-aligned-new.patch @@ -0,0 +1,25 @@ +Fix crash in VirtualGPU constructor with -march supporting AVX-512 +Bug: https://github.com/ROCm/rocm-systems/issues/11256 +Backports: https://github.com/ROCm/rocm-systems/pull/11257 +--- a/rocclr/include/top.hpp ++++ b/rocclr/include/top.hpp +@@ -162,8 +162,19 @@ class ReferenceCountedObject { + public: + ReferenceCountedObject() : referenceCount_(1) {} + ++ // size-only new hides ::operator new(size, align_val_t); over-aligned ++ // subclasses (VirtualGPU alignas(64) AQL packets) need these overloads. + void* operator new(size_t size) { return ::operator new(size); } ++ void* operator new(size_t size, std::align_val_t align) { ++ return ::operator new(size, align); ++ } + void operator delete(void* p) { return ::operator delete(p); } ++ void operator delete(void* p, std::align_val_t align) { ++ return ::operator delete(p, align); ++ } ++ void operator delete(void* p, size_t, std::align_val_t align) { ++ return ::operator delete(p, align); ++ } + void* operator new(size_t size, size_t extSize) { + return ReferenceCountedObject::operator new(size + extSize); + }; diff --git a/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-10.1.0.ebuild b/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-10.1.0.ebuild new file mode 100644 index 0000000000000..797a3cde48e4b --- /dev/null +++ b/dev-libs/rocm-opencl-runtime/rocm-opencl-runtime-10.1.0.ebuild @@ -0,0 +1,121 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +ROCM_SKIP_GLOBALS=1 +inherit cmake edob 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%.0}/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" + "${FILESDIR}/${PN}-10.1.0-aligned-new.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 + + # Allocate all free memory or a buffer of the maximum allocation size. + # On APUs this starves other GPU clients (crashing the desktop session) or OOMs. + cat >> opencl/tests/ocltst/module/runtime/oclruntime.exclude <<-EOF || die + OCLMemoryInfo + OCLCreateBuffer + OCLCreateImage + EOF + + # rocclr finds glXGetProcAddress via dlsym(RTLD_DEFAULT); expose GL libs of the oclgl module + sed -e "s/dlopen(m_paths\[i\].c_str(), RTLD_NOW)/dlopen(m_paths[i].c_str(), RTLD_NOW | RTLD_GLOBAL)/" \ + -i opencl/tests/ocltst/env/ocltst.cpp || 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}"/opencl/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 +}