Jump to content
funtoo forums

Question

Hello All,

 

I have a question regarding the use flags with the intel64-haswell subarch.  Since I don't plan to compile code on any other machine but the computer I'm installing on, why would the use flag -march=core-avx2 be superior to -march=native?

 

Perhaps I'm incorrect, but wouldn't -march=native be best for me?  If not, why?  I'm really confused by core-avx2.  I could be wrong, but I think using -march=native is equivalent to -march=haswell in this case.  If so, is -march=haswell different from -march=core-avx2?

 

I did notice that the CPU_FLAGS mentioned on the subarch page missed avx2, so I added that into the CPU_FLAGS within make.conf.

 

Any help would be greatly appreciated.

 

Thanks,

 

Rick

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

https://gcc.gnu.org/gcc-4.9/changes.html
New Targets and Target Specific Improvements
IA-32/x86-64
Optimizing for other Intel microarchitectures have been renamed to -march=nehalem, westmere, sandybridge, ivybridge, haswell, bonnell.
Funtoo uses gcc-4.9.3,  -march=haswell is set with


epro subarch intel64-haswell-pure64 

or

epro subarch intel64-haswell-64

gcc < 4.9 would use -march=core-avx2

My preference is to use native on my pure64 install.
 

epro subarch native_pure64 

Setting -march=haswell or using native with haswell cpu should enable avx2

man gcc:

haswell
Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL,
FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction set support.

 

Verify what is auto-enabled with native:

gcc -march=native -Q --help=target

Share this post


Link to post
Share on other sites
  • 0

Then, what exactly should be in the /etc/portage/make.conf file for CPU_FLAGS_X86, if using -march=native?  

 

Is this flag passed to programs to be built?  If so, I understand why.  If not, then...what is CPU_FLAGS_X86 for?

Share this post


Link to post
Share on other sites
  • 0

Some programs like ffmpeg are optimized by passing cpu flags as compile options.

If using cpu specific subarch the correct CPU_FLAGS_X86 are specified in the profile.

generic_64 and native_64 subarch provide only CPU_FLAGS_X86="mmx mmxext sse sse2"

For more optimization with generic or native subarch use the tool app-portage/cpuinfo2cpuflags to detect cpu flags of running cpu.

Add detected flags manually to CPU_FLAGS_X86 in make.conf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×