summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Zander <negril.nx+gentoo@gmail.com>2024-03-28 19:06:05 +0100
committerSam James <sam@gentoo.org>2024-04-02 12:27:00 +0100
commit789f92e9d42874af6d16b4026f18d404be539ce2 (patch)
tree1bca156f48d815ca4813a318ef44eff421a80e35 /media-libs/oidn
parentmedia-libs/osl: add 1.12.14.0-r1, 1.13.7.0 (diff)
downloadgentoo-789f92e9d42874af6d16b4026f18d404be539ce2.tar.gz
gentoo-789f92e9d42874af6d16b4026f18d404be539ce2.tar.bz2
gentoo-789f92e9d42874af6d16b4026f18d404be539ce2.zip
media-libs/oidn: add 2.2.2, fix cuda
Bug: https://bugs.gentoo.org/926116#c8 Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/35972 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-libs/oidn')
-rw-r--r--media-libs/oidn/Manifest1
-rw-r--r--media-libs/oidn/files/oidn-2.2.2-amdgpu-targets.patch46
-rw-r--r--media-libs/oidn/metadata.xml3
-rw-r--r--media-libs/oidn/oidn-2.2.2.ebuild95
4 files changed, 145 insertions, 0 deletions
diff --git a/media-libs/oidn/Manifest b/media-libs/oidn/Manifest
index 489f13abaf7b..6fd58c05f4a3 100644
--- a/media-libs/oidn/Manifest
+++ b/media-libs/oidn/Manifest
@@ -1,3 +1,4 @@
DIST oidn-1.4.2.tar.gz 54221996 BLAKE2B bb6593e2e15877f65d9224fc93dac72aff6d567a00d727b050a88a1add4dc1441e695dc38056dd796e004e20916054b43ed7d0e90f22a16597f6617cf6a119e7 SHA512 8b464cedc91ef7a88cfc97c3fde80275b12058cdd26b352718d90f8f20b3462c4ac65b2b1ad5548a520590fbd015fcc8ab9f964633bc8b89d72901fe8a13e352
DIST oidn-1.4.3.tar.gz 54222682 BLAKE2B f9b585c318258fd78e221a453b64e83965a3e5035a912baa49e4d5b48466441bf1d3c15291de2cd4d36e9da187ff7a643bb9d4af5282cdbb8b6bc99fb3cda0d0 SHA512 6fbdf347763c0734140195a523cf0878b1dbd91d4943c9ce4928f6991549f8b3d5ab4d57b90e20a8d04a87d00e3a1554ce73a3a3c1e64fcb016a3c1f8aa07982
DIST oidn-2.1.0.tar.gz 48977314 BLAKE2B 0fc32697df7fc6b8b367a78312a5b16ab68a5c88a2d19a8780e9de87c7e7096d7fe43dbd07928f2eba44c62fb4545338fc92f918dd4c33623259d0088a06a854 SHA512 508cb100f1a0a825774c2c01e0fc983e697341745fa0bfa48a99bfa70fc431f66fcdf17c3f170e40baefd7c3796a25d147f49cb17efbf1a1886556367c5c4566
+DIST oidn-2.2.2.tar.gz 49006605 BLAKE2B e3d32cc2112ded280e642c5d69fb2ef14db59df4f5224bff79e82ede207899c9dbfa43dc663ad9ccc15a6497e363df0b91b43660729962c410b7ec75ac1b3465 SHA512 eca18e9e22a40bc1381e75985e5f5e79f48cc6d168a2a703e54540967646487d347db290459e9a612d8ab4924e8d3c83d84664fd5318cca4f17745da1e47cf50
diff --git a/media-libs/oidn/files/oidn-2.2.2-amdgpu-targets.patch b/media-libs/oidn/files/oidn-2.2.2-amdgpu-targets.patch
new file mode 100644
index 000000000000..4a6c2ce607c2
--- /dev/null
+++ b/media-libs/oidn/files/oidn-2.2.2-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
+@@ -129,6 +129,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})
+@@ -143,7 +147,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}
+@@ -155,6 +158,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: Older versions of the HIP runtime have a bug which may cause a crash if the kernels are
+ # not compiled for all targets detected in the system (it seems mostly APUs/integrated GPUs).
+ # As a workaround, we compile for more targets then we actually support to avoid this crash.
+-set(GPU_TARGETS "gfx902,gfx909,gfx90c,gfx1030,gfx1031,gfx1032,gfx1033,gfx1034,gfx1035,gfx1036,gfx1100,gfx1101,gfx1102,gfx1103" CACHE INTERNAL "")
+-set(AMDGPU_TARGETS ${GPU_TARGETS} CACHE INTERNAL "")
++set(GPU_TARGETS "gfx902,gfx909,gfx90c,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/metadata.xml b/media-libs/oidn/metadata.xml
index 448ccc40008f..228559585b99 100644
--- a/media-libs/oidn/metadata.xml
+++ b/media-libs/oidn/metadata.xml
@@ -21,6 +21,9 @@
<flag name="hip">
Build OIDN with AMD HIP support.
</flag>
+ <flag name="openimageio">
+ Enable OpenImageIO Support
+ </flag>
</use>
<upstream>
<remote-id type="github">OpenImageDenoise/oidn</remote-id>
diff --git a/media-libs/oidn/oidn-2.2.2.ebuild b/media-libs/oidn/oidn-2.2.2.ebuild
new file mode 100644
index 000000000000..27bf11543fa8
--- /dev/null
+++ b/media-libs/oidn/oidn-2.2.2.ebuild
@@ -0,0 +1,95 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+LLVM_COMPAT=( {15..17} )
+ROCM_VERSION=5.7
+
+inherit cuda cmake python-single-r1 llvm-r1 rocm
+
+DESCRIPTION="Intel(R) Open Image Denoise library"
+HOMEPAGE="https://www.openimagedenoise.org/"
+
+if [[ ${PV} = *9999 ]]; then
+ EGIT_REPO_URI="https://github.com/OpenImageDenoise/oidn.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+else
+ SRC_URI="https://github.com/OpenImageDenoise/${PN}/releases/download/v${PV}/${P}.src.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
+fi
+
+LICENSE="Apache-2.0"
+SLOT="0"
+REQUIRED_USE="
+ ${PYTHON_REQUIRED_USE}
+ test? ( apps )
+"
+IUSE="apps cuda hip openimageio test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ ${PYTHON_DEPS}
+ dev-cpp/tbb:=
+ dev-lang/ispc
+ cuda? ( dev-util/nvidia-cuda-toolkit )
+ hip? ( dev-util/hip )
+ openimageio? ( media-libs/openimageio:= )
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-2.2.2-amdgpu-targets.patch"
+)
+
+src_prepare() {
+ if use cuda; then
+ cuda_src_prepare
+ addpredict "/proc/self/task/"
+ fi
+
+ sed -e "/^install.*llvm_macros.cmake.*cmake/d" -i CMakeLists.txt || die
+
+ cmake_src_prepare
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DOIDN_APPS="$(usex apps)"
+ -DOIDN_APPS_OPENIMAGEIO="$(usex apps "$(usex openimageio)")"
+
+ -DOIDN_DEVICE_CPU="yes"
+ -DOIDN_DEVICE_CUDA="$(usex cuda)"
+ -DOIDN_DEVICE_HIP="$(usex hip)"
+ # -DOIDN_DEVICE_SYCL="$(usex sycl)"
+ )
+
+ if use cuda; then
+ export CUDAHOSTCXX="$(cuda_gccdir)"
+ fi
+
+ if use hip; then
+ mycmakeargs+=(
+ -DROCM_PATH="${EPREFIX}/usr"
+ -DOIDN_DEVICE_HIP_COMPILER="$(get_llvm_prefix)/bin/clang++" # use HIPHOSTCOMPILER
+ -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
+}