public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug string/30994] New: REP MOVSB performance suffers from page aliasing on Zen 4
@ 2023-10-24  6:18 bmerry at sarao dot ac.za
  2023-10-24  6:19 ` [Bug string/30994] " bmerry at sarao dot ac.za
                   ` (26 more replies)
  0 siblings, 27 replies; 28+ messages in thread
From: bmerry at sarao dot ac.za @ 2023-10-24  6:18 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30994

            Bug ID: 30994
           Summary: REP MOVSB performance suffers from page aliasing on
                    Zen 4
           Product: glibc
           Version: 2.38
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: string
          Assignee: unassigned at sourceware dot org
          Reporter: bmerry at sarao dot ac.za
  Target Milestone: ---

When (dst-src)&0xFFF is small (but non-zero), the REP MOVSB path in memcpy
performs extremely poorly (as much as 25x slower than the alternative path).
I'm observing this on Zen 4 (Epyc 9374F). I'm running Ubuntu 22.04 with a glibc
hand-built from glibc-2.38.9000-185-g2aa0974d25.

To reproduce:
1. Download the microbench at
https://github.com/ska-sa/katgpucbf/blob/6176ed2e1f5eccf7f2acc97e4779141ac794cc01/scratch/memcpy_loop.cpp
2. Compile it with the adjacent Makefile (tl;dr: g++ -std=c++17 -O3 -pthread -o
memcpy_loop memcpy_loop.cpp)
3. Run ./memcpy_loop -t mmap -f memcpy -b 8192 -p 100000 -D 1 -r 5
4. Run GLIBC_TUNABLES=glibc.cpu.x86_rep_movsb_threshold=10000 ./memcpy_loop -t
mmap -f memcpy -b 8192 -p 100000 -D 1 -r 5

Step 3 reports a rate of 4.2 GB/s, while step 4 (which disables the rep_movsb
path) reports a rate of 111 GB/s. The test uses 8192-byte memory copies, where
the source is page-aligned and the destination starts 1 byte into a page.

I'll also attach the bench-memcpy-large.out, which shows similar results.

I've previously filed this as an Ubuntu bug
(https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2030515) but it doesn't
seem to have received much attention.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2024-04-04 10:36 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-24  6:18 [Bug string/30994] New: REP MOVSB performance suffers from page aliasing on Zen 4 bmerry at sarao dot ac.za
2023-10-24  6:19 ` [Bug string/30994] " bmerry at sarao dot ac.za
2023-10-24  6:20 ` bmerry at sarao dot ac.za
2023-10-24  6:21 ` bmerry at sarao dot ac.za
2023-10-24  6:21 ` bmerry at sarao dot ac.za
2023-10-24  6:32 ` bmerry at sarao dot ac.za
2023-10-24 17:57 ` sam at gentoo dot org
2023-10-25 12:40 ` fweimer at redhat dot com
2023-10-25 13:37 ` bmerry at sarao dot ac.za
2023-10-27 12:39 ` adhemerval.zanella at linaro dot org
2023-10-27 13:04 ` bmerry at sarao dot ac.za
2023-10-27 13:16 ` bmerry at sarao dot ac.za
2023-10-30  8:21 ` bmerry at sarao dot ac.za
2023-10-30 13:30 ` adhemerval.zanella at linaro dot org
2023-10-30 14:21 ` bmerry at sarao dot ac.za
2023-10-30 16:27 ` adhemerval.zanella at linaro dot org
2023-11-07 15:44 ` jamborm at gcc dot gnu.org
2023-11-29  3:08 ` lilydjwg at gmail dot com
2023-11-29 13:01 ` holger@applied-asynchrony.com
2023-11-29 15:57 ` jrmuizel at gmail dot com
2023-11-29 17:25 ` gabravier at gmail dot com
2023-11-29 17:30 ` sam at gentoo dot org
2023-11-29 19:58 ` matti.niemenmaa+sourcesbugs at iki dot fi
2023-11-29 21:08 ` pageexec at gmail dot com
2023-11-30  3:13 ` dushistov at mail dot ru
2023-12-08  8:32 ` mati865 at gmail dot com
2024-02-13 16:54 ` cvs-commit at gcc dot gnu.org
2024-04-04 10:36 ` cvs-commit at gcc dot gnu.org

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).