diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-10 23:55:35 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-10 23:56:58 +0300 |
commit | 4b04a4e2ff4b00258dd98d4d0cb492eb41881d11 (patch) | |
tree | 5f0965a10fc8fc2c14a1c53fc3677dfc0d38b361 /intern/cycles/util/util_system.cpp | |
parent | 28e76bbb931d2747fdb1ef6b47cc313a34899951 (diff) |
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.
Diffstat (limited to 'intern/cycles/util/util_system.cpp')
-rw-r--r-- | intern/cycles/util/util_system.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index 998fad6b00d..6d6bee209b4 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; } |