Cycles: Disable OpenImageDenoise support for AMD GPUs in Blender 4.1

In older drivers with an integrated GPU, this may crash. This not only
affects HIP, but also can crash when using Cycles with an NVIDIA or
Intel GPU in combination with an AMD CPU.

Fixes for this are expected to be coming, but there will not be enough
time for user testing, and it is difficult to be certain that the fix
is complete.

So to be careful, this is postponed until it has had more testing.

Pull Request: https://projects.blender.org/blender/blender/pulls/119476
This commit is contained in:
Brecht Van Lommel 2024-03-14 18:18:18 +01:00 committed by Brecht Van Lommel
parent 479342b1cf
commit 335ff6efab
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";