[PATCH] x86: Disable AVX Fast Unaligned Load on Hygon 1/2/3 due to performance regression
litenglong
litenglong@kylinos.cn
Mon Oct 20 09:56:12 GMT 2025
- Performance testing revealed significant memcpy performance degradation
when bit_arch_AVX_Fast_Unaligned_Load is enabled on Hygon 3.
- Hygon confirmed AVX performance issues in certain memory functions.
- Glibc benchmarks show SSE outperforms AVX for
memcpy/memmove/memset/strcmp/strcpy/strlen and so on.
- Hardware differences primarily in floating-point operations don't justify
AVX usage for memory operations.
Reviewed-by: gaoxiang <gaoxiang@kylinos.cn>
Signed-off-by: litenglong <litenglong@kylinos.cn>
---
sysdeps/x86/cpu-features.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index b67ef541dd..286cbfb1e2 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -1123,6 +1123,11 @@ disable_tsx:
hardware. */
cpu_features->preferred[index_arch_Avoid_Non_Temporal_Memset]
&= ~bit_arch_Avoid_Non_Temporal_Memset;
+ if (model < 0x4) {
+ /* Unaligned AVX loads are slower. */
+ cpu_features->preferred[index_arch_AVX_Fast_Unaligned_Load]
+ &= ~bit_arch_AVX_Fast_Unaligned_Load;
+ }
}
else
{
--
2.25.1
More information about the Libc-alpha
mailing list