Cycles: Disable OpenImageDenoise support for AMD GPUs in Blender 4.1 #119476

Merged
Brecht Van Lommel merged 1 commits from brecht/blender:disable-oidn-hip into blender-v4.1-release 2024-03-14 18:18:28 +01:00
1 changed files with 25 additions and 0 deletions

View File

@ -208,6 +208,27 @@ vector<DeviceType> Device::available_types()
return types;
}
static void device_oidn_init_once()
{
static bool initialized = false;
if (initialized == false) {
/* Disable OIDN for HIP until it has been tested to be stable on more systems.
*
* In older drivers with an integrated GPU, this may crash with message:
* "hipErrorNoBinaryForGpu: Unable to find code object for all current devices".
*
* This also affects systems which have for example an NVIDIA GPU as OIDN
* initializes all device types together. */
#ifdef _WIN32
_putenv_s("OIDN_DEVICE_HIP", "0");
#else
setenv("OIDN_DEVICE_HIP", "0", true);
#endif
initialized = true;
}
}
vector<DeviceInfo> Device::available_devices(uint mask)
{
/* Lazy initialize devices. On some platforms OpenCL or CUDA drivers can
@ -216,6 +237,8 @@ vector<DeviceInfo> Device::available_devices(uint mask)
thread_scoped_lock lock(device_mutex);
vector<DeviceInfo> devices;
device_oidn_init_once();
#if defined(WITH_CUDA) || defined(WITH_OPTIX)
if (mask & (DEVICE_MASK_CUDA | DEVICE_MASK_OPTIX)) {
if (!(devices_initialized_mask & DEVICE_MASK_CUDA)) {
@ -314,6 +337,8 @@ string Device::device_capabilities(uint mask)
thread_scoped_lock lock(device_mutex);
string capabilities = "";
device_oidn_init_once();
if (mask & DEVICE_MASK_CPU) {
capabilities += "\nCPU device capabilities: ";
capabilities += device_cpu_capabilities() + "\n";