[Bf-blender-cvs] [fa91b43e8cb] master: Cycles: Make it more proper check on vectorization flags from DebugFlags

Sergey Sharybin noreply at git.blender.org
Fri Jan 19 15:48:45 CET 2018


Commit: fa91b43e8cbe55179bfb783be4371e8bc50e9d74
Author: Sergey Sharybin
Date:   Fri Jan 19 15:47:53 2018 +0100
Branches: master
https://developer.blender.org/rBfa91b43e8cbe55179bfb783be4371e8bc50e9d74

Cycles: Make it more proper check on vectorization flags from DebugFlags

Mimics to checks in system_cpu_support() checks.

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

M	intern/cycles/device/device_cpu.cpp
M	intern/cycles/util/util_debug.h

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

diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index 0783230ef14..6b6b3432446 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -86,35 +86,35 @@ public:
 		(void)kernel_avx;
 		(void)kernel_avx2;
 #ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX2
-		if(DebugFlags().cpu.avx2 && system_cpu_support_avx2()) {
+		if(DebugFlags().cpu.has_avx2() && system_cpu_support_avx2()) {
 			architecture_name = "AVX2";
 			kernel = kernel_avx2;
 		}
 		else
 #endif
 #ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX
-		if(DebugFlags().cpu.avx && system_cpu_support_avx()) {
+		if(DebugFlags().cpu.has_avx() && system_cpu_support_avx()) {
 			architecture_name = "AVX";
 			kernel = kernel_avx;
 		}
 		else
 #endif
 #ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
-		if(DebugFlags().cpu.sse41 && system_cpu_support_sse41()) {
+		if(DebugFlags().cpu.has_sse41() && system_cpu_support_sse41()) {
 			architecture_name = "SSE4.1";
 			kernel = kernel_sse41;
 		}
 		else
 #endif
 #ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
-		if(DebugFlags().cpu.sse3 && system_cpu_support_sse3()) {
+		if(DebugFlags().cpu.has_sse3() && system_cpu_support_sse3()) {
 			architecture_name = "SSE3";
 			kernel = kernel_sse3;
 		}
 		else
 #endif
 #ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
-		if(DebugFlags().cpu.sse2 && system_cpu_support_sse2()) {
+		if(DebugFlags().cpu.has_sse2() && system_cpu_support_sse2()) {
 			architecture_name = "SSE2";
 			kernel = kernel_sse2;
 		}
diff --git a/intern/cycles/util/util_debug.h b/intern/cycles/util/util_debug.h
index 632c6ae35e7..ec38cd373ba 100644
--- a/intern/cycles/util/util_debug.h
+++ b/intern/cycles/util/util_debug.h
@@ -45,6 +45,15 @@ public:
 		bool sse3;
 		bool sse2;
 
+		/* Check functions to see whether instructions up to the given one
+		 * are allowed for use.
+		 */
+		bool has_avx2()  { return has_avx()   && avx2; }
+		bool has_avx()   { return has_sse41() && avx; }
+		bool has_sse41() { return has_sse3()  && sse41; }
+		bool has_sse3()  { return has_sse2()  && sse3; }
+		bool has_sse2()  { return sse2; }
+
 		/* Whether QBVH usage is allowed or not. */
 		bool qbvh;



More information about the Bf-blender-cvs mailing list