Cycles: Adding OIDN support for CUDA and OptiX devices #115828
|
@ -14,6 +14,7 @@ if(NOT APPLE)
|
|||
${OIDN_EXTRA_ARGS}
|
||||
-DOIDN_DEVICE_SYCL=ON
|
||||
-DOIDN_DEVICE_SYCL_AOT=OFF
|
||||
-DOIDN_DEVICE_CUDA=ON
|
||||
-DOIDN_DEVICE_HIP=ON
|
||||
-DLEVEL_ZERO_ROOT=${LIBDIR}/level-zero
|
||||
)
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
# include "device/cuda/device_impl.h"
|
||||
# include "device/device.h"
|
||||
|
||||
# include "integrator/denoiser_oidn_gpu.h"
|
||||
|
||||
# include "util/string.h"
|
||||
# include "util/windows.h"
|
||||
#endif /* WITH_CUDA */
|
||||
|
@ -162,6 +164,12 @@ void device_cuda_info(vector<DeviceInfo> &devices)
|
|||
(unsigned int)pci_location[1],
|
||||
(unsigned int)pci_location[2]);
|
||||
|
||||
# if defined(WITH_OPENIMAGEDENOISE)
|
||||
if (OIDNDenoiserGPU::is_device_supported(info)) {
|
||||
info.denoisers |= DENOISER_OPENIMAGEDENOISE;
|
||||
}
|
||||
# endif
|
||||
|
||||
/* If device has a kernel timeout and no compute preemption, we assume
|
||||
* it is connected to a display and will freeze the display while doing
|
||||
* computations. */
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "device/cuda/device.h"
|
||||
#include "device/optix/device_impl.h"
|
||||
|
||||
#include "integrator/denoiser_oidn_gpu.h"
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
#ifdef WITH_OSL
|
||||
|
@ -74,6 +76,11 @@ void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo
|
|||
info.has_osl = true;
|
||||
# endif
|
||||
info.denoisers |= DENOISER_OPTIX;
|
||||
# if defined(WITH_OPENIMAGEDENOISE)
|
||||
if (OIDNDenoiserGPU::is_device_supported(info)) {
|
||||
info.denoisers |= DENOISER_OPENIMAGEDENOISE;
|
||||
}
|
||||
# endif
|
||||
|
||||
devices.push_back(info);
|
||||
}
|
||||
|
|
|
@ -111,6 +111,10 @@ uint OIDNDenoiserGPU::get_device_type_mask() const
|
|||
# ifdef OIDN_DEVICE_SYCL
|
||||
device_mask |= DEVICE_MASK_ONEAPI;
|
||||
# endif
|
||||
# ifdef OIDN_DEVICE_CUDA
|
||||
device_mask |= DEVICE_MASK_CUDA;
|
||||
device_mask |= DEVICE_MASK_OPTIX;
|
||||
# endif
|
||||
# ifdef OIDN_DEVICE_HIP
|
||||
device_mask |= DEVICE_MASK_HIP;
|
||||
# endif
|
||||
|
@ -155,9 +159,17 @@ bool OIDNDenoiserGPU::denoise_create_if_needed(DenoiseContext &context)
|
|||
oidn_device_ = oidnNewSYCLDevice(
|
||||
(const sycl::queue *)reinterpret_cast<OneapiDevice *>(denoiser_device_)->sycl_queue(),
|
||||
1);
|
||||
denoiser_queue_->init_execution();
|
||||
break;
|
||||
# endif
|
||||
# if defined(OIDN_DEVICE_CUDA) && defined(WITH_CUDA)
|
||||
case DEVICE_CUDA:
|
||||
case DEVICE_OPTIX: {
|
||||
/* Directly using the stream from the DeviceQueue returns "invalid resource handle". */
|
||||
cudaStream_t stream = nullptr;
|
||||
oidn_device_ = oidnNewCUDADevice(&denoiser_device_->info.num, &stream, 1);
|
||||
break;
|
||||
}
|
||||
# endif
|
||||
# if defined(OIDN_DEVICE_HIP) && defined(WITH_HIP)
|
||||
case DEVICE_HIP: {
|
||||
hipStream_t stream = nullptr;
|
||||
|
|
Loading…
Reference in New Issue