Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Hari-MathWorks opened this issue Jul 11, 2022 · 4 comments
Open

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

Hari-MathWorks opened this issue Jul 11, 2022 · 4 comments
Labels
help wanted performance platform:cpu-x64 Intel64/AMD64 processors. Codeowner: @oneapi-src/onednn-cpu-x64

Comments

@Hari-MathWorks
Copy link

Hari-MathWorks commented Jul 11, 2022

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 Hari-MathWorks added the sighting Suspicious library behavior. Should be promoted to a bug when confirmed label Jul 11, 2022
@igorsafo
Copy link
Contributor

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.

@Hari-MathWorks
Copy link
Author

Hari-MathWorks commented Jul 12, 2022

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

@igorsafo
Copy link
Contributor

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

Regards,
Igor

@aice-support
Copy link

loop @aice-support for customer support

@vpirogov vpirogov added platform:cpu-x64 Intel64/AMD64 processors. Codeowner: @oneapi-src/onednn-cpu-x64 and removed sighting Suspicious library behavior. Should be promoted to a bug when confirmed labels Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted performance platform:cpu-x64 Intel64/AMD64 processors. Codeowner: @oneapi-src/onednn-cpu-x64
Projects
None yet
Development

No branches or pull requests

4 participants