[all-commits] [llvm/llvm-project] 57fe7f: [mlir][Linalg] Add support for scf::ForOp in compr...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Thu Jun 24 08:04:41 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 57fe7fd37dcd1f144f600976b3f33d5d792e89fd
      https://github.com/llvm/llvm-project/commit/57fe7fd37dcd1f144f600976b3f33d5d792e89fd
  Author: Nicolas Vasilache <nicolas.vasilache at gmail.com>
  Date:   2021-06-24 (Thu, 24 Jun 2021)

  Changed paths:
    M mlir/include/mlir/Dialect/SCF/SCFOps.td
    M mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
    A mlir/test/Dialect/Linalg/comprehensive-func-bufferize-analysis-invalid.mlir
    M mlir/test/Dialect/Linalg/comprehensive-func-bufferize-analysis.mlir
    M mlir/test/Dialect/Linalg/comprehensive-func-bufferize.mlir

  Log Message:
  -----------
  [mlir][Linalg] Add support for scf::ForOp in comprehensive bufferization (7/n)

scf::ForOp bufferization analysis proceeds just like for any other op (including FuncOp) at its boundaries; i.e. if:

1. The tensor operand is inplaceable.
2. The matching result has no subsequent read (i.e. all reads dominate the scf::ForOp).
3. In  and does not create a RAW interference.

then it can bufferize inplace.

Still there are a few differences:

1. bbArgs for an scf::ForOp are always considered inplaceable when seen from ops inside the body. This is because a) either the matching tensor operand is not inplaceable and an alloc will be inserted (which makes bbArg itself inplaceable); or b) the tensor operand and bbArg are both already inplaceable.
2. Bufferization within the scf::ForOp body has implications to the outside world : the scf.yield terminator may well ping-pong values of the same type. This muddies the water for alias analysis and is not supported atm. Such cases result in a pass failure.

Differential revision: https://reviews.llvm.org/D104490




More information about the All-commits mailing list