From 24f2fe48804ec650d568af3cc1a807ca70de33a4 Mon Sep 17 00:00:00 2001 From: Alaska Date: Wed, 16 Oct 2024 16:28:54 +0200 Subject: [PATCH] Fix: Cycles HIP: Failing volume renders with HIP 6.1 Fix the failing rendering of volumes on Windows with HIP SDK 6.1 by reducing the optimization level. There should be no functional or performance difference for the average user as the Blender foundation currently does not use HIP SDK 6.1 on Windows. This change is primarily to fix issues for community members building Blender locally. Pull Request: https://projects.blender.org/blender/blender/pulls/128836 --- intern/cycles/kernel/CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index 69126f9b21a..ff50200c8df 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -672,10 +672,13 @@ if(WITH_CYCLES_HIP_BINARIES AND WITH_CYCLES_DEVICE_HIP) set(hip_flags) endif() - # There's a bug in the compiler causing some scenes to fail to render on Vega cards - # A workaround currently is to set -O1 opt level during kernel compilation for these - # cards Remove this when a newer compiler is available with fixes. - if(WIN32 AND (${arch} MATCHES "gfx90[a-z0-9]+")) + # There's a few bugs in the HIP compiler causing some scenes to fail to render, + # or render improperly with specific combinations of device and/or compiler. + # - Vega (gfx90x) fails to render some scenes + # - Other GPUs (E.g. RDNA3) render volumes improperly with HIP 6.1.40252 + # A workaround is to set -O1 opt level during kernel compilation for these + # configurations. + if(WIN32 AND ((${arch} MATCHES "gfx90[a-z0-9]+") OR (${HIP_VERSION} STREQUAL "6.1.40252"))) set(hip_opt_flags "-O1") else() set(hip_opt_flags) @@ -760,6 +763,10 @@ if(WITH_CYCLES_DEVICE_HIPRT) set(hiprt_compile_flags ${hiprt_compile_flags} -D WITH_CYCLES_DEBUG) endif() + if(WIN32 AND (${HIP_VERSION} STREQUAL "6.1.40252")) + message(WARNING "HIP SDK ${HIP_VERSION} has known rendering artifacts with HIPRT. 5.7 is recommended instead") + endif() + set(hiprt_compile_flags_bvh ${hiprt_compile_flags} ${target_gpus}