Repository navigation
Settle AArch64's SVE2 ChaCha20 loops by what precedes them - #6993
Merged
Merged
Conversation
Their speed depends on where their heads are and on the instructions just before: since they became a function (#6887), 16 KiB took 2.5% longer on Neoverse N2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHHqqJqUasi9thfRu12
alex
marked this pull request as ready for review
December 3, 2026 04:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ChaCha20's two SVE2 round loops take up to 2.5% longer on Neoverse N2 depending on where their heads are and on the instructions just before them: one
nopbefore the loop of the code from before #6887 also costs 2.2%. #6887 moved them, and its benchmarks did not cover SVE2 (its "default" run passed the literaldefaulttoVG_CPU_FEATURES, which turns every feature off).Mixed8.leadaligns each loop and loads its counter three more times first, which was the best for ChaCha20 at every size of the 30 or so variants measured. Onlyvg_chacha20_keystream8_sve2changes.Code size
Benchmarks (Neoverse N2, default features, 20 rounds)
chacha20poly1305chacha20poly1305-decryptThe 768-byte row gives back what #6887 had gained there (-0.7%), so against the code from before #6887 it is about +0.5%.
https://claude.ai/code/session_01TKUFHHqqJqUasi9thfRu12
Generated by Claude Code