-O0 -xAVX problems.

-O0 -xAVX problems.

Hi!This really should be, I think, a bug report but I can not find how to do that ;-)The code is not very beautiful since it is straigth from a configure script:#include intmain (){__m256d a __attribute__((aligned(16))); ; return 0;}$ icc -O0 -xAVX -o ./avx ./avx.c && ./avx$ icc -O1 -xAVX -o ./avx ./avx.c && ./avxFatal Error: This program was not built to run in your system.Please verify that both the operating system and the processor support Intel AVX.$With -O0 the program will not raise any errors leading to the incorect detection of the CPU as supporting AVX instructions.Best regards,Jos Rui

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

Hi Jose,

I will investigate and give you and update soon.

Thanks,
Shenghong

Hi Jose,

I can reproduce your issue with a simple test case such as:
int main() {return 0;}

I think it should be kind of a bug. I will report it to our tracking systerm and give you an update if I get any feedback.

Thanks,
Shenghong
Intel Developer Support

I doubt that this is a bug.

When the user specifies conflicting options such as -O0 (do not optimize) and -xAVX (optimize for a specific processor) the outcome of the conflict is unpredictable.

I would find it reasonable if the compiler ignored -xAVX after noting -O0 to be in effect.

You can use the -# compiler option to see which options survive the conflict and are passed on to the compiler mcpcom or fortcom (the actual names depend on the platform).

Hi mecej4,

I agree with your opinions. The compiler may ignore the -xAVX option when using -O0 to disable optimization. What I was thinking is whether there is a friendly way here, such as giving a warning. I think as these are conflicting options, it is better to let the user be aware of it.

Thanks,
Shenghong
Intel Developer Support

The Intel compiler does not generate processor specific code when using -O0 option.

Om

This is somewhat unexpected.If one tells the compiler to compile for a specific platform one would not expect it to compile for a diferent platform... Without even a warning...And secondly the -xAVX is the last option on the command line it should take precedence.This code is used in a configure script to detect the hardware platform and this way it does not fail as it should and leads to the program beeing compiled with the wrong options.I guess that the way to solve this is to add a -O1 before the -xAVX to make sure that the compiler does generate code for the platform in question.Best regards,Jos Rui

I agree that a warning would be helpful, somewhat along the lines of

"option -xx conflicts with option -yy, resolved by ignoring -xx"

However, "If one tells the compiler to compile for a specific platform one would not expect it to compile for a diferent platform" is too harsh.

The compiler does output code for the specific platform in that it will only use instructions available on that platform. However, it need not use all available instructions, especially the more complex instructions, which may or may not exist on other platforms, when simpler instructions (which may be common to a whole family of processors) will do. This is very much in the realm of the optimizer, and -O0 may bypass the optimizer.

FYI.

many customers rely on -O0 to no generate any external library references. The cpu check is done by creating a call to libirc in main. If we added this call at -O0, it would potentially break a lot of customer code.

Closing as not a defect.

Leave a Comment

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