This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tensor] Fix verifier and bufferization of collapse_shape
ClosedPublic

Authored by springerm on Apr 7 2022, 8:46 AM.

Details

Summary

Insert a buffer copy unless the dims are guaranteed to be collapsible. In the verifier, accept collapses unless they are guaranteed to be non-collapsible.

Depends On D123369

Diff Detail

Event Timeline

springerm created this revision.Apr 7 2022, 8:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 8:46 AM
springerm requested review of this revision.Apr 7 2022, 8:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 8:46 AM
akuegel added inline comments.Apr 8 2022, 12:10 AM
mlir/test/Dialect/Tensor/bufferize.mlir
398

I am not sure, but isn't the cast actually wrong? It will cast it back to have the original affine map. But that affine map has already been taken into account when copying to the alloc. So after copying, only the identity map should be used when accessing the data.

springerm added inline comments.Apr 8 2022, 1:02 AM
mlir/test/Dialect/Tensor/bufferize.mlir
398

I am working on a commit that fixes this. In this particular test case, the cast is harmless because we are casting to the fully dynamic layout map. But you're right, this is actually wrong when casting to a specific layout map with static strides. I'll prepare the commit that eliminates these casts and then rebase this commit here on top of that one.

akuegel accepted this revision.Apr 8 2022, 2:16 AM
This revision is now accepted and ready to land.Apr 8 2022, 2:16 AM
This revision was landed with ongoing or failed builds.Apr 8 2022, 2:23 AM
This revision was automatically updated to reflect the committed changes.
springerm marked an inline comment as done.Apr 8 2022, 2:23 AM