diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fee771b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.LLM_Memory/
+/radiance/
diff --git a/dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-dont-add-nogpulib.patch b/dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-dont-add-nogpulib.patch
new file mode 100644
index 0000000..526318f
--- /dev/null
+++ b/dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-dont-add-nogpulib.patch
@@ -0,0 +1,31 @@
+From 179ec2e67bf882c6bccb27f81db3d80f7eb9946e Mon Sep 17 00:00:00 2001
+From: Jacob Lambert <jacob.lambert@amd.com>
+Date: Fri, 12 Apr 2024 13:56:42 -0700
+Subject: [PATCH] [Comgr] Don't add -nogpulib option for assembley action
+
+We can omit setting -nogpulib even without a -rocm-path=. option
+when calling the assembly action. This avoids the following warning:
+
+warning: argument unused during compilation: '-nogpulib'
+Change-Id: I66d512befbafd9382f050c45a0d3950985e8ae38
+---
+ amd/comgr/src/comgr-compiler.cpp | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/comgr-compiler.cpp b/src/comgr-compiler.cpp
+index 143ab4e4f3db..21b233fa94b2 100644
+--- a/src/comgr-compiler.cpp
++++ b/src/comgr-compiler.cpp
+@@ -1758,6 +1758,9 @@ amd_comgr_status_t AMDGPUCompiler::assembleToRelocatable() {
+ Args.push_back("-x");
+ Args.push_back("assembler");
+
++ // -nogpulib option not needed for assembling to relocatable
++ NoGpuLib = false;
++
+ return processFiles(AMD_COMGR_DATA_KIND_RELOCATABLE, ".o");
+ }
+
+--
+2.44.0
+
diff --git a/dev-libs/rocm-comgr/files/rocm-comgr-6.4.1-extend-isa-compatibility-check.patch b/dev-libs/rocm-comgr/files/rocm-comgr-6.4.1-extend-isa-compatibility-check.patch
new file mode 100644
index 0000000..eddc8b1
--- /dev/null
+++ b/dev-libs/rocm-comgr/files/rocm-comgr-6.4.1-extend-isa-compatibility-check.patch
@@ -0,0 +1,204 @@
+Load kernels when compatible by ISA, e. g. if AMDGPU_TARGETS is set
+to gfx1030 and some application was started on gfx1036, it loads gfx1030 kernel.
+
+Based on Debian patch by Cordell Bloor <cgmb@slerp.xyz>
+https://salsa.debian.org/rocm-team/rocm-hipamd/-/blob/master/debian/patches/0026-extend-hip-isa-compatibility-check.patch
+--- a/src/comgr-metadata.cpp
++++ b/src/comgr-metadata.cpp
+@@ -927,23 +927,86 @@ constexpr size_t OffloadBundleMagicLen =
+ strLiteralLength(ClangOffloadBundlerMagic);
+ } // namespace
+
+-bool isCompatibleIsaName(StringRef IsaName, StringRef CodeObjectIsaName) {
++struct GfxPattern {
++ std::string root;
++ std::string suffixes;
++};
++
++static bool matches(const GfxPattern& p, StringRef s) {
++ if (p.root.size() + 1 != s.size()) {
++ return false;
++ }
++ if (0 != std::memcmp(p.root.data(), s.data(), p.root.size())) {
++ return false;
++ }
++ return p.suffixes.find(s[p.root.size()]) != std::string::npos;
++}
++
++static bool isGfx900EquivalentProcessor(StringRef processor) {
++ return matches(GfxPattern{"gfx90", "029c"}, processor);
++}
++
++static bool isGfx900SupersetProcessor(StringRef processor) {
++ return matches(GfxPattern{"gfx90", "0269c"}, processor);
++}
++
++static bool isGfx1030EquivalentProcessor(StringRef processor) {
++ return matches(GfxPattern{"gfx103", "0123456"}, processor);
++}
++
++static bool isGfx1010EquivalentProcessor(StringRef processor) {
++ return matches(GfxPattern{"gfx101", "0"}, processor);
++}
++
++static bool isGfx1010SupersetProcessor(StringRef processor) {
++ return matches(GfxPattern{"gfx101", "0123"}, processor);
++}
++
++enum CompatibilityScore {
++ CS_EXACT_MATCH = 1 << 4,
++ CS_PROCESSOR_MATCH = 1 << 3,
++ CS_PROCESSOR_COMPATIBLE = 1 << 2,
++ CS_XNACK_SPECIALIZED = 1 << 1,
++ CS_SRAM_ECC_SPECIALIZED = 1 << 0,
++ CS_INCOMPATIBLE = 0,
++};
++
++static int getProcessorCompatibilityScore(StringRef CodeObjectProcessor,
++ StringRef AgentProcessor) {
++ if (CodeObjectProcessor == AgentProcessor) {
++ return CS_PROCESSOR_MATCH;
++ }
++
++ bool compatible = false;
++ if (isGfx900SupersetProcessor(AgentProcessor)) {
++ compatible = isGfx900EquivalentProcessor(CodeObjectProcessor);
++ } else if (isGfx1010SupersetProcessor(AgentProcessor)) {
++ compatible = isGfx1010EquivalentProcessor(CodeObjectProcessor);
++ } else if (isGfx1030EquivalentProcessor(AgentProcessor)) {
++ compatible = isGfx1030EquivalentProcessor(CodeObjectProcessor);
++ }
++
++ return compatible ? CS_PROCESSOR_COMPATIBLE : CS_INCOMPATIBLE;
++}
++
++static int getCompatiblityScore(StringRef IsaName, StringRef CodeObjectIsaName) {
+ if (IsaName == CodeObjectIsaName) {
+- return true;
++ return CS_EXACT_MATCH;
+ }
+
+ TargetIdentifier CodeObjectIdent;
+ if (parseTargetIdentifier(CodeObjectIsaName, CodeObjectIdent)) {
+- return false;
++ return CS_INCOMPATIBLE;
+ }
+
+ TargetIdentifier IsaIdent;
+ if (parseTargetIdentifier(IsaName, IsaIdent)) {
+- return false;
++ return CS_INCOMPATIBLE;
+ }
+
+- if (CodeObjectIdent.Processor != IsaIdent.Processor) {
+- return false;
++ int ProcessorScore = getProcessorCompatibilityScore(CodeObjectIdent.Processor, IsaIdent.Processor);
++ if (ProcessorScore == CS_INCOMPATIBLE) {
++ return CS_INCOMPATIBLE;
+ }
+
+ char CodeObjectXnack = ' ', CodeObjectSramecc = ' ';
+@@ -967,18 +1030,23 @@ bool isCompatibleIsaName(StringRef IsaName, StringRef CodeObjectIsaName) {
+ }
+ }
+
++ int XnackBonus = 0;
+ if (CodeObjectXnack != ' ') {
+ if (CodeObjectXnack != IsaXnack) {
+- return false;
++ return CS_INCOMPATIBLE;
+ }
++ XnackBonus = CS_XNACK_SPECIALIZED;
+ }
+
++ int SrameccBonus = 0;
+ if (CodeObjectSramecc != ' ') {
+ if (CodeObjectSramecc != IsaSramecc) {
+- return false;
++ return CS_INCOMPATIBLE;
+ }
++ SrameccBonus = CS_SRAM_ECC_SPECIALIZED;
+ }
+- return true;
++
++ return ProcessorScore + XnackBonus + SrameccBonus;
+ }
+
+ amd_comgr_status_t
+@@ -996,14 +1064,21 @@ lookUpCodeObjectInSharedObject(DataObject *DataP,
+ return Status;
+ }
+
++ int MaxScore = 0;
++ unsigned MaxScoreItem;
+ for (unsigned J = 0; J < QueryListSize; J++) {
+- if (isCompatibleIsaName(QueryList[J].isa, IsaName)) {
+- QueryList[J].offset = 0;
+- QueryList[J].size = DataP->Size;
+- break;
++ int Score = getCompatiblityScore(QueryList[J].isa, IsaName);
++ if (Score > MaxScore) {
++ MaxScore = Score;
++ MaxScoreItem = J;
+ }
+ }
+
++ if (MaxScore) {
++ QueryList[MaxScoreItem].offset = 0;
++ QueryList[MaxScoreItem].size = DataP->Size;
++ }
++
+ return AMD_COMGR_STATUS_SUCCESS;
+ }
+
+@@ -1015,7 +1090,6 @@ amd_comgr_status_t lookUpCodeObject(DataObject *DataP,
+ return lookUpCodeObjectInSharedObject(DataP, QueryList, QueryListSize);
+ }
+
+- int Seen = 0;
+ BinaryStreamReader Reader(StringRef(DataP->Data, DataP->Size),
+ llvm::endianness::little);
+
+@@ -1041,6 +1115,8 @@ amd_comgr_status_t lookUpCodeObject(DataObject *DataP,
+ QueryList[I].size = 0;
+ }
+
++ std::vector<int> QueryListScores(QueryListSize);
++
+ // For each code object, extract BundleEntryID information, and check that
+ // against each ISA in the QueryList
+ for (uint64_t I = 0; I < NumOfCodeObjects; I++) {
+@@ -1073,28 +1149,22 @@ amd_comgr_status_t lookUpCodeObject(DataObject *DataP,
+ }
+
+ for (unsigned J = 0; J < QueryListSize; J++) {
+- // If this QueryList item has already been found to be compatible with
++ // If this QueryList item has exact match with
+ // another BundleEntryID, no need to check against the current
+ // BundleEntryID
+- if (QueryList[J].size != 0) {
++ if (QueryListScores[J] == CS_EXACT_MATCH) {
+ continue;
+ }
+
+ // If the QueryList Isa is compatible with the BundleEntryID, set the
+ // QueryList offset/size to this BundleEntryID
+- if (isCompatibleIsaName(QueryList[J].isa, OffloadAndTargetId.second)) {
++ int Score = getCompatiblityScore(QueryList[J].isa, OffloadAndTargetId.second);
++ if (Score > QueryListScores[J]) {
++ QueryListScores[J] = Score;
+ QueryList[J].offset = BundleEntryCodeObjectOffset;
+ QueryList[J].size = BundleEntryCodeObjectSize;
+- Seen++;
+- break;
+ }
+ }
+-
+- // Stop iterating over BundleEntryIDs once we have populated the entire
+- // QueryList
+- if (Seen == (int)QueryListSize) {
+- break;
+- }
+ }
+
+ return AMD_COMGR_STATUS_SUCCESS;
diff --git a/dev-libs/rocm-comgr/files/rocm-comgr-7.2.0-llvm-22-compat.patch b/dev-libs/rocm-comgr/files/rocm-comgr-7.2.0-llvm-22-compat.patch
new file mode 100644
index 0000000..f378f81
--- /dev/null
+++ b/dev-libs/rocm-comgr/files/rocm-comgr-7.2.0-llvm-22-compat.patch
@@ -0,0 +1,23 @@
+LLVM-22 compatibility fixes.
+Partially backports https://github.com/ROCm/llvm-project/commit/0216fcfc5d2a4f3384873f6e9ac70198760d5a52
+--- a/src/comgr-compiler.cpp
++++ b/src/comgr-compiler.cpp
+@@ -659,7 +659,7 @@ amd_comgr_status_t executeCommand(const Command &Job, raw_ostream &LogS,
+
+ std::unique_ptr<CompilerInstance> Clang(new CompilerInstance());
+ Clang->setVerboseOutputStream(LogS);
+- Clang->setFileManager(new FileManager(Clang->getFileSystemOpts(), &FS));
++ Clang->setVirtualFileSystem(&FS);
+ if (!Argv.back()) {
+ Argv.pop_back();
+ }
+@@ -909,8 +909,7 @@ amd_comgr_status_t AMDGPUCompiler::processFile(DataObject *Input,
+ }
+
+ // By default clang driver will ask CC1 to leak memory.
+- Argv.push_back("-Xclang");
+- Argv.push_back("-no-disable-free");
++ Argv.push_back("-disable-free=false");
+
+ Argv.push_back(InputFilePath);
+
diff --git a/dev-libs/rocm-comgr/metadata.xml b/dev-libs/rocm-comgr/metadata.xml
new file mode 100644
index 0000000..a5cc0c4
--- /dev/null
+++ b/dev-libs/rocm-comgr/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-CompilerSupport</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-libs/rocm-comgr/rocm-comgr-10.1.ebuild b/dev-libs/rocm-comgr/rocm-comgr-10.1.ebuild
new file mode 100644
index 0000000..e4decbe
--- /dev/null
+++ b/dev-libs/rocm-comgr/rocm-comgr-10.1.ebuild
@@ -0,0 +1,92 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_COMPAT=( 22 )
+
+inherit cmake llvm-r2
+
+MY_P=llvm-project-therock-${PV}
+components=( "amd/comgr" )
+
+DESCRIPTION="Radeon Open Compute Code Object Manager"
+HOMEPAGE="https://github.com/ROCm/llvm-project/tree/amd-staging/amd/comgr"
+SRC_URI="https://github.com/ROCm/llvm-project/archive/therock-${PV}.tar.gz -> ${MY_P}.tar.gz"
+S="${WORKDIR}/${MY_P}/${components[0]}"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-6.4.1-extend-isa-compatibility-check.patch"
+ "${FILESDIR}/${PN}-6.1.0-dont-add-nogpulib.patch"
+ "${FILESDIR}/${PN}-7.2.0-llvm-22-compat.patch"
+)
+
+RDEPEND="
+ dev-libs/rocm-device-libs:${SLOT}
+ llvm-runtimes/clang-runtime:=
+ $(llvm_gen_dep "
+ llvm-core/clang:\${LLVM_SLOT}=
+ llvm-core/lld:\${LLVM_SLOT}=
+ llvm-core/llvm:\${LLVM_SLOT}=
+ ")
+ dev-util/hipcc:${SLOT}
+"
+DEPEND="${RDEPEND}"
+
+# Circular dependency: to build tests, hip compiler must be functional
+BDEPEND="test? ( dev-util/hip:${SLOT} )"
+
+CMAKE_BUILD_TYPE=Release
+
+src_unpack() {
+ if [[ ${PV} == *9999 ]] ; then
+ git-r3_fetch
+ git-r3_checkout '' . '' "${components[@]}"
+ else
+ archive="${MY_P}.tar.gz"
+ ebegin "Unpacking from ${archive}"
+ tar -x -z -o \
+ -f "${DISTDIR}/${archive}" \
+ "${components[@]/#/${MY_P}/}" || die
+ eend ${?}
+ fi
+}
+
+src_prepare() {
+ sed -e "s:\${CLANG_CMAKE_DIR}/../../../\*:${EPREFIX}/usr/lib/clang/${LLVM_SLOT}/include:" \
+ -i cmake/opencl_header.cmake || die
+
+ # Backports for llvm-22 from amd-staging:
+ # https://github.com/ROCm/llvm-project/commit/ebcaa3d9226921c8761a5291526291e54611e4a4
+ # https://github.com/ROCm/llvm-project/commit/ccb14ba83fd6bdc01423f71944b4676f740b97cc
+ sed -e "s:Driver/Options.h:Options/Options.h:" \
+ -e "s/clang::driver::options/clang::options/" \
+ -e "s/Driver::GetResourcesPath/GetResourcesPath/" \
+ -i src/comgr-compiler.cpp || die
+
+ cmake_src_prepare
+}
+
+src_configure() {
+ llvm_prepend_path "${LLVM_SLOT}"
+
+ local mycmakeargs=(
+ -DCMAKE_STRIP="" # disable stripping defined at lib/comgr/CMakeLists.txt:58
+ -DBUILD_TESTING=$(usex test ON OFF)
+ -DCOMGR_DISABLE_SPIRV=ON # requires ROCm/SPIRV-LLVM-Translator (fork of dev-util/spirv-llvm-translator)
+ )
+ # Prevent CMake from finding systemwide hip, which breaks tests
+ use test && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_hip=ON )
+ cmake_src_configure
+}
+
+src_test() {
+ cmake_src_test
+}
diff --git a/dev-libs/rocm-core/metadata.xml b/dev-libs/rocm-core/metadata.xml
new file mode 100644
index 0000000..68e21ef
--- /dev/null
+++ b/dev-libs/rocm-core/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-core/rocm-core-10.1.ebuild b/dev-libs/rocm-core/rocm-core-10.1.ebuild
new file mode 100644
index 0000000..7e17c68
--- /dev/null
+++ b/dev-libs/rocm-core/rocm-core-10.1.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+DESCRIPTION="Library that provides ROCm release version and install path information"
+HOMEPAGE="https://github.com/ROCm/rocm-systems/tree/develop/projects/rocm-core"
+SRC_URI="https://github.com/ROCm/rocm-systems/releases/download/therock-${PV}/${PN}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${PN}"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+
+src_configure() {
+ local mycmakeargs=( -DROCM_VERSION=${PV} )
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ # too broad for standard directory
+ rm "${ED}"/usr/.info/version || die
+}
+
+RDEPEND="!<dev-util/hip-7.0"
diff --git a/dev-libs/rocm-device-libs/files/rocm-device-libs-6.2.0-test-bitcode-dir.patch b/dev-libs/rocm-device-libs/files/rocm-device-libs-6.2.0-test-bitcode-dir.patch
new file mode 100644
index 0000000..0ab47c9
--- /dev/null
+++ b/dev-libs/rocm-device-libs/files/rocm-device-libs-6.2.0-test-bitcode-dir.patch
@@ -0,0 +1,32 @@
+`--rocm-device-lib-path` is needed to execute the tests because they are not
+installed to system yet
+--- a/test/compile/CMakeLists.txt
++++ b/test/compile/CMakeLists.txt
+@@ -40,6 +40,7 @@ function(add_compile_test test_name func_name)
+ -DFILECHECK_BIN=${FILECHECK_BIN}
+ -DOUTPUT_FILE=output.${test_name}.${test_cpu}.s
+ -DINPUT_FILE=${file_name}
++ -DAMDGCN_BITCODES=${PROJECT_BINARY_DIR}/lib/amdgcn/bitcode
+ -DTEST_CPU=${test_cpu}
+ -DCOMPILE_FLAGS=${COMPILE_TEST_COMPILE_FLAGS}
+ -DEXTRA_CHECK_PREFIX=${COMPILE_TEST_EXTRA_CHECK_PREFIXES}
+--- a/test/compile/RunCompileTest.cmake
++++ b/test/compile/RunCompileTest.cmake
+@@ -16,6 +16,7 @@ execute_process(COMMAND
+ -target amdgcn-amd-amdhsa -mcpu=${TEST_CPU}
+ -Xclang -finclude-default-header
+ --rocm-path=${BINARY_DIR}
++ --rocm-device-lib-path=${AMDGCN_BITCODES}
+ -mllvm -amdgpu-simplify-libcall=0
+ ${COMPILE_FLAGS}
+ -o ${OUTPUT_FILE} ${INPUT_FILE}
+--- a/test/compile/RunConstantFoldTest.cmake
++++ b/test/compile/RunConstantFoldTest.cmake
+@@ -16,6 +16,7 @@ execute_process(COMMAND
+ -target amdgcn-amd-amdhsa -mcpu=${TEST_CPU}
+ -Xclang -finclude-default-header
+ --rocm-path=${BINARY_DIR}
++ --rocm-device-lib-path=${AMDGCN_BITCODES}
+ -mllvm -amdgpu-simplify-libcall=0
+ -o ${OUTPUT_FILE} ${INPUT_FILE}
+ RESULT_VARIABLE CLANG_RESULT
diff --git a/dev-libs/rocm-device-libs/files/rocm-device-libs-7.2.0-llvm-22-compat.patch b/dev-libs/rocm-device-libs/files/rocm-device-libs-7.2.0-llvm-22-compat.patch
new file mode 100644
index 0000000..f4699d3
--- /dev/null
+++ b/dev-libs/rocm-device-libs/files/rocm-device-libs-7.2.0-llvm-22-compat.patch
@@ -0,0 +1,233 @@
+Fix error: '__builtin_amdgcn_lerp' needs target feature cube-insts.
+
+Copies files from:
+https://github.com/ROCm/llvm-project/blame/amd-staging/amd/device-libs/ockl/src/image.cl
+https://github.com/ROCm/llvm-project/blame/amd-staging/amd/device-libs/ockl/src/media.cl
+--- a/ockl/src/image.cl
++++ b/ockl/src/image.cl
+@@ -13,6 +13,7 @@
+ #define EII() __oclc_ISA_version != 9010
+
+ #define RATTR __attribute__((pure))
++#define CRATTR __attribute__((pure, target("cube-insts")))
+ #define ERATTR __attribute__((pure, target("extended-image-insts")))
+ #define WATTR
+ #define GATTR __attribute__((const))
+@@ -510,14 +511,14 @@ OCKL_MANGLE_T(image_load,3D)(TSHARP i, int4 c)
+ return my_image_load_3d_v4f32_i32(c.x, c.y, c.z, LOAD_TSHARP(i));
+ }
+
+-RATTR float4
+-OCKL_MANGLE_T(image_load,CM)(TSHARP i, int2 c, int f)
++CRATTR float4
++OCKL_MANGLE_T(image_load, CM)(TSHARP i, int2 c, int f)
+ {
+ return my_image_load_cube_v4f32_i32(c.x, c.y, f, LOAD_TSHARP(i));
+ }
+
+-RATTR float4
+-OCKL_MANGLE_T(image_load,CMa)(TSHARP i, int4 c, int f)
++CRATTR float4
++OCKL_MANGLE_T(image_load, CMa)(TSHARP i, int4 c, int f)
+ {
+ f = LS_ARRAY_FACE(c.z, f);
+ return my_image_load_cube_v4f32_i32(c.x, c.y, f, LOAD_TSHARP(i));
+@@ -565,14 +566,14 @@ OCKL_MANGLE_T(image_load_lod,3D)(TSHARP i, int4 c, int l)
+ return my_image_load_mip_3d_v4f32_i32(c.x, c.y, c.z, l, LOAD_TSHARP(i));
+ }
+
+-RATTR float4
+-OCKL_MANGLE_T(image_load_lod,CM)(TSHARP i, int2 c, int f, int l)
++CRATTR float4
++OCKL_MANGLE_T(image_load_lod, CM)(TSHARP i, int2 c, int f, int l)
+ {
+ return my_image_load_mip_cube_v4f32_i32(c.x, c.y, f, l, LOAD_TSHARP(i));
+ }
+
+-RATTR float4
+-OCKL_MANGLE_T(image_load_lod,CMa)(TSHARP i, int4 c, int f, int l)
++CRATTR float4
++OCKL_MANGLE_T(image_load_lod, CMa)(TSHARP i, int4 c, int f, int l)
+ {
+ f = LS_ARRAY_FACE(c.z, f);
+ return my_image_load_mip_cube_v4f32_i32(c.x, c.y, f, l, LOAD_TSHARP(i));
+@@ -614,14 +615,14 @@ OCKL_MANGLE_T(image_loadh,3D)(TSHARP i, int4 c)
+ return my_image_load_3d_v4f16_i32(c.x, c.y, c.z, LOAD_TSHARP(i));
+ }
+
+-RATTR half4
+-OCKL_MANGLE_T(image_loadh,CM)(TSHARP i, int2 c, int f)
++CRATTR half4
++OCKL_MANGLE_T(image_loadh, CM)(TSHARP i, int2 c, int f)
+ {
+ return my_image_load_cube_v4f16_i32(c.x, c.y, f, LOAD_TSHARP(i));
+ }
+
+-RATTR half4
+-OCKL_MANGLE_T(image_loadh,CMa)(TSHARP i, int4 c, int f)
++CRATTR half4
++OCKL_MANGLE_T(image_loadh, CMa)(TSHARP i, int4 c, int f)
+ {
+ f = LS_ARRAY_FACE(c.z, f);
+ return my_image_load_cube_v4f16_i32(c.x, c.y, f, LOAD_TSHARP(i));
+@@ -657,14 +658,14 @@ OCKL_MANGLE_T(image_loadh_lod,3D)(TSHARP i, int4 c, int l)
+ return my_image_load_mip_3d_v4f16_i32(c.x, c.y, c.z, l, LOAD_TSHARP(i));
+ }
+
+-RATTR half4
+-OCKL_MANGLE_T(image_loadh_lod,CM)(TSHARP i, int2 c, int f, int l)
++CRATTR half4
++OCKL_MANGLE_T(image_loadh_lod, CM)(TSHARP i, int2 c, int f, int l)
+ {
+ return my_image_load_mip_cube_v4f16_i32(c.x, c.y, f, l, LOAD_TSHARP(i));
+ }
+
+-RATTR half4
+-OCKL_MANGLE_T(image_loadh_lod,CMa)(TSHARP i, int4 c, int f, int l)
++CRATTR half4
++OCKL_MANGLE_T(image_loadh_lod, CMa)(TSHARP i, int4 c, int f, int l)
+ {
+ f = LS_ARRAY_FACE(c.z, f);
+ return my_image_load_mip_cube_v4f16_i32(c.x, c.y, f, l, LOAD_TSHARP(i));
+@@ -950,8 +951,8 @@ OCKL_MANGLE_T(image_sample,3D)(TSHARP i, SSHARP s, float4 c)
+ return my_image_sample_3d_v4f32_f32(c.x, c.y, c.z, LOAD_TSHARP(i), LOAD_SSHARP(s));
+ }
+
+-RATTR float4
+-OCKL_MANGLE_T(image_sample,CM)(TSHARP i, SSHARP s, float4 c)
++CRATTR float4
++OCKL_MANGLE_T(image_sample, CM)(TSHARP i, SSHARP s, float4 c)
+ {
+ CUBE_PREP(c);
+ if (EII())
+@@ -960,8 +961,8 @@ OCKL_MANGLE_T(image_sample,CM)(TSHARP i, SSHARP s, float4 c)
+ return my_image_sample_cube_v4f32_f32(c.x, c.y, c.z, LOAD_TSHARP(i), LOAD_SSHARP(s));
+ }
+
+-RATTR float4
+-OCKL_MANGLE_T(image_sample,CMa)(TSHARP i, SSHARP s, float4 c)
++CRATTR float4
++OCKL_MANGLE_T(image_sample, CMa)(TSHARP i, SSHARP s, float4 c)
+ {
+ CUBE_PREP(c);
+ c.z = SAMPLE_ARRAY_FACE(c.w, c.z);
+@@ -1068,15 +1069,15 @@ OCKL_MANGLE_T(image_sample_lod,3D)(TSHARP i, SSHARP s, float4 c, float l)
+ return my_image_sample_l_3d_v4f32_f32(c.x, c.y, c.z, l, LOAD_TSHARP(i), LOAD_SSHARP(s));
+ }
+
+-RATTR float4
+-OCKL_MANGLE_T(image_sample_lod,CM)(TSHARP i, SSHARP s, float4 c, float l)
++CRATTR float4
++OCKL_MANGLE_T(image_sample_lod, CM)(TSHARP i, SSHARP s, float4 c, float l)
+ {
+ CUBE_PREP(c);
+ return my_image_sample_l_cube_v4f32_f32(c.x, c.y, c.z, l, LOAD_TSHARP(i), LOAD_SSHARP(s));
+ }
+
+-RATTR float4
+-OCKL_MANGLE_T(image_sample_lod,CMa)(TSHARP i, SSHARP s, float4 c, float l)
++CRATTR float4
++OCKL_MANGLE_T(image_sample_lod, CMa)(TSHARP i, SSHARP s, float4 c, float l)
+ {
+ CUBE_PREP(c);
+ c.z = SAMPLE_ARRAY_FACE(c.w, c.z);
+@@ -1135,8 +1136,8 @@ OCKL_MANGLE_T(image_sampleh,3D)(TSHARP i, SSHARP s, float4 c)
+ return my_image_sample_3d_v4f16_f32(c.x, c.y, c.z, LOAD_TSHARP(i), LOAD_SSHARP(s));
+ }
+
+-RATTR half4
+-OCKL_MANGLE_T(image_sampleh,CM)(TSHARP i, SSHARP s, float4 c)
++CRATTR half4
++OCKL_MANGLE_T(image_sampleh, CM)(TSHARP i, SSHARP s, float4 c)
+ {
+ CUBE_PREP(c);
+ if (EII())
+@@ -1145,8 +1146,8 @@ OCKL_MANGLE_T(image_sampleh,CM)(TSHARP i, SSHARP s, float4 c)
+ return my_image_sample_cube_v4f16_f32(c.x, c.y, c.z, LOAD_TSHARP(i), LOAD_SSHARP(s));
+ }
+
+-RATTR half4
+-OCKL_MANGLE_T(image_sampleh,CMa)(TSHARP i, SSHARP s, float4 c)
++CRATTR half4
++OCKL_MANGLE_T(image_sampleh, CMa)(TSHARP i, SSHARP s, float4 c)
+ {
+ CUBE_PREP(c);
+ c.z = SAMPLE_ARRAY_FACE(c.w, c.z);
+@@ -1225,15 +1226,15 @@ OCKL_MANGLE_T(image_sampleh_lod,3D)(TSHARP i, SSHARP s, float4 c, float l)
+ return my_image_sample_l_3d_v4f16_f32(c.x, c.y, c.z, l, LOAD_TSHARP(i), LOAD_SSHARP(s));
+ }
+
+-RATTR half4
+-OCKL_MANGLE_T(image_sampleh_lod,CM)(TSHARP i, SSHARP s, float4 c, float l)
++CRATTR half4
++OCKL_MANGLE_T(image_sampleh_lod, CM)(TSHARP i, SSHARP s, float4 c, float l)
+ {
+ CUBE_PREP(c);
+ return my_image_sample_l_cube_v4f16_f32(c.x, c.y, c.z, l, LOAD_TSHARP(i), LOAD_SSHARP(s));
+ }
+
+-RATTR half4
+-OCKL_MANGLE_T(image_sampleh_lod,CMa)(TSHARP i, SSHARP s, float4 c, float l)
++CRATTR half4
++OCKL_MANGLE_T(image_sampleh_lod, CMa)(TSHARP i, SSHARP s, float4 c, float l)
+ {
+ CUBE_PREP(c);
+ c.z = SAMPLE_ARRAY_FACE(c.w, c.z);
+--- a/ockl/src/media.cl
++++ b/ockl/src/media.cl
+@@ -11,6 +11,9 @@
+ #pragma OPENCL EXTENSION cl_khr_fp16 : enable
+
+ #define CATTR __attribute__((const))
++#define LCATTR __attribute__((const, target("lerp-inst")))
++#define QCATTR __attribute__((const, target("qsad-insts")))
++#define SCATTR __attribute__((const, target("sad-insts")))
+ #define AS_UCHAR4(X) __builtin_astype(X, uchar4)
+
+ CATTR uint
+@@ -44,7 +47,7 @@ OCKL_MANGLE_U32(bytealign)(uint a, uint b, uint c)
+ return __builtin_amdgcn_alignbyte(a, b, c);
+ }
+
+-CATTR uint
++LCATTR uint
+ OCKL_MANGLE_U32(lerp)(uint a, uint b, uint c)
+ {
+ return __builtin_amdgcn_lerp(a, b, c);
+@@ -155,13 +158,13 @@ OCKL_MANGLE_U32(pack)(float4 a)
+ __builtin_amdgcn_cvt_pk_u8_f32(a.s0, 0, 0))));
+ }
+
+-CATTR ulong
++QCATTR ulong
+ OCKL_MANGLE_U64(qsad)(ulong a, uint b, ulong c)
+ {
+ return __builtin_amdgcn_qsad_pk_u16_u8(a, b, c);
+ }
+
+-CATTR uint
++SCATTR uint
+ OCKL_MANGLE_U32(sad)(uint a, uint b, uint c)
+ {
+ return __builtin_amdgcn_sad_u8(a, b, c);
+@@ -174,13 +177,13 @@ OCKL_MANGLE_U32(sadd)(uint a, uint b, uint c)
+ return (a > b ? a : b) - (a < b ? a : b) + c;
+ }
+
+-CATTR uint
++SCATTR uint
+ OCKL_MANGLE_U32(sadhi)(uint a, uint b, uint c)
+ {
+ return __builtin_amdgcn_sad_hi_u8(a, b, c);
+ }
+
+-CATTR uint
++SCATTR uint
+ OCKL_MANGLE_U32(sadw)(uint a, uint b, uint c)
+ {
+ return __builtin_amdgcn_sad_u16(a, b, c);
+@@ -213,4 +216,3 @@ OCKL_MANGLE_F32(unpack3)(uint a)
+ uchar4 v = AS_UCHAR4(a);
+ return (float)v.s3;
+ }
+-
diff --git a/dev-libs/rocm-device-libs/metadata.xml b/dev-libs/rocm-device-libs/metadata.xml
new file mode 100644
index 0000000..0c978b6
--- /dev/null
+++ b/dev-libs/rocm-device-libs/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-Device-Libs</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-libs/rocm-device-libs/rocm-device-libs-10.1.ebuild b/dev-libs/rocm-device-libs/rocm-device-libs-10.1.ebuild
new file mode 100644
index 0000000..44e7769
--- /dev/null
+++ b/dev-libs/rocm-device-libs/rocm-device-libs-10.1.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_COMPAT=( 22 )
+inherit cmake flag-o-matic llvm-r2
+
+MY_P=llvm-project-therock-${PV}
+components=( "amd/device-libs" )
+
+if [[ ${PV} == *9999 ]] ; then
+ EGIT_REPO_URI="https://github.com/ROCm/llvm-project"
+ inherit git-r3
+ S="${WORKDIR}/${P}/${components[0]}"
+else
+ SRC_URI="https://github.com/ROCm/llvm-project/archive/therock-${PV}.tar.gz -> ${MY_P}.tar.gz"
+ S="${WORKDIR}/${MY_P}/${components[0]}"
+ KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Radeon Open Compute Device Libraries"
+HOMEPAGE="https://github.com/ROCm/llvm-project/tree/amd-staging/amd/device-libs"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+ dev-build/rocm-cmake
+ $(llvm_gen_dep "
+ llvm-core/clang:\${LLVM_SLOT}
+ llvm-core/lld:\${LLVM_SLOT}
+ ")
+"
+
+CMAKE_BUILD_TYPE=Release
+
+PATCHES=(
+ "${FILESDIR}/${PN}-6.2.0-test-bitcode-dir.patch"
+ "${FILESDIR}/${PN}-7.2.0-llvm-22-compat.patch"
+)
+
+src_unpack() {
+ if [[ ${PV} == *9999 ]] ; then
+ git-r3_fetch
+ git-r3_checkout '' . '' "${components[@]}"
+ else
+ archive="${MY_P}.tar.gz"
+ ebegin "Unpacking from ${archive}"
+ tar -x -z -o \
+ -f "${DISTDIR}/${archive}" \
+ "${components[@]/#/${MY_P}/}" || die
+ eend ${?}
+ fi
+}
+
+src_prepare() {
+ sed -e "s:amdgcn/bitcode:lib/amdgcn/bitcode:" \
+ -i cmake/OCL.cmake \
+ -i cmake/Packages.cmake || die
+ # shellcheck disable=SC2016
+ sed -e 's:${CMAKE_INSTALL_DATADIR}/doc/${CPACK_PACKAGE_NAME}:${CMAKE_INSTALL_DOCDIR}:' \
+ -i CMakeLists.txt || die
+ cmake_src_prepare
+}
+
+src_configure() {
+ # Do not trust CMake with autoselecting Clang, as it autoselects the latest one
+ # producing too modern LLVM bitcode and causing linker errors in other packages.
+ llvm_prepend_path "${LLVM_SLOT}"
+ local -x CC=${CHOST}-clang
+ local -x CXX=${CHOST}-clang++
+ # Clean up unsupported flags for the switched compiler, see #936099
+ strip-unsupported-flags
+
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ # install symlink, so that clang won't ask for "--rocm-device-lib-path" flag anymore
+ local bitcodedir="$(clang -print-resource-dir)/$(get_libdir)/amdgcn/bitcode"
+ dosym -r "/usr/lib/amdgcn/bitcode" "${bitcodedir#"${EPREFIX}"}"
+}
+
+src_test() {
+ # https://github.com/ROCm/llvm-project/issues/76
+ # "Failing tests are on gfx that are not supported"
+ local CMAKE_SKIP_TESTS=(
+ compile_frexp__gfx600
+ compile_fract__gfx600
+ compile_native_rcp__gfx600
+ compile_native_rsqrt__gfx600
+ compile_fract__gfx700
+ compile_native_rcp__gfx700
+ compile_native_rsqrt__gfx700
+ compile_native_rcp__gfx803
+ compile_native_rsqrt__gfx803
+ compile_atomic_work_item_fence__*
+ )
+
+ cmake_src_test
+}
diff --git a/dev-libs/rocr-runtime/files/rocr-runtime-7.2.0-fix-libcxx.patch b/dev-libs/rocr-runtime/files/rocr-runtime-7.2.0-fix-libcxx.patch
new file mode 100644
index 0000000..e79e6fc
--- /dev/null
+++ b/dev-libs/rocr-runtime/files/rocr-runtime-7.2.0-fix-libcxx.patch
@@ -0,0 +1,21 @@
+Fix libc++ error: no matching function for call to object of type 'const std::less<void>'.
+libstdc++ compiles due too loose standard following, allowing to compare some structs without a comparator.
+Upstream bug: https://github.com/ROCm/rocm-systems/issues/3307
+--- a/runtime/hsa-runtime/core/inc/amd_gpu_agent.h
++++ b/runtime/hsa-runtime/core/inc/amd_gpu_agent.h
+@@ -575,8 +575,14 @@ class GpuAgent : public GpuAgentInt {
+ // @brief Current short duration scratch memory size.
+ size_t scratch_used_large_;
+
++ struct HsaSignalLess {
++ bool operator()(const hsa_signal_t& lhs, const hsa_signal_t& rhs) const {
++ return lhs.handle < rhs.handle;
++ }
++ };
++
+ // @brief Notifications for scratch release.
+- std::map<hsa_signal_t, hsa_signal_value_t> scratch_notifiers_;
++ std::map<hsa_signal_t, hsa_signal_value_t, HsaSignalLess> scratch_notifiers_;
+
+ // @brief Default scratch size per queue.
+ size_t queue_scratch_len_;
diff --git a/dev-libs/rocr-runtime/files/rocr-runtime-7.2.0-use-system-hsakmt.patch b/dev-libs/rocr-runtime/files/rocr-runtime-7.2.0-use-system-hsakmt.patch
new file mode 100644
index 0000000..aa012ed
--- /dev/null
+++ b/dev-libs/rocr-runtime/files/rocr-runtime-7.2.0-use-system-hsakmt.patch
@@ -0,0 +1,20 @@
+libhsakmt is a part of dev-libs/roct-thunk-interface
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -112,11 +112,16 @@ if (NOT DEFINED BUILD_THUNK_VIRTIO)
+ set(BUILD_THUNK_VIRTIO OFF)
+ endif()
+
++if (BUILD_HSAKMT)
+ add_rocm_subdir(libhsakmt "${THUNK_DEFINITIONS}")
+ set_target_properties(hsakmt PROPERTIES
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libhsakmt/archive"
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libhsakmt/lib"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libhsakmt/runtime")
++else()
++ find_package(hsakmt REQUIRED)
++ add_library(hsakmt ALIAS hsakmt::hsakmt)
++endif()
+ if (WIN32)
+ set_target_properties(hsakmt PROPERTIES
+ CXX_STANDARD 20
diff --git a/dev-libs/rocr-runtime/metadata.xml b/dev-libs/rocr-runtime/metadata.xml
new file mode 100644
index 0000000..68e21ef
--- /dev/null
+++ b/dev-libs/rocr-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/rocr-runtime/rocr-runtime-10.1.ebuild b/dev-libs/rocr-runtime/rocr-runtime-10.1.ebuild
new file mode 100644
index 0000000..8be032f
--- /dev/null
+++ b/dev-libs/rocr-runtime/rocr-runtime-10.1.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_COMPAT=( 22 )
+
+inherit cmake flag-o-matic llvm-r2
+
+if [[ ${PV} == *9999 ]] ; then
+ EGIT_REPO_URI="https://github.com/ROCm/ROCR-Runtime/"
+ inherit git-r3
+ S="${WORKDIR}/${P}"
+else
+ SRC_URI="https://github.com/ROCm/rocm-systems/releases/download/therock-${PV}/${PN}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/${PN}"
+ KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Radeon Open Compute Runtime"
+HOMEPAGE="https://github.com/ROCm/rocm-systems/tree/develop/projects/rocr-runtime"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="debug"
+
+COMMON_DEPEND="dev-libs/elfutils
+ x11-libs/libdrm"
+DEPEND="${COMMON_DEPEND}
+ dev-libs/roct-thunk-interface:${SLOT}
+ dev-libs/rocm-device-libs:${SLOT}
+ $(llvm_gen_dep "
+ llvm-core/clang:\${LLVM_SLOT}=
+ llvm-core/lld:\${LLVM_SLOT}=
+ ")
+"
+RDEPEND="${DEPEND}"
+BDEPEND="app-editors/vim-core"
+ # vim-core is needed for "xxd"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-7.2.0-use-system-hsakmt.patch"
+ "${FILESDIR}/${PN}-7.2.0-fix-libcxx.patch"
+)
+
+# skip false positive detection in samples, bug #958188
+CMAKE_QA_COMPAT_SKIP=1
+
+src_prepare() {
+ cd "${S}/runtime/hsa-runtime" || die
+
+ # Gentoo installs "*.bc" to "/usr/lib" instead of a "[path]/bitcode" directory ...
+ sed -e "s:-O2:--rocm-path=${EPREFIX}/usr/lib/ -O2:" -i image/blit_src/CMakeLists.txt || die
+
+ cd "${S}" || die
+ cmake_src_prepare
+}
+
+src_configure() {
+ # -Werror=odr
+ # https://bugs.gentoo.org/856091
+ # https://github.com/ROCm/ROCR-Runtime/issues/182
+ filter-lto
+
+ use debug || append-cxxflags "-DNDEBUG"
+
+ local mycmakeargs=(
+ -DCMAKE_DISABLE_FIND_PACKAGE_rocprofiler-register=ON
+ -Wno-dev
+ )
+
+ cmake_src_configure
+}
diff --git a/dev-libs/roct-thunk-interface/files/kfdtest-6.1.0-skipIPCtest.patch b/dev-libs/roct-thunk-interface/files/kfdtest-6.1.0-skipIPCtest.patch
new file mode 100644
index 0000000..cca728d
--- /dev/null
+++ b/dev-libs/roct-thunk-interface/files/kfdtest-6.1.0-skipIPCtest.patch
@@ -0,0 +1,20 @@
+Issue: https://github.com/ROCm/ROCT-Thunk-Interface/issues/103
+===================================================================
+--- ROCT-Thunk-Interface-rocm-6.1.1.orig/tests/kfdtest/scripts/kfdtest.exclude
++++ ROCT-Thunk-Interface-rocm-6.1.1/tests/kfdtest/scripts/kfdtest.exclude
+@@ -63,6 +63,7 @@ PERMANENT_BLACKLIST_ALL_ASICS=\
+ # failures can be found
+ # NOTE: If you update this alphabetical listing, add the corresponding JIRA ticket for reference
+ #
++# KFDIPCTest.BasicTest are not compatible with upstream amdgpu kernel module
+ # KFDQMTest.GPUDoorbellWrite fails intermittently (KFD-318)
+ # KFDQMTest.mGPUShareBO (KFD-334)
+ # KFDHWSTest.* (SWDEV-193035)
+@@ -72,6 +73,7 @@ PERMANENT_BLACKLIST_ALL_ASICS=\
+ # KFDDBGTest.SuspendQueues (SWDEV-417850)
+ # KFDDBGTest.HitAddressWatch (SWDEV-420281)
+ TEMPORARY_BLACKLIST_ALL_ASICS=\
++"KFDIPCTest.BasicTest:"\
+ "KFDQMTest.GPUDoorbellWrite:"\
+ "KFDQMTest.mGPUShareBO:"\
+ "KFDQMTest.SdmaEventInterrupt:"\
diff --git a/dev-libs/roct-thunk-interface/files/kfdtest-6.2.4-fix-llvm-header.patch b/dev-libs/roct-thunk-interface/files/kfdtest-6.2.4-fix-llvm-header.patch
new file mode 100644
index 0000000..30515c2
--- /dev/null
+++ b/dev-libs/roct-thunk-interface/files/kfdtest-6.2.4-fix-llvm-header.patch
@@ -0,0 +1,14 @@
+Add header for llvm_shutdown.
+Backports https://github.com/ROCm/ROCT-Thunk-Interface/commit/8bb5764ee1c4e3a8dc7588b597831389b4481345
+--- a/tests/kfdtest/src/Assemble.cpp
++++ b/tests/kfdtest/src/Assemble.cpp
+@@ -69,6 +69,9 @@
+ #else
+ #include <llvm/Support/TargetRegistry.h>
+ #endif
++#if LLVM_VERSION_MAJOR > 18
++#include "llvm/Support/ManagedStatic.h"
++#endif
+
+ #include <linux/elf.h>
+ #include "OSWrapper.hpp"
diff --git a/dev-libs/roct-thunk-interface/files/roct-thunk-interface-7.1.0-functions.patch b/dev-libs/roct-thunk-interface/files/roct-thunk-interface-7.1.0-functions.patch
new file mode 100644
index 0000000..da600e5
--- /dev/null
+++ b/dev-libs/roct-thunk-interface/files/roct-thunk-interface-7.1.0-functions.patch
@@ -0,0 +1,12 @@
+https://github.com/ROCm/rocm-systems/issues/284
+--- a/src/libhsakmt.ver 2025-10-23 22:15:14.000000000 -0000
++++ b/src/libhsakmt.ver 2025-11-08 08:09:20.103216984 -0000
+@@ -90,6 +90,9 @@
+ hsaKmtPcSamplingStop;
+ hsaKmtPcSamplingSupport;
+ hsaKmtAisReadWriteFile;
++hsaKmtCreateQueueExt;
++hsaKmtRegisterGraphicsHandleToNodesExt;
++hsaKmtModelEnabled;
+ local: *;
+ };
diff --git a/dev-libs/roct-thunk-interface/metadata.xml b/dev-libs/roct-thunk-interface/metadata.xml
new file mode 100644
index 0000000..68e21ef
--- /dev/null
+++ b/dev-libs/roct-thunk-interface/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/roct-thunk-interface/roct-thunk-interface-10.1.ebuild b/dev-libs/roct-thunk-interface/roct-thunk-interface-10.1.ebuild
new file mode 100644
index 0000000..1f5967a
--- /dev/null
+++ b/dev-libs/roct-thunk-interface/roct-thunk-interface-10.1.ebuild
@@ -0,0 +1,109 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_COMPAT=( 22 )
+ROCM_SKIP_GLOBALS=1
+inherit cmake flag-o-matic linux-info llvm-r2 rocm
+
+if [[ ${PV} == *9999 ]] ; then
+ EGIT_SUBMODULES=()
+ EGIT_REPO_URI="https://github.com/ROCm/rocm-systems.git"
+ inherit git-r3
+ S="${WORKDIR}/${P}/projects/rocr-runtime/libhsakmt"
+else
+ SRC_URI="https://github.com/ROCm/rocm-systems/releases/download/therock-${PV}/rocr-runtime.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/rocr-runtime/libhsakmt"
+ KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Radeon Open Compute Thunk Interface"
+HOMEPAGE="https://github.com/ROCm/rocm-systems/tree/develop/projects/rocr-runtime/libhsakmt"
+CONFIG_CHECK="~HSA_AMD ~HMM_MIRROR ~ZONE_DEVICE ~DRM_AMDGPU ~DRM_AMDGPU_USERPTR"
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+
+RDEPEND="
+ sys-process/numactl
+ x11-libs/libdrm[video_cards_amdgpu]
+"
+DEPEND="${RDEPEND}
+ test? (
+ $(llvm_gen_dep "llvm-core/llvm:\${LLVM_SLOT}")
+ dev-cpp/gtest
+ )"
+
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+CMAKE_BUILD_TYPE=Release
+
+PATCHES=(
+ "${FILESDIR}/${PN}-7.1.0-functions.patch"
+ "${FILESDIR}/kfdtest-6.1.0-skipIPCtest.patch"
+ "${FILESDIR}/kfdtest-6.2.4-fix-llvm-header.patch"
+)
+
+test_wrapper() {
+ local S="$1"
+ shift 1
+ local CMAKE_USE_DIR="${S}"
+ local BUILD_DIR="${S}_build"
+ cd "${S}" || die
+ "$@"
+}
+
+src_prepare() {
+ sed -e "s/get_version ( \"1.0.0\" )/get_version ( \"${PV}\" )/" -i CMakeLists.txt || die
+
+ # https://github.com/ROCm/ROCR-Runtime/issues/263
+ sed -e "s/\${HSAKMT_TARGET} STATIC/\${HSAKMT_TARGET}/" -i CMakeLists.txt || die
+
+ cmake_src_prepare
+}
+
+src_configure() {
+ llvm_prepend_path "${LLVM_SLOT}"
+
+ # QA warnings
+ append-cxxflags -Wno-unused-value
+
+ local mycmakeargs=(
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
+ -DBUILD_SHARED_LIBS=ON
+ -DCMAKE_DISABLE_FIND_PACKAGE_NUMA=ON # skip warning - will use find_library anyways
+ )
+ cmake_src_configure
+
+ if use test; then
+ # ODR violations (bug #956958)
+ filter-lto
+
+ export LIBHSAKMT_PATH="${BUILD_DIR}"
+ test_wrapper "${S}/tests/kfdtest" cmake_src_configure
+ fi
+}
+
+src_compile() {
+ cmake_src_compile
+ if use test; then
+ LIBRARY_PATH="${BUILD_DIR}" test_wrapper "${S}/tests/kfdtest" cmake_src_compile
+ fi
+}
+
+src_test() {
+ check_amdgpu
+ cd "${S}/tests/kfdtest_build/" || die
+ # Bug: https://github.com/ROCm/rocm-systems/issues/3635
+ local skipped_tests=(
+ KFDMemoryTest.LargestSysBufferTest # OOMs with gfx1151
+ KFDMemoryTest.LargestVramBufferTest # OOMs with gfx1151
+ KFDMemoryTest.BigSysBufferStressTest # OOMs with gfx1151
+ KFDQMTest.mGPUShareBO # wants at least two GPUs?
+ KFDPCSamplingTest.* # gfx1151: no pc sampling?
+ KFDQMTest.QueueLatency # gfx1151: fails (issues with iGPU clock?)
+ )
+ local IFS=:
+ ./run_kfdtest.sh -e "${skipped_tests[*]}" || die
+}
diff --git a/dev-util/amdsmi/amdsmi-10.1.ebuild b/dev-util/amdsmi/amdsmi-10.1.ebuild
new file mode 100644
index 0000000..8a17933
--- /dev/null
+++ b/dev-util/amdsmi/amdsmi-10.1.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..14} )
+ROCM_SKIP_GLOBALS=1
+inherit cmake linux-info python-r1 rocm
+
+ESMI_PN=esmi_pkg_ver
+ESMI_PV=4.2
+
+DESCRIPTION="AMD System Management Interface for managing and monitoring GPUs"
+HOMEPAGE="
+ https://github.com/ROCm/amdsmi
+ https://rocm.docs.amd.com/projects/amdsmi/en/latest/
+"
+SRC_URI="
+ https://github.com/ROCm/rocm-systems/releases/download/therock-${PV}/amdsmi.tar.gz -> ${P}.tar.gz
+ https://github.com/amd/esmi_ib_library/archive/refs/tags/${ESMI_PN}-${ESMI_PV}.tar.gz
+"
+S="${WORKDIR}/amdsmi"
+ESMI_S="${WORKDIR}/esmi_ib_library-${ESMI_PN}-${ESMI_PV}"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="
+ ${PYTHON_DEPS}
+ test? ( dev-cpp/gtest )
+ x11-libs/libdrm[video_cards_amdgpu]
+ dev-libs/rocm-core:${SLOT}
+"
+RDEPEND="
+ ${PYTHON_DEPS}
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-7.0.2-no-git.patch
+ "${FILESDIR}"/${PN}-7.1.1-libdrm-compat.patch
+)
+
+CONFIG_CHECK="~HSA_AMD ~DRM_AMDGPU"
+
+src_prepare() {
+ ln -s "${ESMI_S}" esmi_ib_library || die
+
+ # Compatibility with CMake < 3.10 will be removed
+ sed -e "/cmake_minimum_required/ s/3\.5\.0/3.10/" \
+ -i goamdsmi_shim/CMakeLists.txt "${ESMI_S}"/CMakeLists.txt || die
+
+ sed -e "s/-Wall -Wextra//" \
+ -i CMakeLists.txt "${ESMI_S}"/CMakeLists.txt goamdsmi_shim/CMakeLists.txt || die
+
+ # Reset custom installation path
+ sed -e "/generic_add_rocm/d" -i CMakeLists.txt || die
+
+ # Remove /usr/lib to fix multilib
+ sed -e '/target_link_libraries.*\/lib/d' -i goamdsmi_shim/CMakeLists.txt || die
+
+ # Install docs to correct place
+ sed -e "s:doc/\${CPACK_PACKAGE_NAME}:doc/${P}:" -i CMakeLists.txt || die
+
+ # Do not install /usr/share/doc/${P}-asan
+ sed -e "s/COMPONENT asan/COMPONENT asan EXCLUDE_FROM_ALL/" -i CMakeLists.txt || die
+
+ cmake_src_prepare
+}
+
+src_configure() {
+ python_setup
+
+ local mycmakeargs=(
+ -DBUILD_TESTS=$(usex test)
+ -Wno-dev
+ )
+ use test && mycmakeargs+=( -DCMAKE_REQUIRE_FIND_PACKAGE_GTest=ON )
+ cmake_src_configure
+}
+
+src_test() {
+ # GPU access in amdsmitstReadOnly.TestSysInfoRead and amdsmitstReadOnly.TestIdInfoRead
+ addwrite /dev/dri/renderD128
+
+ # Few tests fail on ASUS GZ302E: no metrics from kernel?
+ GTEST_FILTER="-amdsmitstReadOnly.TempRead:amdsmitstReadOnly.TestFrequenciesRead" \
+ "${BUILD_DIR}/tests/amd_smi_test/amdsmitst" || die "Test failed"
+}
+
+src_install() {
+ cmake_src_install
+
+ # Wrong places
+ rm "${ED}"/usr/share/amd_smi/amdsmi/{libamd_smi.so,LICENSE,README.md} || die
+
+ python_fix_shebang "${ED}"/usr/libexec/amdsmi_cli
+ python_domodule "${ED}"/usr/libexec/amdsmi_cli
+ python_domodule "${ED}"/usr/share/amd_smi/amdsmi
+
+ fperms a+x "/usr/lib/${EPYTHON}/site-packages/amdsmi_cli/amdsmi_cli.py"
+ dosym -r "/usr/lib/${EPYTHON}/site-packages/amdsmi_cli/amdsmi_cli.py" /usr/bin/amd-smi
+
+ rm -rf "${ED}"/usr/share/amd_smi "${ED}"/usr/libexec/amdsmi_cli || die
+}
diff --git a/dev-util/amdsmi/files/amdsmi-7.0.2-no-git.patch b/dev-util/amdsmi/files/amdsmi-7.0.2-no-git.patch
new file mode 100644
index 0000000..9892705
--- /dev/null
+++ b/dev-util/amdsmi/files/amdsmi-7.0.2-no-git.patch
@@ -0,0 +1,21 @@
+Should not check and update esmi_ib_library in network isolation
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -39,7 +39,7 @@ find_package(PkgConfig)
+ generic_add_rocm()
+
+ # provide git to utilities
+-find_program(GIT NAMES git)
++# find_program(GIT NAMES git)
+
+ ## Setup the package version based on git tags.
+ set(PKG_VERSION_GIT_TAG_PREFIX "amdsmi_pkg_ver")
+@@ -126,7 +126,7 @@ if(ENABLE_ESMI_LIB)
+ message(STATUS "Adding esmi_ib_library...")
+ execute_process(COMMAND git clone --depth=1 -b ${current_esmi_tag} https://github.com/amd/esmi_ib_library.git
+ ${PROJECT_SOURCE_DIR}/esmi_ib_library)
+- else()
++ elseif(FALSE)
+ message(STATUS "esmi_ib_library already installed, checking version...")
+
+ # Grab latest commit and get the tag
diff --git a/dev-util/amdsmi/files/amdsmi-7.1.1-libdrm-compat.patch b/dev-util/amdsmi/files/amdsmi-7.1.1-libdrm-compat.patch
new file mode 100644
index 0000000..3e08e3a
--- /dev/null
+++ b/dev-util/amdsmi/files/amdsmi-7.1.1-libdrm-compat.patch
@@ -0,0 +1,22 @@
+Fix compatibility with x11-libs/libdrm-2.4.130
+
+Bug: https://bugs.gentoo.org/967246
+Upstream PR: https://github.com/ROCm/amdsmi/pull/165
+--- a/include/amd_smi/impl/amdgpu_drm.h
++++ b/include/amd_smi/impl/amdgpu_drm.h
+@@ -1625,15 +1625,6 @@ struct drm_amdgpu_info_uq_metadata {
+ #define AMDGPU_FAMILY_GC_11_5_0 150 /* GC 11.5.0 */
+ #define AMDGPU_FAMILY_GC_12_0_0 152 /* GC 12.0.0 */
+
+-/* FIXME wrong namespace! */
+-struct drm_color_ctm_3x4 {
+- /*
+- * Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude
+- * (not two's complement!) format.
+- */
+- __u64 matrix[12];
+-};
+-
+ #if defined(__cplusplus)
+ }
+ #endif
diff --git a/dev-util/amdsmi/metadata.xml b/dev-util/amdsmi/metadata.xml
new file mode 100644
index 0000000..17201a8
--- /dev/null
+++ b/dev-util/amdsmi/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/amdsmi</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-util/hip/files/hip-6.3.0-clr-fix-libcxx.patch b/dev-util/hip/files/hip-6.3.0-clr-fix-libcxx.patch
new file mode 100644
index 0000000..3052e25
--- /dev/null
+++ b/dev-util/hip/files/hip-6.3.0-clr-fix-libcxx.patch
@@ -0,0 +1,30 @@
+Fix compilation with libc++ (ROCM/clr part)
+--- a/hipamd/include/hip/amd_detail/amd_hip_runtime.h
++++ b/hipamd/include/hip/amd_detail/amd_hip_runtime.h
+@@ -386,15 +386,26 @@ hc_get_workitem_absolute_id(int dim)
+ #pragma push_macro("__CUDA__")
+ #define __CUDA__
+ #include <__clang_cuda_math_forward_declares.h>
++// __clang_cuda_complex_builtins wants ::max
++#include <__clang_hip_math.h>
+ #include <__clang_cuda_complex_builtins.h>
+ // Workaround for using libc++ with HIP-Clang.
+ // The following headers requires clang include path before standard C++ include path.
+ // However libc++ include path requires to be before clang include path.
+ // To workaround this, we pass -isystem with the parent directory of clang include
+ // path instead of the clang include path itself.
++
++// libc++: <include/cuda_wrappers/complex> transitively includes <queue>, which uses __local
++#define ORIGINAL__LOCAL __local
++#undef __local
++
+ #include <include/cuda_wrappers/algorithm>
+ #include <include/cuda_wrappers/complex>
+ #include <include/cuda_wrappers/new>
++
++#define __local ORIGINAL__LOCAL
++#undef ORIGINAL__LOCAL
++
+ #undef __CUDA__
+ #pragma pop_macro("__CUDA__")
+ #endif // !_OPENMP || __HIP_ENABLE_CUDA_WRAPPER_FOR_OPENMP__
diff --git a/dev-util/hip/files/hip-6.3.0-no-isystem-usr-include.patch b/dev-util/hip/files/hip-6.3.0-no-isystem-usr-include.patch
new file mode 100644
index 0000000..973de08
--- /dev/null
+++ b/dev-util/hip/files/hip-6.3.0-no-isystem-usr-include.patch
@@ -0,0 +1,17 @@
+Prevent HIP targets from adding -isystem /usr/include, which breaks <cmath>
+--- a/hipamd/hip-config-amd.cmake.in
++++ b/hipamd/hip-config-amd.cmake.in
+@@ -135,13 +135,11 @@ set_target_properties(hip::host PROPERTIES
+
+ set_target_properties(hip::amdhip64 PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
+- INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
+ )
+
+ if(NOT WIN32)
+ set_target_properties(hip::device PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
+- INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
+ )
+ endif()
+
diff --git a/dev-util/hip/files/hip-7.1.0-no-hipother-install.patch b/dev-util/hip/files/hip-7.1.0-no-hipother-install.patch
new file mode 100644
index 0000000..417718e
--- /dev/null
+++ b/dev-util/hip/files/hip-7.1.0-no-hipother-install.patch
@@ -0,0 +1,29 @@
+HIPNV_DIR is /usr (part of dev-libs/hipother).
+Installing from there results in file collision.
+
+Bug: https://bugs.gentoo.org/966306
+--- a/hipamd/packaging/CMakeLists.txt
++++ b/hipamd/packaging/CMakeLists.txt
+@@ -106,10 +106,6 @@ endforeach()
+ install(DIRECTORY ${HIP_COMMON_DIR}/include DESTINATION . COMPONENT dev)
+ install(DIRECTORY ${hip_SOURCE_DIR}/include/hip/amd_detail
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hip COMPONENT dev)
+-if(DEFINED HIPNV_DIR)
+- install(DIRECTORY ${HIPNV_DIR}/include/hip/nvidia_detail
+- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hip COMPONENT dev)
+-endif()
+ if(HIP_PLATFORM STREQUAL "amd" )
+ install(FILES ${CMAKE_BINARY_DIR}/hipamd/include/hip/amd_detail/hip_prof_str.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hip/amd_detail COMPONENT dev)
+--- a/hipamd/CMakeLists.txt
++++ b/hipamd/CMakeLists.txt
+@@ -398,9 +398,6 @@ if(NOT ${INSTALL_SOURCE} EQUAL 0)
+ endif()
+
+ install(DIRECTORY include DESTINATION .)
+- if(DEFINED HIPNV_DIR)
+- install(DIRECTORY ${HIPNV_DIR}/include/hip/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hip/)
+- endif()
+ install(DIRECTORY ${HIP_COMMON_INCLUDE_DIR}/hip/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hip/)
+ if(WIN32)
+ install(DIRECTORY ${HIP_COMMON_DIR}/cmake DESTINATION .)
diff --git a/dev-util/hip/files/hip-7.2.0-local-fixes.patch b/dev-util/hip/files/hip-7.2.0-local-fixes.patch
new file mode 100644
index 0000000..1d1a5c2
--- /dev/null
+++ b/dev-util/hip/files/hip-7.2.0-local-fixes.patch
@@ -0,0 +1,21 @@
+Defining __local before inclusion of libc++ <ranges> or <deque> causes compilation errors.
+
+Upstream bug: https://github.com/ROCm/rocm-systems/issues/1874
+--- a/hipamd/include/hip/amd_detail/device_library_decls.h
++++ b/hipamd/include/hip/amd_detail/device_library_decls.h
+@@ -120,6 +120,15 @@ extern "C" __device__ __hip_uint64_t __ockl_fprintf_append_string_n(__hip_uint64
+ __hip_uint64_t length,
+ __hip_uint32_t is_last);
+
++// libc++ <ranges> uses __local as function name; include one file, before defining __local macro
++#if defined(__cplusplus) && defined(_LIBCPP_VERSION) && defined(__has_include)
++# if __has_include (<__ranges/join_view.h>)
++# include <__ranges/join_view.h>
++# endif
++// Deque also uses __local function name; include should be safe, as it is autoincluded anyways
++# include <deque>
++#endif
++
+ // Introduce local address space
+ #define __local __attribute__((address_space(3)))
+
diff --git a/dev-util/hip/files/hip-7.2.0-noinline-fixes.patch b/dev-util/hip/files/hip-7.2.0-noinline-fixes.patch
new file mode 100644
index 0000000..ee5d17a
--- /dev/null
+++ b/dev-util/hip/files/hip-7.2.0-noinline-fixes.patch
@@ -0,0 +1,26 @@
+Unsetting __noinline__ before inclusion of libc++ __config breaks libc++ headers.
+
+Additionally, `[[__gnu__::__noinline__]]` is used in libstdc++-16 `#include <format>`,
+causing build failures in libstdc++ as well.
+
+Bug: https://github.com/ROCm/rocm-systems/issues/1874
+--- a/hipamd/include/hip/amd_detail/host_defines.h
++++ b/hipamd/include/hip/amd_detail/host_defines.h
+@@ -250,6 +250,17 @@ typedef __hip_internal::int64_t __hip_int64_t;
+
+ #define __global__
+
++// __config in libc++ fails on `__has_attribute(__noinline__)` if __noinline__ is emptied
++#if defined(__cplusplus) && defined(__has_include)
++# if __has_include(<__config>)
++# include <__config>
++# else
++// format in libstdc++-16 fails on `[[__gnu__::__noinline__]]` if __noinline__ is emptied
++// https://github.com/ROCm/rocm-systems/issues/1874#issuecomment-5550937256
++# include <format>
++# endif
++#endif
++
+ #define __noinline__
+ #define __forceinline__ inline
+
diff --git a/dev-util/hip/hip-10.1.ebuild b/dev-util/hip/hip-10.1.ebuild
new file mode 100644
index 0000000..8311a45
--- /dev/null
+++ b/dev-util/hip/hip-10.1.ebuild
@@ -0,0 +1,251 @@
+# 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=( 22 )
+
+inherit cmake docs flag-o-matic llvm-r2 rocm
+
+DESCRIPTION="C++ Heterogeneous-Compute Interface for Portability"
+HOMEPAGE="https://github.com/ROCm/rocm-systems/tree/develop/projects/clr"
+if [[ ${PV} == 9999 ]]; then
+ inherit git-r3
+ EGIT_SUBMODULES=()
+ EGIT_REPO_URI="https://github.com/ROCm/rocm-systems.git"
+ S="${WORKDIR}/${P}/projects/clr"
+ TEST_S="${WORKDIR}/${P}/projects/hip-tests"
+ HIP_S="${WORKDIR}/${P}/projects/hip"
+ SLOT="0/10.1"
+else
+ SRC_URI="
+ https://github.com/ROCm/rocm-systems/releases/download/therock-${PV}/clr.tar.gz -> rocm-clr-${PV}.tar.gz
+ https://github.com/ROCm/rocm-systems/releases/download/therock-${PV}/${PN}.tar.gz -> ${P}.tar.gz
+ test? (
+ https://github.com/ROCm/rocm-systems/releases/download/therock-${PV}/hip-tests.tar.gz -> hip-tests-${PV}.tar.gz
+ )
+ "
+ S="${WORKDIR}/clr/"
+ TEST_S="${WORKDIR}/hip-tests/catch"
+ HIP_S="${WORKDIR}/hip"
+ KEYWORDS="~amd64"
+ SLOT="0/$(ver_cut 1-2)"
+fi
+
+LICENSE="MIT"
+
+IUSE="debug +hip opencl test video_cards_amdgpu video_cards_nvidia"
+
+# many tests are broken; also tests run against installed version, not built one
+RESTRICT="test"
+
+REQUIRED_USE="
+ || ( hip opencl )
+ ^^ ( video_cards_amdgpu video_cards_nvidia )
+"
+
+DEPEND="
+ video_cards_amdgpu? (
+ dev-util/rocminfo:${SLOT}
+ dev-libs/rocm-comgr:${SLOT}
+ dev-libs/rocr-runtime:${SLOT}
+ )
+ video_cards_nvidia? ( dev-libs/hipother:${SLOT} )
+ x11-base/xorg-proto
+ virtual/opengl[X]
+"
+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.1.0-no-hipother-install.patch"
+ "${FILESDIR}/${PN}-7.2.0-noinline-fixes.patch"
+ "${FILESDIR}/${PN}-7.2.0-local-fixes.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
+
+ # 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 "hipamd/src/hiprtc/cmake/hiprtc-config.cmake.in" \
+ -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)"
+ # hiprtc-builtins embeds headers preprocessed by this clang. It must
+ # match the LLVM slot used by rocm-comgr, not clang from PATH.
+ -Dclang="$(get_llvm_prefix)/bin/clang"
+ -Dllvm-mc="$(get_llvm_prefix)/bin/llvm-mc"
+ -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=OFF
+ -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
+ )
+ elif use video_cards_nvidia; then
+ mycmakeargs+=(
+ -DHIPNV_DIR="${EPREFIX}/usr"
+ -DHIP_PLATFORM="nvidia"
+ )
+ 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"
+ )
+ elif use video_cards_nvidia; then
+ mycmakeargs+=(
+ -DHIP_PLATFORM="nvidia"
+ )
+ 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
+}
diff --git a/dev-util/hip/metadata.xml b/dev-util/hip/metadata.xml
new file mode 100644
index 0000000..0393d06
--- /dev/null
+++ b/dev-util/hip/metadata.xml
@@ -0,0 +1,32 @@
+<?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>
+ <use>
+ <flag name="hip">Build HIP runtime</flag>
+ <flag name="numa">Enable NUMA support using <pkg>sys-process/numactl</pkg> (NUMA kernel support is also required)</flag>
+ <flag name="opencl">Build vendored OpenCL runtime</flag>
+ <flag name="video_cards_amdgpu">Build for AMD platform</flag>
+ <flag name="video_cards_nvidia">Build for Nvidia platform</flag>
+ </use>
+</pkgmetadata>
diff --git a/dev-util/hipcc/hipcc-10.1.ebuild b/dev-util/hipcc/hipcc-10.1.ebuild
new file mode 100644
index 0000000..b0e3030
--- /dev/null
+++ b/dev-util/hipcc/hipcc-10.1.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_COMPAT=( 22 )
+inherit cmake llvm-r2
+
+DESCRIPTION="Radeon Open Compute hipcc"
+HOMEPAGE="https://github.com/ROCm/llvm-project/tree/amd-staging/amd/hipcc"
+
+MY_P=llvm-project-therock-${PV}
+components=( "amd/hipcc" )
+if [[ ${PV} == *9999 ]] ; then
+ EGIT_REPO_URI="https://github.com/ROCm/llvm-project"
+ inherit git-r3
+ S="${WORKDIR}/${P}/${components[0]}"
+else
+ SRC_URI="https://github.com/ROCm/llvm-project/archive/therock-${PV}.tar.gz -> ${MY_P}.tar.gz"
+ S="${WORKDIR}/${MY_P}/${components[0]}"
+ KEYWORDS="~amd64"
+fi
+
+LICENSE="Apache-2.0 MIT"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="debug"
+
+DEPEND="
+ $(llvm_gen_dep "
+ llvm-runtimes/compiler-rt:\${LLVM_SLOT}=
+ llvm-core/llvm:\${LLVM_SLOT}=
+ llvm-core/clang:\${LLVM_SLOT}=
+ ")
+"
+RDEPEND="${DEPEND}"
+
+src_unpack() {
+ if [[ ${PV} == *9999 ]] ; then
+ git-r3_fetch
+ git-r3_checkout '' . '' "${components[@]}"
+ else
+ archive="${MY_P}.tar.gz"
+ ebegin "Unpacking from ${archive}"
+ tar -x -z -o \
+ -f "${DISTDIR}/${archive}" \
+ "${components[@]/#/${MY_P}/}" || die
+ eend ${?}
+ fi
+}
+
+src_prepare() {
+ cmake_src_prepare
+
+ sed -e "s:lib/llvm/bin:lib/llvm/${LLVM_SLOT}/bin:" \
+ -e "s:/opt/rocm:/usr:g" \
+ -i src/hipBin_base.h \
+ -i src/hipBin_amd.h || die
+
+ sed -e "s:amdgcn/bitcode:lib/amdgcn/bitcode:g" \
+ -i src/hipBin_amd.h || die
+}
+
+src_install() {
+ cmake_src_install
+ # remove bat files...
+ rm -rf "${ED}/usr/hip" || die
+}
diff --git a/dev-util/hipcc/metadata.xml b/dev-util/hipcc/metadata.xml
new file mode 100644
index 0000000..2f61f8d
--- /dev/null
+++ b/dev-util/hipcc/metadata.xml
@@ -0,0 +1,29 @@
+<?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">
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</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/hipcc</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-util/rocm-smi/files/rocm-smi-5.7.1-no-strip.patch b/dev-util/rocm-smi/files/rocm-smi-5.7.1-no-strip.patch
new file mode 100644
index 0000000..0779629
--- /dev/null
+++ b/dev-util/rocm-smi/files/rocm-smi-5.7.1-no-strip.patch
@@ -0,0 +1,36 @@
+--- a/oam/CMakeLists.txt
++++ b/oam/CMakeLists.txt
+@@ -82,15 +82,6 @@ set_property(TARGET ${OAM_TARGET} PROPERTY
+ set_property(TARGET ${OAM_TARGET} PROPERTY
+ VERSION "${SO_VERSION_STRING}")
+
+-## If the library is a release, strip the target library
+-if ("${CMAKE_BUILD_TYPE}" STREQUAL Release)
+- if(${BUILD_SHARED_LIBS}) #striping only for .so
+- add_custom_command(
+- TARGET ${OAM_TARGET}
+- POST_BUILD COMMAND ${CMAKE_STRIP} lib${OAM_TARGET}.so)
+- endif()
+-endif ()
+-
+ # use the target_include_directories() command to specify the include directories for the target
+ target_include_directories(${OAM_TARGET}
+ PUBLIC
+--- a/rocm_smi/CMakeLists.txt
++++ b/rocm_smi/CMakeLists.txt
+@@ -103,15 +103,6 @@ set_property(TARGET ${ROCM_SMI_TARGET} PROPERTY
+ set_property(TARGET ${ROCM_SMI_TARGET} PROPERTY
+ VERSION "${SO_VERSION_STRING}")
+
+-## If the library is a release, strip the target library
+-if ("${CMAKE_BUILD_TYPE}" STREQUAL Release)
+- if(${BUILD_SHARED_LIBS}) #stripping only for .so
+- add_custom_command(
+- TARGET ${ROCM_SMI_TARGET}
+- POST_BUILD COMMAND ${CMAKE_STRIP} lib${ROCM_SMI_TARGET}.so.${SO_VERSION_STRING})
+- endif()
+-endif ()
+-
+ #file reorganization changes
+ #rocm_smi.py moved to libexec/rocm_smi. so creating rocm-smi symlink
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
diff --git a/dev-util/rocm-smi/files/rocm-smi-5.7.1-remove-example.patch b/dev-util/rocm-smi/files/rocm-smi-5.7.1-remove-example.patch
new file mode 100644
index 0000000..18e1f4c
--- /dev/null
+++ b/dev-util/rocm-smi/files/rocm-smi-5.7.1-remove-example.patch
@@ -0,0 +1,14 @@
+Remove example; unused, only generates not important QA warnings
+--- a/rocm_smi/CMakeLists.txt
++++ b/rocm_smi/CMakeLists.txt
+@@ -76,8 +76,10 @@ set(SMI_INC_LIST "")
+
+ set(SMI_EXAMPLE_EXE "rocm_smi_ex")
+
++if (WITH_EXAMPLE)
+ add_executable(${SMI_EXAMPLE_EXE} "example/rocm_smi_example.cc")
+ target_link_libraries(${SMI_EXAMPLE_EXE} ${ROCM_SMI_TARGET})
++endif()
+ add_library(${ROCM_SMI_TARGET} ${CMN_SRC_LIST} ${SMI_SRC_LIST}
+ ${CMN_INC_LIST} ${SMI_INC_LIST})
+ target_link_libraries(${ROCM_SMI_TARGET} pthread rt)
diff --git a/dev-util/rocm-smi/metadata.xml b/dev-util/rocm-smi/metadata.xml
new file mode 100644
index 0000000..68e21ef
--- /dev/null
+++ b/dev-util/rocm-smi/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-util/rocm-smi/rocm-smi-10.1.ebuild b/dev-util/rocm-smi/rocm-smi-10.1.ebuild
new file mode 100644
index 0000000..edb3b4e
--- /dev/null
+++ b/dev-util/rocm-smi/rocm-smi-10.1.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..14} python3_13t )
+
+inherit cmake linux-info optfeature python-r1
+
+DESCRIPTION="ROCm System Management Interface Library"
+HOMEPAGE="https://github.com/ROCm/rocm-systems/tree/develop/projects/rocm-smi-lib"
+
+if [[ ${PV} == *9999 ]] ; then
+ inherit git-r3
+ EGIT_SUBMODULES=()
+ EGIT_REPO_URI="https://github.com/ROCm/rocm-systems.git"
+ S="${WORKDIR}/${P}/projects/rocm-smi-lib"
+else
+ SRC_URI="https://github.com/ROCm/rocm-systems/releases/download/therock-${PV}/rocm-smi-lib.tar.gz -> rocm-smi-${PV}.tar.gz"
+ KEYWORDS="~amd64"
+ S="${WORKDIR}/rocm-smi-lib"
+fi
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="${PYTHON_DEPS}"
+DEPEND="${RDEPEND}
+ sys-kernel/linux-headers
+ x11-libs/libdrm[video_cards_amdgpu]
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-5.7.1-no-strip.patch
+ "${FILESDIR}"/${PN}-5.7.1-remove-example.patch
+)
+
+CONFIG_CHECK="~HSA_AMD ~DRM_AMDGPU"
+
+src_prepare() {
+ cmake_src_prepare
+
+ # Disable code that relies on missing .git directory.
+ # Just silences potential "git: command not found" QA warnings.
+ sed -e "/find_program (GIT NAMES git)/d" -i CMakeLists.txt || die
+ sed -e "/num_change_since_prev_pkg(\${VERSION_PREFIX})/d" -i cmake_modules/utils.cmake || die
+
+ local rocm_lib="${EPREFIX}/usr/$(get_libdir)/librocm_smi64.so.@VERSION_MAJOR@"
+ sed -E "s|path_librocm =.+__file__.+|path_librocm = '${rocm_lib}'|" \
+ -i python_smi_tools/rsmiBindingsInit.py.in || die
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
+ )
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ python_foreach_impl python_newscript python_smi_tools/rocm_smi.py rocm-smi
+ python_foreach_impl python_domodule python_smi_tools/rsmiBindings.py
+ python_foreach_impl python_domodule python_smi_tools/rsmiBindingsInit.py
+
+ mv "${ED}"/usr/share/doc/rocm-smi-lib/* "${ED}/usr/share/doc/${PF}" || die
+ rm -r "${ED}"/usr/share/doc/rocm-smi-lib || die
+}
+
+pkg_postinst() {
+ optfeature "vendor and device names instead of hex device IDs" sys-apps/hwdata
+}
diff --git a/dev-util/rocminfo/metadata.xml b/dev-util/rocminfo/metadata.xml
new file mode 100644
index 0000000..68e21ef
--- /dev/null
+++ b/dev-util/rocminfo/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-util/rocminfo/rocminfo-10.1.ebuild b/dev-util/rocminfo/rocminfo-10.1.ebuild
new file mode 100644
index 0000000..fec64e6
--- /dev/null
+++ b/dev-util/rocminfo/rocminfo-10.1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..14} python3_13t )
+inherit cmake python-r1
+
+if [[ ${PV} == *9999 ]] ; then
+ EGIT_REPO_URI="https://github.com/ROCm/rocminfo/"
+ inherit git-r3
+else
+ SRC_URI="https://github.com/ROCm/rocm-systems/releases/download/therock-${PV}/${PN}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64"
+ S="${WORKDIR}/${PN}"
+fi
+
+DESCRIPTION="ROCm Application for Reporting System Info"
+HOMEPAGE="https://github.com/ROCm/rocm-systems/tree/develop/projects/rocminfo"
+LICENSE="UoI-NCSA"
+SLOT="0/$(ver_cut 1-2)"
+
+RDEPEND="dev-libs/rocr-runtime:${SLOT}
+ ${PYTHON_DEPS}"
+DEPEND="${RDEPEND}"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+src_prepare() {
+ sed -e "/CPACK_RESOURCE_FILE_LICENSE/d" -i CMakeLists.txt || die
+ sed -e "/num_change_since_prev_pkg(/cset(NUM_COMMITS 0)" \
+ -i cmake_modules/utils.cmake || die # Fix QA issue on "git not found"
+ cmake_src_prepare
+}
+
+src_configure() {
+ local mycmakeargs=( -DROCRTST_BLD_TYPE=Release )
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+ rm "${ED}/usr/bin/rocm_agent_enumerator" || die
+ python_foreach_impl python_doexe rocm_agent_enumerator "${BUILD_DIR}"/rocm_agent_enumerator
+}
diff --git a/eclasses/rocm.eclass b/eclasses/rocm.eclass
new file mode 100644
index 0000000..15e6a43
--- /dev/null
+++ b/eclasses/rocm.eclass
@@ -0,0 +1,363 @@
+# Copyright 2022-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: rocm.eclass
+# @MAINTAINER:
+# Gentoo Science Project <sci@gentoo.org>
+# @AUTHOR:
+# Yiyang Wu <xgreenlandforwyy@gmail.com>
+# @SUPPORTED_EAPIS: 8
+# @BLURB: Common functions and variables for ROCm packages written in HIP
+# @DESCRIPTION:
+# ROCm packages such as sci-libs/<roc|hip>*, and packages built on top of ROCm
+# libraries, can utilize variables and functions provided by this eclass.
+# It handles the AMDGPU_TARGETS variable via USE_EXPAND, so user can
+# edit USE flag to control which GPU architecture to compile. Using
+# ${ROCM_USEDEP} can ensure coherence among dependencies. Ebuilds can call the
+# function get_amdgpu_flag to translate activated target to GPU compile flags,
+# passing it to configuration. Function rocm_use_hipcc switches active compiler
+# to hipcc and cleans incompatible flags (useful for users with gcc-only flags
+# in /etc/portage/make.conf). Function check_amdgpu can help ebuild ensure
+# read and write permissions to GPU device in src_test phase, throwing friendly
+# error message if unavailable. However src_configure in general should not
+# access any AMDGPU devices. If it does, it usually means that CMakeLists.txt
+# ignores AMDGPU_TARGETS in favor of autodetected GPU, which is not desired.
+#
+# @EXAMPLE:
+# Example ebuild for ROCm library in https://github.com/ROCmSoftwarePlatform
+# which uses cmake to build and test, and depends on rocBLAS:
+# @CODE
+# ROCM_VERSION=${PV}
+# inherit cmake rocm
+# # ROCm libraries SRC_URI is usually in form of:
+# SRC_URI="https://github.com/ROCmSoftwarePlatform/${PN}/archive/rocm-${PV}.tar.gz -> ${P}.tar.gz"
+# S=${WORKDIR}/${PN}-rocm-${PV}
+# SLOT="0/$(ver_cut 1-2)"
+# IUSE="test"
+# REQUIRED_USE="${ROCM_REQUIRED_USE}"
+# RESTRICT="!test? ( test )"
+#
+# RDEPEND="
+# dev-util/hip
+# sci-libs/rocBLAS:${SLOT}[${ROCM_USEDEP}]
+# "
+#
+# src_configure() {
+# rocm_use_hipcc
+# local mycmakeargs=(
+# -DAMDGPU_TARGETS="$(get_amdgpu_flags)"
+# -DBUILD_CLIENTS_TESTS=$(usex test ON OFF)
+# )
+# cmake_src_configure
+# }
+#
+# src_test() {
+# check_amdgpu
+# # export LD_LIBRARY_PATH=<path to built lib dir> if necessary
+# cmake_src_test # for packages using the cmake test
+# # For packages using a standalone test binary rather than cmake test,
+# # just execute it (or using edob)
+# }
+# @CODE
+#
+# Examples for packages depend on ROCm libraries -- a package which depends on
+# rocBLAS, uses comma separated ${HCC_AMDGPU_TARGET} to determine GPU
+# architectures, and requires ROCm version >=5.1
+# @CODE
+# ROCM_VERSION=5.1
+# inherit rocm
+# IUSE="rocm"
+# REQUIRED_USE="rocm? ( ${ROCM_REQUIRED_USE} )"
+# DEPEND="rocm? ( >=dev-util/hip-${ROCM_VERSION}
+# >=sci-libs/rocBLAS-${ROCM_VERSION}[${ROCM_USEDEP}] )"
+#
+# src_configure() {
+# if use rocm; then
+# local amdgpu_flags=$(get_amdgpu_flags)
+# export HCC_AMDGPU_TARGET=${amdgpu_flags//;/,}
+# fi
+# default
+# }
+# src_test() {
+# use rocm && check_amdgpu
+# default
+# }
+# @CODE
+
+case ${EAPI} in
+ 8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ -z ${_ROCM_ECLASS} ]]; then
+_ROCM_ECLASS=1
+
+inherit flag-o-matic
+
+# @ECLASS_VARIABLE: ROCM_VERSION
+# @REQUIRED
+# @PRE_INHERIT
+# @DESCRIPTION:
+# The ROCm version of current package. For ROCm libraries, it should be ${PV};
+# for other packages that depend on ROCm libraries, this can be set to match
+# the version required for ROCm libraries.
+
+# @ECLASS_VARIABLE: ROCM_REQUIRED_USE
+# @OUTPUT_VARIABLE
+# @DESCRIPTION:
+# Requires at least one AMDGPU target to be compiled.
+# Example use for ROCm libraries:
+# @CODE
+# REQUIRED_USE="${ROCM_REQUIRED_USE}"
+# @CODE
+# Example use for packages that depend on ROCm libraries:
+# @CODE
+# IUSE="rocm"
+# REQUIRED_USE="rocm? ( ${ROCM_REQUIRED_USE} )"
+# @CODE
+
+# @ECLASS_VARIABLE: ROCM_USEDEP
+# @OUTPUT_VARIABLE
+# @DESCRIPTION:
+# This is an eclass-generated USE-dependency string which can be used to
+# depend on another ROCm package being built for the same AMDGPU architecture.
+#
+# The generated USE-flag list is compatible with packages using rocm.eclass.
+#
+# Example use:
+# @CODE
+# DEPEND="sci-libs/rocBLAS[${ROCM_USEDEP}]"
+# @CODE
+
+# @ECLASS_VARIABLE: ROCM_SKIP_GLOBALS
+# @DESCRIPTION:
+# Controls whether _rocm_set_globals() is executed. This variable is for
+# ebuilds that call check_amdgpu() without the need to define amdgpu_targets_*
+# USE-flags, such as dev-util/hip and dev-libs/rocm-opencl-runtime.
+#
+# Example use:
+# @CODE
+# ROCM_SKIP_GLOBALS=1
+# inherit rocm
+# @CODE
+
+# @FUNCTION: _rocm_set_globals
+# @INTERNAL
+# @DESCRIPTION:
+# Set global variables useful to ebuilds: IUSE, ROCM_REQUIRED_USE, and
+# ROCM_USEDEP, unless ROCM_SKIP_GLOBALS is set.
+
+_rocm_set_globals() {
+ [[ -n ${ROCM_SKIP_GLOBALS} ]] && return
+
+ # Two lists of AMDGPU_TARGETS of certain ROCm version. Official support
+ # matrix:
+ # https://docs.amd.com/bundle/ROCm-Installation-Guide-v${ROCM_VERSION}/page/Prerequisite_Actions.html.
+ # There is no well-known unofficial support matrix.
+ # https://github.com/Bengt/ROCm/blob/patch-2/README.md#library-target-matrix
+ # may help. Gentoo have patches to enable gfx1031 as well.
+ local unofficial_amdgpu_targets official_amdgpu_targets
+ case ${ROCM_VERSION} in
+ 5.[0-3].*)
+ unofficial_amdgpu_targets=(
+ gfx803 gfx900 gfx1010 gfx1011 gfx1012 gfx1031
+ )
+ official_amdgpu_targets=(
+ gfx906 gfx908 gfx90a gfx1030
+ )
+ ;;
+ 5.*)
+ unofficial_amdgpu_targets=(
+ gfx803 gfx900 gfx1010 gfx1011 gfx1012
+ gfx1031 gfx1100 gfx1101 gfx1102
+ )
+ official_amdgpu_targets=(
+ gfx906 gfx908 gfx90a gfx1030
+ )
+ ;;
+ 6.[0-3].*)
+ unofficial_amdgpu_targets=(
+ gfx803 gfx900 gfx940 gfx941
+ gfx1010 gfx1011 gfx1012
+ gfx1031 gfx1101 gfx1102
+ )
+ official_amdgpu_targets=(
+ gfx906 gfx908 gfx90a gfx942 gfx1030 gfx1100
+ )
+ ;;
+ 6.4.[0-2])
+ unofficial_amdgpu_targets=(
+ gfx803 gfx900 gfx906 gfx940 gfx941
+ gfx1010 gfx1011 gfx1012
+ gfx1031 gfx1101 gfx1102 gfx1200 gfx1201
+ )
+ official_amdgpu_targets=(
+ gfx908 gfx90a gfx942 gfx1030 gfx1100
+ )
+ ;;
+ 6.*)
+ unofficial_amdgpu_targets=(
+ gfx803 gfx900 gfx906 gfx940 gfx941
+ gfx1010 gfx1011 gfx1012
+ gfx1031 gfx1102 gfx1103 gfx1150 gfx1151
+ )
+ official_amdgpu_targets=(
+ gfx908 gfx90a gfx942 gfx1030 gfx1100 gfx1101 gfx1200 gfx1201
+ )
+ ;;
+ 7.*|9999)
+ unofficial_amdgpu_targets=(
+ gfx803 gfx900 gfx906 gfx940 gfx941
+ gfx1010 gfx1011 gfx1012
+ gfx1031 gfx1102 gfx1103 gfx1150 gfx1151
+ )
+ official_amdgpu_targets=(
+ gfx908 gfx90a gfx942 gfx950 gfx1030 gfx1100 gfx1101 gfx1200 gfx1201
+ )
+ ;;
+ 10.*)
+ unofficial_amdgpu_targets=(
+ gfx803 gfx900 gfx906 gfx940 gfx941
+ gfx1010 gfx1011 gfx1012
+ gfx1031
+ )
+ official_amdgpu_targets=(
+ gfx908 gfx90a gfx942 gfx950 gfx1030
+ gfx1100 gfx1101 gfx1102 gfx1103
+ gfx1150 gfx1151 gfx1152 gfx1153
+ gfx1200 gfx1201
+ )
+ ;;
+ *)
+ die "Unknown ROCm major version! Please update rocm.eclass before bumping to new ebuilds"
+ ;;
+ esac
+
+ local iuse_flags=(
+ "${official_amdgpu_targets[@]/#/+amdgpu_targets_}"
+ "${unofficial_amdgpu_targets[@]/#/amdgpu_targets_}"
+ )
+ IUSE="${iuse_flags[*]}"
+
+ local all_amdgpu_targets=(
+ "${official_amdgpu_targets[@]}"
+ "${unofficial_amdgpu_targets[@]}"
+ )
+ local allflags=( "${all_amdgpu_targets[@]/#/amdgpu_targets_}" )
+ ROCM_REQUIRED_USE=" || ( ${allflags[*]} )"
+
+ local optflags=${allflags[@]/%/(-)?}
+ ROCM_USEDEP=${optflags// /,}
+}
+_rocm_set_globals
+unset -f _rocm_set_globals
+
+# @FUNCTION: get_amdgpu_flags
+# @USAGE: get_amdgpu_flags
+# @DESCRIPTION:
+# Convert specified use flag of amdgpu_targets to compilation flags.
+# Append default target feature to GPU arch. See
+# https://llvm.org/docs/AMDGPUUsage.html#target-features
+get_amdgpu_flags() {
+ echo $(printf "%s;" ${AMDGPU_TARGETS[@]})
+}
+
+# @FUNCTION: rocm_add_sandbox
+# @USAGE: [-w]
+# @DESCRIPTION:
+# Add AMD GPU/NPU dev nodes to the sandbox predict list.
+# with -w, add to the sandbox write list.
+rocm_add_sandbox() {
+ debug-print-function "${FUNCNAME[0]}" "$@"
+
+ local i
+ for i in /dev/kfd /dev/dri/render* /dev/accel/accel*; do
+ if [[ ! -c $i ]]; then
+ continue
+ elif [[ $1 == '-w' ]]; then
+ addwrite "$i"
+ else
+ addpredict "$i"
+ fi
+ done
+}
+
+# @FUNCTION: check_amdgpu
+# @USAGE: check_amdgpu
+# @DESCRIPTION:
+# Grant and check read-write permissions on AMDGPU and AMDNPU devices.
+# Die if no AMDGPU devices are available.
+check_amdgpu() {
+ # Common case: no AMDGPU device or the kernel fusion driver is disabled in the kernel.
+ if [[ ! -c /dev/kfd ]]; then
+ eerror "Device /dev/kfd does not exist!"
+ eerror "To proceed, you need to have an AMD GPU and have CONFIG_HSA_AMD set in your kernel config."
+ die "/dev/kfd is missing"
+ fi
+
+ local device
+ for device in /dev/kfd /dev/dri/render* /dev/accel/accel*; do
+ [[ ! -c ${device} ]] && continue
+
+ addwrite "${device}"
+ if [[ ! -r ${device} || ! -w ${device} ]]; then
+ eerror "Cannot read or write ${device}!"
+ eerror "Make sure it is present and check the permission."
+ ewarn "By default render group have access to it. Check if portage user is in render group."
+ die "${device} inaccessible"
+ fi
+ done
+}
+
+fi
+
+# @FUNCTION: _rocm_strip_unsupported_flags
+# @INTERNAL
+# @DESCRIPTION:
+# Clean flags that are not compatible with 'amdgcn-amd-amdhsa' target.
+_rocm_strip_unsupported_flags() {
+ strip-unsupported-flags
+
+ # FLAGS like -mtls-dialect=* pass test-flags-CXX check, but are not supported
+ # bug #957893
+ export CXXFLAGS=$(test-flags-HIPCXX ${CXXFLAGS})
+}
+
+# @FUNCTION: rocm_use_hipcc
+# @USAGE: rocm_use_hipcc
+# @DESCRIPTION:
+# switch active C and C++ compilers to hipcc, clean unsupported flags and setup ROCM_TARGET_LST file.
+rocm_use_hipcc() {
+ # During the configuration stage, CMake tests whether the compiler is able to compile a simple program.
+ # Since CMake checker does not specify --offload-arch=, hipcc enumerates devices using four methods
+ # until it finds at least one device. Last way is by accessing them (via rocminfo).
+ # To prevent potential sandbox violations, we set the ROCM_TARGET_LST variable (which is checked first).
+ local target_lst="${T}"/gentoo_rocm_target.lst
+ if [[ "${AMDGPU_TARGETS[@]}" = "" ]]; then
+ # Expected no GPU code; still need to calm down sandbox
+ echo "gfx000" > "${target_lst}" || die
+ else
+ printf "%s\n" ${AMDGPU_TARGETS[@]} > "${target_lst}" || die
+ fi
+ export ROCM_TARGET_LST="${target_lst}"
+
+ # Export updated CC and CXX. Note that CC is needed even if no C code used,
+ # as CMake checks that C compiler can compile a simple test program.
+ export CC=hipcc CXX=hipcc
+ _rocm_strip_unsupported_flags
+}
+
+# @FUNCTION: rocm_use_clang
+# @USAGE: rocm_use_clang
+# @DESCRIPTION:
+# switch active C and C++ compilers to clang/clang++, clean unsupported flags
+rocm_use_clang() {
+ local hipclangpath
+ if ! hipclangpath=$(hipconfig --hipclangpath); then
+ die "Error: \"hipconfig --hipclangpath\" failed"
+ fi
+
+ export CC="${hipclangpath}/${CHOST}-clang"
+ export CXX="${hipclangpath}/${CHOST}-clang++"
+ _rocm_strip_unsupported_flags
+}
diff --git a/metadata/layout.conf b/metadata/layout.conf
new file mode 100644
index 0000000..20fcfea
--- /dev/null
+++ b/metadata/layout.conf
@@ -0,0 +1,3 @@
+masters = gentoo
+thin-manifests = true
+sign-manifests = false
Initial overlay: ROCm 10.1 (TheRock) ebuilds + rocm.eclass shadow
10 ebuilds (dev-libs x5, dev-util x5) ported from the 7.2.0 tree
templates with the rocm-${PV} -> therock-${PV} tag remap, plus a
shadow rocm.eclass with a 10.* target-matrix case (gfx1201 official).
86f0b1edee8b3be1eefca5aee90313a262a10f27
cjosie <administrator@josie-c.com> · 2026-10-13T20:45 ·
browse files at this commit