MLIR: mlir::ConversionTarget Class Reference (original) (raw)
This class describes a specific conversion target. More...
#include "[mlir/Transforms/DialectConversion.h](DialectConversion%5F8h%5Fsource.html)"
Classes | |
---|---|
struct | LegalOpDetails |
A structure containing additional information describing a specific legal operation instance. More... | |
Public Types | |
---|---|
enum class | LegalizationAction { Legal, Dynamic, Illegal } |
This enumeration corresponds to the specific action to take when considering an operation legal for this conversion target. More... | |
using | DynamicLegalityCallbackFn = std::function< std::optional< bool >(Operation *)> |
The signature of the callback used to determine if an operation is dynamically legal on the target. More... | |
Public Member Functions | |
---|---|
ConversionTarget (MLIRContext &ctx) | |
virtual | ~ConversionTarget ()=default |
void | setOpAction (OperationName op, LegalizationAction action) |
Register a legality action for the given operation. More... | |
template | |
void | setOpAction (LegalizationAction action) |
void | addLegalOp (OperationName op) |
Register the given operations as legal. More... | |
template | |
void | addLegalOp () |
template<typename OpT , typename OpT2 , typename... OpTs> | |
void | addLegalOp () |
void | addDynamicallyLegalOp (OperationName op, const DynamicLegalityCallbackFn &callback) |
Register the given operation as dynamically legal and set the dynamic legalization callback to the one provided. More... | |
template | |
void | addDynamicallyLegalOp (const DynamicLegalityCallbackFn &callback) |
template<typename OpT , typename OpT2 , typename... OpTs> | |
void | addDynamicallyLegalOp (const DynamicLegalityCallbackFn &callback) |
template<typename OpT , class Callable > | |
std::enable_if_t<!std::is_invocable_v< Callable, Operation * > > | addDynamicallyLegalOp (Callable &&callback) |
void | addIllegalOp (OperationName op) |
Register the given operation as illegal, i.e. More... | |
template | |
void | addIllegalOp () |
template<typename OpT , typename OpT2 , typename... OpTs> | |
void | addIllegalOp () |
void | markOpRecursivelyLegal (OperationName name, const DynamicLegalityCallbackFn &callback) |
Mark an operation, that must have either been set as Legal or DynamicallyLegal, as being recursively legal. More... | |
template | |
void | markOpRecursivelyLegal (const DynamicLegalityCallbackFn &callback={}) |
template<typename OpT , typename OpT2 , typename... OpTs> | |
void | markOpRecursivelyLegal (const DynamicLegalityCallbackFn &callback={}) |
template<typename OpT , class Callable > | |
std::enable_if_t<!std::is_invocable_v< Callable, Operation * > > | markOpRecursivelyLegal (Callable &&callback) |
void | setDialectAction (ArrayRef< StringRef > dialectNames, LegalizationAction action) |
Register a legality action for the given dialects. More... | |
template<typename... Names> | |
void | addLegalDialect (StringRef name, Names... names) |
Register the operations of the given dialects as legal. More... | |
template<typename... Args> | |
void | addLegalDialect () |
template<typename... Names> | |
void | addDynamicallyLegalDialect (const DynamicLegalityCallbackFn &callback, StringRef name, Names... names) |
Register the operations of the given dialects as dynamically legal, i.e. More... | |
template<typename... Args> | |
void | addDynamicallyLegalDialect (DynamicLegalityCallbackFn callback) |
void | markUnknownOpDynamicallyLegal (const DynamicLegalityCallbackFn &fn) |
Register unknown operations as dynamically legal. More... | |
template<typename... Names> | |
void | addIllegalDialect (StringRef name, Names... names) |
Register the operations of the given dialects as illegal, i.e. More... | |
template<typename... Args> | |
void | addIllegalDialect () |
std::optional< LegalizationAction > | getOpAction (OperationName op) const |
Get the legality action for the given operation. More... | |
std::optional< LegalOpDetails > | isLegal (Operation *op) const |
If the given operation instance is legal on this target, a structure containing legality information is returned. More... | |
bool | isIllegal (Operation *op) const |
Returns true is operation instance is illegal on this target. More... | |
This class describes a specific conversion target.
Definition at line 868 of file DialectConversion.h.
◆ DynamicLegalityCallbackFn
The signature of the callback used to determine if an operation is dynamically legal on the target.
Definition at line 895 of file DialectConversion.h.
◆ LegalizationAction
This enumeration corresponds to the specific action to take when considering an operation legal for this conversion target.
Enumerator | |
---|---|
Legal | The target supports this operation. |
Dynamic | This operation has dynamic legalization constraints that must be checked by the target. |
Illegal | The target explicitly does not support this operation. |
Definition at line 872 of file DialectConversion.h.
mlir::ConversionTarget::ConversionTarget ( MLIRContext & ctx) | inline |
---|
◆ ~ConversionTarget()
virtual mlir::ConversionTarget::~ConversionTarget ( ) | virtualdefault |
---|
◆ addDynamicallyLegalDialect() [1/2]
template<typename... Names>
void mlir::ConversionTarget::addDynamicallyLegalDialect ( const DynamicLegalityCallbackFn & callback, StringRef name, Names... names ) | inline |
---|
◆ addDynamicallyLegalDialect() [2/2]
template<typename... Args>
◆ addDynamicallyLegalOp() [1/4]
template<typename OpT , class Callable >
std::enable_if_t<!std::is_invocable_v<Callable, Operation *> > mlir::ConversionTarget::addDynamicallyLegalOp ( Callable && callback) | inline |
---|
◆ addDynamicallyLegalOp() [2/4]
◆ addDynamicallyLegalOp() [3/4]
template<typename OpT , typename OpT2 , typename... OpTs>
◆ addDynamicallyLegalOp() [4/4]
◆ addIllegalDialect() [1/2]
template<typename... Args>
void mlir::ConversionTarget::addIllegalDialect ( ) | inline |
---|
◆ addIllegalDialect() [2/2]
template<typename... Names>
void mlir::ConversionTarget::addIllegalDialect ( StringRef name, Names... names ) | inline |
---|
◆ addIllegalOp() [1/3]
template
void mlir::ConversionTarget::addIllegalOp ( ) | inline |
---|
◆ addIllegalOp() [2/3]
template<typename OpT , typename OpT2 , typename... OpTs>
void mlir::ConversionTarget::addIllegalOp ( ) | inline |
---|
◆ addIllegalOp() [3/3]
void mlir::ConversionTarget::addIllegalOp ( OperationName op) | inline |
---|
◆ addLegalDialect() [1/2]
template<typename... Args>
void mlir::ConversionTarget::addLegalDialect ( ) | inline |
---|
◆ addLegalDialect() [2/2]
template<typename... Names>
void mlir::ConversionTarget::addLegalDialect ( StringRef name, Names... names ) | inline |
---|
◆ addLegalOp() [1/3]
template
void mlir::ConversionTarget::addLegalOp ( ) | inline |
---|
◆ addLegalOp() [2/3]
template<typename OpT , typename OpT2 , typename... OpTs>
void mlir::ConversionTarget::addLegalOp ( ) | inline |
---|
◆ addLegalOp() [3/3]
void mlir::ConversionTarget::addLegalOp ( OperationName op) | inline |
---|
◆ getOpAction()
◆ isIllegal()
bool ConversionTarget::isIllegal | ( | Operation * | op | ) | const |
---|
Returns true is operation instance is illegal on this target.
Returns false if operation is legal, operation legality wasn't registered by user or dynamic legality callbacks returned None.
Definition at line 3208 of file DialectConversion.cpp.
References mlir::Operation::getName().
◆ isLegal()
auto ConversionTarget::isLegal | ( | Operation * | op | ) | const |
---|
◆ markOpRecursivelyLegal() [1/4]
template<typename OpT , class Callable >
std::enable_if_t<!std::is_invocable_v<Callable, Operation *> > mlir::ConversionTarget::markOpRecursivelyLegal ( Callable && callback) | inline |
---|
◆ markOpRecursivelyLegal() [2/4]
◆ markOpRecursivelyLegal() [3/4]
template<typename OpT , typename OpT2 , typename... OpTs>
◆ markOpRecursivelyLegal() [4/4]
Mark an operation, that must have either been set as Legal
or DynamicallyLegal
, as being recursively legal.
This means that in addition to the operation itself, all of the operations nested within are also considered legal. An optional dynamic legality callback may be provided to mark subsets of legal instances as recursively legal.
Definition at line 3251 of file DialectConversion.cpp.
References composeLegalityCallbacks().
◆ markUnknownOpDynamicallyLegal()
◆ setDialectAction()
◆ setOpAction() [1/2]
◆ setOpAction() [2/2]
The documentation for this class was generated from the following files:
- include/mlir/Transforms/DialectConversion.h
- lib/Transforms/Utils/DialectConversion.cpp