My Project
|
#include <Configuration.h>
Public Types | |
using | OpHandlerFn = std::function< void(Operation *op, CAGSlice &cag)> |
Public Member Functions | |
TargetConfiguration (SolverContext &context) | |
virtual | ~TargetConfiguration ()=default |
unsigned | addCandidateType (quant::AnyQuantizedType quantizedType, CandidateQuantizedType::Scheme scheme) |
Adds a candidate type, returning its ordinal. More... | |
const CandidateQuantizedType & | getCandidateType (unsigned index) const |
Gets a prototype scheme by index. More... | |
ArrayRef< CandidateQuantizedType > | getCandidateTypes () const |
llvm::SmallBitVector | getAllCandidateTypesMask () const |
Gets a mask of all enabled candidate types by ordinal. More... | |
llvm::SmallBitVector | getCandidateTypeDisabledExceptMask (ArrayRef< unsigned > exceptOrdinals) const |
Gets a mask with every candidate type except those in the given mask. More... | |
template<typename OpTy > | |
void | addOpHandler (OpHandlerFn fn) |
Adds an op handler. More... | |
template<typename OpTy > | |
void | addRequireStatsOp () |
bool | isRequireStatsOp (Operation *op) const |
Returns whether opName is a RequireStatsOp. More... | |
template<typename OpTy > | |
void | addValueIdentityOp () |
void | handleOp (Operation *op, CAGSlice &cag) const |
Handles the operation if a handler is defined for it. More... | |
virtual void | finalizeAnchors (CAGSlice &cag) const |
Finalizes the CAG after all anchors have been added. More... | |
virtual bool | isHandledType (Type t) const =0 |
Whether an operand or result type is subject to analysis by this config. More... | |
Static Public Attributes | |
static constexpr size_t | MaxSchemeIndex = 31 |
Protected Member Functions | |
virtual void | addValueIdentityOpByName (StringRef opName)=0 |
void | addOpHandlerByName (StringRef name, OpHandlerFn fn) |
Defines quantization configuration for the target. The settings here depend on a variety of details about the deployment environment, although, where we have control over such things, we do try to standardize as possible.
Non-const methods are used to setup the configuration. It is expected that const instances/references are used post-build.
using mlir::quantizer::TargetConfiguration::OpHandlerFn = std::function<void(Operation *op, CAGSlice &cag)> |
TargetConfiguration::TargetConfiguration | ( | SolverContext & | context | ) |
|
virtualdefault |
|
inline |
Adds a candidate type, returning its ordinal.
|
inline |
Adds an op handler.
|
protected |
|
inline |
Adds an operation which requires statistics at its result nodes for best quantization performance. Note that the opName StringRef is expected to come from getOperationName() and be static.
|
inline |
Adds an op which does not mutate its values but may mutate its shape or combine its operands in an arbitrary way. Such ops are expected to have the same types for operands and results and must be capable of operating on storage types.
|
protectedpure virtual |
|
inlinevirtual |
Finalizes the CAG after all anchors have been added.
|
inline |
Gets a mask of all enabled candidate types by ordinal.
|
inline |
Gets a prototype scheme by index.
|
inline |
Gets a mask with every candidate type except those in the given mask.
|
inline |
Handles the operation if a handler is defined for it.
|
pure virtual |
Whether an operand or result type is subject to analysis by this config.
bool TargetConfiguration::isRequireStatsOp | ( | Operation * | op | ) | const |
Returns whether opName is a RequireStatsOp.
|
static |