[all-commits] [llvm/llvm-project] 391cb5: [mlir] Add option to limit number of pattern rewri...

Matthias Springer via All-commits all-commits at lists.llvm.org
Fri Dec 23 04:09:30 PST 2022


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

  Changed paths:
    M mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h
    M mlir/include/mlir/Transforms/Passes.td
    M mlir/lib/Transforms/Canonicalizer.cpp
    M mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
    M mlir/test/Pass/run-reproducer.mlir

  Log Message:
  -----------
  [mlir] Add option to limit number of pattern rewrites in CanonicalizerPass

The greedy pattern rewriter consists of two nested loops. `config.maxIterations` (which configurable on the CanonicalizerPass) controls the maximum number of iterations of the outer loop.

```
/// This specifies the maximum number of times the rewriter will iterate
/// between applying patterns and simplifying regions. Use `kNoLimit` to
/// disable this iteration limit.
int64_t maxIterations = 10;
```

This change adds `config.maxNumRewrites` which controls the maximum number of pattern rewrites within an iteration. (It effectively control the maximum number of iterations of the inner loop.)

This flag is meant for debugging and useful in cases where one or multiple faulty patterns can be applied indefinitely, resulting in an infinite loop.

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




More information about the All-commits mailing list