[all-commits] [llvm/llvm-project] 7932d2: [MLIR] Introduce a new rewrite driver to simplify ...

Uday Bondhugula via All-commits all-commits at lists.llvm.org
Wed Jul 21 07:56:10 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7932d21f5d795230ce9f8e74415fddcc29d91642
      https://github.com/llvm/llvm-project/commit/7932d21f5d795230ce9f8e74415fddcc29d91642
  Author: Uday Bondhugula <uday at polymagelabs.com>
  Date:   2021-07-21 (Wed, 21 Jul 2021)

  Changed paths:
    M mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h
    M mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
    M mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
    M mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
    M mlir/test/Dialect/Affine/simplify-affine-structures.mlir
    M mlir/test/Dialect/Linalg/fold-affine-min-scf.mlir
    M mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp
    M mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp

  Log Message:
  -----------
  [MLIR] Introduce a new rewrite driver to simplify supplied list of ops

Introduce a new rewrite driver (MultiOpPatternRewriteDriver) to rewrite
a supplied list of ops and other ops. Provide a knob to restrict
rewrites strictly to those ops or also to affected ops (but still not to
completely related ops).

This rewrite driver is commonly needed to run any simplification and
cleanup at the end of a transforms pass or transforms utility in a way
that only simplifies relevant IR. This makes it easy to write test cases
while not performing unrelated whole IR simplification that may
invalidate other state at the caller.

The introduced utility provides more freedom to developers of transforms
and transform utilities to perform focussed and local simplification. In
several cases, it provides greater efficiency as well as more
simplification when compared to repeatedly calling
`applyOpPatternsAndFold`; in other cases, it avoids the need to
undesirably call `applyPatternsAndFoldGreedily` to do unrelated
simplification in a FuncOp.

Update a few transformations that were earlier using
applyOpPatternsAndFold (SimplifyAffineStructures,
affineDataCopyGenerate, a linalg transform).

TODO:
- OpPatternRewriteDriver can be removed as it's a special case of
  MultiOpPatternRewriteDriver, i.e., both can be merged.

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




More information about the All-commits mailing list