From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org,
Noah Goldstein <goldstein.w.n@gmail.com>,
"H . J . Lu" <hjl.tools@gmail.com>,
Bruce Merry <bmerry@sarao.ac.za>
Subject: [PATCH 3/4] x86: Do not prefer ERMS for memset on Zen3+
Date: Tue, 31 Oct 2023 17:09:24 -0300 [thread overview]
Message-ID: <20231031200925.3297456-4-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20231031200925.3297456-1-adhemerval.zanella@linaro.org>
The REP STOSB usage on memset does show any performance gain on
Zen3/Zen4 cores compared to the vectorized loops.
Checked on x86_64-linux-gnu.
---
sysdeps/x86/dl-cacheinfo.h | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
index 51e5ba200f..99ba0f776a 100644
--- a/sysdeps/x86/dl-cacheinfo.h
+++ b/sysdeps/x86/dl-cacheinfo.h
@@ -1018,11 +1018,17 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
if (tunable_size > minimum_rep_movsb_threshold)
rep_movsb_threshold = tunable_size;
- /* NB: The default value of the x86_rep_stosb_threshold tunable is the
- same as the default value of __x86_rep_stosb_threshold and the
- minimum value is fixed. */
- rep_stosb_threshold = TUNABLE_GET (x86_rep_stosb_threshold,
- long int, NULL);
+ /* For AMD Zen3+ architecture, the performance of vectorized loop is
+ slight better than ERMS. */
+ if (cpu_features->basic.kind == arch_kind_amd)
+ rep_stosb_threshold = SIZE_MAX;
+
+ if (TUNABLE_IS_INITIALIZED (x86_rep_stosb_threshold))
+ /* NB: The default value of the x86_rep_stosb_threshold tunable is the
+ same as the default value of __x86_rep_stosb_threshold and the
+ minimum value is fixed. */
+ rep_stosb_threshold = TUNABLE_GET (x86_rep_stosb_threshold,
+ long int, NULL);
TUNABLE_SET_WITH_BOUNDS (x86_data_cache_size, data, 0, SIZE_MAX);
TUNABLE_SET_WITH_BOUNDS (x86_shared_cache_size, shared, 0, SIZE_MAX);
--
2.34.1
next prev parent reply other threads:[~2023-10-31 20:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-31 20:09 [PATCH 0/4] x86: Improve ERMS usage " Adhemerval Zanella
2023-10-31 20:09 ` [PATCH 1/4] elf: Add a way to check if tunable is set (BZ 27069) Adhemerval Zanella
2023-10-31 20:09 ` [PATCH 2/4] x86: Fix Zen3/Zen4 ERMS selection (BZ 30994) Adhemerval Zanella
2023-10-31 20:09 ` Adhemerval Zanella [this message]
2023-10-31 20:09 ` [PATCH 4/4] x86: Expand the comment on when REP STOSB is used on memset Adhemerval Zanella
2023-11-15 19:05 ` [PATCH 0/4] x86: Improve ERMS usage on Zen3+ sajan.karumanchi
2023-11-16 18:35 ` Adhemerval Zanella Netto
2024-02-05 19:01 ` Sajan Karumanchi
2024-02-06 13:00 ` Adhemerval Zanella Netto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231031200925.3297456-4-adhemerval.zanella@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=bmerry@sarao.ac.za \
--cc=goldstein.w.n@gmail.com \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).