This is an archive of the discontinued LLVM Phabricator instance.

[mlir][tensor] Realloc to bufferize ReshapeOp with non-identity layout.
Needs ReviewPublic

Authored by ingomueller-net on Jun 2 2023, 9:51 AM.

Details

Summary

tensor.reshape gets bufferized to memref.reshape, which requires its
operands to have statically known identity layout. The previous
implementation did this conversion blindly, so a tensor in non-identity
layout would be converted into a memref op that does not verify. This
patch extends the conversion such that an input that gets bufferized
into a non-identity layout gets copied into a new allocation, which can
then be reshaped.

Diff Detail

Event Timeline

ingomueller-net created this revision.Jun 2 2023, 9:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2023, 9:51 AM
ingomueller-net requested review of this revision.Jun 2 2023, 9:51 AM
ingomueller-net added inline comments.Jun 2 2023, 9:51 AM
mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
1006

I do not intend to work on this TODO as part of this patch.

@springerm: Is this patch completely obsolete now? Should we abandon it?