Skip to content

Conversation

@wingertge
Copy link
Contributor

Pull Request Template

Checklist

  • Confirmed that cargo run-checks command has been executed.
  • Made sure the book is up to date with changes in this PR.

Related Issues/PRs

Requires tracel-ai/cubecl#1003

Changes

Adds lower level MMA matmul to tuning for both fused and unfused matmul.

Testing

All tests pass and burn-lm works as expected (but 25-40% faster depending on the model).

Comment on lines +116 to +153
simple: selector(FusedMatmulSelector::Simple {
multi_rows: false,
tile_matmul: AcceleratedTileKind::Cmma,
}),
simple_mma: selector(FusedMatmulSelector::Simple {
multi_rows: false,
tile_matmul: AcceleratedTileKind::Mma,
}),
simple_multi_rows: selector(FusedMatmulSelector::Simple {
multi_rows: true,
tile_matmul: AcceleratedTileKind::Cmma,
}),
simple_multi_rows_mma: selector(FusedMatmulSelector::Simple {
multi_rows: true,
tile_matmul: AcceleratedTileKind::Mma,
}),
double_buffering: selector(FusedMatmulSelector::DoubleBuffering {
specialized: false,
tile_matmul: AcceleratedTileKind::Cmma,
}),
double_buffering_mma: selector(FusedMatmulSelector::DoubleBuffering {
specialized: false,
tile_matmul: AcceleratedTileKind::Mma,
}),
specialized: selector(FusedMatmulSelector::DoubleBuffering {
specialized: true,
tile_matmul: AcceleratedTileKind::Cmma,
}),
specialized_mma: selector(FusedMatmulSelector::DoubleBuffering {
specialized: true,
tile_matmul: AcceleratedTileKind::Mma,
}),
ordered: selector(FusedMatmulSelector::OrderedDoubleBuffering {
tile_matmul: AcceleratedTileKind::Cmma,
}),
ordered_mma: selector(FusedMatmulSelector::OrderedDoubleBuffering {
tile_matmul: AcceleratedTileKind::Mma,
}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of duplications here. I think a good refactor would be to store the selectors in a vector and select them based on indexing. Unsure how to actually do it, but that would be cleaner.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just a HashMap or BTreeMap, with the selector as the key?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's something to be said for keeping it statically typed so all the variants are properly initialized. So I'd keep it for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can look into, I want to refactor that project with better documentation

@codecov
Copy link

codecov bot commented Nov 1, 2025

Codecov Report

❌ Patch coverage is 0% with 203 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.65%. Comparing base (5da68bf) to head (a8a58ac).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...ates/burn-cubecl-fusion/src/matmul/optimization.rs 0.00% 112 Missing ⚠️
crates/burn-cubecl/src/kernel/matmul/tune/base.rs 0.00% 69 Missing ⚠️
crates/burn-cubecl-fusion/src/matmul/tune.rs 0.00% 22 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3961      +/-   ##
==========================================
- Coverage   64.71%   64.65%   -0.06%     
==========================================
  Files        1180     1180              
  Lines      140328   140452     +124     
==========================================
  Hits        90816    90816              
- Misses      49512    49636     +124     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nathanielsimard nathanielsimard merged commit 1c5c777 into tracel-ai:main Nov 3, 2025
9 of 10 checks passed
@wingertge wingertge deleted the feat/mma-matmul branch November 3, 2025 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants