Error compiling with g++ 6.3.0 with -mavx2

Issue #224 resolved
Zhen Wang created an issue

Hi,

I'm having difficulty building Blaze on Linux. I pull latest source, include <blaze/Blaze.h> and compile an empty main with g++ 6.3.0 on CentOS 7.1. The g++ line is

g++ --std=c++14 -fext-numeric-literals -mavx2

The error message is

include/blaze/math/simd/Prod.h: In function 'float blaze::prod(const blaze::SIMDfloat&)':
include/blaze/math/simd/Prod.h:313:78: error: '_mm256_cvtss_f32' was not declared in this scope
    return _mm256_cvtss_f32( _mm256_mul_ps( c, _mm256_shuffle_ps( c, c, 1 ) ) );
                                                                              ^
include/blaze/math/simd/Prod.h: In function 'double blaze::prod(const blaze::SIMDdouble&)':
include/blaze/math/simd/Prod.h:367:78: error: '_mm256_cvtsd_f64' was not declared in this scope
    return _mm256_cvtsd_f64( _mm256_mul_pd( b, _mm256_shuffle_pd( b, b, 1 ) ) );

Google search shows those functions are declared on Windows, but I can't find them on Linux. It seems I did something wrong. Could you please help? The code does compile after removing -maxv2. Thanks.

Comments (7)

  1. Klaus Iglberger

    Hi Zhen!

    Thanks a lot for pointing out this issue. Unfortunately this problem didn't surface during our testing. Apparently GCC 6 does not provide the _mm256_cvtss_f32() and _mm256_cvtsd_f64() intrinsics, but GCC 7 does. A quick solution to the problem would be to upgrade your compiler, then the problem should be gone. However, we'll still try to find a solution on our side to provide full compatibility with GCC 6. Thanks again,

    Best regards,

    Klaus!

  2. Zhen Wang reporter

    Klaus,

    Thanks for your prompt response, and your work. I'll try GCC 7.

    In blaze homepage, it states "In fact, Blaze is constantly tested with the GNU compiler collection (version 6.0 through 7.2)". That's why I tried GCC 6. You may want to update this if you could reproduce my issue. :)

    Thanks again, Zhen

  3. Klaus Iglberger

    Commit 705cd82 resolves the GCC 6 compilation issues for the AVX prod() functions for 32-bit and 64-bit floating point numbers. The fix is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.5.

  4. Klaus Iglberger

    Hi Zhen!

    The statement is accurate, we constantly test with GCC 6. However, we don't test every possible combination (platform, compiler, instruction set, parallelisation backend, optimization level, ...). Thus unfortunately this combination slipped through. Therefore we are grateful for these kind of hints. Thanks again,

    Best regards,

    Klaus!

  5. Log in to comment