Page MenuHome

Fix build with tests on CPU without AVX2 support
ClosedPublic

Authored by Nikita Sirgienko (sirgienko) on Jul 3 2020, 10:16 PM.

Details

Summary

Now, if you try to build Blender with tests for development (make debug developer) with CPU without AVX2 support (for example, AMD FX-8150), you will got error like this

In file included from /usr/lib/gcc/x86_64-linux-gnu/8/include/immintrin.h:43,
                 from /usr/lib/gcc/x86_64-linux-gnu/8/include/x86intrin.h:48,
                 from /home/mmmm1998/blender/intern/cycles/test/../util/util_simd.h:37,
                 from /home/mmmm1998/blender/intern/cycles/test/../util/util_types.h:34,
                 from /home/mmmm1998/blender/intern/cycles/test/../util/util_aligned_malloc.h:20,
                 from /home/mmmm1998/blender/intern/cycles/test/../util/util_vector.h:24,
                 from /home/mmmm1998/blender/intern/cycles/test/../util/util_string.h:24,
                 from /home/mmmm1998/blender/intern/cycles/test/../util/util_system.h:20,
                 from /home/mmmm1998/blender/intern/cycles/test/util_avxf_test.h:18,
                 from /home/mmmm1998/blender/intern/cycles/test/util_avxf_avx2_test.cpp:20:
/usr/lib/gcc/x86_64-linux-gnu/8/include/avx2intrin.h: In function ‘const ccl::avxf ccl::permute(const ccl::avxf&) [with int i0 = 3; int i1 = 0; int i2 = 1; int i3 = 7; int i4 = 6; int i5 = 5; int i6 = 2; int i7 = 4]’:
/usr/lib/gcc/x86_64-linux-gnu/8/include/avx2intrin.h:1060:1: error: inlining failed in call to always_inline ‘__m256 _mm256_permutevar8x32_ps(__m256, __m256i)’: target specific option mismatch
 _mm256_permutevar8x32_ps (__m256 __X, __m256i __Y)

The problem is that avx2 test enable AVX2 intrinsic functions without actually checking AVX2 presence. With this changes, build will be successful. The only minor issue, that cycles_util_avxf_avx2_test will still presence and wil pass, but exlude this test via Cmake is a problem, because Cmake don't know about stuff like AVX.

Diff Detail

Repository
rB Blender

Event Timeline

Nikita Sirgienko (sirgienko) requested review of this revision.Jul 3 2020, 10:16 PM
Nikita Sirgienko (sirgienko) created this revision.

I am new in Blender development, so I have added reviewers from 'Build System' and 'Development Management' according this page of activity. But I can be wrong, so feel free to change reviewers, description, etc according the project lifestyle.

I don't think this is the correct place to solve the problem, with this patch the avx2 test will pass which is misleading.

CMake could check if AVX2 is available, then only attempt to run the test when it's found.

Tagging as cycles.

I'll commit a variation of this that also fixes the AVX test.

This revision is now accepted and ready to land.Apr 1 2021, 12:20 PM