title: error: inlining failed to call always_inline
body: <p>I am trying to implement and code on some files, some of which contain SIMD-calls. I have compiled this code on a server, running basically the same OS as my machine, yet i cant compile it. </p>
  
  <p>This is the error:</p>
  
  <pre><code>make
  g++ main.cpp -march=native -o main -fopenmp
  In file included from /usr/lib/gcc/x86_64-linux-gnu/7/include/immintrin.h:53:0,
                   from tensor.hpp:9,
                   from main.cpp:4:
  /usr/lib/gcc/x86_64-linux-gnu/7/include/avx512vlintrin.h: In function ‘_ZN6TensorIdE8add_avx2ERKS0_._omp_fn.5’:
  /usr/lib/gcc/x86_64-linux-gnu/7/include/avx512vlintrin.h:447:1: error: inlining failed in call to always_inline ‘__m256d _mm256_mask_add_pd(__m256d, __mmask8, __m256d, __m256d)’: target specific option mismatch
   _mm256_mask_add_pd (__m256d __W, __mmask8 __U, __m256d __A,
   ^~~~~~~~~~~~~~~~~~
  In file included from main.cpp:4:0:
  tensor.hpp:228:33: note: called from here
           res = _mm256_mask_add_pd(tmp, 0xFF, _mm256_mask_loadu_pd(tmp, 0xFF, &amp;elements[i]), _mm256_mask_loadu_pd(tmp, 0xFF, &amp;a.elements[i]));
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from /usr/lib/gcc/x86_64-linux-gnu/7/include/immintrin.h:53:0,
                   from tensor.hpp:9,
                   from main.cpp:4:
  /usr/lib/gcc/x86_64-linux-gnu/7/include/avx512vlintrin.h:610:1: error: inlining failed in call to always_inline ‘__m256d _mm256_mask_loadu_pd(__m256d, __mmask8, const void*)’: target specific option mismatch
   _mm256_mask_loadu_pd (__m256d __W, __mmask8 __U, void const *__P)
   ^~~~~~~~~~~~~~~~~~~~
  In file included from main.cpp:4:0:
  tensor.hpp:228:33: note: called from here
           res = _mm256_mask_add_pd(tmp, 0xFF, _mm256_mask_loadu_pd(tmp, 0xFF, &amp;elements[i]), _mm256_mask_loadu_pd(tmp, 0xFF, &amp;a.elements[i]));
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from /usr/lib/gcc/x86_64-linux-gnu/7/include/immintrin.h:53:0,
                   from tensor.hpp:9,
                   from main.cpp:4:
  /usr/lib/gcc/x86_64-linux-gnu/7/include/avx512vlintrin.h:610:1: error: inlining failed in call to always_inline ‘__m256d _mm256_mask_loadu_pd(__m256d, __mmask8, const void*)’: target specific option mismatch
   _mm256_mask_loadu_pd (__m256d __W, __mmask8 __U, void const *__P)
   ^~~~~~~~~~~~~~~~~~~~
  In file included from main.cpp:4:0:
  tensor.hpp:228:33: note: called from here
           res = _mm256_mask_add_pd(tmp, 0xFF, _mm256_mask_loadu_pd(tmp, 0xFF, &amp;elements[i]), _mm256_mask_loadu_pd(tmp, 0xFF, &amp;a.elements[i]));
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Makefile:7: recipe for target 'main' failed
  make: *** [main] Error 1
  
  </code></pre>
  
  <p>Googling the problem didnt really help, as all answers pointed things out, i allready do/tried.</p>
  
  <p>Can somebody provide some background as to why it doesn´t work.</p>
  
  <p>EDIT:</p>
  
  <pre><code>int main(){
  #ifdef __AVX512F___
      auto tt = createTensor();
      auto tt2 = createTensor();
      auto res = tt.addAVX512(tt2);
  #endif
  }
  
  //This is in tensor.hpp
  #ifdef __AVX512F__
  Tensor&lt;T&gt; Tensor::addAVX512(_param_){
     res = _mm256_mask_add_pd(tmp, 0xFF, _mm256_mask_loadu_pd(tmp, 0xFF, &amp;elements[i]), _mm256_mask_loadu_pd(tmp, 0xFF, &amp;a.elements[i]));
  }
  #endif
  </code></pre>
  
  <p>This it the gist of what happens ... i have encased all SIMDcalls in #ifdefs, etc.</p>