-
Notifications
You must be signed in to change notification settings - Fork 686
Improve kleidi-ai matmul register usage #5165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Nicoshev
wants to merge
1
commit into
pytorch:main
Choose a base branch
from
Nicoshev:export-D87656468
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
Contributor
edd0424 to
c995700
Compare
Nicoshev
added a commit
to Nicoshev/FBGEMM
that referenced
this pull request
Nov 23, 2025
Summary: X-link: facebookresearch/FBGEMM#2164 Refactor kleidi-ai matrix multiplication routines to only rely on temporary registers. Doing this removes from each call the need to save and restore registers [x19, x30], and also simd registers [d9, d15] for the smaller routines. Cache miss is likely to happen for these loads, as the matrix processing should fill the cache. Around 10 memory load/store instructions get removed on each subroutine. Because larger matrixes get broken down into small pieces, these savings are once per piece. Reducing code size for these routines also makes them more likely to be in cache when needing to execute them. Benchmarks seem to show a small improvement. Now, some nice runs show almost the same throughput as BGM: P2050470491, P2050484212 Reviewed By: mcfi Differential Revision: D87656468
c995700 to
be2e1a1
Compare
Nicoshev
added a commit
to Nicoshev/FBGEMM
that referenced
this pull request
Nov 24, 2025
Summary: X-link: facebookresearch/FBGEMM#2164 Refactor kleidi-ai matrix multiplication routines to only rely on temporary registers. Doing this removes from each call the need to save and restore registers [x19, x30], and also simd registers [d9, d15] for the smaller routines. Cache miss is likely to happen for these loads, as the matrix processing should fill the cache. Around 10 memory load/store instructions get removed on each subroutine. Because larger matrixes get broken down into small pieces, these savings are once per piece. Reducing code size for these routines also makes them more likely to be in cache when needing to execute them. Benchmarks seem to show a small improvement. Now, some nice runs show almost the same throughput as BGM: P2050470491, P2050484212 Reviewed By: mcfi Differential Revision: D87656468
be2e1a1 to
94470f7
Compare
Nicoshev
added a commit
to Nicoshev/FBGEMM
that referenced
this pull request
Nov 24, 2025
Summary: X-link: facebookresearch/FBGEMM#2164 Refactor kleidi-ai matrix multiplication routines to only rely on temporary registers. Doing this removes from each call the need to save and restore registers [x19, x30], and also simd registers [d9, d15] for the smaller routines. Cache miss is likely to happen for these loads, as the matrix processing should fill the cache. Around 10 memory load/store instructions get removed on each subroutine. Because larger matrixes get broken down into small pieces, these savings are once per piece. Reducing code size for these routines also makes them more likely to be in cache when needing to execute them. Benchmarks seem to show a small improvement. Now, some nice runs show almost the same throughput as BGM: P2050470491, P2050484212 Reviewed By: mcfi Differential Revision: D87656468
94470f7 to
249fdfc
Compare
Summary: X-link: facebookresearch/FBGEMM#2164 Refactor kleidi-ai matrix multiplication routines to only rely on temporary registers. Doing this removes from each call the need to save and restore registers [x19, x30], and also simd registers [d9, d15] for the smaller routines. Cache miss is likely to happen for these loads, as the matrix processing should fill the cache. Around 10 memory load/store instructions get removed on each subroutine. Because larger matrixes get broken down into small pieces, these savings are once per piece. Reducing code size for these routines also makes them more likely to be in cache when needing to execute them. Benchmarks seem to show a small improvement. Now, some nice runs show almost the same throughput as BGM: P2050470491, P2050484212 Reviewed By: mcfi Differential Revision: D87656468
249fdfc to
19eaafd
Compare
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.
Summary:
Refactor kleidi-ai matrix multiplication routines to only rely on temporary registers.
Doing this removes from each call the need to save and restore registers [x19, x30], and also simd registers [d9, d15] for the smaller routines.
Around 10 memory load/store instructions get removed on each subroutine.
Because larger matrixes get broken down into small pieces, these savings are once per piece.
Reducing code size for these routines also makes them more likely to be in cache when needing to execute them.
Differential Revision: D87656468