Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH v2 0/3] lib/crypto: x86/chacha: Add a 16-block AVX-512 function
@ 2026-11-02 11:39 Martin Willi
  2026-11-02 11:39 ` [PATCH v2 1/3] lib/crypto: x86/chacha: Rename the AVX-512VL assembly file Martin Willi
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Martin Willi @ 2026-11-02 11:39 UTC (permalink / raw)
  To: Eric Biggers, linux-crypto
  Cc: Jason A. Donenfeld, Ard Biesheuvel, Antonio Quartulli

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

 lib/crypto/Makefile                           |   2 +-
 ...x512vl-x86_64.S => chacha-avx512-x86_64.S} | 730 +++++++++++-------
 lib/crypto/x86/chacha.h                       |  28 +-
 3 files changed, 477 insertions(+), 283 deletions(-)
 rename lib/crypto/x86/{chacha-avx512vl-x86_64.S => chacha-avx512-x86_64.S} (55%)


base-commit: c90bb21618db40f1f30a1c0ed58d4f46b27dba26
-- 
2.53.0


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

end of thread, other threads:[~2026-11-03 23:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox