Pin tool AVX scalar/vector identification

Pin tool AVX scalar/vector identification

Hi,

is there a way in pin (a pin API function) to find out whether a specific instruction is a vector (packed) or scalar version of an instruction? I am able to find out the isa class/category/extension using the pin API, but that doesn't tell me whether or not the instruction is truly an SIMD instruction (works on 256 bytes vs. 64 bytes). For instance, VMULPD and VMULSD are both AVX, but not necessarily "true" vector instructions.

Currently I am looking at the largest operand size and classify it based on the returned value, but I am not sure is that a valid approach.

I looked for something like INS_IsScalar() INS_IsVector() in the pin API documentation but couldn't find anything similar.

Greatly appreciate your help and pointers.

-Mark

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

To get the scalar attribute, you need to drop down to XED API and literally get the XED_ATTRIBUTE_SIMD_SCALAR attribute.  

 if (xed_decoded_inst_get_attribute(xedd, XED_ATTRIBUTE_SIMD_SCALAR))

 

To get the xed_deoded_inst_t xedd variable,  see the Pin examples (SimpleExamples/xed-use.cpp)

In more recent versions of XED, there are xed_classify_{avx512,avx512_maskop,avx,sse}() functions but a version of Pin that uses that version of XED has not been released publicly yet. Otherwise, you'll have to look at the more volumnious XED_ISA_SET_* values which is kinda painful (which is why I made the new "classify" APIs).

 

Hi Mark,

thank you for the swift reply. I used your suggestions and checked against the XED_ATTRIBUTE_SIMD_SCALAR attribute to see whether certain operations are considered SIMD scalar.

A question regarding the attribute enums. I browsed through some online documentation for XED, and I found an attribute called XED_ATTRIBUTE_SIMD_PACKED_ALIGNMENT (https://software.intel.com/sites/landingpage/xed/ref-manual/html/xed-att...). Is this attribute the exact opposite of SIMD_SCALAR attribute? Are they mutually exclusive (one for scalar operations - e.g. vaddsd; one for packed operations - e.g. vaddpd)? Also, I tried to check whether or not an instruction has this attribute set, but I can't compile the code because the attribute is not defined. I checked the xed-attribute-enum.h header file, and indeed I don't have the attribute listed there. I have downloaded the latest pin package (on 09/06). Is it also something which hasn't been included in the xed version pin uses, or is it something which has been deprecated but hasn't been updated in the documentation?

Thanks again.

-Marko

That documentation you point to is old. I should remove it -- or better, make it point to the newer stuff: 

https://intelxed.github.io/

(which also is a little out of date, but newer. I'll update that too soon).

That attribute you mention was for an experimental feature which never became part of the ISA so I removed it in a cleanup last year.

 

Leave a Comment

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