[all-commits] [llvm/llvm-project] 546834: [mlir][bufferization] Improve analysis for element...

Matthias Springer via All-commits all-commits at lists.llvm.org
Thu Aug 3 07:36:17 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 54683405532722b2e1c1677fbc18e2df69a05307
      https://github.com/llvm/llvm-project/commit/54683405532722b2e1c1677fbc18e2df69a05307
  Author: Matthias Springer <me at m-sp.org>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td
    M mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
    M mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp
    A mlir/test/Dialect/Linalg/one-shot-bufferize-analysis.mlir

  Log Message:
  -----------
  [mlir][bufferization] Improve analysis for element-wise operations

Before this change, two equivalent operands that bufferize to a memory read and write, respectively, were always conflicting. This change improves the analysis for ops that bufferize to element-wise access. Such ops can bufferize in-place, because an original element value is not needed anymore after computing and writing an updated element value.

This change allows ops such as the following one to bufferize in-place:
```
  %0 = linalg.elemwise_binary {fun = #linalg.binary_fn<add>}
      ins(%a, %b : tensor<5xf32>, tensor<5xf32>)
      outs(%a : tensor<5xf32>) -> tensor<5xf32>
```

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




More information about the All-commits mailing list