From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: Alexander Monakov <amonakov@ispras.ru>,
Mikhail Romanov <mmromanov@ispras.ru>
Subject: [PATCH v6 04/10] util/bufferiszero: Remove useless prefetches
Date: Wed, 24 Apr 2024 15:56:59 -0700 [thread overview]
Message-ID: <20240424225705.929812-5-richard.henderson@linaro.org> (raw)
In-Reply-To: <20240424225705.929812-1-richard.henderson@linaro.org>
From: Alexander Monakov <amonakov@ispras.ru>
Use of prefetching in bufferiszero.c is quite questionable:
- prefetches are issued just a few CPU cycles before the corresponding
line would be hit by demand loads;
- they are done for simple access patterns, i.e. where hardware
prefetchers can perform better;
- they compete for load ports in loops that should be limited by load
port throughput rather than ALU throughput.
Signed-off-by: Alexander Monakov <amonakov@ispras.ru>
Signed-off-by: Mikhail Romanov <mmromanov@ispras.ru>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240206204809.9859-5-amonakov@ispras.ru>
---
util/bufferiszero.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/util/bufferiszero.c b/util/bufferiszero.c
index 972f394cbd..00118d649e 100644
--- a/util/bufferiszero.c
+++ b/util/bufferiszero.c
@@ -50,7 +50,6 @@ static bool buffer_is_zero_integer(const void *buf, size_t len)
const uint64_t *e = (uint64_t *)(((uintptr_t)buf + len) & -8);
for (; p + 8 <= e; p += 8) {
- __builtin_prefetch(p + 8);
if (t) {
return false;
}
@@ -80,7 +79,6 @@ buffer_zero_sse2(const void *buf, size_t len)
/* Loop over 16-byte aligned blocks of 64. */
while (likely(p <= e)) {
- __builtin_prefetch(p);
t = _mm_cmpeq_epi8(t, zero);
if (unlikely(_mm_movemask_epi8(t) != 0xFFFF)) {
return false;
@@ -111,7 +109,6 @@ buffer_zero_avx2(const void *buf, size_t len)
/* Loop over 32-byte aligned blocks of 128. */
while (p <= e) {
- __builtin_prefetch(p);
if (unlikely(!_mm256_testz_si256(t, t))) {
return false;
}
--
2.34.1
next prev parent reply other threads:[~2024-04-24 22:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-24 22:56 [PATCH v6 00/10] Optimize buffer_is_zero Richard Henderson
2024-04-24 22:56 ` [PATCH v6 01/10] util/bufferiszero: Remove SSE4.1 variant Richard Henderson
2024-04-24 22:56 ` [PATCH v6 02/10] util/bufferiszero: Remove AVX512 variant Richard Henderson
2024-04-29 11:16 ` Daniel P. Berrangé
2024-04-29 11:29 ` Alexander Monakov
2024-04-24 22:56 ` [PATCH v6 03/10] util/bufferiszero: Reorganize for early test for acceleration Richard Henderson
2024-04-24 22:56 ` Richard Henderson [this message]
2024-04-24 22:57 ` [PATCH v6 05/10] util/bufferiszero: Optimize SSE2 and AVX2 variants Richard Henderson
2024-04-24 22:57 ` [PATCH v6 06/10] util/bufferiszero: Improve scalar variant Richard Henderson
2024-04-29 12:18 ` Philippe Mathieu-Daudé
2024-04-29 12:31 ` Richard Henderson
2024-04-29 13:21 ` Philippe Mathieu-Daudé
2024-04-24 22:57 ` [PATCH v6 07/10] util/bufferiszero: Introduce biz_accel_fn typedef Richard Henderson
2024-04-29 11:14 ` Philippe Mathieu-Daudé
2024-04-24 22:57 ` [PATCH v6 08/10] util/bufferiszero: Simplify test_buffer_is_zero_next_accel Richard Henderson
2024-04-29 11:05 ` Philippe Mathieu-Daudé
2024-04-24 22:57 ` [PATCH v6 09/10] util/bufferiszero: Add simd acceleration for aarch64 Richard Henderson
2024-04-29 11:06 ` Philippe Mathieu-Daudé
2024-04-29 12:45 ` Philippe Mathieu-Daudé
2024-04-24 22:57 ` [PATCH v6 10/10] tests/bench: Add bufferiszero-bench Richard Henderson
2024-04-29 11:12 ` Philippe Mathieu-Daudé
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=20240424225705.929812-5-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=amonakov@ispras.ru \
--cc=mmromanov@ispras.ru \
--cc=qemu-devel@nongnu.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 NNTP newsgroup(s).