[all-commits] [llvm/llvm-project] 65bded: [mlir] Bubble up tensor.extract_slice above linalg...

Okwan Kwon via All-commits all-commits at lists.llvm.org
Thu Mar 31 09:58:43 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 65bdeddb1e5c0d27be0397379131b2d712c7a227
      https://github.com/llvm/llvm-project/commit/65bdeddb1e5c0d27be0397379131b2d712c7a227
  Author: Okwan Kwon <okkwon at gmail.com>
  Date:   2022-03-31 (Thu, 31 Mar 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
    M mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
    M mlir/include/mlir/IR/AffineMap.h
    A mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp
    M mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
    M mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
    M mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
    M mlir/lib/Dialect/Linalg/Utils/Utils.cpp
    M mlir/lib/IR/AffineMap.cpp
    A mlir/test/Dialect/Linalg/bubble-up-extract-slice-op.mlir
    M mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp

  Log Message:
  -----------
  [mlir] Bubble up tensor.extract_slice above linalg operation

Bubble up extract_slice above Linalg operation.

A sequence of operations

    %0 = linalg.<op> ... arg0, arg1, ...
    %1 = tensor.extract_slice %0 ...

can be replaced with

    %0 = tensor.extract_slice %arg0
    %1 = tensor.extract_slice %arg1
    %2 = linalg.<op> ... %0, %1, ...

This results in the reduce computation of the linalg operation.

The implementation uses the tiling utility functions. One difference
from the tiling process is that we don't need to insert the checking
code for the out-of-bound accesses. The use of the slice itself
represents that the code writer is sure about the boundary condition.
To avoid adding the boundary condtion check code, `omitPartialTileCheck`
is introduced for the tiling utility functions.

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




More information about the All-commits mailing list