From: Eric Biggers <ebiggers@kernel.org>
To: Martin Willi <martin@strongswan.org>
Cc: linux-crypto@vger.kernel.org,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
Ard Biesheuvel <ardb@kernel.org>,
Antonio Quartulli <antonio@mandelbit.com>
Subject: Re: [PATCH v2 0/3] lib/crypto: x86/chacha: Add a 16-block AVX-512 function
Date: Tue, 3 Nov 2026 15:31:27 -0800 [thread overview]
Message-ID: <20261103233127.GL2281@quark> (raw)
In-Reply-To: <20261102113926.2765176-1-martin@strongswan.org>
On Mon, Nov 02, 2026 at 12:39:23PM +0100, Martin Willi wrote:
> Here is v2 of the 16-block ChaCha function for 512-bit zmm registers.
> Patch 1 renames the assembly file, patch 2 wraps the 8-block code in
> a macro, and patch 3 adds the 16-block function on top.
>
> I previously mentioned a larger series with more AVX refactorings to
> shared macros along with a 4-block zmm variant. That needs some
> more work, so here is just the 16-block variant.
>
> v1 used embedded broadcasts for the final ChaCha state add. This comes
> with a minor regression on older Intel chips when used in the 8-block
> variant. Therefore I kept the state words in registers in the macro
> version used by both 8/16-block variants, see patch 3.
>
> I don't have a Zen 4, which splits zmm instructions into two 256-bit
> halves, so I can't tell how the 16-block function performs there.
> If anybody has access to one, numbers from there would be great.
>
> Changes in v2:
> - Rename chacha-avx512vl-x86_64.S to chacha-avx512-x86_64.S
> - Generate the 8- and 16-block functions from a shared macro
> - Drop the cpu_has_xfeatures() and X86_FEATURE_AVX512F checks
> - Keep the state words in registers for the final add
> - Benchmark with the ChaCha KUnit suite instead of tcrypt
>
> v1: https://lore.kernel.org/linux-crypto/20260722153247.630519-1-martin@strongswan.org/
>
> Martin Willi (3):
> lib/crypto: x86/chacha: Rename the AVX-512VL assembly file
> lib/crypto: x86/chacha: Wrap the 8-block AVX-512 code in a macro
> lib/crypto: x86/chacha: Add a 16-block AVX-512 function
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=libcrypto-next
I updated the last commit message to add my results for Zen 4:
Results on Zen 4 (specifically Genoa), which has a 256-bit datapath:
Length Before After Change
====== ========== ========== ======
768 2674 MB/s 3417 MB/s +27.8%
1024 3241 MB/s 4514 MB/s +39.3%
1420 3242 MB/s 3845 MB/s +18.6%
2048 3587 MB/s 4829 MB/s +34.6%
4096 3743 MB/s 5040 MB/s +34.7%
8920 3606 MB/s 4846 MB/s +34.4%
16384 3739 MB/s 5105 MB/s +36.5%
- Eric
prev parent reply other threads:[~2026-11-03 23:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 11:39 [PATCH v2 0/3] lib/crypto: x86/chacha: Add a 16-block AVX-512 function Martin Willi
2026-11-02 11:39 ` [PATCH v2 1/3] lib/crypto: x86/chacha: Rename the AVX-512VL assembly file Martin Willi
2026-11-02 11:39 ` [PATCH v2 2/3] lib/crypto: x86/chacha: Wrap the 8-block AVX-512 code in a macro Martin Willi
2026-11-02 11:39 ` [PATCH v2 3/3] lib/crypto: x86/chacha: Add a 16-block AVX-512 function Martin Willi
2026-11-03 13:49 ` [PATCH v2 0/3] " Antonio Quartulli
2026-11-03 23:08 ` Eric Biggers
2026-11-03 23:31 ` Eric Biggers [this message]
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=20261103233127.GL2281@quark \
--to=ebiggers@kernel.org \
--cc=Jason@zx2c4.com \
--cc=antonio@mandelbit.com \
--cc=ardb@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=martin@strongswan.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.