Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

FMA illegal instruction

unrue
Beginner
472 Views

Dear Intel developers,

I'm using Intel 15 on Intel(R) Xeon(R) CPU E5-2670 processor. I have a problem using FMA instrinsic instruction. My compiler flags are -O3 -xHost. Compilation ends well but when I run my program I get: Program Exception - illegal instruction

I have to suppose FMA is not available on that processor? If yes, why the compiler does not advice me during compilation phase?

Thanks.

0 Kudos
6 Replies
TimP
Honored Contributor III
472 Views

The original 2670 did not support fma. If xhost is mistaking it for -v2 you would need to specify avx until a compiler upgrade fixes it.

0 Kudos
TimP
Honored Contributor III
472 Views

The current compiler doesn't expand fma intrinsic so you will need plain c++ source for automatic instruction selection.

0 Kudos
unrue
Beginner
472 Views

Tim Prince wrote:

The current compiler doesn't expand fma intrinsic so you will need plain c++ source for automatic instruction selection.

Thanks Tim. How can I check at compile time if FMA is supported?

0 Kudos
Bernard
Valued Contributor I
472 Views

You may read the following link:  https://software.intel.com/en-us/articles/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family

0 Kudos
TimP
Honored Contributor III
472 Views

Your xhost option should result in __AVX2__ being set when your build platform supports  Fma. so you can use that macro symbol to choose fma at compile time.  There is also CPU dispatch facility to choose code path at run time.

0 Kudos
unrue
Beginner
472 Views

Ok, thanks to everybody.

0 Kudos
Reply