oneDNN
oneDNN copied to clipboard
LSTM kernel performs 1.5x slower for v2.6 compared with v1.4
Summary
I have benchmarked LSTM layer using OneDNN for v1.4 and v2.6. I have observed that OneDNN v2.6 performs 1.5x slower compared with v1.4.
Version
v2.6
Environment
oneDNN includes hardware-specific optimizations and may behave differently on depending on the compiler and build environment. Include the following information to help reproduce the issue:
- CPU :
Architecture: x86_64CPU op-mode(s): 32-bit, 64-bitByte Order: Little EndianAddress sizes: 46 bits physical, 48 bits virtualCPU(s): 12On-line CPU(s) list: 0-11Thread(s) per core: 2Core(s) per socket: 6Socket(s): 1NUMA node(s): 1Vendor ID: GenuineIntelCPU family: 6Model: 85Model name: Intel(R) Xeon(R) W-2133 CPU @ 3.60GHzStepping: 4CPU MHz: 1200.451CPU max MHz: 3900.0000CPU min MHz: 1200.0000BogoMIPS: 7200.00Virtualization: VT-xL1d cache: 192 KiBL1i cache: 192 KiBL2 cache: 6 MiBL3 cache: 8.3 MiBNUMA node0 CPU(s): 0-11Vulnerability Itlb multihit: KVM: Mitigation: VMX disabledVulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerableVulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerableVulnerability Meltdown: Mitigation; PTIVulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccompVulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitizationVulnerability Spectre v2: Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP conditional, RSB fillingVulnerability Srbds: Not affectedVulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerableFlags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xt opology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdra nd lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 e rms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm i da arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req md_clear flush_l1d arch_capabilities - OS version :
Linux <username> 5.10.0-14-amd64 #1 SMP Debian 5.10.113-1 (2022-04-29) x86_64 GNU/Linux - Compiler version:
gcc (Debian 10.2.1-6) 10.2.1 20210110 - CMake version:
3.18.4
Steps to reproduce
Run lstm kernel with below configuration for OneDNN v1.4 and OneDNN v2.6
/benchdnn --rnn --mode=P --alg=VANILLA_LSTM l1t1000mb16_sic100_slc3_dhc100_dic100
Below is the benchdnn verbose output using v1.4:
dnnl_verbose,exec,cpu,rnn,ref:any,forward_inference,src_layer_f32::blocked:abc:f0 src_iter_f32::blocked:abcd:f0 wei_layer_f32::blocked:abcde:f0 wei_layer_f32::blocked:abcde:f0 bias_f32::blocked:abcd:f0 dst_layer_f32::blocked:abc:f0 dst_iter_f32::blocked:abcd:f0,,alg:vanilla_lstm direction:unidirectional_left2right activation:undef,l1t1000mb16sic100slc3dhc100dlc100,22.8691
Below is the benchdnn verbose output using v2.6:
onednn_verbose,exec,cpu,rnn,brgemm,forward_inference,src_layer_f32::blocked:abc:f0 src_iter_f32::blocked:abcd:f0 wei_layer_f32:p:blocked:abdEc32e:f0 wei_iter_f32:p:blocked:abdEc32e:f0 bias_f32::blocked:abcd:f0 dst_layer_f32::blocked:abc:f0 dst_iter_f32::blocked:abcd:f0,,alg:vanilla_lstm direction:unidirectional_left2right activation:undef,l1t1000mb16sic100slc3dhc100dic100,35.7739
You can see that OneDNN v2.6 performs 1.5x slower compared with v1.4.
Hi @Hari-MathWorks , thanks for the report. Could you please try to run both cases with --trivial-strides=true? This options means tensors are dense.
Hi @igorsafo ,
I can still see the performance drop with --trivial-strides=true for v2.6.
% ./benchdnn --rnn --mode=P --alg=VANILLA_LSTM --trivial-strides=true l1t1000mb16_sic100_slc3_dhc100_dic100
Below are the verbose outputs for v2.6 and v1.4.
For 1.4:
dnnl_verbose,exec,cpu,rnn,ref:any,forward_inference,src_layer_f32::blocked:abc:f0 src_iter_f32::blocked:abcd:f0 wei_layer_f32::blocked:abcde:f0 wei_layer_f32::blocked:abcde:f0 bias_f32::blocked:abcd:f0 dst_layer_f32::blocked:abc:f0 dst_iter_f32::blocked:abcd:f0,,alg:vanilla_lstm direction:unidirectional_left2right activation:undef,l1t1000mb16sic100slc3dhc100dlc100,20.606
For 2.6:
onednn_verbose,exec,cpu,rnn,brgemm,forward_inference,src_layer_f32::blocked:abc:f0 src_iter_f32::blocked:abcd:f0 wei_layer_f32:p:blocked:abdEc32e:f0 wei_iter_f32:p:blocked:abdEc32e:f0 bias_f32::blocked:abcd:f0 dst_layer_f32::blocked:abc:f0 dst_iter_f32::blocked:abcd:f0,,alg:vanilla_lstm direction:unidirectional_left2right activation:undef,l1t1000mb16sic100slc3dhc100dic100,38.614
Thanks @Hari-MathWorks , I created another internal task to track this issue. We will notify you once the issue is fixed.
Regards, Igor
loop @aice-support for customer support