The Linux kernel's ChaCha symmetric stream cipher code has long had an AVX-512 optimized code path but it was catering to the early generations of Intel CPUs with AVX-512 (Skylake) that suffered from down-clocking under use. But now slated for arrival with Linux 7.5 is tuning the code to perform better on today's AVX-512 Intel and AMD processors that don't suffer from this limitation. In turn the ChaCha performance is as much as 99% faster with current-generation AMD Zen 5 processors. StrongSwan developer Martin Willi took to adding a 16-block AVX-512 function for the ChaCha code in libcrypto. This allows better performance on modern AVX-512 processors with testing on AMD Ryzen AI Max Strix Halo (Zen 5) with the full AVX-512 512-bit data path yielding up to a 99% improvement. Or even with prior-generation AMD Zen 4 with the 256-bit data path still showing up to 39% improvements. Martin explained with the patch: "The AVX-512VL code processes at most 8 blocks at a time in 256-bit ymm registers. That width was chosen to avoid the heavy core down-clocking that 512-bit zmm instructions triggered on Skylake-X. That penalty is gone on more recent AVX-512 parts, where full 512-bit registers can encrypt 16 blocks per invocation and roughly double the data-level parallelism for bulk traffic. So instantiate the shared block macro a second time at VL=64, where only the final lane-crossing transpose differs. Enable it on top of the avx512vl path, gated only by X86_FEATURE_PREFER_YMM, and dispatch to it for inputs larger than 8 blocks." The patch is queued into Eric Biggers' libcrypto-next Git branch and thus expected to be submitted for the Linux 7.5 merge window at the end of the year.
ChaCha AVX-512 Optimization For Linux 7.5 Yields Up To 99% Improvement On AMD Zen 5
Full Article
Original Source
Read the full article at Phoronix →KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.