coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] split: add content-defined chunking to --bytes


From: Leonid Evdokimov
Subject: Re: [PATCH] split: add content-defined chunking to --bytes
Date: Sun, 29 Mar 2026 16:37:00 +0300

On Mon, Mar 16, 2026 at 6:41 PM Pádraig Brady <P@draigbrady.com> wrote:
> Newer hardware for example won't have to worry about the JCC issue,
> so that might be left as a distro level / user level setting.

Affected Skylake chips get 15..43% speedup in case of Jcc-workaround
being both needed and implemented. I've found just one case when the
Jcc-workaround penalizes execution time of the aligned loop. It's
BUZHash on Raptor Lake's pinned to Efficient-core. This case gets a
20% slowdown. Performance-core of the same CPU is unaffected.

Longer story below.

I run a benchmark on a dozen x86_64 CPUs from different eras (both
newer and older than Skylake), while copyright assignment paperwork is
going on. That's the CPUs I was able to sample:

- Intel Xeon L5630               10Q1  Nehalem/Westmere
- AMD A4-3310MX                  11Q2  AMD A-Series, Llano
- Intel Xeon E3-1245 V2          12Q2  Sandy Bridge/Ivy Bridge
- Intel Celeron N2830            14Q1  Silvermont/Bay Trail
- Intel Xeon E5-2620 v3          14Q3  Haswell
- Intel 6th-gen Core i7-6600U    15Q3  Skylake/Skylake
- Intel Xeon Gold 6133           17Q3  Skylake/Skylake
- Intel 8th-gen Core i5-8250U    17Q3  Skylake/Kaby Lake R
- AMD Ryzen 5 PRO 3400GE         19Q3  Ryzen 3000
- Intel 10th-gen Core i7-10750H  20Q2  Skylake/Comet Lake
- AMD EPYC 7773X 64-Core         21Q1  EPYC 7003
- Intel Xeon Platinum 8592+      23Q4  Raptor Cove/Emerald Rapids
- Intel 14th-gen Core i7-14700HX 24Q1  Raptor Lake

I've compiled the CDC code with bare -O2 and align-loops=32 /
Jcc-workaround toggled on/off. I used GCC 13, 14, 15, Clang 22 and
inspected resulting binaries with objdump checking if they're actually
affected by Jcc-erratum and under-alignment or not.

The only under-aligned loops were clang22/{buz64,gear32} and
gcc13/{gear32,gear64}. All other lookup loops were already aligned to
the 32-byte boundary.

The opcodes GCC 13 and Clang 22 generate for these tiny loops were
often less performant than ones GCC 15 generates. 35% difference was
not unusual in this micro-benchmark, 100% difference was also
possible: 1cpb with GCC-15 vs. 2cpb with Clang-22 for GearHash on AMD
EPYC 7773X.

I'm attaching a summarized cycles-per-byte table in case someone is
curious about raw numbers.

Lesson learned: tiny loops are extremely sensitive & CC version matters a lot.

So, I think the way to conceptualize this song and dance around CFLAGS
is neither "optimization" nor "Jcc workaround" but "fix for _known_
performance regressions".

E.g. gcc13 GearHash build with Jcc-workaround & default loop alignment
is penalized on EPYC and almost all Skylakes, probably, due to
misalignment.

clang22 BUZHash build with align-loops=32 and no Jcc-workaround is
penalized on affected Intel chips due to unlucky layout triggering the
issue.

So, a single --enable option for every tunable knob makes little sense
to me. I'd suggest --enable-cdc-cflags[=FLAGS] with default value
depending on CC version.

It turns out, as expected, that building a single x86_64 binary that
performs well across a large variety of chips is a non-trivial task
:-)


--
WBRBW, Leonid Evdokimov, https://darkk.net.ru tel:+79816800702
PGP: 6691 DE6B 4CCD C1C1 76A0  0D4A E1F2 A980 7F50 FAB2

Attachment: cdc-bench-cpb.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]