MLIR
21.0.0git
|
Dialect conversion configuration. More...
#include "mlir/Transforms/DialectConversion.h"
Public Attributes | |
function_ref< void(Diagnostic &)> | notifyCallback = nullptr |
An optional callback used to notify about match failure diagnostics during the conversion. More... | |
DenseSet< Operation * > * | unlegalizedOps = nullptr |
Partial conversion only. More... | |
DenseSet< Operation * > * | legalizableOps = nullptr |
Analysis conversion only. More... | |
RewriterBase::Listener * | listener = nullptr |
An optional listener that is notified about all IR modifications in case dialect conversion succeeds. More... | |
bool | buildMaterializations = true |
If set to "true", the dialect conversion attempts to build source/target materializations through the type converter API in lieu of "builtin.unrealized_conversion_cast ops". More... | |
bool | allowPatternRollback = true |
If set to "true", pattern rollback is allowed. More... | |
Dialect conversion configuration.
Definition at line 1161 of file DialectConversion.h.
bool mlir::ConversionConfig::allowPatternRollback = true |
If set to "true", pattern rollback is allowed.
The conversion driver rolls back IR modifications in the following situations.
If set to "false", the conversion driver will produce an LLVM fatal error instead of rolling back IR modifications. Moreover, in case of a failed conversion, the original IR is not restored. The resulting IR may be a mix of original and rewritten IR. (Same as a failed greedy pattern rewrite.)
Note: This flag was added in preparation of the One-Shot Dialect Conversion refactoring, which will remove the ability to roll back IR modifications from the conversion driver. Use this flag to ensure that your patterns do not trigger any IR rollbacks. For details, see https://discourse.llvm.org/t/rfc-a-new-one-shot-dialect-conversion-driver/79083.
Definition at line 1241 of file DialectConversion.h.
Referenced by mlir::OperationConverter::convertOperations(), and mlir::detail::ConversionPatternRewriterImpl::undoRewrites().
bool mlir::ConversionConfig::buildMaterializations = true |
If set to "true", the dialect conversion attempts to build source/target materializations through the type converter API in lieu of "builtin.unrealized_conversion_cast ops".
The conversion process fails if at least one materialization could not be built.
If set to "false", the dialect conversion does not build any custom materializations and instead inserts "builtin.unrealized_conversion_cast" ops to ensure that the resulting IR is valid.
Definition at line 1221 of file DialectConversion.h.
Referenced by mlir::OperationConverter::convertOperations().
Analysis conversion only.
All operations that are found to be legalizable are placed in this set. Note that no actual rewrites are applied to the IR during an analysis conversion and only pre-existing operations are added to the set.
Definition at line 1177 of file DialectConversion.h.
RewriterBase::Listener* mlir::ConversionConfig::listener = nullptr |
An optional listener that is notified about all IR modifications in case dialect conversion succeeds.
If the dialect conversion fails and no IR modifications are visible (i.e., they were all rolled back), or if the dialect conversion is an "analysis conversion", no notifications are sent (apart from notifyPatternBegin
/notifyPatternEnd`).
Note: Notifications are sent in a delayed fashion, when the dialect conversion is guaranteed to succeed. At that point, some IR modifications may already have been materialized. Consequently, operations/blocks that are passed to listener callbacks should not be accessed. (Ops/blocks are guaranteed to be valid pointers and accessing op names is allowed. But there are no guarantees about the state of ops/blocks at the time that a callback is triggered.)
Example: Consider a dialect conversion a new op ("test.foo") is created and inserted, and later moved to another block. (Moving ops also triggers "notifyOperationInserted".)
(1) notifyOperationInserted: "test.foo" (into block "b1") (2) notifyOperationInserted: "test.foo" (moved to another block "b2")
When querying "op->getBlock()" during the first "notifyOperationInserted", "b2" would be returned because "moving an op" is a kind of rewrite that is immediately performed by the dialect conversion (and rolled back upon failure).
Definition at line 1211 of file DialectConversion.h.
Referenced by mlir::detail::ConversionPatternRewriterImpl::applyRewrites(), mlir::detail::ConversionPatternRewriterImpl::applySignatureConversion(), and mlir::OperationConverter::convertOperations().
function_ref<void(Diagnostic &)> mlir::ConversionConfig::notifyCallback = nullptr |
An optional callback used to notify about match failure diagnostics during the conversion.
Diagnostics reported to this callback may only be available in debug mode.
Definition at line 1165 of file DialectConversion.h.
Referenced by mlir::detail::ConversionPatternRewriterImpl::notifyMatchFailure().
Partial conversion only.
All operations that are found not to be legalizable are placed in this set. (Note that if there is an op explicitly marked as illegal, the conversion terminates and the set will not necessarily be complete.)
Definition at line 1171 of file DialectConversion.h.