Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

xcode

macos

avx

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.

like image 279
maofu Avatar asked Jan 29 '23 22:01

maofu


1 Answers

I had this same compilation issue on Xcode 9.2 on a 2017 MacBook Pro - which supports up to AVX2.

I was able to get it to compile by manually configuring the AVX vector extensions, instead of using "Platform Default".

enter image description here

To find out whether your CPU supports AVX, check the output of the following command in a terminal to see if it shows AVX or even AVX2:

sysctl -a | grep machdep.cpu.features

like image 87
Sidelobe Avatar answered Feb 01 '23 12:02

Sidelobe