VNNI 指令集从 Intel Xeon 第二代 cascade lake开始支持,你可以通过以下途径检测是否用oneDNN 正常运行VNNI 指令加速.
git clone https://github.com/oneapi-src/oneDNN.git
cd oneDNN/
mkdir build
cd build/
cmake ../
make -j
DNNL_VERBOSE=1 ./tests/benchdnn/benchdnn --matmul --cfg=u8s8u8 12x128x768:12x768x2304
看输出重是否含有 avx512_core_vnni:
onednn_verbose,info,cpu,runtime:OpenMP,nthr:112
onednn_verbose,info,cpu,isa:Intel AVX-512 with Intel DL Boost
onednn_verbose,info,gpu,runtime:none
onednn_verbose,info,prim_template:operation,engine,primitive,implementation,prop_kind,memory_descriptors,attributes,auxiliary,problem_desc,exec_time
onednn_verbose,exec,c,12x128x768,9.37915
onednn_verbose,exec,cpu,reorder,rnn_data_reorder,undef,src_f32::blocked:abc:f0 dst_u8::blocked:abc:f0,,pu,reorder,rnn_data_reorder,undef,src_f32::blocked:abc:f0 dst_s8::blocked:abc:f0,,,12x768x2304,10.8618
onednn_verbose,exec,cpu,matmul,brg:avx512_core_vnni,undef,src_u8::blocked:abc:f0 wei_s8::blocked:abc:f0 dst_u8::blocked:abc:f0,,,12x128x768:12x768x2304:12x128x2304,11.6199
onednn_verbose,exec,cpu,reorder,simple:any,undef,src_f32::blocked:abc:f0 dst_f32::blocked:abc:f0,,,12x128x2304,0.546875
onednn_verbose,exec,cpu,reorder,jit:uni,undef,src_u8::blocked:abc:f0 dst_f32::blocked:abc:f0,,,12x128x2304,1.92188
0:PASSED __REPRO: --matmul --cfg=u8s8u8 12x128x768:12x768x2304
tests:1 passed:1 skipped:0 mistrusted:0 unimplemented:0 invalid_arguments:0 failed:0 listed:0
total compute_ref: sum(s):0.28