diff options
author | Noah Goldstein <goldstein.w.n@gmail.com> | 2024-09-27 15:50:10 -0700 |
---|---|---|
committer | Noah Goldstein <goldstein.w.n@gmail.com> | 2024-09-30 07:40:40 -0700 |
commit | 483443d3211532903d7e790211af5a1d55fdb1f3 (patch) | |
tree | 1e54b4bf103555b32707d8d8cafecb38be9d49f4 /localedata/locales/pap_CW | |
parent | 6948ee4edf0c57c556f8d5f394d9191216d05780 (diff) | |
download | glibc-483443d3211532903d7e790211af5a1d55fdb1f3.tar.gz glibc-483443d3211532903d7e790211af5a1d55fdb1f3.tar.xz glibc-483443d3211532903d7e790211af5a1d55fdb1f3.zip |
x86/string: Fixup alignment of main loop in str{n}cmp-evex [BZ #32212]
The loop should be aligned to 32-bytes so that it can ideally run out the DSB. This is particularly important on Skylake-Server where deficiencies in it's DSB implementation make it prone to not being able to run loops out of the DSB. For example running strcmp-evex on 200Mb string: 32-byte aligned loop: - 43,399,578,766 idq.dsb_uops not 32-byte aligned loop: - 6,060,139,704 idq.dsb_uops This results in a 25% performance degradation for the non-aligned version. The fix is to just ensure the code layout is such that the loop is aligned. (Which was previously the case but was accidentally dropped in 84e7c46df). NB: The fix was actually 64-byte alignment. This is because 64-byte alignment generally produces more stable performance than 32-byte aligned code (cache line crosses can affect perf), so if we are going past 16-byte alignmnent, might as well go to 64. 64-byte alignment also matches most other functions we over-align, so it creates a common point of optimization. Times are reported as ratio of Time_With_Patch / Time_Without_Patch. Lower is better. The values being reported is the geometric mean of the ratio across all tests in bench-strcmp and bench-strncmp. Note this patch is only attempting to improve the Skylake-Server strcmp for long strings. The rest of the numbers are only to test for regressions. Tigerlake Results Strings <= 512: strcmp : 1.026 strncmp: 0.949 Tigerlake Results Strings > 512: strcmp : 0.994 strncmp: 0.998 Skylake-Server Results Strings <= 512: strcmp : 0.945 strncmp: 0.943 Skylake-Server Results Strings > 512: strcmp : 0.778 strncmp: 1.000 The 2.6% regression on TGL-strcmp is due to slowdowns caused by changes in alignment of code handling small sizes (most on the page-cross logic). These should be safe to ignore because 1) We previously only 16-byte aligned the function so this behavior is not new and was essentially up to chance before this patch and 2) this type of alignment related regression on small sizes really only comes up in tight micro-benchmark loops and is unlikely to have any affect on realworld performance. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'localedata/locales/pap_CW')
0 files changed, 0 insertions, 0 deletions