[all-commits] [llvm/llvm-project] 1d259f: [mlir][affine] Add affine.min / affine.max canonic...

Tobias Gysi via All-commits all-commits at lists.llvm.org
Tue Mar 22 00:19:15 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1d259f9f02021f9a64fa168e270db4e28bf31c90
      https://github.com/llvm/llvm-project/commit/1d259f9f02021f9a64fa168e270db4e28bf31c90
  Author: gysit <gysit at google.com>
  Date:   2022-03-22 (Tue, 22 Mar 2022)

  Changed paths:
    M mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    M mlir/test/Dialect/Affine/canonicalize.mlir
    M mlir/test/Dialect/Linalg/codegen-strategy.mlir
    M mlir/test/Dialect/Linalg/fusion-pattern.mlir
    M mlir/test/Dialect/Linalg/fusion-sequence.mlir
    M mlir/test/Dialect/Linalg/fusion-tensor-pattern.mlir
    M mlir/test/Dialect/Linalg/fusion.mlir
    M mlir/test/Dialect/Linalg/hoist-padding.mlir
    M mlir/test/Dialect/Linalg/pad.mlir
    M mlir/test/Dialect/Linalg/tile-and-fuse-tensors.mlir
    M mlir/test/Dialect/Linalg/tile-conv.mlir
    M mlir/test/Dialect/Linalg/tile-tensors.mlir
    M mlir/test/Dialect/Linalg/tile.mlir
    M mlir/test/Dialect/SCF/for-loop-peeling.mlir

  Log Message:
  -----------
  [mlir][affine] Add affine.min / affine.max canonicalization.

The revision introduces a affine.min and affine.max canonicalization pattern that orders the result expressions. It flattens the result expressions to arrays of dimension and symbol coefficients plus one constant coefficient and rearranges them in lexicographic order.

Without the pattern, CSE will not eliminate two affine.min / affine.max operation if the results are ordered differently. For example, the operations
```
  %1 = affine.min affine_map<(d0) -> (8, -d0 + 27)>(%arg4)
  %2 = affine.min affine_map<(d0) -> (-d0 + 27, 8)>(%arg4)
```
doe not CSE. After applying the pattern, the two operations are equivalent
```
  %1 = affine.min affine_map<(d0) -> (8, -d0 + 27)>(%arg4)
  %2 = affine.min affine_map<(d0) -> (8, -d0 + 27)>(%arg4)
```
which enables CSE.

Reviewed By: nicolasvasilache

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




More information about the All-commits mailing list