Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
mlir/include/mlir/Transforms/DialectConversion.h
Show First 20 Lines • Show All 519 Lines • ▼ Show 20 Lines | |||||||||||||
struct ConversionPatternRewriterImpl; | struct ConversionPatternRewriterImpl; | ||||||||||||
} // end namespace detail | } // end namespace detail | ||||||||||||
/// This class implements a pattern rewriter for use with ConversionPatterns. It | /// This class implements a pattern rewriter for use with ConversionPatterns. It | ||||||||||||
/// extends the base PatternRewriter and provides special conversion specific | /// extends the base PatternRewriter and provides special conversion specific | ||||||||||||
/// hooks. | /// hooks. | ||||||||||||
class ConversionPatternRewriter final : public PatternRewriter { | class ConversionPatternRewriter final : public PatternRewriter { | ||||||||||||
public: | public: | ||||||||||||
ConversionPatternRewriter(MLIRContext *ctx); | explicit ConversionPatternRewriter(MLIRContext *ctx); | ||||||||||||
~ConversionPatternRewriter() override; | ~ConversionPatternRewriter() override; | ||||||||||||
rriddle: Cab we initialize it in the impl separately? Having it here leaks the implementation details a… | |||||||||||||
/// Apply a signature conversion to the entry block of the given region. This | /// Apply a signature conversion to the entry block of the given region. This | ||||||||||||
/// replaces the entry block with a new block containing the updated | /// replaces the entry block with a new block containing the updated | ||||||||||||
/// signature. The new entry block to the region is returned for convenience. | /// signature. The new entry block to the region is returned for convenience. | ||||||||||||
/// | /// | ||||||||||||
/// If provided, `converter` will be used for any materializations. | /// If provided, `converter` will be used for any materializations. | ||||||||||||
Block * | Block * | ||||||||||||
applySignatureConversion(Region *region, | applySignatureConversion(Region *region, | ||||||||||||
TypeConverter::SignatureConversion &conversion, | TypeConverter::SignatureConversion &conversion, | ||||||||||||
▲ Show 20 Lines • Show All 388 Lines • ▼ Show 20 Lines | |||||||||||||
/// Apply an analysis conversion on the given operations, and all nested | /// Apply an analysis conversion on the given operations, and all nested | ||||||||||||
/// operations. This method analyzes which operations would be successfully | /// operations. This method analyzes which operations would be successfully | ||||||||||||
/// converted to the target if a conversion was applied. All operations that | /// converted to the target if a conversion was applied. All operations that | ||||||||||||
/// were found to be legalizable to the given 'target' are placed within the | /// were found to be legalizable to the given 'target' are placed within the | ||||||||||||
/// provided 'convertedOps' set; note that no actual rewrites are applied to the | /// provided 'convertedOps' set; note that no actual rewrites are applied to the | ||||||||||||
/// operations on success and only pre-existing operations are added to the set. | /// operations on success and only pre-existing operations are added to the set. | ||||||||||||
/// This method only returns failure if there are unreachable blocks in any of | /// This method only returns failure if there are unreachable blocks in any of | ||||||||||||
/// the regions nested within 'ops'. | /// the regions nested within 'ops'. There's an additional argument | ||||||||||||
LogicalResult applyAnalysisConversion(ArrayRef<Operation *> ops, | /// `notifyCallback` which is used for collecting match failure diagnostics | ||||||||||||
ConversionTarget &target, | /// generated during the conversion. Diagnostics are only reported to this | ||||||||||||
/// callback may only be available in debug mode. | |||||||||||||
Not Done ReplyInline Actions
rriddle: | |||||||||||||
LogicalResult applyAnalysisConversion( | |||||||||||||
Not Done ReplyInline ActionsCan you document the callback here? What invariants is it supposed to provide? How would a potential user interact with it/know when they would want to provide it? Also, do we only want the diagnostic here? What about the pattern/op being matched/etc.? What information is useful to provide back? rriddle: Can you document the callback here? What invariants is it supposed to provide? How would a… | |||||||||||||
Also added the log of the pattern and operation. According to the current architecture, The match failure reason will come before pattern name, it'll be like, match failure .... Chia-hungDuan: Also added the log of the pattern and operation. According to the current architecture, The… | |||||||||||||
ArrayRef<Operation *> ops, ConversionTarget &target, | |||||||||||||
const FrozenRewritePatternSet &patterns, | const FrozenRewritePatternSet &patterns, | ||||||||||||
DenseSet<Operation *> &convertedOps); | DenseSet<Operation *> &convertedOps, | ||||||||||||
LogicalResult applyAnalysisConversion(Operation *op, ConversionTarget &target, | function_ref<void(Diagnostic &)> notifyCallback = nullptr); | ||||||||||||
LogicalResult applyAnalysisConversion( | |||||||||||||
Operation *op, ConversionTarget &target, | |||||||||||||
const FrozenRewritePatternSet &patterns, | const FrozenRewritePatternSet &patterns, | ||||||||||||
DenseSet<Operation *> &convertedOps); | DenseSet<Operation *> &convertedOps, | ||||||||||||
function_ref<void(Diagnostic &)> notifyCallback = nullptr); | |||||||||||||
} // end namespace mlir | } // end namespace mlir | ||||||||||||
Not Done ReplyInline ActionsIs this only intended for analysis conversions, or should we do this for partial/full conversions too? rriddle: Is this only intended for analysis conversions, or should we do this for partial/full… | |||||||||||||
Per discussion, now we will only have it in analysis conversions. Chia-hungDuan: Per discussion, now we will only have it in analysis conversions. | |||||||||||||
#endif // MLIR_TRANSFORMS_DIALECTCONVERSION_H_ | #endif // MLIR_TRANSFORMS_DIALECTCONVERSION_H_ |
Cab we initialize it in the impl separately? Having it here leaks the implementation details a bit. (This constructor really shouldn't be public anyways).