Can't use AVX intrinsic ,because my function compiled without support for 'xsave'

Viewed 5936

I want to use AVX intrinsic, like: __m256 factor_min = _mm256_set1_ps(1.329227); but I got the following compile error:

Always_inline function '_mm256_set1_ps' requires target feature 'xsave', but would be inlined into function 'AveragePooling' that is compiled without support for 'xsave'

My environment is:MacOs + Intel Core i7 + xcode8.3 enter image description here I have seen other discussion about 'xsave'.But still don't know how to fix this compile error.I know nothing about assembly instructions.Is there any easy way to fix this error(maybe just change xode setting?)? Thanks a lot.

I think Intel Core i7 can totally support AVX.

2 Answers

Just an update - both my Macs only showed AVX1.0 from sysctl, but in XCode 10.3, I was able to search the target settings for vector and under "Enable Additional Vector Extensions" select AVX 2, which according to Intel these Macs DO support - and it worked. :)

Update2: Due to a quirk in Clang, not all of AVX 2 is enabled, so to get FMA support, I had to go into Build Phases->Compile Sources and add the flag -mfma. Then I got fma instructions to compile. Note that it looks like this process has to be done for each source file.

Related