[all-commits] [llvm/llvm-project] 0f8a6b: [mlir] Add fast walk-based pattern rewrite driver ...

Jakub Kuderski via All-commits all-commits at lists.llvm.org
Thu Oct 31 08:10:31 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f8a6b7d03550cb58cf49535af2de2230abfe997
      https://github.com/llvm/llvm-project/commit/0f8a6b7d03550cb58cf49535af2de2230abfe997
  Author: Jakub Kuderski <jakub at nod-labs.com>
  Date:   2024-10-31 (Thu, 31 Oct 2024)

  Changed paths:
    M mlir/docs/ActionTracing.md
    M mlir/docs/PatternRewriter.md
    M mlir/include/mlir/IR/PatternMatch.h
    A mlir/include/mlir/Transforms/WalkPatternRewriteDriver.h
    M mlir/lib/Dialect/Arith/Transforms/UnsignedWhenEquivalent.cpp
    M mlir/lib/Transforms/Utils/CMakeLists.txt
    A mlir/lib/Transforms/Utils/WalkPatternRewriteDriver.cpp
    M mlir/test/IR/enum-attr-roundtrip.mlir
    M mlir/test/IR/greedy-pattern-rewrite-driver-bottom-up.mlir
    M mlir/test/IR/greedy-pattern-rewrite-driver-top-down.mlir
    A mlir/test/IR/test-walk-pattern-rewrite-driver.mlir
    M mlir/test/Transforms/test-operation-folder-commutative.mlir
    M mlir/test/Transforms/test-operation-folder.mlir
    M mlir/test/lib/Dialect/Test/TestPatterns.cpp
    M mlir/test/mlir-tblgen/pattern.mlir

  Log Message:
  -----------
  [mlir] Add fast walk-based pattern rewrite driver (#113825)

This is intended as a fast pattern rewrite driver for the cases when a
simple walk gets the job done but we would still want to implement it in
terms of rewrite patterns (that can be used with the greedy pattern
rewrite driver downstream).

The new driver is inspired by the discussion in
https://github.com/llvm/llvm-project/pull/112454 and the LLVM Dev
presentation from @matthias-springer earlier this week.

This limitation comes with some limitations:
* It does not repeat until a fixpoint or revisit ops modified in place
or newly created ops. In general, it only walks forward (in the
post-order).
* `matchAndRewrite` can only erase the matched op or its descendants.
  This is verified under expensive checks.
* It does not perform folding / DCE.
 
We could probably relax some of these in the future without sacrificing
too much performance.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list