-
Notifications
You must be signed in to change notification settings - Fork 25
[water] Support read/write lowering with MemRefType memory operands #686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
63918c8 to
4eb8d5c
Compare
|
|
Awesome, I hate it so much when having to introduce a new attribute solely to communicate this information. I think at this point we can have a normal form requiring all memory ops to have index attribute before getting to lowering pass instead of a rigid verification for memref-typed memory ops. WDYT? |
|
Normal forms are not free, neither cognitively nor in compile time. Do we have a situation where we want operations with memref types and without index expressions? If not, I'd rather not add complexity to the system to support that and have it either in the main verifier or in the resolved-distribution form. Separately, I think index expressions we compute follow the order of dimensions in shapes, but this is purely an artifact of the mechanics: we just happen follow the tensor shape in the loop computing the index expression. For index expressions converted from Python, this may not be guaranteed. So we may need to check/reorder them here, and potentially consider verifying this at some point. |
|
No I wanted to have a normal form that checks that index expressions are present for ALL memory ops in the IR, not only for memref-typed ones. This does not hold for IR before running index analysis, so we cannot just put it in the op verifier, right? Agreed on the second point. I guess then we'll need to ensure the order matches between index expressions and tensor shape WHEN creating the memory ops from Python. Then make sure that's still the case when resolving distributed allocation, rewriting memory ops to use memref types? |
We already have something:
|
4eb8d5c to
4cb62c3
Compare
After ResolveDistributedAllocations converts WaveTensorType to MemRefType, read/write ops need to determine dimension ordering for correct lowering. With IndexExprsSpecified as a precondition for LowerWaveToMLIR, read/write ops are guaranteed to have index expressions. Since DictAttr is internally an ArrayRef<NamedAttribute>, the index dictionary keys are ordered and can be used directly for dimension ordering. Signed-off-by: tyb0807 <[email protected]>
4cb62c3 to
0330807
Compare
After ResolveDistributedAllocations converts WaveTensorType to MemRefType,
read/write ops need to determine dimension ordering for correct lowering.
With IndexExprsSpecified as a precondition for LowerWaveToMLIR, read/write
ops are guaranteed to have index expressions. Since DictAttr is internally
an ArrayRef, the index dictionary keys are ordered and can
be used directly for dimension ordering.
Fixes #659.