From 37817cfc2443d93be03a96b21be1f167de58dd44 Mon Sep 17 00:00:00 2001 From: Xavier Hallade Date: Tue, 25 Jul 2023 18:50:57 +0200 Subject: [PATCH] Cycles: add /jumptablerdata to MSVC compiler flags Starting with MSVC 17.7 preview 3, /jumptablerdata is available and allows to ensure switch tables don't get mixed with the code, helping on performance when there is contention in a large switch statement, such as in svm.h. --- intern/cycles/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index de6fc13ac1e..abe5732316d 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -83,6 +83,13 @@ elseif(WIN32 AND MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang") # grained control and the speedup we get here is too big to ignore. set(CYCLES_KERNEL_FLAGS "/fp:fast -D_CRT_SECURE_NO_WARNINGS /GS-") + # "jumptablerdata" improves performance when there is contention in large switch statements such as in svm.h + # This flag is supported starting with MSVC 17.7 preview 3: + # https://learn.microsoft.com/en-us/cpp/build/reference/jump-table-rdata + if(MSVC_VERSION GREATER_EQUAL 1937) + string(APPEND CYCLES_KERNEL_FLAGS " /jumptablerdata") + endif() + # there is no /arch:SSE3, but intrinsics are available anyway if(CMAKE_CL_64) set(CYCLES_SSE2_KERNEL_FLAGS "${CYCLES_KERNEL_FLAGS}") -- 2.30.2