Repository navigation
[DT] Implement LayoutMaterializerAttr for identity resolver. - #22337
Conversation
Signed-off-by: hanhanW <[email protected]>
Signed-off-by: hanhanW <[email protected]>
| if (!type.doesSliceSpanWholeTensor(dynamicDims, offsets, sizes, strides)) { | ||
| return failure(); | ||
| } |
There was a problem hiding this comment.
I don't see how we can drop this check? If this is not checked, the below implementation is incorrect?
There was a problem hiding this comment.
By the definition of the attribute, it does not transform any dimension, so we can safely use the same offsets/sizes/strides. However, I failed to add a test because we still have such checks in load/store ops lowering. The patterns already deny partial load/store, so we don't really need the check.
I think the check is required for data-tiling, but not identity resolver and maybe padding resolver.
The partial slice check should belong to interface implementation, IMO. I want to move the checks to data-tiling resolvers in a follow-up; then we can add the tests.
I can add the check back for now, if it makes you more comfortable. My point is that the definition allows the change. Both look okay to me, as the patterns already have the check.
There was a problem hiding this comment.
The patterns already deny partial load/store, so we don't really need the check.
The materialization patterns do, but those are users of these interface functions, and I think it's generally more robust to put the check in the implementations themselves. From the definition of this interface method, it is possible to provide a slice through offsets, sizes and strides and by removing this check, we actually disregard those parameters and pretend it's always a whole tensor slice :
Returns success if materialized
newOffsets,newSizesand
newStridescan be calculated and set for the slice specified by
offsets,sizesandstrideson the dispatch tensortypewith
potentialdynamicDimssizes.
The partial slice check should belong to interface implementation, IMO.
This is the implementation for the IdentityResolverAttr of the getOffsetSizesStrides interface method right? So, I think the check belongs here. If we remove them anywhere (which wouldn't even advocate), it should be in the users (materialization patterns in this case).
There was a problem hiding this comment.
I think we all agree that the check belongs to interface implementations, and my point is that it can be dropped naturally based on the resolver definition. So let me add the check back, as I can't add a test now. I'll do it in a follow-up that moves the check from patterns to implementation, drop the check and add the test.
Signed-off-by: hanhanW <[email protected]>
Max191
left a comment
There was a problem hiding this comment.
nit about the title: Maybe [DT] Implement LayoutMaterializerAttr for identity resolver instead?
Also, do we have e2e tests for the identity layout encodings (or lit tests)?
I forgot to answer the question. Yes, we have lit tests in specialize_encodings.mlir, materialize_encoding_into_nop.mlir and a new test case in We also have e2e tests in vulkan, cuda and any backend that don't support data-tiling, because the default is using the resolver to drop the encodings. It will need further setup to expose the identity resolver option to data-tiling, but it violates the purpose of using data-tiling: if you don't want it, please don't enable it. |
…g#22337) The identity resolver is one of the basic encoding resolvers that drops encodings. The revision implements the interface and retires the IREE::Codegen::EncodingNopLayoutAttr. Fixes iree-org#20846 --------- Signed-off-by: hanhanW <[email protected]>
The identity resolver is one of the basic encoding resolvers that drops encodings. The revision implements the interface and retires the IREE::Codegen::EncodingNopLayoutAttr.
Fixes #20846