Decode what -xHost does

Decode what -xHost does

I would like to compile some production level code so it is fully optimized for both some Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz and  E5410  @ 2.33GHz machines. Ideal would be some way to export what -xHost on each does, then merge then into a file/parameter that can be read. Searching through the documentation I do not see this, and a web search did not bring up anything obvious. I hope that someone has a simple tool/suggestion for this (that hopefully will be forward compatible).....

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

The compiler does not currently have a straightforward way of telling you what it picked when you say -xHost. This is something that has been requested before and perhaps someday an option will be added. I do know that you can get some of this information by adding -watch and looking at the set of -D options passed to the compiler. For example, you might see:

    -D__SSE2__ \
    -D__SSE3__ \
    -D__SSSE3__ \
    -D__SSE4_1__ \
    -D__SSE4_2__ \
    -D__SSE__ \
    -D__MMX__ \

these tell you the instruction set categories being supported. But perhaps easier would be to read Which compiler options should I use to optimize best for a specific Intel® processor? and find your processors in the lists there.

Retired 12/31/2016

Thanks for the response. Unfortunately there are some details which it would be useful to clarify (for me and anyone else in the future) as there are ambiguities both in the "Which compiler options..." page as well as in the man pages and the -watch output. Specifically:

a) The decoding which compiler option goes with which processor based upon  the information in the page is less than transparent. It would be better if more specific numbers were given, particularly as what Intel calls its CPU's is flexible.

b) I assume that -watch -xHost will provide the highest -D_XXX level as well as all others, which is then what is needed in a -ax??? or -x??? commands. For instance, in my case it looks like (if I compile on the older machines) the relevant command is -axAVX -xHost -- yes?

c) Am I correct in saying that the over-kill solution would be something like -xHost -axAVX,SSE4.1,SSE4.2  which looks to be somewhat simple and portable (at the expense of compiled code size).

If you combine -xHost with -ax then you are specifying the "generic" code path to be that of whatever -xHost ends up using. This is probably not what you want as that should be the "lowest common denominator". Realistically, I see little benefit of specifying both SSE4.1 and SSE4.2, but you should do some testing on the various CPUs you want to support to see if there are any differences.

I fully agree that Intel's processor naming/numbering strategy can be opaque and can sometimes hide important differences, but it's just not practical to list every possible CPU SKU. I would suggest then that you run an informational program such as the Intel Processor Identification Utility or CPUID to see what the capabilites are.

Retired 12/31/2016

Leave a Comment

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