Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 929031 - media-libs/opus-1.5.1-r1 error: inlining failed in call to ‘always_inline’ when avx2 is enabled without fma
Summary: media-libs/opus-1.5.1-r1 error: inlining failed in call to ‘always_inline’ wh...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Sound Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-09 22:42 UTC by tdr
Modified: 2024-04-10 02:02 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
march=skylake build fail (opus-1.5.1-r1-build.log,175.85 KB, text/plain)
2024-04-09 22:43 UTC, tdr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tdr 2024-04-09 22:42:41 UTC
reported on #gentoo by user whose:
    cpu native resolves to skylake
    CPU_FLAGS_X86="aes avx avx2 mmx mmxest pclmul popcnt rdcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3"

Reproducible: Always

Steps to Reproduce:
CPU_FLAGS_X86="aes avx avx2 mmx mmxest pclmul popcnt rdcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" CFLAGS="-march=skylake -mabm -mno-adx -mno-f16c -mno-fma -mno-sgx -mno-xsavec -mno-xsaveopt -mno-xsaves --param=l1-cache-line-size=64 --param=l1-cache-size=32  --param=l2-cache-size=8192 -O2 -pipe" CXXFLAGS=${CFLAGS} ebuild opus-1.5.1-r1.ebuild clean compile
Actual Results:  
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/fmaintrin.h:47:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_fmadd_pd’: target specific option mismatch
   47 | _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C)
      | ^~~~~~~~~~~~~~~
../opus-1.5.1/silk/float/x86/inner_product_FLP_avx2.c:63:18: note: called from here
   63 |         accum2 = _mm256_fmadd_pd( x1d, x2d, accum2 );
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/fmaintrin.h:47:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_fmadd_pd’: target specific option mismatch
   47 | _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C)
      | ^~~~~~~~~~~~~~~
../opus-1.5.1/silk/float/x86/inner_product_FLP_avx2.c:58:18: note: called from here
   58 |         accum1 = _mm256_fmadd_pd( x1d, x2d, accum1 );
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/fmaintrin.h:47:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_fmadd_pd’: target specific option mismatch
   47 | _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C)
      | ^~~~~~~~~~~~~~~
../opus-1.5.1/silk/float/x86/inner_product_FLP_avx2.c:58:18: note: called from here
   58 |         accum1 = _mm256_fmadd_pd( x1d, x2d, accum1 );
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/fmaintrin.h:47:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_fmadd_pd’: target specific option mismatch
   47 | _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C)
      | ^~~~~~~~~~~~~~~
../opus-1.5.1/silk/float/x86/inner_product_FLP_avx2.c:63:18: note: called from here
   63 |         accum2 = _mm256_fmadd_pd( x1d, x2d, accum2 );
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/fmaintrin.h:47:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_fmadd_pd’: target specific option mismatch
   47 | _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C)
      | ^~~~~~~~~~~~~~~
../opus-1.5.1/silk/float/x86/inner_product_FLP_avx2.c:72:18: note: called from here
   72 |         accum1 = _mm256_fmadd_pd( x1d, x2d, accum1 );
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/fmaintrin.h:47:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_fmadd_pd’: target specific option mismatch
   47 | _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C)
      | ^~~~~~~~~~~~~~~
../opus-1.5.1/silk/float/x86/inner_product_FLP_avx2.c:72:18: note: called from here
   72 |         accum1 = _mm256_fmadd_pd( x1d, x2d, accum1 );


attaching build log

seems to be march specific, passes with -march=core2 and other specific march set (and all other options the same)
Comment 1 tdr 2024-04-09 22:43:09 UTC
Created attachment 890126 [details]
march=skylake build fail
Comment 2 Ionen Wolkens gentoo-dev 2024-04-09 22:56:15 UTC
Looking at the code, more specifically this should only happen when have AVX2 enabled but FMA disabled (-march=skylake enables avx2 and fma, but then the passed -mno-fma disables fma).

It's atypical to have a cpu that supports avx2 but not fma, albeit there are apparently some (we had similar issues with qtbase).

As a minimal workaround, could do -mno-avx2 just for this package (haven't tried but don't see why it wouldn't work).

As for a ebuild fix, code needs to either be improved upstream to handle this configuration -- or ebuild could do a workaround like we did in qt6-build.eclass which auto-passes -mno-avx2 *if* fma is not enabled.
Comment 3 Ionen Wolkens gentoo-dev 2024-04-09 23:05:58 UTC
(In reply to Ionen Wolkens from comment #2)
> As for a ebuild fix, code needs to either be improved upstream to handle
> this configuration -- or ebuild could do a workaround like we did in
> qt6-build.eclass which auto-passes -mno-avx2 *if* fma is not enabled.
For a simpler version than the eclass, one could do something like (haven't tried it):

    tc-cpp-is-true 'defined(__FMA__)' ${CFLAGS} ||
        append-flags $(test-flags-CC -mno-avx2)

Could optionally guard behind use amd64 || x86, albeit test-flags-CC takes care of that too.
Comment 4 Ionen Wolkens gentoo-dev 2024-04-10 02:02:18 UTC
(in case unclear, note that this can happen with -march=native if have such a cpu, so this is not necessarily about having -mno-fma in CFLAGS)