Skip to content

Explicit stores, cb lifetime ops, and side-effect-only loops#314

Open
zoecarver wants to merge 11 commits intomainfrom
zoecarver/new-lowering-strategy
Open

Explicit stores, cb lifetime ops, and side-effect-only loops#314
zoecarver wants to merge 11 commits intomainfrom
zoecarver/new-lowering-strategy

Conversation

@zoecarver
Copy link
Contributor

@zoecarver zoecarver commented Feb 13, 2026

This reworks the lowering pipeline so that stores and cb lifetime ops are explicit from Python all the way down, and loops don't carry dead tensor dataflow.

  • ttl.store / ttl.tile_store split: The old ttl.store is renamed to ttl.tile_store (tile-level, lives inside compute bodies). A new tensor-level ttl.store is added, emitted directly by Python's o.store(result). This means the user's store intent is in the IR from the start rather than being reconstructed later from yields.
  • LowerStoreToCompute pattern: convert-ttl-to-compute now has a pattern that finds each ttl.store, locates the compute op that produces its input, and sinks to a ttl.tile_store in a ttl.compute block (this is the same logic we use to fuse eltwise ops).
  • TTLInsertTileRegsSync no longer walks yields, scans for reserves, or synthesizes stores. It just inserts acquire/commit/wait/release around the existing tile_store ops. Went from ~250 lines of store inference down to straightforward insertion logic.
  • Side-effect-only loops: ConvertTTLComputeToSCF generates scf.for without iter_args for outputs. No tensor.insert, no yielding updated tensors. Stores are explicit side effects via tile_store. This also simplifies ConvertTTLToTTKernel cleanup since there are no tensor.insert ops to tear down anymore.
  • DST assignment refactored: TTLAssignDST now inserts all copy_tile ops at the block start (reverse arg order) via a shared createCopyTileForArg utility, instead of inserting at first-use with duplicated allocation logic.

@zoecarver zoecarver changed the title [draft] New lowering strategy Explicit stores, cb lifetime ops, and side-effect-only loops Feb 13, 2026
@zoecarver zoecarver marked this pull request as ready for review February 13, 2026 18:31
@zoecarver zoecarver requested a review from a team as a code owner February 13, 2026 18:31
@zoecarver zoecarver force-pushed the zoecarver/new-lowering-strategy branch from 30b4850 to 464f5fd Compare February 13, 2026 19:13
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.

1 participant