Skip to content

Comments

[water] replace ReadWriteBoundsAttr with SymbolMappingAttr, NFC#930

Merged
ftynse merged 2 commits intomainfrom
users/ftynse/replace-bounds
Feb 20, 2026
Merged

[water] replace ReadWriteBoundsAttr with SymbolMappingAttr, NFC#930
ftynse merged 2 commits intomainfrom
users/ftynse/replace-bounds

Conversation

@ftynse
Copy link
Contributor

@ftynse ftynse commented Feb 19, 2026

This removes one level of indirection when accessing the bounds attribute and another level of indirection in using context-uniqued WaveSymbolAttr instead of raw strings.

Partially supersedes #730

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR replaces WaveReadWriteBoundsAttr with WaveSymbolMappingAttr to simplify access to bounds attributes and use context-uniqued WaveSymbolAttr instead of raw strings for dictionary keys.

Changes:

  • Renamed WaveReadWriteBoundsAttr to WaveSymbolMappingAttr throughout the codebase
  • Changed attribute storage from dictionary-based (string keys) to parallel arrays of symbol attributes and expression lists
  • Updated Python bindings to support dict-like access with __getitem__, __len__, and __contains__ methods

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
wave_lang/kernel/wave/mlir_converter/water_emitter.py Updated attribute creation to use WaveSymbolMappingAttr
wave_lang/kernel/wave/mlir_converter/fx_emitter.py Updated import and conversion function to iterate over new attribute structure
water/test/Dialect/Wave/python_bindings.py Updated tests to use new attribute name and added tests for dict-like access methods
water/test/Dialect/Wave/ops.mlir Updated MLIR test syntax from read_write_bounds to symbol_mapping with @ symbol prefix
water/test/Dialect/Wave/ops-invalid.mlir Updated error test cases to use new attribute syntax and removed obsolete test
water/test/Dialect/Wave/lower-wave-to-mlir.mlir Updated MLIR lowering tests to use new attribute syntax
water/python/WaterExtensionNanobind.cpp Rewrote Python bindings to use parallel arrays instead of dictionary, added dict-like access methods
water/lib/Dialect/Wave/Transforms/LowerReadWriteOps.cpp Updated to use lookup method on new attribute structure
water/lib/Dialect/Wave/IR/WaveOps.cpp Simplified verification logic to work with symbol attributes instead of strings
water/lib/Dialect/Wave/IR/WaveAttrs.cpp Added builder method for WaveSymbolMappingAttr
water/lib/CAPI/Dialects.cpp Rewrote C API functions to use parallel arrays and provide lookup functionality
water/include/water/c/Dialects.h Updated C API declarations with new function signatures
water/include/water/Dialect/Wave/IR/WaveOps.td Changed attribute type references in operation definitions
water/include/water/Dialect/Wave/IR/WaveAttrs.td Removed WaveReadWriteBoundsAttr definition and enhanced WaveSymbolMappingAttr
lit_tests/kernel/wave/mlir_converter.py Updated test expectations for new attribute syntax

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@martin-luecke martin-luecke left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@martin-luecke martin-luecke left a comment

Choose a reason for hiding this comment

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

adding a few more nits

Base automatically changed from users/ftynse/symbol-mapping-attr to main February 20, 2026 12:45
This removes one level of indirection when accessing the bounds
attribute and another level of indirection in using context-uniqued
WaveSymbolAttr instead of raw strings.

Signed-off-by: Alex Zinenko <git@ozinenko.com>
- fix naming nits
- add support for string inclusion checks in py bindings
- avoid exceptions in py bindings on happy path
- beef up py bindings tests

Signed-off-by: Alex Zinenko <git@ozinenko.com>
@ftynse ftynse force-pushed the users/ftynse/replace-bounds branch from 3735e83 to 7abf646 Compare February 20, 2026 13:03
@ftynse ftynse merged commit 3cd7968 into main Feb 20, 2026
15 checks passed
@ftynse ftynse deleted the users/ftynse/replace-bounds branch February 20, 2026 14:15
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