[all-commits] [llvm/llvm-project] 52b0fe: [mlir] Add func-bufferize pass.

Sean Silva via All-commits all-commits at lists.llvm.org
Mon Nov 2 12:49:14 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 52b0fe64045d3fbbb7604f70066ac91970da612f
      https://github.com/llvm/llvm-project/commit/52b0fe64045d3fbbb7604f70066ac91970da612f
  Author: Sean Silva <silvasean at google.com>
  Date:   2020-11-02 (Mon, 02 Nov 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.h
    M mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.td
    M mlir/include/mlir/Transforms/Bufferize.h
    M mlir/lib/Dialect/StandardOps/Transforms/CMakeLists.txt
    A mlir/lib/Dialect/StandardOps/Transforms/FuncBufferize.cpp
    M mlir/lib/Transforms/Bufferize.cpp
    A mlir/test/Dialect/Standard/func-bufferize.mlir

  Log Message:
  -----------
  [mlir] Add func-bufferize pass.

This is the most basic possible finalizing bufferization pass, which I
also think is sufficient for most new use cases. The more concentrated
nature of this pass also greatly clarifies the invariants that it
requires on its input to safely transform the program (see the
pass description in Passes.td).

With this pass, I have now upstreamed practically all of the
bufferizations from npcomp (the exception being std.constant, which can
be upstreamed when std.global_memref lands:
https://llvm.discourse.group/t/rfc-global-variables-in-mlir/2076/16 )

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


  Commit: 773ad135a30dbe0f969086e3ed518ab17502e9f5
      https://github.com/llvm/llvm-project/commit/773ad135a30dbe0f969086e3ed518ab17502e9f5
  Author: Sean Silva <silvasean at google.com>
  Date:   2020-11-02 (Mon, 02 Nov 2020)

  Changed paths:
    R mlir/test/Transforms/buffer-placement-preparation-allowed-memref-results.mlir
    R mlir/test/Transforms/buffer-placement-preparation.mlir
    A mlir/test/Transforms/finalizing-bufferize-allowed-memref-results.mlir
    A mlir/test/Transforms/finalizing-bufferize.mlir
    M mlir/test/lib/Transforms/CMakeLists.txt
    R mlir/test/lib/Transforms/TestBufferPlacement.cpp
    A mlir/test/lib/Transforms/TestFinalizingBufferize.cpp
    M mlir/tools/mlir-opt/mlir-opt.cpp

  Log Message:
  -----------
  [mlir][Bufferize] Rename TestBufferPlacement to TestFinalizingBufferize

BufferPlacement is no longer part of bufferization. However, this test
is an important test of "finalizing" bufferize passes.
A "finalizing" bufferize conversion is one that performs a "full"
conversion and expects all tensors to be gone from the program. This in
particular involves rewriting funcs (including block arguments of the
contained region), calls, and returns. The unique property of finalizing
bufferization passes is that they cannot be done via a local
transformation with suitable materializations to ensure composability
(as other bufferization passes do). For example, if a call is
rewritten, the callee needs to be rewritten otherwise the IR will end up
invalid. Thus, finalizing bufferization passes require an atomic change
to the entire program (e.g. the whole module).

This new designation makes it clear also that it shouldn't be testing
bufferization of linalg ops, so the tests have been updated to not use
linalg.generic ops. (linalg.copy is still used as the "copy" op for
copying into out-params)

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


Compare: https://github.com/llvm/llvm-project/compare/395c8bed6450...773ad135a30d


More information about the All-commits mailing list