Improve SVE2 optimizations of SimdGetColSums - #899
Merged
Conversation
Replace unpack-and-add with SVE2 widening even/odd adds (svaddwb/svaddwt), keep that layout in the 16-bit buffer, and zip back to natural order only when converting to 32-bit. Unroll the inner loop across four vectors and apply the same approach to GetAbsDxColSums. Co-authored-by: igor.ermolaev <igor.ermolaev@altezza.org>
ermig1979
marked this pull request as ready for review
August 20, 2026 13:27
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.
The SVE2 implementation of
SimdGetColSumsusedsvunpklo/svunpkhiplus a separate add, which is more work than NEONvaddw_u8and was much slower.This change:
svaddwb_u16/svaddwt_u16(even/odd widening adds) after a singlesvld1per vectorsvzip1/svzip2only when converting to 32-bitGetAbsDxColSumssvld4/svst4loads/stores, and does not add macrosRelease notes for 7.2.165 list the improvement.
The AArch64 object dump of the inner loop is
ld1b+uaddwb/uaddwt(nold4/st4). Unpack and zip appear only in the 16-to-32 conversion.Correctness:
addwb/addwt+zip1/zip2vs Base, for SVE lengths 128/256/512 bits and AutoTest-like shapes (42 cases)aarch64-linux-gnu-g++(-march=armv9-a+sve+sve2, scalable VL)Test::GetColSumsAutoTestandGetAbsDxColSumsAutoTestunder QEMUneoverse-n2andcortex-a710(SVE2, 128-bit): Base vs Sve2, including[16, 255],[17, 256],[31, 257]. All passed.