oneDNN icon indicating copy to clipboard operation
oneDNN copied to clipboard

LSTM kernel performs 1.5x slower for v2.6 compared with v1.4

Open Hari-MathWorks opened this issue 2 years ago • 4 comments

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_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 46 bits physical, 48 bits virtual CPU(s): 12 On-line CPU(s) list: 0-11 Thread(s) per core: 2 Core(s) per socket: 6 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 85 Model name: Intel(R) Xeon(R) W-2133 CPU @ 3.60GHz Stepping: 4 CPU MHz: 1200.451 CPU max MHz: 3900.0000 CPU min MHz: 1200.0000 BogoMIPS: 7200.00 Virtualization: VT-x L1d cache: 192 KiB L1i cache: 192 KiB L2 cache: 6 MiB L3 cache: 8.3 MiB NUMA node0 CPU(s): 0-11 Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable Vulnerability Meltdown: Mitigation; PTI Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable Flags: 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.

Hari-MathWorks avatar Jul 11 '22 19:07 Hari-MathWorks

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.

igorsafo avatar Jul 11 '22 19:07 igorsafo

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

Hari-MathWorks avatar Jul 12 '22 12:07 Hari-MathWorks

Thanks @Hari-MathWorks , I created another internal task to track this issue. We will notify you once the issue is fixed.

Regards, Igor

igorsafo avatar Jul 19 '22 17:07 igorsafo

loop @aice-support for customer support

aice-support avatar Aug 09 '22 00:08 aice-support