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

Mimics to checks in system_cpu_support() checks.
This commit is contained in:
Sergey Sharybin 2018-01-19 15:47:53 +01:00
parent edf053ff63
commit fa91b43e8c
2 changed files with 14 additions and 5 deletions

View File

@ -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;
}

View File

@ -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;