Optimize matrix multiplication performance test for Apple M3 Max.#9183
Open
alexreinking wants to merge 3 commits into
Open
Optimize matrix multiplication performance test for Apple M3 Max.#9183alexreinking wants to merge 3 commits into
alexreinking wants to merge 3 commits into
Conversation
shoaibkamil
reviewed
Jun 22, 2026
shoaibkamil
reviewed
Jun 22, 2026
shoaibkamil
approved these changes
Jun 22, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9183 +/- ##
=======================================
Coverage ? 69.35%
=======================================
Files ? 254
Lines ? 78274
Branches ? 18729
=======================================
Hits ? 54290
Misses ? 18471
Partials ? 5513 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
shoaibkamil
reviewed
Jun 23, 2026
| A.set(mat_A); | ||
| B.set(mat_B); | ||
|
|
||
| // TODO: we really need a generic performance testing harness |
Contributor
There was a problem hiding this comment.
can we create an issue to track?
shoaibkamil
reviewed
Jun 23, 2026
| for (int iy = 0; iy < matrix_size && halide_correct; iy++) { | ||
| for (int ix = 0; ix < matrix_size; ix++) { | ||
| halide_correct = halide_correct && (std::abs(output_ref(ix, iy) - output_halide(ix, iy)) < 0.001f); | ||
| bool halide_correct = [&] { |
Contributor
There was a problem hiding this comment.
we also need a generic equalsish for floats too, but maybe that's part of our generic perf testing harness
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.
I ran a local parameter sweep to find the best parameters for the performance_matrix_multiply schedule on my Apple M3 Max. The comments have been updated to explain the schedules in a little more detail.
I searched a total of 256 configurations:
{1,2,3,4} * vec{1,2,4,8}{2,4,8,16}{2,4,8,16}Removed the "Uncomment to see the generated assembly" section because it doesn't compile (name collision with
t, the benchmark time).Checklist