Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
456 views
in Technique[技术] by (71.8m points)

c++ - AVX log intrinsics (_mm256_log_ps) missing in g++-4.8?

I am trying to utilise some AVX intrinsics in my code and have run into a brick wall with the logarithm intrinsics.

Using the Intel Intrinsics Guide v3.0.1 for Linux, I see the intrinsic _mm256_log_ps(__m256) listed as being part of "immintrin.h" and also supported on my current arch.

However trying to compile this simple test case fails with "error: ‘_mm256_log_ps’ was not declared in this scope"

The example was compiled with g++-4.8 -march=native -mavx test.cpp

#include <immintrin.h>
int main()
{
        __m256 i;
        _mm256_log_ps(i);
}

Am I missing something fundamental here? Are certain intrinsics not supported by g++ and only available in icc?

SOLVED: This instruction is not a true intrinsic but instead implemented as part of the Intel SVML for ICC.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As indicated in the comments to your question, that intrinsic doesn't map to an actual AVX instruction; it is an Intel extension to the intrinsic set. The implementation likely uses many underlying instructions, as a logarithm isn't a trivial operation.

If you'd like to use a non-Intel compiler but want a fast logarithm implementation, you might check out this open-source implementation of sin(), cos(), exp(), and log() functions using AVX. They are based on an earlier SSE2 version of the same functions.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...