Repository navigation
Conversation
Every rewritten loop with two or more slices calls _loopvecOverlap for each pair before it runs. The helper took the windows as ...int and inlining it cost 114, over the compiler's budget of 80, so each call was a real call: AddFloat32s made two before it loaded anything, which for a short loop costs about as much as the loop. The helper now takes the windows as four plain arguments, and a whole slice is passed as 0 and its length. It inlines (cost 55), and the comparison is the same.
Regenerated with make test-update. The -d scripts (flag_diff.txt, readme_patterns.txt) also check the size of the generated hunk, which shrinks by six lines.
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 change is the first commit; the second only regenerates the goldens.
_loopvecOverlaptook the windows as...int, and with that its inlining cost was 114, over the budget of 80:So every rewritten loop that touches two slices makes a real call per pair before it starts, which takes about as long as a 64-element loop.
It now takes the four bounds as plain ints (a whole slice is
0, len(s)) and inlines at cost 55. The comparison is the same.On an M4 Max, on top of #17: AddFloat32s/64 goes from 9.9 to 8.1 ns, AxpyFloat32s/64 from 10.3 to 8.0, ClampInt32s/64 from 8.3 to 6.9. Larger sizes don't notice.