g ++中缺少AVX日志内在函数(_mm256_log_ps) - 4.8? [英] AVX log intrinsics (_mm256_log_ps) missing in g++-4.8?
问题描述
我试图在我的代码中使用一些AVX内在函数,并遇到了对数内在函数的砖墙。
I am trying to utilise some AVX intrinsics in my code and have run into a brick wall with the logarithm intrinsics.
使用英特尔Intrinsics指南v3.0.1 Linux,我看到内在的 _mm256_log_ps(__ m256)
被列为immintrin.h的一部分,并且也支持我当前的arch。
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.
但是试图编译这个简单的测试用例失败,error:'_mm256_log_ps'没有在这个范围内声明
However trying to compile this simple test case fails with "error: ‘_mm256_log_ps’ was not declared in this scope"
code> g ++ - 4.8 -march = native -mavx test.cpp
The example was compiled with g++-4.8 -march=native -mavx test.cpp
#include <immintrin.h>
int main()
{
__m256 i;
_mm256_log_ps(i);
}
我缺少一些基本的东西吗? g ++是否支持某些内在函数,并且仅在icc中可用?
Am I missing something fundamental here? Are certain intrinsics not supported by g++ and only available in icc?
解决方案:此指令不是真正的内在,而是作为ICC的Intel SVML的一部分实现。 / p>
SOLVED: This instruction is not a true intrinsic but instead implemented as part of the Intel SVML for ICC.
推荐答案
如您对问题的评论中所示,该内在函数不映射到实际的AVX指令;它是对内在集的Intel扩展。该实现可能使用许多基本指令,因为对数不是微不足道的操作。
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.
如果您想要使用非英特尔的编译器,但想要一个快速的对数实现,您可以查看此开源实现 sin()
, cos()
, exp()
和 log()
函数。它们基于之前具有相同功能的 SSE2版本。
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.
这篇关于g ++中缺少AVX日志内在函数(_mm256_log_ps) - 4.8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!