0

I am using Ubuntu 21.04 on Intel® Core™ i3-6157U CPU @ 2.40GHz × 4 on CHUWI core book. I made this source code and compiled.

#include <immintrin.h>

__m512i test__mm512_add_epi8 (__m512i a, __m512i b)
{
    return _mm512_add_epi8 (a,b);
}

but cannot compile

$ gcc test.c
test.c: In function ‘test__mm512_add_epi8’:
test.c:4:1: warning: AVX512F vector return without AVX512F enabled changes the ABI [-Wpsabi]
    4 | {
      | ^
test.c:3:9: note: the ABI for passing parameters with 64-byte alignment has changed in GCC 4.6
    3 | __m512i test__mm512_add_epi8 (__m512i a, __m512i b)
      |         ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-linux-gnu/10/include/immintrin.h:65,
                 from test.c:1:
/usr/lib/gcc/x86_64-linux-gnu/10/include/avx512bwintrin.h:924:1: error: inlining failed in call to ‘always_inline’ ‘_mm512_add_epi8’: target specific option mismatch
  924 | _mm512_add_epi8 (__m512i __A, __m512i __B)
      | ^~~~~~~~~~~~~~~
test.c:5:9: note: called from here
    5 |  return _mm512_add_epi8 (a,b);
      |         ^~~~~~~~~~~~~~~~~~~~~

How to solve this? Please teach me.

phuclv
  • 37,963
  • 15
  • 156
  • 475
  • Can you tell us how you tried to compile your code? There are already some similar problems discussed [here](https://stackoverflow.com/a/44962907/9788713) and [here](https://stackoverflow.com/questions/43128698/inlining-failed-in-call-to-always-inline-mm-mullo-epi32-target-specific-opti) – Flusslauf Jul 16 '21 at 09:00
  • I used GCC and i made only test.c file on Ubuntu Linux 21.04 – daisukeokaoss Jul 16 '21 at 09:36
  • 1
    Ah, sorry, yes - as pointed out in the linked issues, can you add ```-march=native``` to your compilier flags (which are currently empty) and [enable all instruction sets on your local machine](https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html) - you can also enable the required instruction sets (as described in the linked issues). Alternatively ```-mavx512bw``` as vpaddb uses AVX512BW as explained in the [intel intrinsics guide](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#avx512techs=AVX512BW) – Flusslauf Jul 16 '21 at 09:51
  • 1
    The Intel intrinsics guide seems to be [broken currently](https://community.intel.com/t5/Software-Tuning-Performance/Intel-Intrinsics-Guide-can-not-visit/m-p/1297763) (at least I cannot load data from it so [here is a working mirror](https://www.laruence.com/sse/). Just type in the instruction you are using and it will tell you the respective [CPUID Flag](https://en.wikipedia.org/wiki/CPUID) for your instruction which will in turn help when enabling that instruction set with your used compiler. – Flusslauf Jul 16 '21 at 10:03
  • Does this answer your question? [inlining failed in call to always\_inline ‘\_mm\_mullo\_epi32’: target specific option mismatch](https://stackoverflow.com/questions/43128698/inlining-failed-in-call-to-always-inline-mm-mullo-epi32-target-specific-opti) – Flusslauf Jul 16 '21 at 10:05
  • Thank you! I can finally compiled it!! `$ gcc -march=native -mavx512bw test.c` – daisukeokaoss Jul 16 '21 at 10:46
  • 1
    @Flusslauf: That Skylake-client CPU doesn't have AVX-512, so `-march=native` is not useful. You want `-march=skylake-avx512` or `-march=icelake-client`. (Which will make a binary that can't run on that desktop.) – Peter Cordes Jul 16 '21 at 16:47
  • 1
    okay Thank you! `$ gcc -march=skylake-avx512 test.c` `$gcc -march=icelake-client test.c` is good – daisukeokaoss Jul 17 '21 at 01:39
  • @PeterCordes yes, you are completely correct, my bad there, thanks – Flusslauf Jul 19 '21 at 09:13

0 Answers0