Software Archive
Read-only legacy content

A weird linker error with _mm512_storenr_ps intrinsic in offload mode

Hien_P_1
Beginner
958 Views

Hi guys, I am facing a weird linker error with _mm512_storenr_ps() intrinsic in offload mode programming. I post this issue here and hope that someone could give the advice. 

I have implemented successfully a Xeon Phi program in native mode and then changed to offload mode. 

There are 3 files and the code is summarized like this

file main.cpp

#include myfunction.h

void main()

{

// CPU code

...

//pragma code, simply call the computeX() function to offload to Xeon Phi

#pragma offload target(mic)

computeX() 

//CPU code

....

 

}

And file myfunction.h (header file)

#pragma offload_attribute (push,target(mic))

void computeX()

#pragma offload_attribute(pop)

And file myfuncion.cpp (implementation of functions in header file)

#pragma offload_attribute (push,target(mic))

#include myfunction.h
void computeX()

{

//many KNC intrinsic instructions such as _mm512_add_epi32(...);

_mm512_storenr_ps(...); //execute the _mm512_storenr_ps(...)

//many KNC intrinsic instructions such as _mm512_sub_epi32(...);

 

}

#pragma offload_attribute(pop)

When I compile the code, there is a weird linker error like this: undefined reference to `_mm512_storenr_ps' 

However, if I remove the _mm512_storenr_ps() intrinsic in my code, the offload program is complied, linked, executed successfully. I have to stress that besides using _mm512_storenr_ps(), I also use many KNC intrinsic instructions but the compiler only generate the linker error with the code line of calling _mm512_storenr_ps(). 

I guess this is such a bug in Intel compiler (linker). Could someone give me some feedback about this?

For more information, my OS: centOS 7, ICC: 15, MPSS: 3.4

Thanks in advance.

0 Kudos
5 Replies
pbkenned1
Employee
958 Views

Thanks for reporting this, it looks like a bug.  If you don't think my example is correct, please advise.

Patrick

[U543444]$ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.2.164 Build 20150121
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

[U543444]$ cat U543444.cpp
#pragma offload_attribute (push,target(mic))
#include <immintrin.h>
#pragma offload_attribute(pop)

extern void _mm512_storenr_ps(void* mt, __m512 v1);
extern void  _mm512_store_ps(void* mt, __m512 v1);


__attribute__ (( target (mic)))
void foo(double  *mt, __m512 v1)
{
#ifdef SHOWBUG
     _mm512_storenr_ps((void *)mt, v1);
#else
    _mm512_store_ps((void*) mt, v1);
#endif
     return;
}

int main()
{
   __m512 v1;
   double * mt = new double[512];

#pragma offload target(mic) in(mt:length(512))
   { foo(mt,v1); }

   return 0;
}
[U543444]$ icc U543444.cpp -o U543444.cpp.x


[U543444]$ icc U543444.cpp -o U543444.cpp.x -DSHOWBUG
/tmp/iccrgmN3T.o: In function `foo(double*, __m512)':
U543444.cpp:(.text+0x121): undefined reference to `_mm512_storenr_ps'
[U543444]$

0 Kudos
pbkenned1
Employee
958 Views

Problem reported to the developers, internal tracking ID DPD200367991.  I'll keep this thread updated with any developments.

Patrick

0 Kudos
Hien_P_1
Beginner
958 Views

Hi Patrick, 
I have the same error message like yours. It's a bug. 

0 Kudos
pbkenned1
Employee
958 Views

Actually, it's not a bug.  _mm512_storenr_ps  is only available on MIC, so it has to be protected with #ifdef __MIC__

[U543444]$ diff U543444.cpp U543444-fix.cpp
8d7
<
10,18c9,18
< void foo(double  *mt, __m512 v1)
< {
< #ifdef SHOWBUG
<      _mm512_storenr_ps((void *)mt, v1);
< #else
<     _mm512_store_ps((void*) mt, v1);
< #endif
<      return;
< }
---
> void foo(double  *mt, __m512 v1)
> {
> #ifdef __MIC__
>      _mm512_storenr_ps((void *)mt, v1);
> #else
>     _mm512_store_ps((void*) mt, v1);
> #endif
>      return;
> }
>
[U543444]$ icc U543444-fix.cpp -o U543444-fix.cpp.x
[U543444]$

 

Patrick

 

0 Kudos
Hien_P_1
Beginner
958 Views

Hi Patrick, 
Thanks for your useful reply. I just wonder why  _mm512_storenr_ps  is only available on MIC whilst most of other KNC instructions such as _mm512_add_epi32(...), _mm512_sub_epi32(...) are acting normal (could be complied and linked normally).

I reckon that this exception could be a trick for programmers. 

0 Kudos
Reply