[all-commits] [llvm/llvm-project] 8d8b1a: [mlir][Transforms] Dialect conversion: Add option ...

Matthias Springer via All-commits all-commits at lists.llvm.org
Sun May 19 02:57:38 PDT 2024


  Branch: refs/heads/users/matthias-springer/dialect_conv_no_fold
  Home:   https://github.com/llvm/llvm-project
  Commit: 8d8b1ad8310223b584fc9d0af57019a45dfbec77
      https://github.com/llvm/llvm-project/commit/8d8b1ad8310223b584fc9d0af57019a45dfbec77
  Author: Matthias Springer <mspringer at nvidia.com>
  Date:   2024-05-19 (Sun, 19 May 2024)

  Changed paths:
    M mlir/include/mlir/Transforms/DialectConversion.h
    M mlir/lib/Transforms/Utils/DialectConversion.cpp
    M mlir/test/Transforms/test-legalizer-analysis.mlir
    M mlir/test/Transforms/test-legalizer-full.mlir
    A mlir/test/Transforms/test-legalizer-no-fold.mlir
    M mlir/test/lib/Dialect/Test/TestPatterns.cpp

  Log Message:
  -----------
  [mlir][Transforms] Dialect conversion: Add option to disable folding

This commit adds a new flag to `ConversionConfig` that deactivates op folding during a dialect conversion.

Op folding is problematic beause op folders may assume that the IR is in a valid state. (See #89770 for an example.) However, the dialect conversion driver does not guarantee that the IR is valid during a dialect conversion; it only guarantees that the IR is valid at the end of a dialect conversion. E.g., IR may be invalid after a conversion pattern application because some IR modifications (e.g., op/block replacements) are applied in a delayed fashion at the end of a dialect conversion. This makes op folders generally unsafe to use with a dialect conversion.

Note: For the same reason, it is also not safe to use non-conversion patterns with a dialect conversion. Conversion patterns can be used safely because they have an "adapter". (And conversion patterns cannot assume that the entire IR is valid in general.)



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