-
Notifications
You must be signed in to change notification settings - Fork 1k
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
BF16 Softmax on EMR got 40% performance regression #2237
Comments
Hi team, I confirmed this is regression issue on both of SPR and EMR. Linux ortce-emr3 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux only main branch applied "--attr-acc-mode=bf16" option. |
F16 also met the regression |
Thanks for the report. This change in oneDNN implementation was to resolve an accuracy issue, where we used to accumulate with destination datatype (e.g. bf16/f16), instead of f32. Reverting performance would require to introduce support for |
So, you means that I use accumulation_mode=relaxed can fix the perf gap? Another phenomenon is that the performance regression is obvious when the axis dim is small, and as the dim size grows, the performance gap becomes almost invisible. Can we do some optimization for small size? |
Hi Team, the option of "--attr-acc-mode=relaxed" does not help for the performance gap. numactl -N 1 ./tests/benchdnn/benchdnn --softmax --mode=p --dir=FWD_I --sdt=bf16 --ddt=bf16 --stag=abcd --dtag=abcd --alg=SOFTMAX --axis=3 64x16x100x100 --attr-acc-mode=relaxed |
@a3213105 @kminemur attr-acc-mode relaxed is not supported yet by the implementation. To restore performance:
We will update you as we add support for the accumulation mode to the implementation. |
Summary
BF16 Softmax on EMR got 40% performance regression after V3.5 "enable scratchpad for non-f32 dst dt"
Below is the reproducing step, we can see that after commit ad99c73, the average latency of softmax slowdown from 0.198575ms to 0.337924 ms
performance of commit e2d4a8c
$ numactl -N 1 ./tests/benchdnn/benchdnn --soft
max --mode=p --dir=FWD_I --sdt=bf16 --ddt=bf16 --stag=abcd --dtag=abcd --alg=SOFTMAX --
axis=3 64x16x100x100
Output template: perf,%engine%,%impl%,%name%,%prb%,%Gops%,%+ctime%,%-time%,%-Gflops%,%0time%,%0Gflops%
perf,cpu,jit:avx10_1_512,,--mode=P --softmax --dir=FWD_I --sdt=bf16 --ddt=bf16 --stag=abcd --dtag=abcd --axis=3 64x16x100x100,0,0.495605,0.18042,0,0.198575,0
tests:1 passed:1 skipped:0 mistrusted:0 unimplemented:0 invalid_arguments:0 failed:0 listed:0
total perf: min(ms):0.18042 avg(ms):0.198575
total: 3.41s; fill: 0.39s (11%);
performance of commit ad99c73
$ numactl -N 1 ./tests/benchdnn/benchdnn --softmax --mode=p --dir=FWD_I --sdt=bf16 --ddt=bf16 --stag=abcd --dtag=abcd --alg=SOFTMAX --axis=3 64x16x100x100
Output template: perf,%engine%,%impl%,%name%,%prb%,%Gops%,%+ctime%,%-time%,%-Gflops%,%0time%,%0Gflops%
perf,cpu,jit:avx10_1_512,,--mode=P --softmax --dir=FWD_I --sdt=bf16 --ddt=bf16 --stag=abcd --dtag=abcd --axis=3 64x16x100x100,0,0.455322,0.287598,0,0.337924,0
tests:1 passed:1 skipped:0 mistrusted:0 unimplemented:0 invalid_arguments:0 failed:0 listed:0
total perf: min(ms):0.287598 avg(ms):0.337924
total: 3.40s; fill: 0.39s (11%);
Environment
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 xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq 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 rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req vnmi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr ibt amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities
Linux emr-qs-01 6.5.0-44-generic #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jun 18 14:36:16 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
cmake version 3.27.5
The text was updated successfully, but these errors were encountered: