Skip to content

[DispatchCreation] Propagate tensor encodings outside dispatch regions - #24966

Merged
maxbartel merged 2 commits into
mainfrom
users/maxbartel/layout/propagate-tensor-encodings
Oct 6, 2026
Merged

maxbartel merged 2 commits into
mainfrom
users/maxbartel/layout/propagate-tensor-encodings

Conversation

@maxbartel

@maxbartel maxbartel commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Encoding propagation is currently tied to dispatch hoisting, which prevents layout assignment from using the same rewrite rules on the surrounding tensor graph.

Separate where propagation may happen from the rewrites themselves, and add the function pass iree-dispatch-creation-propagate-data-tiling-encodings for propagation outside dispatches. Hoisting keeps its existing behavior. The new pass stops at existing dispatches and block boundaries, and constant CSE stays disabled because Flow regions do not materialize constants themselves.

  • iree-dispatch-creation-propagate-encodings runs in the dispatch-time data-tiling pipeline and only swaps set_encoding with tensor.cast producers, so adding these rewrites to it would change that pipeline. They stay separate until bubbling through generic ops goes through the encoding propagation interfaces (TODO(RFC: Encoding Propagation Interfaces #20179)).
  • Bubbling now stops at set_encoding ops whose encoding is not an EncodingAttr, such as #iree_encoding.padding, instead of crashing. iree-dispatch-creation-hoist-encoding-ops could already hit this within dispatches; both passes have a regression test.

No pipeline runs the new pass yet. #24969 adds it to the experimental early data-tiling route.

This is one of five PRs adding an experimental CPU path that materializes data-tiling layouts before dispatch creation, so that linalg.mmt4d and data-tiled convolutions fuse with their elementwise epilogues and result unpacks.

Assisted by AI.

@maxbartel
maxbartel added this pull request to stack #24970 September 28, 2026 16:31
@maxbartel
maxbartel marked this pull request as ready for review September 28, 2026 17:04
@maxbartel
maxbartel force-pushed the users/maxbartel/layout/propagate-tensor-encodings branch from 1b8d6bb to ac661a8 Compare September 29, 2026 08:33
Base automatically changed from users/maxbartel/layout/collapse-contraction-dimensions to main October 5, 2026 12:38
@maxbartel
maxbartel force-pushed the users/maxbartel/layout/propagate-tensor-encodings branch from ac661a8 to 9b258b1 Compare October 5, 2026 12:39
@jschuhmacher
jschuhmacher self-requested a review October 5, 2026 14:44

@phemashekar phemashekar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks Max! Mostly looks good to me, just some nits :)

maxbartel and others added 2 commits October 6, 2026 14:38
Encoding propagation is currently tied to dispatch hoisting, which
prevents layout assignment from using the same rewrite rules on the
surrounding tensor graph.

Separate where propagation may happen from the rewrites themselves and
add a function pass for propagation outside dispatches. Keep the
existing hoisting behavior, and stop at existing dispatches and block
boundaries.

iree-dispatch-creation-propagate-encodings runs in the dispatch-time
data-tiling pipeline and only swaps set_encoding ops with tensor.cast
producers, so adding these rewrites to it would change that pipeline.
Keep them separate until propagation through generic ops goes through
the encoding propagation interfaces.

Also stop bubbling set_encoding ops whose encoding is not an
EncodingAttr, such as a padding encoding, instead of crashing. Hoisting
already reached this within dispatches.

No pipeline runs the new pass yet. A follow-up adds it to an
experimental route that assigns and materializes data-tiling layouts
before dispatch formation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
iree-dispatch-creation-propagate-data-tiling-encodings was hard to tell
apart from iree-dispatch-creation-propagate-encodings. Both run outside
dispatches; the difference is that the new pass moves encodings through
linalg.generic ops, while the existing one only swaps set_encoding ops
with tensor.cast producers. Rename it to
iree-dispatch-creation-propagate-encodings-through-generic-ops and keep
its definition next to the existing pass.

Test that propagation does not cross the boundary of an existing
dispatch region in either direction, and describe the expectations in
terms of dispatch regions rather than early and late placement.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@maxbartel
maxbartel force-pushed the users/maxbartel/layout/propagate-tensor-encodings branch from 9b258b1 to 229f0a2 Compare October 6, 2026 14:03
@maxbartel
maxbartel requested a review from phemashekar October 6, 2026 14:05

@phemashekar phemashekar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@maxbartel
maxbartel merged commit 466f8d3 into main Oct 6, 2026
80 of 88 checks passed
@maxbartel
maxbartel deleted the users/maxbartel/layout/propagate-tensor-encodings branch October 6, 2026 17:52
@devtbi devtbi mentioned this pull request Oct 19, 2026
7 of 8 tasks
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