Skip to content

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

Open
maxbartel wants to merge 1 commit into
layout/collapse-contraction-dimensionsfrom
layout/propagate-tensor-encodings
Open

maxbartel wants to merge 1 commit into
layout/collapse-contraction-dimensionsfrom
layout/propagate-tensor-encodings

Conversation

@maxbartel

@maxbartel maxbartel commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

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 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.

Stack. 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. Each PR is based on the previous one; please review only its own commit.

  1. [DispatchCreation] Normalize contraction dimensions outside dispatches #1 Normalize contraction dimensions outside dispatches
  2. [DispatchCreation] Propagate tensor encodings outside dispatch regions #2 Propagate tensor encodings outside dispatch regions
  3. [DispatchCreation] Fuse packed contractions with epilogues and unpack #3 Fuse packed contractions with epilogues and unpack
  4. [DispatchCreation] Preserve the target of materialized tensor layouts #4 Preserve the target of materialized tensor layouts
  5. [GlobalOptimization] Add target-aware layout materialization #5 Add target-aware layout materialization (--iree-opt-experimental-early-data-tiling)

Validation. bazel test //compiler/src/iree/compiler/DispatchCreation/test:all passes (53/53) at this commit. The new bubble and sink tests across an scf.if fail when the same-block check is removed.

Built and tested with Bazel on macOS arm64 (Apple M3 Max). Two local-only flags work around toolchain issues on that machine that are unrelated to this stack: --features=-layering_check and a linker wrapper for -Wl,--fatal-warnings, which Apple ld rejects.

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
@maxbartel
maxbartel force-pushed the layout/propagate-tensor-encodings branch from 1b8d6bb to ac661a8 Compare September 29, 2026 08:33
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