Skip to content

Comments

[water] Allow sparse bounds dictionaries in read/write wave MLIR ops#899

Merged
martin-luecke merged 3 commits intomainfrom
users/martin/bounds
Feb 20, 2026
Merged

[water] Allow sparse bounds dictionaries in read/write wave MLIR ops#899
martin-luecke merged 3 commits intomainfrom
users/martin/bounds

Conversation

@martin-luecke
Copy link
Contributor

@martin-luecke martin-luecke commented Feb 18, 2026

Relax the WaveReadWriteBoundsAttr verifier to accept sparse bounds dictionaries. The Python pipeline only stores bounds for dimensions that actually need out-of-bounds masking with downstream passes relying on this sparsity. Previously, the MLIR verifier required an entry for every tensor dimension, causing verification failures during emission.

  • Remove the "all dimensions required" check from the verifier.
  • Update buildMask in lowering to skip dimensions without a bounds entry instead of asserting.
  • Add lowering and round-trip tests for sparse bounds.
  • Remove generate_bounds_exprs, merge_contiguous_reads, and location_check_pass from the roundtrip expected_failures set.

@martin-luecke martin-luecke marked this pull request as draft February 18, 2026 13:48
@ftynse
Copy link
Contributor

ftynse commented Feb 18, 2026

We can also relax the MLIR modeling and allow for missing entries, in particular if it becomes too costly to maintain bounds or avoid producing unmasked loads when bounds are fully covered.

@martin-luecke martin-luecke force-pushed the users/martin/bounds branch 2 times, most recently from 666dd4d to 0e6e730 Compare February 20, 2026 09:32
@martin-luecke martin-luecke marked this pull request as ready for review February 20, 2026 09:51
Copy link
Contributor

@ftynse ftynse left a comment

Choose a reason for hiding this comment

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

Please update the PR name and description, unfortunately github doesn't when the branch is force-pushed and it will take the PR description for the squashed commit.

Comment on lines 556 to 559
Example:
```
#wave.read_write_bounds<{M = #wave.expr_list<[BLOCK_M] -> BLOCK_M * 2>}>
#wave.read_write_bounds<{M = #wave.expr_list<[#wave.symbol<"M">] -> (M)>}>
```
Copy link
Contributor

Choose a reason for hiding this comment

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

This is why I usually advise against putting examples in ODS: they bitrot faster than you blink. I had seen PRs where examples were already incorrect :) We can point to the test file for syntax example, but the assembly format below (which is normally included in the generated .md) should be descriptive enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed 👍

Signed-off-by: Martin Lücke <martin.luecke@amd.com>
Signed-off-by: Martin Lücke <martin.luecke@amd.com>
@martin-luecke martin-luecke changed the title Make generate_bounds_exprs produce complete bounds dicts [water] Allow sparse bounds dictionaries in read/write wave MLIR ops Feb 20, 2026
Signed-off-by: Martin Lücke <martin.luecke@amd.com>
@martin-luecke martin-luecke merged commit 1885d02 into main Feb 20, 2026
15 checks passed
@martin-luecke martin-luecke deleted the users/martin/bounds branch February 20, 2026 11:24
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