[PATCH] x86: Disable AVX Fast Unaligned Load on Hygon 1/2/3 due to performance regression

H.J. Lu hjl.tools@gmail.com
Tue Oct 21 05:52:43 GMT 2025


On Tue, Oct 21, 2025 at 11:34 AM 李腾龙 <litenglong@kylinos.cn> wrote:
>
> On Mon, Oct 20, 2025 21:00 pm  H.J. Lu<hjl.tools@gmail.com> wrote:
>
> > The commit subject is too long.  Just use
>
> > x86: Disable AVX Fast Unaligned Load on Hygon 1/2/3
>
> 0001-x86-Disable-AVX-Fast-Unaligned-Load-on-Hygon-1-2-3.patch
>
> Thank you for your reply. Here is the revised patch file. For the patch file in this email reply, I first added it as an attachment and then embedded its content in the body. I'm not sure if the format is appropriate.
>
>
>
>
> 主   题:Re: [PATCH] x86: Disable AVX Fast Unaligned Load on Hygon 1/2/3 due to performance regression
> 日   期:2025年10月20日21:00
> 发件人:H.J. Lu
> 收件人:H.J. Lu
> 抄送人:libc-alpha,高翔
>
> On Mon, Oct 20, 2025 at 5:57 PM litenglong <litenglong@kylinos.cn> wrote: > > - 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 > The commit subject is too long. Just use x86: Disable AVX Fast Unaligned Load on Hygon 1/2/3 -- H.J. </litenglong@kylinos.cn></gaoxiang@kylinos.cn></litenglong@kylinos.cn>
>
>
>

LGTM.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Thanks.

H.J.


More information about the Libc-alpha mailing list