Skip to content

Commit 2658d44

Browse files
[mlir][Transforms][WIP] Dialect conversion: Make materializations optional
Build all source/target/argument materializations after the conversion has succeeded. Provide a new configuration option for users to opt out of all automatic materializations. In that case, the resulting IR will have `builtin.unrealized_conversion_cast` ops.
1 parent ed5a2dc commit 2658d44

File tree

5 files changed

+105
-298
lines changed

5 files changed

+105
-298
lines changed

mlir/include/mlir/Transforms/DialectConversion.h

+11
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,17 @@ struct ConversionConfig {
11241124
// already been modified) and iterators into past IR state cannot be
11251125
// represented at the moment.
11261126
RewriterBase::Listener *listener = nullptr;
1127+
1128+
/// If set to "true", the dialect conversion attempts to build source/target/
1129+
/// argument materializations through the type converter API in lieu of
1130+
/// builtin.unrealized_conversion_cast ops. The conversion process fails if
1131+
/// at least one materialization could not be built.
1132+
///
1133+
/// If set to "false", the dialect conversion does not does not build any
1134+
/// custom materializations and instead inserts
1135+
/// builtin.unrealized_conversion_cast ops to ensure that the resulting IR
1136+
/// is valid.
1137+
bool buildMaterializations = true;
11271138
};
11281139

11291140
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)