Cycles: Switch to HIP SDK 6.4.2 on Windows

This also reverts 367d5b7eabd53229fb7e79465b4761e65e531741,
as the math flags workaround is no longer needed.

Fix #139796
Fix #138646
Fix #139071
Fix #139070

Ref #140278

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/145311
This commit is contained in:
Sergey Sharybin
2025-08-29 12:49:11 +02:00
committed by Brecht Van Lommel
parent af700685e7
commit 03003365cc
5 changed files with 1 additions and 43 deletions

View File

@@ -263,11 +263,6 @@ string HIPDevice::compile_kernel(const uint kernel_features, const char *name, c
const char *const kernel_ext = "genco";
std::string options = "-Wno-parentheses-equality -Wno-unused-value -ffast-math";
if (hipNeedPreciseMath(arch)) {
options.append(
" -fhip-fp32-correctly-rounded-divide-sqrt -fno-gpu-approx-transcendentals "
"-fgpu-flush-denormals-to-zero -ffp-contract=off");
}
# ifndef NDEBUG
options.append(" -save-temps");

View File

@@ -77,18 +77,6 @@ static inline bool hipIsRDNA2OrNewer(const int hipDevId)
return (major > 10 || (major == 10 && minor >= 3));
}
static inline bool hipNeedPreciseMath(const std::string &arch)
{
# ifdef _WIN32
/* Enable stricter math options for RDNA2 GPUs (compiler bug on Windows). */
return (arch == "gfx1030" || arch == "gfx1031" || arch == "gfx1032" || arch == "gfx1033" ||
arch == "gfx1034" || arch == "gfx1035" || arch == "gfx1036");
# else
(void)arch;
return false;
# endif
}
static inline bool hipSupportsDeviceOIDN(const int hipDevId)
{
/* Matches HIPDevice::getArch in HIP. */

View File

@@ -225,11 +225,6 @@ string HIPRTDevice::compile_kernel(const uint kernel_features, const char *name,
options.append(
"-Wno-parentheses-equality -Wno-unused-value -ffast-math -O3 -std=c++17 -D __HIPRT__");
options.append(" --offload-arch=").append(arch.c_str());
if (hipNeedPreciseMath(arch)) {
options.append(
" -fhip-fp32-correctly-rounded-divide-sqrt -fno-gpu-approx-transcendentals "
"-fgpu-flush-denormals-to-zero -ffp-contract=off");
}
# ifdef WITH_NANOVDB
options.append(" -D WITH_NANOVDB");
# endif

View File

@@ -643,21 +643,6 @@ endif()
# HIP module
# Workaround for SDK 6.3.42560-881c2d702 compiler bug on RDNA2
# Issue #136138
function(get_hip_math_flag arch math_flag)
if(WIN32 AND (${arch} MATCHES "gfx1030|gfx1031|gfx1032|gfx1033|gfx1034|gfx1035|gfx1036"))
set(result
-fhip-fp32-correctly-rounded-divide-sqrt
-fno-gpu-approx-transcendentals
-fgpu-flush-denormals-to-zero
-ffp-contract=off)
else()
set(result "")
endif()
set(${math_flag} "${result}" PARENT_SCOPE)
endfunction()
if(WITH_CYCLES_HIP_BINARIES AND WITH_CYCLES_DEVICE_HIP)
# build for each arch
set(hip_sources device/hip/kernel.cpp
@@ -698,8 +683,6 @@ if(WITH_CYCLES_HIP_BINARIES AND WITH_CYCLES_DEVICE_HIP)
set(hip_opt_flags)
endif()
get_hip_math_flag(${arch} math_flag)
set(hip_flags
${hip_flags}
--offload-arch=${arch}
@@ -716,7 +699,6 @@ if(WITH_CYCLES_HIP_BINARIES AND WITH_CYCLES_DEVICE_HIP)
-Wno-unused-value
-ffast-math
-std=c++17
${math_flag}
${hip_opt_flags}
-o ${CMAKE_CURRENT_BINARY_DIR}/${hip_file})
@@ -812,12 +794,10 @@ if(WITH_CYCLES_HIP_BINARIES AND WITH_CYCLES_DEVICE_HIPRT)
set(hiprt_hipfb)
foreach(arch ${CYCLES_HIP_BINARIES_ARCH})
get_hip_math_flag(${arch} math_flag)
set(hiprt_file ${CMAKE_CURRENT_BINARY_DIR}/kernel_rt_${arch}.hipfb)
set(hiprt_file_compressed ${hiprt_file}.zst)
set(hiprt_flags
${hiprt_compile_flags}
${math_flag}
--offload-arch=${arch}
-o ${hiprt_file})