[all-commits] [llvm/llvm-project] 9c4611: [mlir] Implement pass utils for 1:N type conversions.

Ingo Müller via All-commits all-commits at lists.llvm.org
Mon Mar 27 02:02:41 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c4611f9c7a7055b18f0a30a4c9074b9917e4ab0
      https://github.com/llvm/llvm-project/commit/9c4611f9c7a7055b18f0a30a4c9074b9917e4ab0
  Author: Ingo Müller <ingomueller at google.com>
  Date:   2023-03-27 (Mon, 27 Mar 2023)

  Changed paths:
    A mlir/include/mlir/Dialect/Func/Transforms/OneToNFuncConversions.h
    A mlir/include/mlir/Transforms/OneToNTypeConversion.h
    M mlir/lib/Dialect/Func/Transforms/CMakeLists.txt
    A mlir/lib/Dialect/Func/Transforms/OneToNFuncConversions.cpp
    M mlir/lib/Transforms/Utils/CMakeLists.txt
    A mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp
    M mlir/test/Transforms/decompose-call-graph-types.mlir
    M mlir/test/lib/Conversion/CMakeLists.txt
    A mlir/test/lib/Conversion/OneToNTypeConversion/CMakeLists.txt
    A mlir/test/lib/Conversion/OneToNTypeConversion/TestOneToNTypeConversionPass.cpp
    M mlir/tools/mlir-opt/CMakeLists.txt
    M mlir/tools/mlir-opt/mlir-opt.cpp

  Log Message:
  -----------
  [mlir] Implement pass utils for 1:N type conversions.

The current dialect conversion does not support 1:N type conversions.
This commit implements a (poor-man's) dialect conversion pass that does
just that. To keep the pass independent of the "real" dialect conversion
infrastructure, it provides a specialization of the TypeConverter class
that allows for N:1 target materializations, a specialization of the
RewritePattern and PatternRewriter classes that automatically add
appropriate unrealized casts supporting 1:N type conversions and provide
converted operands for implementing subclasses, and a conversion driver
that applies the provided patterns and replaces the unrealized casts
that haven't folded away with user-provided materializations.

The current pass is powerful enough to express many existing manual
solutions for 1:N type conversions or extend transforms that previously
didn't support them, out of which this patch implements call graph type
decomposition (which is currently implemented with a ValueDecomposer
that is only used there).

The goal of this pass is to illustrate the effect that 1:N type
conversions could have, gain experience in how patterns should be
written that achieve that effect, and get feedback on how the APIs of
the dialect conversion should be extended or changed to support such
patterns. The hope is that the "real" dialect conversion eventually
supports such patterns, at which point, this pass could be removed
again.

Reviewed By: springerm

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




More information about the All-commits mailing list