[all-commits] [llvm/llvm-project] e6d90a: [mlir][Transforms] GreedyPatternRewriteDriver debu...

Matthias Springer via All-commits all-commits at lists.llvm.org
Wed May 24 07:24:27 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e6d90a0d5e202166a9846f1845196086aa02f35e
      https://github.com/llvm/llvm-project/commit/e6d90a0d5e202166a9846f1845196086aa02f35e
  Author: Matthias Springer <me at m-sp.org>
  Date:   2023-05-24 (Wed, 24 May 2023)

  Changed paths:
    M mlir/CMakeLists.txt
    A mlir/include/mlir/Config/mlir-config.h.cmake
    M mlir/include/mlir/IR/PatternMatch.h
    M mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp

  Log Message:
  -----------
  [mlir][Transforms] GreedyPatternRewriteDriver debugging: Detect faulty patterns

Compute operation finger prints to detect incorrect API usage in RewritePatterns. Does not work for dialect conversion patterns.

Detect patterns that:
* Returned `failure` but changed the IR.
* Returned `success` but did not change the IR.
* Inserted/removed/modified ops, bypassing the rewriter. Not all cases are detected.

These new checks are quite expensive, so they are only enabled with `-DMLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS=ON`. Failures manifest as fatal errors (`llvm::report_fatal_error`) or crashes (accessing deallocated memory). To get better debugging information, run `mlir-opt -debug` (to see which pattern is broken) with ASAN (to see where memory was deallocated).

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




More information about the All-commits mailing list