Skip to content

[Codegen] Distribute workgroups along X dim - #21334

Merged
Max191 merged 3 commits into
iree-org:mainfrom
Max191-agents:linearize-wgs-on-x
Jul 15, 2025
Merged

Max191 merged 3 commits into
iree-org:mainfrom
Max191-agents:linearize-wgs-on-x

Conversation

@Max191

@Max191 Max191 commented Jul 10, 2025

Copy link
Copy Markdown
Contributor

Sets the default workgroup distribution to only use the X dim, and delinearize all IDs from it. This prevents bugs with trying to use too many workgroups along Y/Z, which have smaller maximum workgroup counts.

@kuhar kuhar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add a test for this?

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator

Wait, how come no tests broke?

@Max191

Max191 commented Jul 11, 2025

Copy link
Copy Markdown
Contributor Author

I guess we don't have any pipeline tests for anything after LLVMGPULowerExecutableTarget (our lit tests use the pass option, not the dev flag). I'll see if I can add some tests for this.

@MaheshRavishankar MaheshRavishankar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Max191

Max191 commented Jul 11, 2025

Copy link
Copy Markdown
Contributor Author

Something is off here. I would have expected https://github.com/iree-org/iree/blob/main/compiler/src/iree/compiler/Codegen/Common/test/reconcile_translation_info.mlir tests to be changed. I dont think this is working as expected.

This PR only changes the flag in Passes.cpp. That lit test creates its own pass pipeline, without the pass option set to distribute from X.

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator

Something is off here. I would have expected https://github.com/iree-org/iree/blob/main/compiler/src/iree/compiler/Codegen/Common/test/reconcile_translation_info.mlir tests to be changed. I dont think this is working as expected.

This PR only changes the flag in Passes.cpp. That lit test creates its own pass pipeline, without the pass option set to distribute from X.

Oh I see what happened. Ok, can we change the default in the pass also then?

@Max191
Max191 force-pushed the linearize-wgs-on-x branch from a8bbf4a to 7c3f9d9 Compare July 14, 2025 15:07
@Max191
Max191 requested a review from hanhanW as a code owner July 14, 2025 15:07
@@ -1,4 +1,4 @@
// RUN: iree-opt --split-input-file --pass-pipeline="builtin.module(hal.executable(hal.executable.variant(iree-codegen-reconcile-translation-info, canonicalize, cse)))" %s --verify-diagnostics --allow-unregistered-dialect | FileCheck %s
// RUN: iree-opt --split-input-file --pass-pipeline="builtin.module(hal.executable(hal.executable.variant(iree-codegen-reconcile-translation-info{distribute-along=z}, canonicalize, cse)))" %s --verify-diagnostics --allow-unregistered-dialect | FileCheck %s

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am sorry, I know you are trying to avoid the pain of changing lit tests, but if we are making x the default, then this file should change accordingly. Otherwise it leads to a testing gap cause the default path wont be as tested as a non-default path.

@MaheshRavishankar MaheshRavishankar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clicked approve by mistake

@Max191
Max191 force-pushed the linearize-wgs-on-x branch from 7c3f9d9 to c74864b Compare July 15, 2025 16:52

@MaheshRavishankar MaheshRavishankar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice! Thanks!! Now I can wrap up the split-k work on top of this

@Max191
Max191 merged commit 1ad18f4 into iree-org:main Jul 15, 2025
@Max191
Max191 deleted the linearize-wgs-on-x branch July 15, 2025 19:29
Max191 added a commit that referenced this pull request Jul 16, 2025
…#21137)" (#21382)

Undo the revert of
887d75a
and
7f35ecf
now that the failure is fixed by
#21334

Signed-off-by: Max Dawkins <[email protected]>
IanWood1 pushed a commit to IanWood1/iree that referenced this pull request Jul 18, 2025
Sets the default workgroup distribution to only use the X dim, and
delinearize all IDs from it. This prevents bugs with trying to use too
many workgroups along Y/Z, which have smaller maximum workgroup counts.

---------

Signed-off-by: Max Dawkins <[email protected]>
IanWood1 pushed a commit to IanWood1/iree that referenced this pull request Jul 18, 2025
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
Sets the default workgroup distribution to only use the X dim, and
delinearize all IDs from it. This prevents bugs with trying to use too
many workgroups along Y/Z, which have smaller maximum workgroup counts.

---------

Signed-off-by: Max Dawkins <[email protected]>
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
…#21137)" (#21382)

Undo the revert of
887d75a
and
7f35ecf
now that the failure is fixed by
#21334

Signed-off-by: Max Dawkins <[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.

4 participants