Skip to content

[LLVMGPU] Tile outer reduction dimensions in contraction config - #25044

Open
purnima-nlp wants to merge 1 commit into
iree-org:mainfrom
purnima-nlp:fix-llvmgpu-multi-reduction-tiling
Open

purnima-nlp wants to merge 1 commit into
iree-org:mainfrom
purnima-nlp:fix-llvmgpu-multi-reduction-tiling

Conversation

@purnima-nlp

Copy link
Copy Markdown
Contributor

LLVMGPU contraction configuration previously assigned the reduction tile size only to the last loop dimension, leaving outer reduction dimensions untiled. For contractions with multiple reduction dimensions, this could cause excessive IR expansion during vector lowering.

This PR uses the inferred contraction K dimensions to tile outer reduction dimensions with size 1, while preserving tileK for the innermost K dimension.

Changes

  • Tile outer K dimensions with size 1 to prevent excessive IR expansion.
  • Use inferred K indices instead of assuming the last loop dimension is a reduction dimension.
  • Add regression tests for multiple reduction dimensions, including interleaved parallel and reduction loops.

Results

For a contraction with reduction dimensions [128, 112, 112]:

  • Static math.fma operations:** Reduced from 14,336 to 1.
  • Expanded IR size:** Reduced from approximately 13.4 MB to 4.5 KB.

These measurements reflect compiler IR expansion, not GPU runtime performance.

Testing

  • Passed LLVMGPU SM80 configuration tests, including the new regression cases.
  • Passed existing specialized and generalized matmul configuration tests.
  • Verified small and large reproducers through reduction tiling, vectorization, and LLVMGPU vector lowering.
  • Verified the generated MLIR modules.

Fixes #25016.

@purnima-nlp
purnima-nlp force-pushed the fix-llvmgpu-multi-reduction-tiling branch from bdc78e0 to 84ad0a4 Compare November 25, 2026 06:22
@purnima-nlp

Copy link
Copy Markdown
Contributor Author

Hi, gentle ping on this PR.

This patch addresses excessive IR expansion during LLVMGPU vector lowering for contractions with multiple reduction dimensions, reducing the expanded IR size from approximately 13.4 MB to 4.5 KB in the reported reproducer.

All executed CI tests have passed. I'd appreciate a review when someone has bandwidth. Happy to address any feedback or concerns regarding the tiling strategy. Thanks!

This branch has not been deployed

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

[Codegen] LLVMGPU Untiled outer reduction dimensions cause excessive IR expansion

1 participant