我正在尝试为本期报告创建一个最小的复制器。AVX-512似乎有一些问题,它是在最新的带有Skylake处理器的苹果机器上发货的。
根据GCC6发行说明,AVX-512齿轮应该是可用的。根据英特尔Intrinsics指南,vmovdqu64可以与AVX-512VL和AVX-512F一起使用
$ cat test.cxx
#include <cstdint>
#include <immintrin.h>
int main(int argc, char* argv[])
{
uint64_t x[8];
__m512i y = _mm512_loadu_epi64(x);
return 0;
}然后:
$ /opt/local/bin/g++-mp-6 -mavx512f -Wa,-q test.cxx -o test.exe
test.cxx: In function 'int main(int, char**)':
test.cxx:6:37: error: '_mm512_loadu_epi64' was not declared in this scope
__m512i y = _mm512_loadu_epi64(x);
^
$ /opt/local/bin/g++-mp-6 -mavx -mavx2 -mavx512f -Wa,-q test.cxx -o test.exe
test.cxx: In function 'int main(int, char**)':
test.cxx:6:37: error: '_mm512_loadu_epi64' was not declared in this scope
__m512i y = _mm512_loadu_epi64(x);
^
$ /opt/local/bin/g++-mp-6 -msse4.1 -msse4.2 -mavx -mavx2 -mavx512f -Wa,-q test.cxx -o test.exe
test.cxx: In function 'int main(int, char**)':
test.cxx:6:37: error: '_mm512_loadu_epi64' was not declared in this scope
__m512i y = _mm512_loadu_epi64(x);
^我选择了回到-msse2,但没有成功。我好像漏掉了什么。
现代GCC接触AVX-512需要什么?
根据一个/opt/local/bin/g++-mp-6 -v,这些是标题搜索路径:
#include "..." search starts here:
#include <...> search starts here:
/opt/local/include/gcc6/c++/
/opt/local/include/gcc6/c++//x86_64-apple-darwin13
/opt/local/include/gcc6/c++//backward
/opt/local/lib/gcc6/gcc/x86_64-apple-darwin13/6.5.0/include
/opt/local/include
/opt/local/lib/gcc6/gcc/x86_64-apple-darwin13/6.5.0/include-fixed
/usr/include
/System/Library/Frameworks
/Library/Frameworks然后:
$ grep -R '_mm512_' /opt/local/lib/gcc6/ | grep avx512f | head -n 8
/opt/local/lib/gcc6//gcc/x86_64-apple-darwin13/6.5.0/include/avx512fintrin.h:_mm512_set_epi64 (long long __A, long long __B, long long __C,
/opt/local/lib/gcc6//gcc/x86_64-apple-darwin13/6.5.0/include/avx512fintrin.h:_mm512_set_epi32 (int __A, int __B, int __C, int __D,
/opt/local/lib/gcc6//gcc/x86_64-apple-darwin13/6.5.0/include/avx512fintrin.h:_mm512_set_pd (double __A, double __B, double __C, double __D,
/opt/local/lib/gcc6//gcc/x86_64-apple-darwin13/6.5.0/include/avx512fintrin.h:_mm512_set_ps (float __A, float __B, float __C, float __D,
/opt/local/lib/gcc6//gcc/x86_64-apple-darwin13/6.5.0/include/avx512fintrin.h:#define _mm512_setr_epi64(e0,e1,e2,e3,e4,e5,e6,e7) \
/opt/local/lib/gcc6//gcc/x86_64-apple-darwin13/6.5.0/include/avx512fintrin.h: _mm512_set_epi64(e7,e6,e5,e4,e3,e2,e1,e0)
/opt/local/lib/gcc6//gcc/x86_64-apple-darwin13/6.5.0/include/avx512fintrin.h:#define _mm512_setr_epi32(e0,e1,e2,e3,e4,e5,e6,e7, \
/opt/local/lib/gcc6//gcc/x86_64-apple-darwin13/6.5.0/include/avx512fintrin.h: _mm512_set_epi32(e15,e14,e13,e12,e11,e10,e9,e8,e7,e6,e5,e4,e3,e2,e1,e0)
...发布于 2018-12-04 03:27:15
没有掩蔽的情况下,这个固有的_mm512_loadu_si512.没有存在的理由,也没有理由使用它来代替等价的它只是令人困惑,并可能欺骗人类读者认为它是一个vmovq零扩展的单一epi64负载。
英特尔的本质发现器确实指明了它的存在,但即使是现在的主干gcc (在“上帝”上)也不能定义它。
几乎所有的AVX512指令都支持合并掩蔽和零掩蔽.过去是纯按位/全寄存器的指令,没有任何有意义的元素边界,现在有32位和64位元素的味道,比如vpxord和vpxorq。或vmovdqa64.但是,使用任何一个没有掩蔽的版本的仍然只是一个法线向量加载/存储/寄存器复制,并且在C++源代码中为它们指定任何元素大小的内容没有意义,只有总向量宽度。
另见si512?
SSE*和AVX 1/2选项与GCC头是否定义这个内在的gcc内置项无关;-mavx512f已经暗示了在AVX512之前的所有英特尔SSE/AVX扩展。
它存在于clang主干中(但不是7.0,所以它只是最近才添加的)。
_mm512_loadu_si512支持的任何地方,使用以下_mm512_loadu_epi64 - clang树干,不是gcc。_mm512_load_si512,请使用以下内容_mm512_load_epi64 -也支持各地,令人惊讶。_mm512_maskz_loadu_epi64,将其用于零掩蔽负载。_mm512_mask_loadu_epi64,将其用于合并掩码加载。这段代码最早在gcc上编译4.9.0,而mainline (Linux) clang最早编译到3.9,都是用-march=avx512f编写的。或者如果他们支持它,-march=skylake-avx512或-march=knl。我还没有用苹果Clang做过测试。
#include <immintrin.h>
__m512i loadu_si512(void *x) { return _mm512_loadu_si512(x); }
__m512i load_epi64(void *x) { return _mm512_load_epi64(x); }
//__m512i loadu_epi64(void *x) { return _mm512_loadu_epi64(x); }
__m512i loadu_maskz(void *x) { return _mm512_maskz_loadu_epi64(0xf0, x); }
__m512i loadu_mask(void *x) { return _mm512_mask_loadu_epi64(_mm512_setzero_si512(), 0xf0, x); }发布于 2019-06-17 13:55:11
_mm512_loadu_epi64在32位模式下不可用.您需要编译64位模式.一般来说,AVX512在64位模式下工作得最好.
https://stackoverflow.com/questions/53604986
复制相似问题