Repository navigation
perf(gemm): pack full B panels with whole-row array moves - #75
Merged
Merged
Conversation
packB copied each NR-element row run of a full panel element by element. A pprof of a 64² float32 product put it at 21% of the time. A full panel (nr == NR, unit column stride) now moves each run with one fixed-size array assignment, *(*[NR]T)(dst) = *(*[NR]T)(src), for the two widths in use (8 and 16). The compiler lowers it to vector moves with no runtime call. The conversions are bounds-checked like any slice-to-array conversion. abbench, 10 rounds, one core, against v0.26.0: Zen 3 float32 -11.6/-7.1/-1.7% (64²/256²/1024²), float64 -4.4/-2.3/~ N1 float32 -16.4/-8.9/~, float64 -9.5/~/~ Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
packBcopied each row run of a full B panel element by element; a pprof of a 64² float32 product put it at 21% of the time. A full panel now moves each run with one fixed-size array assignment (8 or 16 elements). The compiler lowers it to vector moves, with no runtime call, and the conversions are bounds-checked.MatMulvs v0.26.0, abbench 10 rounds, 1 coreTestPackRowsWholecovers both widths, checks that nothing is written past the last run, and covers the declined width. No new memory access: the conversions are checked against the same slices the element loop indexed.🤖 Generated with Claude Code