public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: media-libs/oidn/, media-libs/oidn/files/
@ 2024-03-25 18:57 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2024-03-25 18:57 UTC (permalink / raw
  To: gentoo-commits

commit:     24c3de08e5ef07f46d1a887e8ad8a56821012a60
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Fri Jan 19 21:12:57 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar 25 18:54:57 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=24c3de08

media-libs/oidn: apply Gentoo-related fixes for hip suport

Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../oidn/files/oidn-2.1.0-amdgpu-targets.patch     | 46 ++++++++++++++++++++++
 media-libs/oidn/oidn-2.1.0.ebuild                  | 28 ++++++++++++-
 2 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/media-libs/oidn/files/oidn-2.1.0-amdgpu-targets.patch b/media-libs/oidn/files/oidn-2.1.0-amdgpu-targets.patch
new file mode 100644
index 000000000000..90d3c17f38cc
--- /dev/null
+++ b/media-libs/oidn/files/oidn-2.1.0-amdgpu-targets.patch
@@ -0,0 +1,46 @@
+Allow specifying AMDGPU_TARGETS with CMake flags.
+Fix build when main compiler is set to GCC.
+--- a/devices/CMakeLists.txt
++++ b/devices/CMakeLists.txt
+@@ -123,6 +123,10 @@ if(OIDN_DEVICE_HIP)
+   )
+   mark_as_advanced(OIDN_DEVICE_HIP_COMPILER)
+ 
++  set(AMDGPU_TARGETS "gfx1030;gfx1031;gfx1032;gfx1033;gfx1034;gfx1035;gfx1036;gfx1100;gfx1101;gfx1102;gfx1103" CACHE STRING "AMD GPU targets to compile for")
++  mark_as_advanced(AMDGPU_TARGETS)
++  message(STATUS "AMD targets: ${AMDGPU_TARGETS}")
++
+   # Add ROCm to CMAKE_PREFIX_PATH
+   set(_hip_prefix_path CMAKE_PREFIX_PATH)
+   list(APPEND _hip_prefix_path ${ROCM_PATH}/hip ${ROCM_PATH})
+@@ -137,7 +141,6 @@ if(OIDN_DEVICE_HIP)
+     CMAKE_CACHE_ARGS
+       -DCMAKE_PREFIX_PATH:STRING=${_hip_prefix_path_str}
+       -DCMAKE_CXX_COMPILER:FILEPATH=${OIDN_DEVICE_HIP_COMPILER}
+-      -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}
+       -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+       -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/hip/preinstall
+       -DCMAKE_INSTALL_BINDIR:PATH=${CMAKE_INSTALL_BINDIR}
+@@ -149,6 +152,9 @@ if(OIDN_DEVICE_HIP)
+       -DOIDN_API_NAMESPACE:STRING=${OIDN_API_NAMESPACE}
+       -DOIDN_WARN_AS_ERRORS:BOOL=${OIDN_WARN_AS_ERRORS}
+       -DOIDN_SANITIZER:STRING=${OIDN_SANITIZER}
++      -DGPU_TARGETS:STRING=${AMDGPU_TARGETS}
++      -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
++      -G "${CMAKE_GENERATOR}"
+     BUILD_ALWAYS TRUE
+     DEPENDS
+       OpenImageDenoise_core
+--- a/devices/hip/CMakeLists.txt
++++ b/devices/hip/CMakeLists.txt
+@@ -25,8 +25,8 @@ include(oidn_common_external)
+ # FIXME: The HIP runtime has a bug that causes a crash if the kernels are not compiled for all
+ # targets detected in the system. As a workaround, we compile for more targets then we actually
+ # support to avoid the crash on systems with dedicated + integrated GPUs.
+-set(GPU_TARGETS "gfx1030,gfx1031,gfx1032,gfx1033,gfx1034,gfx1035,gfx1036,gfx1100,gfx1101,gfx1102,gfx1103" CACHE INTERNAL "")
+-set(AMDGPU_TARGETS ${GPU_TARGETS} CACHE INTERNAL "")
++set(GPU_TARGETS "gfx1030;gfx1031;gfx1032;gfx1033;gfx1034;gfx1035;gfx1036;gfx1100;gfx1101;gfx1102;gfx1103" CACHE STRING "")
++set(AMDGPU_TARGETS ${GPU_TARGETS} CACHE STRING "")
+ 
+ # Find HIP
+ find_package(hip REQUIRED)

diff --git a/media-libs/oidn/oidn-2.1.0.ebuild b/media-libs/oidn/oidn-2.1.0.ebuild
index 2eab9e4151b6..4cc4883b6c7f 100644
--- a/media-libs/oidn/oidn-2.1.0.ebuild
+++ b/media-libs/oidn/oidn-2.1.0.ebuild
@@ -1,11 +1,13 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
 PYTHON_COMPAT=( python3_{9..11} )
+LLVM_MAX_SLOT=17
+ROCM_VERSION=5.7
 
-inherit cmake python-single-r1
+inherit cmake python-single-r1 llvm rocm
 
 DESCRIPTION="Intel(R) Open Image Denoise library"
 HOMEPAGE="https://www.openimagedenoise.org/"
@@ -37,15 +39,37 @@ RDEPEND="
 "
 DEPEND="${RDEPEND}"
 
+PATCHES=(
+	"${FILESDIR}/${PN}-2.1.0-amdgpu-targets.patch"
+)
+
 src_configure() {
 	local mycmakeargs=(
 		-DOIDN_DEVICE_CUDA=$(usex cuda)
 		-DOIDN_DEVICE_HIP=$(usex hip)
 		-DOIDN_APPS=$(usex apps)
 	)
+
+	if use hip; then
+		mycmakeargs+=(
+			-DROCM_PATH="${EPREFIX}/usr"
+			-DOIDN_DEVICE_HIP_COMPILER="$(get_llvm_prefix ${LLVM_MAX_SLOT})/bin/clang++"
+			-DAMDGPU_TARGETS="$(get_amdgpu_flags)"
+		)
+	fi
+
 	cmake_src_configure
 }
 
 src_test() {
 	"${BUILD_DIR}"/oidnTest || die "There were test faliures!"
 }
+
+src_install() {
+	cmake_src_install
+
+	if use hip || use cuda ; then
+		# remove garbage in /var/tmp left by subprojects
+		rm -rf "${ED}"/var || die
+	fi
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/oidn/, media-libs/oidn/files/
@ 2025-03-07 13:22 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2025-03-07 13:22 UTC (permalink / raw
  To: gentoo-commits

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-07 13:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07 13:22 [gentoo-commits] repo/gentoo:master commit in: media-libs/oidn/, media-libs/oidn/files/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2024-03-25 18:57 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox