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

Which C++ compiler options are best for a processor architecture?

roberto_g_2
New Contributor I
2,520 Views

Among the features that I like in oneApi C++ (classical) compiler, the option for a specific CPU architecture is what I use to specialize the executable for an Intel processor.

However, I am still confused by the options below for the Windows version (one of them is not fully documented for WIndows but it is accepted by icl.exe). For example:

  • /arch:skylake
  • /QaxSKYLAKE
  • /QxSKYLAKE
  • /tune:skylake

Which combination of the above options is best for the Skylake (or your favorite) architecture? My guess is the last three options: /QaxSKYLAKE /QxSKYLAKE /tune:skylake

Thank you 
-Roberto

 

P.S. Some documentation is here:

https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/code-generation-options/ax-qax.html

0 Kudos
1 Solution
Viet_H_Intel
Moderator
2,284 Views

/arch and /tune are to be compatible with other compilers; whereas /Q[a]x are Intel's specific options.

/arch:skylake is equivalent to /QxSKYLAKE. It generates code exclusively for a given CPU. You will get "illegal instructions" error, if you try to run your binary on unsupported systems.

/tune:skylake is equivalent to /QaxSKYLAKE. This will generate multiple code paths, one path defaults to SSE2 and other path is to support Skylake (auto-dispatch code paths at runtime).

In general, there are some differences between /arch vs. /Qx or /tune vs. /Qax, because Intel compiler is a step ahead compares to other compilers in term of supporting new instruction set (added on later in the same code name).

Hence, we might support those new instructions with /Q[a]x options but not /tune nor /arch(for compatibility).

 

Sine you are specifically targeting Comet Lake processor, /Qx:SKYLAKE is the best choice.

 

Thanks,

 

View solution in original post

0 Kudos
12 Replies
RahulV_intel
Moderator
2,481 Views

Hi,


/Qax generates multiple feature-specific code paths along with the baseline code. When you specify both /Qax and /Qx options, the /Qx option is essentially the baseline code path option (typically to support older processors).


Qx/Qax and arch are mutually exclusive. If both are specified, the compiler uses the last one specified and generates a warning (Intel-specific instruction set is not generated). The binaries produced by Qx/Qax will only run on Intel architectures whereas the code generated by the /arch option is compatible on non-intel architectures with support for the corresponding instruction set.

The /tune option performs optimization for specific processors and is backward compatible.


The best combination depends on your application. Please check the optimization report generated by /Qopt-report. You may also experiment by setting the instruction set as an option value for Qx/Qax.


Please find the documentation for these compiler options:

  • /Qx

https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/code-generation-options/x-qx.html

  • /Qax

https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/code-generation-options/ax-qax.html

  • /arch

https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/code-generation-options/arch.html#arch

  • /tune

https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/code-generation-options/mtune-tune.html


Thanks,

Rahul


0 Kudos
roberto_g_2
New Contributor I
2,464 Views

Thank you Rahul, my point is how to get the best from, say, SkyLake (micro)architecture. Sorry, from your answer it is unclear to me which one among the choices below is the best:

  1. /QaxSKYLAKE /QxSKYLAKE
  2. /QaxSKYLAKE
  3. /QxSKYLAKE

Regards
-Roberto

0 Kudos
roberto_g_2
New Contributor I
2,443 Views

Believe it or not, compiling with /QaxSKYLAKE /QxSKYLAKE and /QxSKYLAKE /QaxSKYLAKE  (just swapping the options) gives different outcomes. This is puzzling me. Let's wait for the 2021.2 upcoming release at this point.

-R

0 Kudos
RahulV_intel
Moderator
2,429 Views

Hi Roberto,


Apologies for the late response.


>>Believe it or not, compiling with /QaxSKYLAKE /QxSKYLAKE and /QxSKYLAKE /QaxSKYLAKE (just swapping the options) gives different outcomes.


Could you please elaborate more on the various outcomes you get when you interchange these flags?


Regarding the best option (for a particular architecture), I need to check with the team on this internally. I will get back to you once I have the info.



Thanks,

Rahul


0 Kudos
RahulV_intel
Moderator
2,375 Views

Hi,


/Qax option would better since it generates multiple code paths. The binary generated is also compatible with the older architectures since it involves the generation of the baseline code path. The only disadvantage could be a relatively large executable file.


Thanks,

Rahul


0 Kudos
roberto_g_2
New Contributor I
2,369 Views

Dear Rahul,

sorry for the late reply, and thank you for taking care of my question.

Just to clarify: I have a Comet Lake processor, and I would to exploit its features at its best. I do not want compatibility with other processors. I am using the code on the Comet Lake. If I need to run my code  on another processor, I recompile it for that processor.

Intel C++ classic compiler offers four options: /arch, /Qx, /Qax and /tune.

If I compile with /Qax alone, it generates warnings. It takes as a default an SSE processor and extends it with dynamic paths. I am not sure this is the best way to exploit my Comet Lake processor.

Kind regards
-Roberto

0 Kudos
roberto_g_2
New Contributor I
2,358 Views

I double checked the documentation and I am even more confused, sorry about that

If I just specify /Qax:SKYLAKE, this is equivalent to having also /arch:SSE2, as the latter is the default value.

Hence it could make sense to specify both /arch:SKYLAKE and /Qax:SKYLAKE. However, the documentation says that "If you specify both the /Qax and /arch options, the compiler will not generate Intel-specific instructions.". How is that possible,  if SKYLAKE is a feasible option that is specific for Intel processors? 

Would you be so kind to ask the developers of the Intel C++ classic compilers? They know the internals and can clarify this ambiguity Thank you.

Kind regards
-Roberto

0 Kudos
RahulV_intel
Moderator
2,301 Views

Hi,


As rightly pointed out, it is unclear from the documentation whether the Intel-specific instructions will not be generated only for the baseline code path or even for the /Qax specific path.


I will check with the developers on this and get back to you once I have the information.


Thanks for bringing this up.


Regards,

Rahul


0 Kudos
roberto_g_2
New Contributor I
2,297 Views

Thank you Rahul for asking. I am currently using /qx:SKYLAKE /tune:skylake

Kind regards

Roberto

 

0 Kudos
Viet_H_Intel
Moderator
2,285 Views

/arch and /tune are to be compatible with other compilers; whereas /Q[a]x are Intel's specific options.

/arch:skylake is equivalent to /QxSKYLAKE. It generates code exclusively for a given CPU. You will get "illegal instructions" error, if you try to run your binary on unsupported systems.

/tune:skylake is equivalent to /QaxSKYLAKE. This will generate multiple code paths, one path defaults to SSE2 and other path is to support Skylake (auto-dispatch code paths at runtime).

In general, there are some differences between /arch vs. /Qx or /tune vs. /Qax, because Intel compiler is a step ahead compares to other compilers in term of supporting new instruction set (added on later in the same code name).

Hence, we might support those new instructions with /Q[a]x options but not /tune nor /arch(for compatibility).

 

Sine you are specifically targeting Comet Lake processor, /Qx:SKYLAKE is the best choice.

 

Thanks,

 

0 Kudos
roberto_g_2
New Contributor I
2,278 Views

Thank you Viet_H, I will drop /tune:skylake and just keep /Qx:SKYLAKE.

Regards

-Roberto

0 Kudos
Viet_H_Intel
Moderator
2,257 Views

Hi Roberto,

This issue has been resolved and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.


Thanks,


0 Kudos
Reply