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
This commit is contained in:
Alaska
2024-10-16 16:28:54 +02:00
committed by Sergey Sharybin
parent 9cb4d3bbff
commit 24f2fe4880

View File

@@ -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}