Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Kumar__Amit1
Beginner
104 Views

How to detect New Instruction support in the Haswell/Broadwell generation Intel® Core™ processor family

Dear Support,

I have used this piece of code in the following link for a while to detect the support of new instructions across the board with different compilers (Intel, GCC, PGI). What I am looking for is a feedback and may be an updated piece of code to detect the support for the new ISA in the haswell/broadwell processors for example "Intel(R) Xeon(R) CPU E7-8891 v3 @ 2.80GHz". 

https://software.intel.com/en-us/articles/how-to-detect-new-instruction-support-in-the-4th-generatio...

Also could you please comment on how much does Intel compilers rely on GNU assemblers to provide various support to the hardware feature sets. Or is it just Intel makes it binary compatible to work with GNU, and rely's on its own assembler to produce its object codes?

Any help is greatly appreciated.

 

thank you,
Amit

0 Kudos
4 Replies
andysem
New Contributor III
104 Views

I'm not sure what you're asking because Haswell is the 4-th generation Core microarchitecture.

Kumar__Amit1
Beginner
104 Views

Hi "Andysem"

Thank you for your response. I am unaware of the fact that "Haswell is the 4-th generation Core microarchitecture".  To rephrase my question: My contention is, Compilers such as Intel, PGI and GCC all build support for the special instructions supported by the microarchitecture. Now how do I tell if the compiler version I have installed have those built in support. And in this regard I used the above piece of code naively to compile the code against different compilers to see if it could build the code for specific target architecture. Not sure if this dumb but I used this method to ascertain that the compilers i have installed supported the special ISA"s of the specific target architecture. I hope I am making sense. Please let me know otherwise, I will try to explain further.

 

Thank you,
Amit

Gregg_S_Intel
Employee
104 Views

It's a bit confusing, Haswell was the codename for Intel 4th generation Core microarchitecture, which includes processors such as Intel(R) Xeon(R) CPU E7-8891 v3.  You found the right code example.

For the compilers, try an AVX2 flag (Intel -xCORE-AVX2,  GNU -march=core-avx2,  PGI -tp haswell-64).  AVX2 support has been in compilers for the past 2-3 years. 

Assembly is done by GNU linker ld.

 

 

andysem
New Contributor III
104 Views

Amit K. wrote:

Compilers such as Intel, PGI and GCC all build support for the special instructions supported by the microarchitecture. Now how do I tell if the compiler version I have installed have those built in support.

You should refer to the documentation for the compiler. The documentation will list the supported target architectures along with the command line flags to enable ISA extensions. Some compilers, like gcc for example, also define macros that allow you detect the enabled extensions in your code.

Note that compiler options may result in mandatory requirement for the extensions in the CPU to run your code. If you want to keep your code runnable on CPUs without the extensions, you will have to perform runtime detection of the extensions.

Amit K. wrote:

And in this regard I used the above piece of code naively to compile the code against different compilers to see if it could build the code for specific target architecture. Not sure if this dumb but I used this method to ascertain that the compilers i have installed supported the special ISA"s of the specific target architecture. I hope I am making sense. Please let me know otherwise, I will try to explain further.

As far as I can tell, that piece of code does not guarantee that the compiler supports Haswell ISA extensions. Well, the Intel Compiler branch does use some macros that are supposedly defined in a compiler-supplied header, so they are a sort of indication (the code will not compile if they are not defined). Other branches use cpuid and xgetbv instructions more or less directly and will compile regardless of support for Haswell ISA extensions by the compiler. What that code does it verify that the extensions are supported by the CPU in run time.

Note that there can be different kinds of "support". The compiler may be just able to translate extension instructions from assembler into byte code. Or it may support intrinsics. Or it may support using the instruction in autovectorization. There is no way to tell what is supported by the compiler other than reading its docs.

 

Reply