[Bf-blender-cvs] [9339dc6dd10] master: Fix T70685: Cycles crash using WITH_CYCLES_NATIVE_ONLY on Windows

Ray molenkamp noreply at git.blender.org
Fri Feb 14 14:11:37 CET 2020


Commit: 9339dc6dd1080730d1cf0e9a3f14d6139b2fda06
Author: Ray molenkamp
Date:   Fri Feb 14 13:54:09 2020 +0100
Branches: master
https://developer.blender.org/rB9339dc6dd1080730d1cf0e9a3f14d6139b2fda06

Fix T70685: Cycles crash using WITH_CYCLES_NATIVE_ONLY on Windows

MSVC does not have -march=native, so the kernel gets built without AVX2 and
BVH8 support. The code assumed it to be available and crashed

Differential Revision: https://developer.blender.org/D6082

===================================================================

M	intern/cycles/device/device_cpu.cpp

===================================================================

diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index 42ebf3a8399..795781ee072 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -338,7 +338,10 @@ class CPUDevice : public Device {
     if (DebugFlags().cpu.has_sse2() && system_cpu_support_sse2()) {
       bvh_layout_mask |= BVH_LAYOUT_BVH4;
     }
-#if defined(__x86_64__) || defined(_M_X64)
+    /* MSVC does not support the -march=native switch and you always end up  */
+    /* with an sse2 kernel when you use WITH_KERNEL_NATIVE. We *cannot* feed */
+    /* that kernel BVH8 even if the CPU flags would allow for it. */
+#if (defined(__x86_64__) || defined(_M_X64)) && !(defined(_MSC_VER) && defined(WITH_KERNEL_NATIVE))
     if (DebugFlags().cpu.has_avx2() && system_cpu_support_avx2()) {
       bvh_layout_mask |= BVH_LAYOUT_BVH8;
     }



More information about the Bf-blender-cvs mailing list