commit:     0f3d926297ee15bd36ba36ac322b7ce234f8d5c2
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Sun Jan 26 16:37:35 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar  7 13:21:42 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f3d9262

media-libs/oidn: fix dependency on hipcc and compilation with rocm-6.3.0

Befor this change media-libs/oidn[hip] had both llvm-core/clang (some version)
and dev-util/hip (some version) in dependencies, while not attempting to keep in
sync both packages. However specifying dependency on llvm-core/clang is not
needed. Open Image Denoise exposes C99 API with C++11 wrapper, users of this
library has no interest in specifying specific version of LLVM using slots. For
example, it is possible to use LLVM-18-based Mesa (as Mesa is traditionally
lagging behind) with Cycles+OIDN compiled by hipcc-6.3.0 (LLVM-19-based).

This change is followed by change in media-gfx/blender, which removes
`[${LLVM_USEDEP}]` from media-libs/oidn dependency (otherwise the dependency
graph can't be solved).

Closes: https://bugs.gentoo.org/936899
Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../oidn/files/oidn-2.3.1-hip-clang-19.patch       | 18 ++++++++++++++++++
 media-libs/oidn/metadata.xml                       |  3 +--
 media-libs/oidn/oidn-2.3.1.ebuild                  | 22 ++++++++++++----------
 3 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/media-libs/oidn/files/oidn-2.3.1-hip-clang-19.patch 
b/media-libs/oidn/files/oidn-2.3.1-hip-clang-19.patch
new file mode 100644
index 000000000000..944e238139ef
--- /dev/null
+++ b/media-libs/oidn/files/oidn-2.3.1-hip-clang-19.patch
@@ -0,0 +1,18 @@
+Fix compilation with Clang 19 (rocm-6.3.0 and above).
+
+Backports commit 
https://github.com/ROCm/composable_kernel/commit/c44137838e2cb30bbe5a3b9903c357b476a34d52
+Upstream bug: https://github.com/RenderKit/oidn/issues/250
+--- 
a/external/composable_kernel/include/ck/tensor_operation/gpu/block/blockwise_gemm_xdlops.hpp
++++ 
b/external/composable_kernel/include/ck/tensor_operation/gpu/block/blockwise_gemm_xdlops.hpp
+@@ -781,11 +781,6 @@ struct BlockwiseGemmXdlops_v2
+                       "wrong!");
+     }
+ 
+-    __host__ __device__ BlockwiseGemmXdlops_v2(const BlockwiseGemmXdlops_v2& 
other)
+-        : a_thread_copy_(other.a_origin), b_thread_copy_(other.b_origin)
+-    {
+-    }
+-
+     // transposed XDL output supporting C_xdl' = B_xdl' * A_xdl'
+     __host__ __device__ static constexpr auto 
GetCThreadDescriptor_M0_N0_M1_N1_M2_N2_N3_N4()
+     {

diff --git a/media-libs/oidn/metadata.xml b/media-libs/oidn/metadata.xml
index eb65b09493a5..ea208b614223 100644
--- a/media-libs/oidn/metadata.xml
+++ b/media-libs/oidn/metadata.xml
@@ -11,8 +11,7 @@
        </maintainer>
        <longdescription>
                Intel Open Image Denoise is an open source library of 
high-performance,
-               high-quality denoising filters for images rendered with ray 
tracing. Intel
-               Open Image Denoise is part of the IntelĀ® oneAPI Rendering 
Toolkit and is
+               high-quality denoising filters for images rendered with ray 
tracing.
        </longdescription>
        <use>
                <flag name="apps">

diff --git a/media-libs/oidn/oidn-2.3.1.ebuild 
b/media-libs/oidn/oidn-2.3.1.ebuild
index e7a61860c41b..e461dfc6169f 100644
--- a/media-libs/oidn/oidn-2.3.1.ebuild
+++ b/media-libs/oidn/oidn-2.3.1.ebuild
@@ -4,10 +4,9 @@
 EAPI=8
 
 PYTHON_COMPAT=( python3_{10..13} )
-LLVM_COMPAT=( {15..18} )
 ROCM_VERSION=5.7
 
-inherit cmake cuda llvm-r1 python-any-r1 rocm
+inherit cmake cuda python-any-r1 rocm
 
 DESCRIPTION="IntelĀ® Open Image Denoise library"
 HOMEPAGE="https://www.openimagedenoise.org https://github.com/RenderKit/oidn";
@@ -36,16 +35,12 @@ RDEPEND="
        hip? ( dev-util/hip )
        openimageio? ( media-libs/openimageio:= )
 "
-DEPEND="${RDEPEND}
-       $(llvm_gen_dep '
-               llvm-core/clang:${LLVM_SLOT}=
-               llvm-core/llvm:${LLVM_SLOT}=
-       ')
-"
+DEPEND="${RDEPEND}"
 BDEPEND="${PYTHON_DEPS}"
 
 PATCHES=(
        "${FILESDIR}/${PN}-2.2.2-amdgpu-targets.patch"
+       "${FILESDIR}/${PN}-2.3.1-hip-clang-19.patch"
 )
 
 src_prepare() {
@@ -54,8 +49,15 @@ src_prepare() {
        fi
 
        if use hip; then
+               # Fix Clang 19 error
+               # Bug: https://github.com/RenderKit/oidn/issues/250
+               sed -i "s/.template Run(/.template Run<>(/g" \
+                       
external/composable_kernel/include/ck/tensor_operation/gpu/block/blockwise_gemm_wmma.hpp
 \
+                       
external/composable_kernel/include/ck/tensor_operation/gpu/block/blockwise_gemm_xdlops_skip_b_lds.hpp
 \
+                       
external/composable_kernel/include/ck/tensor_operation/gpu/block/blockwise_gemm_xdlops.hpp
 || die
+
                # https://bugs.gentoo.org/930391
-               sed "/-Wno-unused-result/s:): --rocm-path=${EPREFIX}/usr/lib):" 
\
+               sed "/-Wno-unused-result/s:): --rocm-path=${EPREFIX}/usr):" \
                        -i devices/hip/CMakeLists.txt || die
        fi
 
@@ -87,7 +89,7 @@ src_configure() {
        if use hip; then
                mycmakeargs+=(
                        -DROCM_PATH="${EPREFIX}/usr"
-                       
-DOIDN_DEVICE_HIP_COMPILER="$(get_llvm_prefix)/bin/clang++" # use 
HIPHOSTCOMPILER
+                       -DOIDN_DEVICE_HIP_COMPILER="${ESYSROOT}/usr/bin/hipcc"
                        -DAMDGPU_TARGETS="$(get_amdgpu_flags)"
                )
        fi

Reply via email to