[all-commits] [llvm/llvm-project] c1fef4: [mlir][bufferization] Make `TensorCopyInsertionPas...

Matthias Springer via All-commits all-commits at lists.llvm.org
Fri Dec 2 06:39:41 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c1fef4e88ad461724f7454d7d8177f7fe30cf58c
      https://github.com/llvm/llvm-project/commit/c1fef4e88ad461724f7454d7d8177f7fe30cf58c
  Author: Matthias Springer <springerm at google.com>
  Date:   2022-12-02 (Fri, 02 Dec 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
    M mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
    M mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h
    M mlir/lib/Dialect/Bufferization/Transforms/TensorCopyInsertion.cpp
    M mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
    M mlir/lib/Dialect/SparseTensor/Transforms/CMakeLists.txt
    R mlir/lib/Dialect/SparseTensor/Transforms/DenseBufferizationPass.cpp
    A mlir/lib/Dialect/SparseTensor/Transforms/SparsificationAndBufferizationPass.cpp
    M mlir/test/Dialect/Bufferization/Transforms/tensor-copy-insertion-memory-space-invalid.mlir
    M mlir/test/Dialect/Bufferization/Transforms/tensor-copy-insertion-memory-space.mlir
    M mlir/test/Dialect/Bufferization/Transforms/tensor-copy-insertion.mlir
    M mlir/test/Dialect/SCF/one-shot-bufferize-tensor-copy-insertion.mlir
    M mlir/test/Dialect/SparseTensor/one_shot_bufferize_tensor_copy_insertion.mlir
    M mlir/test/Dialect/SparseTensor/sparse_sddmm.mlir
    M mlir/test/Dialect/Tensor/one-shot-bufferize-tensor-copy-insertion.mlir
    A mlir/test/lib/Dialect/Bufferization/CMakeLists.txt
    A mlir/test/lib/Dialect/Bufferization/TestTensorCopyInsertion.cpp
    M mlir/test/lib/Dialect/CMakeLists.txt
    M mlir/tools/mlir-opt/CMakeLists.txt
    M mlir/tools/mlir-opt/mlir-opt.cpp
    M utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
    M utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel

  Log Message:
  -----------
  [mlir][bufferization] Make `TensorCopyInsertionPass` a test pass

TensorCopyInsertion should not have been exposed as a pass. This was a flaw in the original design. It is a preparation step for bufferization and certain transforms (that would otherwise be legal) are illegal between TensorCopyInsertion and actual rewrite to MemRef ops. Therefore, even if broken down as two separate steps internally, they should be exposed as a single pass.

This change affects the sparse compiler, which uses `TensorCopyInsertionPass`. A new `SparsificationAndBufferizationPass` is added to replace all passes in the sparse tensor pipeline from `TensorCopyInsertionPass` until the actual bufferization (rewrite to memref/non-tensor). It is generally unsafe to run arbitrary passes in-between, in particular passes that hoist tensor ops out of loops or change SSA use-def chains along tensor ops.

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




More information about the All-commits mailing list