No subject

Sajan Karumanchi sajan.karumanchi@gmail.com
Fri Nov 13 12:43:34 GMT 2026


From: Sajan Karumanchi <sajan.karumanchi@amd.com>
Date: Fri, 13 Nov 2026 09:39:53 +0000
Subject: [PATCH 0/2] x86: Enable ERMS codepath for AMD Zen5/Zen6 servers

This series enables the Enhanced REP MOVSB/STOSB (ERMS) code paths for
the string memory routines on AMD Zen5 and Zen6 Server-class CPUs.
Microcode improvements on these models make REP MOVSB/STOSB outperform
the traditional vectorized memcpy/memmove/memset routines within
specific size ranges.

A new CPU_FEATURES flag, Prefer_Server_ERMS, is introduced to detect
Zen5/Zen6 Server-class CPUs and gate the tuned thresholds so that
existing client-class behaviour is left unchanged.

Patch 1 (memcpy/memmove):
  - Introduces the Prefer_Server_ERMS feature flag and enables the ERMS
    path for memcpy and memmove on Zen5+ servers.
  - Thresholds tuned from real-workload benchmarks.
  - Range [16KB, NT threshold]: 11% to 25% improvement.
  - Introduces Avoid_Overlap_REP_MOVSB to skip forward-overlapping
    memmove cases that regress with REP MOVSB on Zen5+.

Patch 2 (memset):
  - Extends the Zen5+ server ERMS tuning to memset by lowering the
    default rep_stosb_threshold from SIZE_MAX to 32KB when
    Prefer_Server_ERMS is set.
  - Also enables Avoid_Non_Temporal_Memset so large memsets stay on
    ERMS, which edges out non-temporal stores on these models.
  - Range [32KB, SIZE_MAX]: 9% to 43% improvement.

Both changes are gated on the Prefer_Server_ERMS feature flag and have
no effect on non-Zen5/6 or client-class processors.

Note: This series tunes the currently released AMD Zen5/Zen6 Server-class
models.  Tuning for the yet-to-be-released server models of the Zen5/Zen6
family will be carried out separately after their official launch.

Sajan Karumanchi (2):
  x86: Enable ERMS memcpy/memmove for AMD Zen5/Zen6 servers
  x86: Enable ERMS memset for AMD Zen5/Zen6 servers

 sysdeps/x86/cacheinfo.h                       |  7 ++++
 sysdeps/x86/cpu-features.c                    | 31 +++++++++++---
 sysdeps/x86/dl-cacheinfo.h                    | 42 ++++++++++++++-----
 ...cpu-features-preferred_feature_index_1.def |  2 +
 sysdeps/x86/sysdep.h                          |  2 +
 .../multiarch/memmove-vec-unaligned-erms.S    | 13 ++++++
 6 files changed, 83 insertions(+), 14 deletions(-)

-- 
2.34.1


More information about the Libc-alpha mailing list