Skip to content

[FEAT] Add get_leaves op and support convert dyn_tuple to py_tuple#391

Merged
coderfeli merged 2 commits intomainfrom
pr/feat-get-leaves
Apr 13, 2026
Merged

[FEAT] Add get_leaves op and support convert dyn_tuple to py_tuple#391
coderfeli merged 2 commits intomainfrom
pr/feat-get-leaves

Conversation

@sjfeng1999
Copy link
Copy Markdown
Collaborator

@sjfeng1999 sjfeng1999 commented Apr 13, 2026

close #323

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new fly.get_leaves/GetLeavesOp that lowers !fly.int_tuple leaves into SSA values (optionally only dynamic leaves), and updates the Python frontend to reconstruct Python tuples from dynamic IntTuple values.

Changes:

  • Add GetLeavesOp to the Fly dialect (variadic i32/i64 results, dynamicOnly attr) and implement return-type inference.
  • Implement GetLeavesOp lowering in fly-layout-lowering and add MLIR tests for both “all leaves” and “dynamic-only” modes.
  • Update Python IntTuple.to_py_value() and related helpers/APIs to support dynamic tuples, and refresh the tiled-copy example to use make_layout_tv.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/mlir/Transforms/layout_lowering.mlir Adds FileCheck coverage for GetLeavesOp lowering behavior.
python/flydsl/expr/typing.py Implements dynamic IntTuple.to_py_value() reconstruction via get_leaves.
python/flydsl/expr/primitive.py Updates get_leaves wrapper to use GetLeavesOp; adds tuple→tile conversions for tiled ops.
python/flydsl/expr/derived.py Updates make_layout_tv to require static layouts and return Python values for tile sizes.
lib/Dialect/Fly/Transforms/LayoutLowering.cpp Adds GetLeavesLowering rewrite pattern.
lib/Dialect/Fly/IR/FlyOps.cpp Implements GetLeavesOp return-type inference.
include/flydsl/Dialect/Fly/IR/FlyOps.td Updates GetLeavesOp signature (attr + variadic results).
examples/02-tiledCopy.py Switches example to use make_layout_tv output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread python/flydsl/expr/primitive.py Outdated
Comment thread lib/Dialect/Fly/Transforms/LayoutLowering.cpp
Comment thread lib/Dialect/Fly/Transforms/LayoutLowering.cpp
Comment thread lib/Dialect/Fly/IR/FlyOps.cpp
Comment thread python/flydsl/expr/typing.py
@coderfeli coderfeli merged commit c5d83df into main Apr 13, 2026
9 checks passed
@coderfeli coderfeli deleted the pr/feat-get-leaves branch April 13, 2026 12:18
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.

[Issue]: make_layout_tv API fails due to compilation issue

3 participants