[Bf-blender-cvs] [4b04a4e] master: Cycles: Control CPU capabilities via environment variables

Sergey Sharybin noreply at git.blender.org
Tue Feb 10 21:57:06 CET 2015


Commit: 4b04a4e2ff4b00258dd98d4d0cb492eb41881d11
Author: Sergey Sharybin
Date:   Wed Feb 11 01:55:35 2015 +0500
Branches: master
https://developer.blender.org/rB4b04a4e2ff4b00258dd98d4d0cb492eb41881d11

Cycles: Control CPU capabilities via environment variables

Purely developers-only feature which allows to disable some of the CPU
capabilities. This way it's easier to test different kernels on the
same machine.

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

M	intern/cycles/util/util_system.cpp

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

diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp
index 998fad6..6d6bee2 100644
--- a/intern/cycles/util/util_system.cpp
+++ b/intern/cycles/util/util_system.cpp
@@ -135,6 +135,29 @@ struct CPUCapabilities {
 	bool bmi2;
 };
 
+static void system_cpu_capabilities_override(CPUCapabilities *caps)
+{
+	/* Only capabilities which affects on cycles kernel. */
+	if(getenv("CYCLES_CPU_NO_AVX2")) {
+		caps->avx2 = false;
+	}
+	if(getenv("CYCLES_CPU_NO_AVX")) {
+		caps->avx = false;
+	}
+	if(getenv("CYCLES_CPU_NO_SSE41")) {
+		caps->sse41 = false;
+	}
+	if(getenv("CYCLES_CPU_NO_SSE3")) {
+		caps->sse3 = false;
+	}
+	if(getenv("CYCLES_CPU_NO_SSE2")) {
+		caps->sse2 = false;
+	}
+	if(getenv("CYCLES_CPU_NO_SSE")) {
+		caps->sse = false;
+	}
+}
+
 static CPUCapabilities& system_cpu_capabilities()
 {
 	static CPUCapabilities caps;
@@ -200,6 +223,8 @@ static CPUCapabilities& system_cpu_capabilities()
 		}
 #endif
 
+		system_cpu_capabilities_override(&caps);
+
 		caps_init = true;
 	}




More information about the Bf-blender-cvs mailing list