Skip to content

[DispatchCreation] Normalize contraction dimensions outside dispatches - #24965

Merged
maxbartel merged 1 commit into
mainfrom
users/maxbartel/layout/collapse-contraction-dimensions
Oct 5, 2026
Merged

maxbartel merged 1 commit into
mainfrom
users/maxbartel/layout/collapse-contraction-dimensions

Conversation

@maxbartel

@maxbartel maxbartel commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Contractions with several contiguous M, N, K or batch dimensions can miss data-tiling encodings because dimension collapsing currently runs inside dispatches.

Add a function pass that reuses the existing collapse rules outside dispatches and restores the original tensor shapes at the op boundaries. Leave existing dispatches (regions and workgroups) and ops with a preset compilation info or lowering config alone, since those configurations refer to the original loops.

No pipeline runs the 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.

Contractions with several contiguous M, N, K or batch dimensions can
miss data-tiling encodings because dimension collapsing currently runs
inside dispatches.

Add a function pass that reuses the existing collapse rules outside
dispatches and restores the original tensor shapes at the boundaries.
Leave existing dispatches and operations with a preset compilation info
or lowering config alone.

No pipeline runs the 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]>
@maxbartel
maxbartel force-pushed the users/maxbartel/layout/collapse-contraction-dimensions branch from a8b799d to 5eca0c5 Compare September 29, 2026 08:33
@jschuhmacher

Copy link
Copy Markdown
Contributor

Thanks @maxbartel! LGTM

One question though, if I understand it correctly the CollapseDimensions pass that runs during dispatch creation considers producer and consumer compatibility, whereas this pass considers each contraction independently. Why do we not need to do that here?

@jschuhmacher
jschuhmacher self-requested a review October 5, 2026 12:18
@maxbartel

Copy link
Copy Markdown
Contributor Author

One question though, if I understand it correctly the CollapseDimensions pass that runs during dispatch creation considers producer and consumer compatibility, whereas this pass considers each contraction independently. Why do we not need to do that here?

CollapseDimensionsPass runs on dispatch regions that already exist. All the ops in a region have to agree on what to collapse or a reshape gets stuck inside the dispatch.

Outside dispatches there's no region yet, so each contraction can be collapsed on its own. SinkReshapes cleans up the reshapes afterwards.

@maxbartel
maxbartel merged commit 7fd5f9a into main Oct 5, 2026
58 of 60 checks passed
@maxbartel
maxbartel deleted the users/maxbartel/layout/collapse-contraction-dimensions branch October 5, 2026 12:38
@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