Porting MIC code to AVX512

Porting MIC code to AVX512

With the latest C++ compiler 14.0 SP1, Update 1 it is now possible to use the Intel compiler to port code from MIC to AVX512.

When starting to port code to AVX512, i noticed that some functionality that was available on MIC could be missing.

For example on MIC i could gather 8 or 16 bit data and upconvert this into an integer, e.g. for signed 16 bit integer data

_mm512_i32extgather_epi32(aIndexVector, aArray, _MM_UPCONV_EPI32_SINT16, _MM_SCALE_2, _MM_HINT_NONE);

When trying to porting this to AVX512 i was not able to achieve exacly the same with the new ISA..

Interestingly, the compiler documentation that comes with the latest SP1 update1 compiler mentions that upconversion is still possible for gather with AVX512 and one can find the follwoing AVX512 intrinsic in the docu

_mm512_i32gather_epi32

extern __m512i __cdecl _mm512_i32gather_epi32(__m512i vindex, void const* base_addr, _MM_UPCONV_EPI32_ENUM upconv, int scale, int hint);

But i can not find a suitable intrinsic for AVX512 that is able to do this in the zmmintrin.h file that works for AVX512.

Is the AVX512 documentation wrong - or the zmmintrin.h file that does not contain such an AVX512 gather instruction that allows upconversion?

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

Ok, so in zmmintrin.h there is:

#define _mm512_i32gather_epi32(index, addr, scale) \
_mm512_i32extgather_epi32((index), (addr), _MM_UPCONV_EPI32_NONE, \
(scale), _MM_HINT_NONE)

but what you need is:

#define _mm512_i32gather_epi32(index, addr, scale) \
_mm512_i32extgather_epi32((index), (addr), _MM_UPCONV_EPI32_ENUM, \
(scale), _MM_HINT_NONE)

Have I got this right? If so, I will see if I can find someone to tell me where it is or when it will be available.

In the latest Intel Compiler documentation for AVX512, the gather intrinsic is described as

__m512i _mm512_i32gather_epi32(__m512i vindex, void const* base_addr, _MM_UPCONV_EPI32_ENUM upconv, int scale, int hint);

but in the zmmintrin.h it occurs only in the form

__m512i _mm512_i32gather_epi32(__m512i vindex, void const* base_addr, int scale);

so without an upconvert and without a memory hint. So the question is what version of gather is correct?

If the zmmintrin.h is correct this would mean that the documentation should be updated, since the upconvert and the memory hint are no longer supported with a gather on AVX512.

Leave a Comment

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