[all-commits] [llvm/llvm-project] a5d09c: [mlir][scf] Implement BufferizableOpInterface for ...

Matthias Springer via All-commits all-commits at lists.llvm.org
Fri May 6 01:28:54 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a5d09c637261252393a015e7858efd85c9166e32
  Author: Matthias Springer <springerm at google.com>
  Date:   2022-05-06 (Fri, 06 May 2022)

  Changed paths:
    M mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
    M mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize-invalid.mlir
    M mlir/test/Dialect/SCF/one-shot-bufferize.mlir

  Log Message:
  [mlir][scf] Implement BufferizableOpInterface for scf::WhileOp

This follows the same implementation strategy as scf::ForOp and common functionality is extracted into helper functions.

This implementation works well in cases where each yielded value (from either body/condition region) is equivalent to the corresponding bbArg of the parent block. In that case, each OpResult of the loop may be aliasing with the corresponding OpOperand of the loop (and with no other OpOperand).

In the absence of said equivalence relationship, new buffer copies must be inserted, so that the aliasing OpOperand/OpResult contract of scf::WhileOp is honored. In essence, by yielding a newly allocated buffer, we can enforce the specified may-alias relationship. (Newly allocated buffers cannot alias with any OpOperands of the loop.)

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

More information about the All-commits mailing list