How to know or specify the instrcution set (X87, SSE, or AVX) that being used

How to know or specify the instrcution set (X87, SSE, or AVX) that being used

Hi,

I am compiling my code using ifort 13.1.0 and running it on an Xeon Intel 8-Core 64-bit E5-processor. 
The platform supports X87, SSE and AVX. Now I am using PAPI to measure the floating point instructions
and later may do some vectorization work. My questions are:

1. Both X87 and SSE can do scalar floating point operations. Which one will the compiler choose to
use? Is there a switch to control? I can measure the scalar FLOP from SSE but I don't have a counter for X87.

2. Both SSE and AVX can do vector floating point operations. Which one will the compiler choose to
use? Is there a switch to control?

Thanks for your time and help.

Happy Thanksgiving!

Best regards,
   Wentao

 

 

 

11 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I just noticed that I carelessly made two same posts. Sorry.

Best regards,
   Wentao

 

ifort 13.1 supports x87 code generation only in the ia32 (32-bit) compiler, with -mia32 compile switch.

If you don't specify an architecture switch, the compiler uses SSE/SSE2.  When you specify -mavx or -xHost, the compiler will use AVX.

Hi,

Thank you so much for your reply. Just to make sure my understanding is correct:

1.When you say ia32 compiler, do you mean that there is a 32-bit ifort 13.1 for ia-32 architecture
and a 64-bit ifort 13.1 for intel 64 architecture? Or what you mean is I can use -mia32 to tell ifort 13.1 
that I am using ia-32 architecture and please generate X87 code.

2. I am now using Sandy Bridge, which implements Intel 64 architecture. If I don't specify -mia32, 
ifort 13.10 will never generate X87 code. It will by default use SSE/SSE2. Am I correct?

Many thanks!

Best,
Wentao

The compiler option list shows that both -xK (use -mia32) and -axK (use -mia32) are deprecated options.

Best Reply

Yes, there are separate ia32 (32-bit) and Intel64 (64-bit) compilers.  Only the ia32 compiler supports -mia32, so the 64-bit compiler doesn't use x87 except to support C long double. 

In gfortran, the -m32 and -m64 options are available to switch compilers (those also are actually separate compilers), and the -m32 one normally defaults to x87, so this subject may be confusing.

In order to support the Intel ia32 compiler on 64-bit OS, you must have both the g++ 32- and 64-bit compilers and libraries installed.

-xK used to mean a combination of x87 and SSE (no SSE2), to support Pentium III compatible CPUs (which could run only 32-bit mode).  The only remaining option in ifort for those CPUs is -mia32 (no SSE or SSE2, only x87).  -axK used to request the combination of x87 and SSE for Intel CPUs P-III and later, and x87 only for other CPUs.  Again, this would be supported now by -mia32.

Thanks for your reply.

I have checked the compiler option list and I did not find -mia32. So I think I am using 64-bit compiler that 
does not support X87. Then there will be no X87 floating point instructions generated right ? (I want to 
purely use SSE and AVX. I don't want X87 involved since I cannot measure it)

Best,
Wentao

 

 

 

 

Just to clarify, if you did want to use the 32 bit/X87 compiler, then you would switch compilers by running something like `/opt/intel/composer_xe_2013/bin/compilervars.sh ia32` I know you don't want to do this, but I found this confusing relative to gcc/gfortran. (Although, as Tim notes, gcc is effectively doing the same thing behind the scenes with some trickery.)

-Zaak

Thanks!

Just to be clear,  the compiler for Intel64 does not promise not to use x87 instructions, but it will normally use SSE or AVX instructions unless obliged to do otherwise. However, math library functions may still use x87 instructions in some circumstances, e.g. to benefit from the extra precision.

You will not get AVX instructions unless you compile with -xavx, -xhost, -xcore-avx2 or similar.If you do this, you will normally get just AVX instructions, (128 or 256 bit), but may also get SSE instructions in some cases. Calls to scalar math library functions are likely to use SSE instructions rather than AVX.

Hi Martyn,

Many thanks for your detailed answer. Now things become clear:-)

Best regards,
   Wentao
 

 

Leave a Comment

Please sign in to add a comment. Not a member? Join today