[FlyOp] Add stages args for MmaMakeFragment to simplify multi-stages allocation#437
Open
sjfeng1999 wants to merge 2 commits intomainfrom
Open
[FlyOp] Add stages args for MmaMakeFragment to simplify multi-stages allocation#437sjfeng1999 wants to merge 2 commits intomainfrom
sjfeng1999 wants to merge 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an optional stages attribute/argument for fly.mma.make_fragment to simplify allocating multi-stage MMA fragments, wiring it through the Fly dialect op definition, C++ type inference/lowering, and the Python DSL API. It also updates an example to use the new API and adds an MLIR regression test for the staged layout behavior.
Changes:
- Add
stages(optional i32 attr) tofly.mma.make_fragmentwith updated assembly format and type inference behavior. - Update layout lowering to allocate the fragment directly from the inferred static layout.
- Expose
stagesin Pythonmake_fragment_{A,B,C}helpers, update an example, and add a new MLIR FileCheck test.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/mlir/LayoutAlgebra/mma_make_fragment_stages.mlir | New regression test covering staged vs non-staged fragment layout/allocation. |
| python/flydsl/expr/typing.py | Add keyword-only stages to TiledMma.make_fragment_{A,B,C} and export Numeric. |
| python/flydsl/expr/primitive.py | Thread stages through mma_make_fragment Python wrapper. |
| python/flydsl/expr/derived.py | Add make_tiled_copy_tv helper and export it. |
| lib/Dialect/Fly/Transforms/LayoutLowering.cpp | Change MmaMakeFragmentOp lowering to allocate directly from inferred static layout. |
| lib/Dialect/Fly/IR/FlyOps.cpp | Implement stages handling in MmaMakeFragmentOp return type inference. |
| include/flydsl/Dialect/Fly/IR/FlyOps.td | Add optional stages attribute and assembly format to the op definition. |
| examples/04-preshuffle_gemm.py | Use stages=2 for B fragment allocation and minor runtime/validation tweaks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist