[all-commits] [llvm/llvm-project] d31a6d: [mlir][bufferization] Add bufferization.copy_tenso...

Matthias Springer via All-commits all-commits at lists.llvm.org
Tue Jun 27 05:58:41 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d31a6dfbc0a9b259e365b3748bf142884b6fabe5
      https://github.com/llvm/llvm-project/commit/d31a6dfbc0a9b259e365b3748bf142884b6fabe5
  Author: Matthias Springer <me at m-sp.org>
  Date:   2023-06-27 (Tue, 27 Jun 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
    M mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp
    M mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize.mlir
    M mlir/test/Dialect/Bufferization/invalid.mlir
    M mlir/test/Dialect/Bufferization/ops.mlir

  Log Message:
  -----------
  [mlir][bufferization] Add bufferization.copy_tensor op

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.

Differential Revision: https://reviews.llvm.org/D153552




More information about the All-commits mailing list