Build failure with AVX and Clang 10

Issue #377 resolved
Nils Deppe created an issue

Hi Klaus,

We just updated to Blaze 3.8 and I now get the following compilation failure:

In file included from /usr/local/include/blaze/math/CustomVector.h:44:
In file included from /usr/local/include/blaze/math/dense/CustomVector.h:52:
In file included from /usr/local/include/blaze/math/dense/DenseIterator.h:36:
In file included from /usr/local/include/blaze/math/SIMD.h:45:
In file included from /usr/local/include/blaze/math/simd/Functions.h:67:
/usr/local/include/blaze/math/simd/Floor.h:81:11: error: no viable conversion from returned value of type '__m256' (vector of 8 'float' values) to function return type 'const blaze::SIMDfloat'
   return _mm256_floor_ps((*a).eval().value);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/llvm-10/lib/clang/10.0.0/include/avxintrin.h:504:28: note: expanded from macro '_mm256_floor_ps'
#define _mm256_floor_ps(V) _mm256_round_ps((V), _MM_FROUND_FLOOR)
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/llvm-10/lib/clang/10.0.0/include/avxintrin.h:435:3: note: expanded from macro '_mm256_round_ps'
  (__m256)__builtin_ia32_roundps256((__v8sf)(__m256)(V), (M))
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/blaze/math/simd/BasicTypes.h:1078:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from '__m256' (vector of 8 'float' values) to 'const blaze::SIMDfloat &' for 1st argument
struct SIMDfloat
       ^
/usr/local/include/blaze/math/simd/BasicTypes.h:1078:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from '__m256' (vector of 8 'float' values) to 'blaze::SIMDfloat &&' for 1st argument
/usr/local/include/blaze/math/simd/BasicTypes.h:1107:24: note: candidate constructor not viable: no known conversion from '__m256' (vector of 8 'float' values) to 'blaze::SIMDfloat::IntrinsicType' (aka '__m512') for 1st argument
   BLAZE_ALWAYS_INLINE SIMDfloat( IntrinsicType v ) noexcept : value( v ) {}
                       ^
/usr/local/include/blaze/math/simd/BasicTypes.h:1110:24: note: candidate template ignored: could not match 'SIMDf32<type-parameter-0-0>' against '__attribute__((__vector_size__(8 * sizeof(float)))) float' (vector of 8 'float' values)
   BLAZE_ALWAYS_INLINE SIMDfloat( const SIMDf32<T>& v ) noexcept : value( (*v).eval().value ) {}
                       ^

Any suggestions on how to deal with this other than reverting to Blaze 3.7?

Many thanks in advance!

Best wishes,

Nils

Comments (8)

  1. Klaus Iglberger

    Hi Nils!

    Thanks for reporting this potential defect. Unfortunately I cannot reproduce the issue with Clang 10 (more specifically Clang 10.0.1) and the AVX floor() function (where the compilation error seems to originate). I ran the test suite and also used the following code to try to reproduce the issue:

    blaze::DynamicVector<float> a{ 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8 };
    blaze::DynamicVector<float> b( 8UL, 0.0F );
    
    b = floor( a );
    

    The surprising part in the error messages is these three lines:

    /usr/local/include/blaze/math/simd/BasicTypes.h:1078:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from '__m256' (vector of 8 'float' values) to 'blaze::SIMDfloat &&' for 1st argument
    /usr/local/include/blaze/math/simd/BasicTypes.h:1107:24: note: candidate constructor not viable: no known conversion from '__m256' (vector of 8 'float' values) to 'blaze::SIMDfloat::IntrinsicType' (aka '__m512') for 1st argument
       BLAZE_ALWAYS_INLINE SIMDfloat( IntrinsicType v ) noexcept : value( v ) {}
    

    It appears that in one file (<blaze/math/simd/Floor.h>) the BLAZE_AVX_MODE macro is active, but in another file (<blaze/math/simd/BasicTypes.h>) the BLAZE_AVX512_MODE macro.

    Since there haven’t been any fundamental changes to the files in question, I’m surprised that you experience no problems with Blaze 3.7. Therefore I unfortunately don’t have any suggestions right now how to circumvent the problem.

    In order to help me understand the issue, could you please post a minimum example that demonstrates the failure on your side? I would also ask you to run the following code snippet:

    std::cerr << "\n"
              << " BLAZE_SSE_MODE      = " << BLAZE_SSE_MODE << "\n"
              << " BLAZE_SSE2_MODE     = " << BLAZE_SSE2_MODE << "\n"
              << " BLAZE_SSE3_MODE     = " << BLAZE_SSE3_MODE << "\n"
              << " BLAZE_SSSE3_MODE    = " << BLAZE_SSSE3_MODE << "\n"
              << " BLAZE_SSE4_MODE     = " << BLAZE_SSE4_MODE << "\n"
              << " BLAZE_AVX_MODE      = " << BLAZE_AVX_MODE << "\n"
              << " BLAZE_AVX2_MODE     = " << BLAZE_AVX2_MODE << "\n"
              << " BLAZE_AVX512F_MODE  = " << BLAZE_AVX512F_MODE << "\n"
              << " BLAZE_AVX512BW_MODE = " << BLAZE_AVX512BW_MODE << "\n"
              << " BLAZE_AVX512DQ_MODE = " << BLAZE_AVX512DQ_MODE << "\n"
              << " BLAZE_MIC_MODE      = " << BLAZE_MIC_MODE << "\n"
              << " BLAZE_SVML_MODE     = " << BLAZE_SVML_MODE << "\n"
              << " BLAZE_SLEEF_MODE    = " << BLAZE_SLEEF_MODE << "\n"
              << std::endl;
    

    Last but not least I’m interested in the compiler flags you are using. Thanks a lot, your help is highly appreciated.

    Best regards,

    Klaus!

  2. Klaus Iglberger

    Hi Nils!

    Please ignore the previous post, I’ve now been able to reproduce the problem. Despite the fact that the error message results from the AVX version of the SIMD floor() function, you apparently use AVX-512.

    I apologize for the problem and will provide a fix within the next 24 hours. The problem can be circumvented by using AVX instead of AVX-512. Unfortunately this will result in a performance loss, but since the CPU will automatically slow down with AVX-512, the loss should be far less than a factor of 2.

    Again, I apologize for the inconvenience,

    Best regards,

    Klaus!

  3. Klaus Iglberger

    Commit 0082c68 fixes the SIMD floor() functions. The fix is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.9.

  4. Klaus Iglberger

    Hi Nils!

    Commit 0082c68 fixes the issue. The problem is indeed limited to the combination of Clang and AVX-512. Using GCC or AVX instead helps. Thanks a lot for reporting the problem,

    Best regards,

    Klaus!

  5. Nils Deppe reporter

    Hi Klaus!

    Thank you so much for the super quick fix on this! We really appreciate it!

    A related question I started thinking about: have you had any success using Intel Software Development Emulator to run tests on virtual CPUs that aren’t available in CI? This is something we will try to implement so we can catch any weird CPU-specific bugs as early as possible and I was wondering if you had any experience with this sort of thing. Thanks in advance!

    Best wishes,

    Nils

  6. Klaus Iglberger

    Hi Nils!

    I haven’t tried using the Intel Software Development Emulator yet. So I unfortunately don’t have any experience.

    Best regards,

    Klaus!

  7. Log in to comment