Software Archive
Read-only legacy content
17061 Discussions

Gather using _mm512_i32logather_pd

RKannan
Beginner
540 Views

I seem to be having problems getting _mm512_i32logather_pd to work correctly.

[cpp] __m512d simd_rhs = _mm512_i32loextgather_pd(simd_ind1, data, _MM_UPCONV_PD_NONE, scale, _MM_HINT_NT); [/cpp]

Firstly, if the high elements of simd_ind1 are anything other than 0, the code segfaults. So when I set those 8 elements to 0 and run, all elements in simd_rhs are the value at the base address , i.e. *data. In other words, the indices in simd_ind1 are disregarded and I get back a vector filled with a value at the base addres I supply.

Does anyone know what I might be doing wrong or have a sample code that works? I'm using composer_xe_2013_sp1.0.080 and am running natively on the MIC.

Thanks

0 Kudos
4 Replies
Kevin_D_Intel
Employee
540 Views

Let me seek some advice and see about creating an example. Please stand by.

0 Kudos
RKannan
Beginner
540 Views

Thanks Kevin.

0 Kudos
Kevin_D_Intel
Employee
540 Views

Please excuse the delay. In creating a small example and discussing this with the developer, he thinks it might be possible you may have actually set the low 8 elements of the index vector to 0 but not the high 8 elements. He said it is an easy mistake to make, especially when using _mm512_set_epi32() to build the index vector. I do not know whether you use that intrinsic in your code or not. This intrinsic takes 16 integer parameters going in opposite order, i.e. the first parameter will be written in the highest (15-th) element of the result, and the last parameter will be written to the lowest (0-th) element.

He suggested first checking the values of the index vector. The index vector can be printed by inserting the following code right before calling the gather intrinsic:
 
for(i=0;i<16;i++)
   printf(”%d “, ((int*)&simd_ind1);
printf(“\n”);
    
__m512d simd_rhs = _mm512_i32loextgather_pd(simd_ind1, data, _MM_UPCONV_PD_NONE, scale, _MM_HINT_NT);
 

0 Kudos
RKannan
Beginner
540 Views

Thanks for your reply, I hadn't seen the notification.

I'll try out your suggestions.

0 Kudos
Reply