Skip to content

[Codegen] Create scf.forall -> scf.for pass - #20962

Merged
hanhanW merged 7 commits into
iree-org:mainfrom
AaronStGeorge:stgeorge-aaron/cpu-tile-using-forall_2/4
Jun 4, 2025
Merged

hanhanW merged 7 commits into
iree-org:mainfrom
AaronStGeorge:stgeorge-aaron/cpu-tile-using-forall_2/4

Conversation

@AaronStGeorge

Copy link
Copy Markdown
Contributor

This PR is part of a larger change moving LLVMCPUTileRootAndFuseProducerConsumer's tiling of parallel dimensions to use scf.forall rather than scf.for; allowing us to take advantage of some canonicalization patterns available on scf.forall. The patterns available prevent redundant stack allocations seen in #20792. Tiling parallel dimensions with scf.forall rather than scf.for could also be said to be semantically cleaner.

As part of that change, the pipeline will need to moved the tiled scf.forall back to a scf.for as later stages expect scf.for. This PR introduces a pass to do the conversion.

PR 2/4 addressing #20792

This PR is part of a larger change moving `LLVMCPUTileRootAndFuseProducerConsumer`'s tiling of parallel dimensions to use `scf.forall` rather than `scf.for`; allowing us to take advantage of some canonicalization patterns available on scf.forall. The patterns available prevent redundant stack allocations seen in iree-org#20792. Tiling parallel dimensions with `scf.forall` rather than `scf.for` could also be said to be semantically cleaner.

As part of that change, the pipeline will need to moved the tiled `scf.forall` back to a `scf.for` as later stages expect `scf.for`. This PR introduces a pass to do the conversion.

PR 2/4 addressing iree-org#20792
@AaronStGeorge
AaronStGeorge requested a review from hanhanW as a code owner May 30, 2025 19:48
@AaronStGeorge
AaronStGeorge requested a review from pashu123 May 30, 2025 19:48

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

Nits

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

Some NITs. But LGTM! I'll wait for @hanhanW review.

@hanhanW
hanhanW enabled auto-merge (squash) June 4, 2025 17:18
@hanhanW
hanhanW merged commit 5be08ff into iree-org:main Jun 4, 2025
@AaronStGeorge
AaronStGeorge deleted the stgeorge-aaron/cpu-tile-using-forall_2/4 branch June 4, 2025 17:44
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
This PR is part of a larger change moving
`LLVMCPUTileRootAndFuseProducerConsumer`'s tiling of parallel dimensions
to use `scf.forall` rather than `scf.for`; allowing us to take advantage
of some canonicalization patterns available on scf.forall. The patterns
available prevent redundant stack allocations seen in #20792. Tiling
parallel dimensions with `scf.forall` rather than `scf.for` could also
be said to be semantically cleaner.

As part of that change, the pipeline will need to moved the tiled
`scf.forall` back to a `scf.for` as later stages expect `scf.for`. This
PR introduces a pass to do the conversion.

PR 2/4 addressing #20792

---------

Co-authored-by: Prashant Kumar <[email protected]>
Co-authored-by: Han-Chung Wang <[email protected]>
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.

3 participants