[mlir][Linalg] Add a polymorphic linalg.copy operation
authorNicolas Vasilache <ntv@google.com>
Tue, 8 Mar 2022 17:40:12 +0000 (12:40 -0500)
committerNicolas Vasilache <ntv@google.com>
Tue, 8 Mar 2022 17:52:51 +0000 (12:52 -0500)
commiteb6a3c0c0c71ab44141e71112ecd0a2ae2848037
tree9065269e906dc28810dd6b29dfb157c0a8fc4df9
parent550b2eaaa6e402ce664fe55c038e5fe387258af7
[mlir][Linalg] Add a polymorphic linalg.copy operation

With the recent improvements to OpDSL it is cheap to reintroduce a linalg.copy operation.

This operation is needed in at least 2 cases:
  1. for copies that may want to change the elemental type (e.g. cast, truncate, quantize, etc)
  2. to specify new tensors that should bufferize to a copy operation. The linalg.generic form
     always folds away which is not always the right call.

Differential Revision: https://reviews.llvm.org/D121230
mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml
mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py
mlir/test/Dialect/Linalg/generalize-named-polymorphic-ops.mlir