[all-commits] [llvm/llvm-project] 0ff3cf: [mlir] GreedyPatternRewriter: fix counting of iter...

Matthias Springer via All-commits all-commits at lists.llvm.org
Tue Jan 10 03:25:45 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0ff3cf0c0cda58b139ddbf6954befeebdda7ed52
      https://github.com/llvm/llvm-project/commit/0ff3cf0c0cda58b139ddbf6954befeebdda7ed52
  Author: Matthias Springer <springerm at google.com>
  Date:   2023-01-10 (Tue, 10 Jan 2023)

  Changed paths:
    M mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp

  Log Message:
  -----------
  [mlir] GreedyPatternRewriter: fix counting of iterations

The GreedyPatternRewriteDriver did previously not count the first iteration. I.e., when setting `config.maxIterations = 1`, two iterations were performed. In pratice, this number is not really important; we usually just need a limit in some reasonable order of magnitude. However, this fix allows us to write better convergence/worklist tests with carefully crafted test patterns to purposely trigger edge cases in the driver.

Similarly, the first rewrite was previously not counted towards `config.maxNumRewrites`.

For consistency, `OpPatternRewriteDriver` now uses `config.maxNumRewrites` instead of `config.maxIterations`; this driver does not have "iterations", it consists of a single loop (corresponding to the inner loop in the GreedyPatternRewriteDriver).

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




More information about the All-commits mailing list