Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
公告
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29286 讨论

SSE error in compilation with xHost option on AMD Zen 3 CPU

artu72
初学者
7,606 次查看

On a host with an AMD Ryzen 5800X CPU (zen 3 architecture), compiling a fortran 90 code with -xHost opion raises the error

catastrophic error: Function return parameter requires SSE register while SSE is disabled

corresponding to a row whit a square root of a quadruple precision floating point value.

If I replace -xHost option with a -march=core-avx2 one, the compilation goes fine. 

The compiler is ifort Version 2021.2.0 Build 20210228_000000

0 项奖励
1 解答
Steve_Lionel
名誉分销商 III
7,537 次查看

If your CPU supports AVX2 (which it does), then yes, that's the right choice. It is what -xHost should do anyway. Do keep in mind that -fp-model:strict will reduce performance. You may want to use this only on the sources where you need that.

在原帖中查看解决方案

0 项奖励
5 回复数
Steve_Lionel
名誉分销商 III
7,583 次查看

Please provide an example source that demonstrates the problem. I'd also be interested in the output of compiling this source with the -# option (I'm not sure if that's the right one for Linux, but it might be.) I wrote the original compiler code to implement -xHost - it uses a CPUID instruction and looks at the feature bits returned if a non-Intel CPU. That was some years ago - the code may have been altered since then. But the -# output will at least show what features the driver THINKS the CPU has.

0 项奖励
artu72
初学者
7,572 次查看

Thank you for your kind reply. Meanwhile, I have found that the culprit is the -fp-model strict option. By removing it, the compilation is ok. I attach here a sample code that reproduces the problematic part. By compiling it with

ifort -O3 -xHost test-amd.f90 -o test-amd -fp-model strict

there is the error. By removing -xHost or -fp-model strict option, it works. I attach here also the output generated by inserting -# option. As said before, by issuing

ifort -O3 -march=core-avx2 test-amd.f90 -o test-amd -fp-model strict

it works again.

UPDATE: the fp-model source option gives the same behavior as strict one.

0 项奖励
Steve_Lionel
名誉分销商 III
7,560 次查看

Thanks. The output you attached shows that the compiler believes the processor supports SSE4 and AVX1, at least. You've identified a compiler bug, to be sure. Do you have purchased support? If so, I'd encourage you to report this at the Intel Online Service Center. If not, hope that one of the Intel support engineers sees this and picks it up. I'll comment that for Fortran, source and strict are the same (they aren't for Intel C++.)

0 项奖励
artu72
初学者
7,555 次查看

Hi Steve, I will report the bug to the IT staff in my company, they have a corporate support. Thank you very much for the support. As workaround, can I use  -march=core-avx2 instead of -xHost to have the best code on my CPU?

0 项奖励
Steve_Lionel
名誉分销商 III
7,538 次查看

If your CPU supports AVX2 (which it does), then yes, that's the right choice. It is what -xHost should do anyway. Do keep in mind that -fp-model:strict will reduce performance. You may want to use this only on the sources where you need that.

0 项奖励
回复