This is an archive of the discontinued LLVM Phabricator instance.

[mlir][bufferization] Add bufferization.copy_tensor op
ClosedPublic

Authored by springerm on Jun 22 2023, 7:45 AM.

Details

Summary

This operation is a "copy" operation on tensors. It is guaranteed to bufferize to a memcpy. This is different from "tensor.insert_slice", which may fold away.

Note: There is a symmetry between certain tensor, bufferization and memref ops:

  • tensor.empty, bufferization.alloc_tensor, memref.alloc
  • (none), bufferization.dealloc_tensor, memref.dealloc
  • tensor.insert_slice, bufferization.copy_tensor, memref.copy

Tensor ops can generally canonicalize/fold away, while bufferization dialect ops can be used when a certain side effect is expected to materialize; so they do not fold away.

Depends On: D153514

Diff Detail

Event Timeline

springerm created this revision.Jun 22 2023, 7:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 7:45 AM
springerm requested review of this revision.Jun 22 2023, 7:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2023, 7:46 AM
nicolasvasilache accepted this revision.Jun 27 2023, 5:42 AM
This revision is now accepted and ready to land.Jun 27 2023, 5:42 AM
This revision was automatically updated to reflect the committed changes.