MLIR
17.0.0git
|
Classes | |
struct | ValueKnowledge |
Statically known information for a particular Value. More... | |
Functions | |
std::unique_ptr< Pass > | createTosaToArith (bool includeApplyRescale=false, bool use32BitApplyRescale=false) |
void | populateTosaToArithConversionPatterns (RewritePatternSet *patterns) |
void | populateTosaRescaleToArithConversionPatterns (RewritePatternSet *patterns, bool include32Bit=false) |
std::unique_ptr< Pass > | createTosaToLinalg () |
std::unique_ptr< Pass > | createTosaToLinalgNamed () |
void | addTosaToLinalgPasses (OpPassManager &pm, bool disableTosaDecompositions=false) |
Populates passes to convert from TOSA to Linalg on buffers. More... | |
void | populateTosaToLinalgConversionPatterns (RewritePatternSet *patterns) |
Populates conversion passes from TOSA dialect to Linalg dialect. More... | |
void | populateTosaToLinalgNamedConversionPatterns (RewritePatternSet *patterns) |
Populates conversion passes from TOSA dialect to Linalg named operations. More... | |
std::unique_ptr< Pass > | createTosaToSCF () |
void | populateTosaToSCFConversionPatterns (RewritePatternSet *patterns) |
void | addTosaToSCFPasses (OpPassManager &pm) |
Populates passes to convert from TOSA to SCF. More... | |
std::unique_ptr< Pass > | createTosaToTensor () |
void | populateTosaToTensorConversionPatterns (RewritePatternSet *patterns) |
void | populateTosaDecomposeConv2D (MLIRContext *ctx, RewritePatternSet &patterns) |
void | populateTosaDecomposeTransposeConv (MLIRContext *ctx, RewritePatternSet &patterns) |
void | populateTosaDecomposeDepthwise (MLIRContext *ctx, RewritePatternSet &patterns) |
void | populateTosaFoldConstantTransposePatterns (MLIRContext *ctx, RewritePatternSet &patterns) |
std::unique_ptr< Pass > | createTosaLayerwiseConstantFoldPass () |
std::unique_ptr< Pass > | createTosaInferShapesPass () |
std::unique_ptr< Pass > | createTosaMakeBroadcastablePass () |
std::unique_ptr< Pass > | createTosaTestQuantUtilAPIPass () |
std::unique_ptr< Pass > | createTosaOptionalDecompositions () |
std::unique_ptr< Pass > | createTosaValidationPass () |
SmallVector< utils::IteratorType > | getNParallelLoopsAttrs (unsigned nParallelLoops) |
SmallVector< Value > | condenseValues (const SmallVector< Value > &values) |
Value | clampFloatHelper (Location loc, Value arg, Value min, Value max, OpBuilder &rewriter) |
Value | clampIntHelper (Location loc, Value arg, Value min, Value max, OpBuilder &rewriter) |
bool | validIntegerRange (IntegerType ty, int64_t value) |
template<typename Op > | |
std::optional< SmallVector< Value > > | checkHasDynamicBatchDims (PatternRewriter &rewriter, Op op, ArrayRef< Value > params) |
void | computeMultiplierAndShift (double scale, int32_t &multiplier, int32_t &shift, int32_t scaleWidth) |
From a scale value, computes multiplier and shift values for 16 or 32-bit scale widths. More... | |
ConvOpQuantizationAttr | buildConvOpQuantizationAttr (OpBuilder &builder, Value input, Value weight) |
Method to build ConvOpQuantizationAttr, called from ConvOpQuantInfoBuilder/TransConvOpQuantInfoBuilder: input_zp: input zeropoint weight_zp: weight zeropoint. More... | |
MatMulOpQuantizationAttr | buildMatMulOpQuantizationAttr (OpBuilder &builder, Value a, Value b) |
Builds MatMulOpQuantizationAttr, called from MatMulOpQuantInfoBuilder: aZp: input a zeropoint bZp: input b zeropoint. More... | |
UnaryOpQuantizationAttr | buildUnaryOpQuantizationAttr (OpBuilder &builder, Value input, Type outputRawType) |
Builds UnaryOpQuantizationAttr UnaryOpQuantInfoBuilder: inputZp: input zeropoint outputZp: output zeropoint. More... | |
PadOpQuantizationAttr | buildPadOpQuantizationAttr (OpBuilder &builder, Value input) |
Builds PadOpQuantizationAttr, called from PadOpQuantInfoBuilder: inputZp: input zeropoint. More... | |
Type | buildConvOpResultTypeInfo (OpBuilder &builder, Type outputType, Value input, Value weight) |
construct ConvOp output type with correct bitwidth based on input/weight width. More... | |
Type | buildQTypeFromMinMax (OpBuilder builder, Type inputDType, Attribute minAttr, Attribute maxAttr, IntegerAttr quantBits, int filterQuantDim, bool isSigned, BoolAttr narrowRange) |
Builds Tosa quantization attributes from min/max values. More... | |
TypeAttr | buildQTypeAttrFromMinMax (OpBuilder builder, Type inputDType, Attribute minAttr, Attribute maxAttr, IntegerAttr quantBits, int filterQuantDim, bool isSigned, BoolAttr narrowRange) |
Builds Tosa quantization attributes from min/max values. More... | |
void mlir::tosa::addTosaToLinalgPasses | ( | OpPassManager & | pm, |
bool | disableTosaDecompositions = false |
||
) |
Populates passes to convert from TOSA to Linalg on buffers.
At the end of the pass, the function will only contain linalg ops or standard ops if the pipeline succeeds. The option to disable decompositions is available for benchmarking performance improvements from the canonicalizations.
Definition at line 77 of file TosaToLinalgPass.cpp.
References mlir::OpPassManager::addNestedPass(), mlir::createCanonicalizerPass(), createTosaLayerwiseConstantFoldPass(), createTosaMakeBroadcastablePass(), createTosaOptionalDecompositions(), createTosaToLinalg(), createTosaToLinalgNamed(), and createTosaValidationPass().
void mlir::tosa::addTosaToSCFPasses | ( | OpPassManager & | pm | ) |
Populates passes to convert from TOSA to SCF.
Definition at line 55 of file TosaToSCFPass.cpp.
References mlir::OpPassManager::addNestedPass(), and createTosaToSCF().
ConvOpQuantizationAttr mlir::tosa::buildConvOpQuantizationAttr | ( | OpBuilder & | builder, |
Value | input, | ||
Value | weight | ||
) |
Method to build ConvOpQuantizationAttr, called from ConvOpQuantInfoBuilder/TransConvOpQuantInfoBuilder: input_zp: input zeropoint weight_zp: weight zeropoint.
Definition at line 116 of file QuantUtils.cpp.
References mlir::Type::dyn_cast(), GET_UQTYPE, mlir::Builder::getAttr(), and mlir::Value::getType().
Referenced by buildConvOpWithQuantInfo(), buildFCOpWithQuantInfo(), and buildTransConvOpWithQuantInfo().
Type mlir::tosa::buildConvOpResultTypeInfo | ( | OpBuilder & | builder, |
Type | outputType, | ||
Value | input, | ||
Value | weight | ||
) |
construct ConvOp output type with correct bitwidth based on input/weight width.
Builds output type for a quantized ConvOp with the right bitwidth.
This is called by the builder when dealing with quantized content.
Definition at line 235 of file QuantUtils.cpp.
References mlir::Type::dyn_cast(), GET_QTYPE, mlir::Builder::getI32Type(), mlir::Builder::getIntegerType(), and mlir::Value::getType().
Referenced by buildConvOpWithQuantInfo(), buildFCOpWithQuantInfo(), and buildTransConvOpWithQuantInfo().
MatMulOpQuantizationAttr mlir::tosa::buildMatMulOpQuantizationAttr | ( | OpBuilder & | builder, |
Value | a, | ||
Value | b | ||
) |
Builds MatMulOpQuantizationAttr, called from MatMulOpQuantInfoBuilder: aZp: input a zeropoint bZp: input b zeropoint.
Definition at line 160 of file QuantUtils.cpp.
References mlir::Type::dyn_cast(), GET_UQTYPE, mlir::Builder::getAttr(), and mlir::Value::getType().
Referenced by buildMatMulOpWithQuantInfo().
Builds PadOpQuantizationAttr, called from PadOpQuantInfoBuilder: inputZp: input zeropoint.
Definition at line 215 of file QuantUtils.cpp.
References mlir::Type::dyn_cast(), GET_UQTYPE, mlir::Builder::getAttr(), and mlir::Value::getType().
Referenced by buildExplicitValuePadOpWithQuantInfo(), and buildPadOpWithQuantInfo().
TypeAttr mlir::tosa::buildQTypeAttrFromMinMax | ( | OpBuilder | builder, |
Type | inputDType, | ||
Attribute | minAttr, | ||
Attribute | maxAttr, | ||
IntegerAttr | quantBits, | ||
int | filterQuantDim, | ||
bool | isSigned, | ||
BoolAttr | narrowRange | ||
) |
Builds Tosa quantization attributes from min/max values.
Definition at line 335 of file QuantUtils.cpp.
References buildQTypeFromMinMax().
Type mlir::tosa::buildQTypeFromMinMax | ( | OpBuilder | builder, |
Type | inputDType, | ||
Attribute | minAttr, | ||
Attribute | maxAttr, | ||
IntegerAttr | quantBits, | ||
int | filterQuantDim, | ||
bool | isSigned, | ||
BoolAttr | narrowRange | ||
) |
Builds Tosa quantization attributes from min/max values.
Definition at line 267 of file QuantUtils.cpp.
References mlir::Attribute::dyn_cast(), mlir::Type::dyn_cast(), mlir::quant::fakeQuantAttrsToType(), mlir::quant::ExpressedToQuantizedConverter::forInputType(), mlir::Builder::getUnknownLoc(), mlir::BoolAttr::getValue(), max(), and min().
Referenced by buildQTypeAttrFromMinMax().
UnaryOpQuantizationAttr mlir::tosa::buildUnaryOpQuantizationAttr | ( | OpBuilder & | builder, |
Value | input, | ||
Type | outputRawType | ||
) |
Builds UnaryOpQuantizationAttr UnaryOpQuantInfoBuilder: inputZp: input zeropoint outputZp: output zeropoint.
Definition at line 189 of file QuantUtils.cpp.
References mlir::Type::dyn_cast(), GET_UQTYPE, mlir::Builder::getAttr(), and mlir::Value::getType().
Referenced by buildAvgPool2dOpWithQuantInfo(), and buildUnaryOpWithQuantInfo().
std::optional<SmallVector<Value> > mlir::tosa::checkHasDynamicBatchDims | ( | PatternRewriter & | rewriter, |
Op | op, | ||
ArrayRef< Value > | params | ||
) |
Definition at line 49 of file ConversionUtils.h.
References mlir::OpBuilder::create(), mlir::OpState::getLoc(), and mlir::RewriterBase::notifyMatchFailure().
Value mlir::tosa::clampFloatHelper | ( | Location | loc, |
Value | arg, | ||
Value | min, | ||
Value | max, | ||
OpBuilder & | rewriter | ||
) |
Definition at line 33 of file ConversionUtils.cpp.
References mlir::OpBuilder::create(), max(), and min().
Referenced by createLinalgBodyCalculationForElementwiseOp().
Value mlir::tosa::clampIntHelper | ( | Location | loc, |
Value | arg, | ||
Value | min, | ||
Value | max, | ||
OpBuilder & | rewriter | ||
) |
Definition at line 39 of file ConversionUtils.cpp.
References mlir::OpBuilder::create(), max(), and min().
Referenced by createLinalgBodyCalculationForElementwiseOp().
void mlir::tosa::computeMultiplierAndShift | ( | double | scale, |
int32_t & | multiplier, | ||
int32_t & | shift, | ||
int32_t | scaleWidth | ||
) |
From a scale value, computes multiplier and shift values for 16 or 32-bit scale widths.
Generates a quantized multiplier/shift from double.
Definition at line 91 of file QuantUtils.cpp.
References computeMultiplierAndShiftTosaScale16(), and computeMultiplierAndShiftTosaScale32().
SmallVector< Value > mlir::tosa::condenseValues | ( | const SmallVector< Value > & | values | ) |
Definition at line 25 of file ConversionUtils.cpp.
Referenced by elementwiseMatchAndRewriteHelper(), and inferDynamicDimsForConv().
std::unique_ptr< Pass > mlir::tosa::createTosaInferShapesPass | ( | ) |
Definition at line 332 of file TosaInferShapes.cpp.
std::unique_ptr< Pass > mlir::tosa::createTosaLayerwiseConstantFoldPass | ( | ) |
Definition at line 63 of file TosaLayerwiseConstantFoldPass.cpp.
Referenced by addTosaToLinalgPasses().
std::unique_ptr< Pass > mlir::tosa::createTosaMakeBroadcastablePass | ( | ) |
Definition at line 320 of file TosaMakeBroadcastable.cpp.
Referenced by addTosaToLinalgPasses().
std::unique_ptr< Pass > mlir::tosa::createTosaOptionalDecompositions | ( | ) |
Definition at line 52 of file TosaOptionalDecompositions.cpp.
Referenced by addTosaToLinalgPasses().
std::unique_ptr<Pass> mlir::tosa::createTosaTestQuantUtilAPIPass | ( | ) |
std::unique_ptr< Pass > mlir::tosa::createTosaToArith | ( | bool | includeApplyRescale = false , |
bool | use32BitApplyRescale = false |
||
) |
Definition at line 57 of file TosaToArithPass.cpp.
References options.
std::unique_ptr< Pass > mlir::tosa::createTosaToLinalg | ( | ) |
Definition at line 73 of file TosaToLinalgPass.cpp.
Referenced by addTosaToLinalgPasses().
std::unique_ptr< Pass > mlir::tosa::createTosaToLinalgNamed | ( | ) |
Definition at line 71 of file TosaToLinalgNamedPass.cpp.
Referenced by addTosaToLinalgPasses().
std::unique_ptr< Pass > mlir::tosa::createTosaToSCF | ( | ) |
Definition at line 51 of file TosaToSCFPass.cpp.
Referenced by addTosaToSCFPasses().
std::unique_ptr< Pass > mlir::tosa::createTosaToTensor | ( | ) |
Definition at line 54 of file TosaToTensorPass.cpp.
std::unique_ptr< Pass > mlir::tosa::createTosaValidationPass | ( | ) |
Definition at line 124 of file TosaValidation.cpp.
Referenced by addTosaToLinalgPasses().
SmallVector< utils::IteratorType > mlir::tosa::getNParallelLoopsAttrs | ( | unsigned | nParallelLoops | ) |
Definition at line 19 of file ConversionUtils.cpp.
Referenced by elementwiseMatchAndRewriteHelper(), and linalgIntBroadcastExtSIAdd().
void mlir::tosa::populateTosaDecomposeConv2D | ( | MLIRContext * | ctx, |
RewritePatternSet & | patterns | ||
) |
Definition at line 160 of file TosaDecomposeConv2D.cpp.
References mlir::RewritePatternSet::add().
void mlir::tosa::populateTosaDecomposeDepthwise | ( | MLIRContext * | ctx, |
RewritePatternSet & | patterns | ||
) |
Definition at line 155 of file TosaDecomposeDepthwise.cpp.
References mlir::RewritePatternSet::add().
void mlir::tosa::populateTosaDecomposeTransposeConv | ( | MLIRContext * | ctx, |
RewritePatternSet & | patterns | ||
) |
Definition at line 378 of file TosaDecomposeTransposeConv.cpp.
References mlir::RewritePatternSet::add().
void mlir::tosa::populateTosaFoldConstantTransposePatterns | ( | MLIRContext * | ctx, |
RewritePatternSet & | patterns | ||
) |
Definition at line 135 of file TosaFoldConstantTranspose.cpp.
References mlir::RewritePatternSet::add().
void mlir::tosa::populateTosaRescaleToArithConversionPatterns | ( | RewritePatternSet * | patterns, |
bool | include32Bit = false |
||
) |
Definition at line 244 of file TosaToArith.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
void mlir::tosa::populateTosaToArithConversionPatterns | ( | RewritePatternSet * | patterns | ) |
Definition at line 239 of file TosaToArith.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
void mlir::tosa::populateTosaToLinalgConversionPatterns | ( | RewritePatternSet * | patterns | ) |
Populates conversion passes from TOSA dialect to Linalg dialect.
Definition at line 2004 of file TosaToLinalg.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
void mlir::tosa::populateTosaToLinalgNamedConversionPatterns | ( | RewritePatternSet * | patterns | ) |
Populates conversion passes from TOSA dialect to Linalg named operations.
Definition at line 976 of file TosaToLinalgNamed.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
void mlir::tosa::populateTosaToSCFConversionPatterns | ( | RewritePatternSet * | patterns | ) |
Definition at line 107 of file TosaToSCF.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
void mlir::tosa::populateTosaToTensorConversionPatterns | ( | RewritePatternSet * | patterns | ) |
Definition at line 416 of file TosaToTensor.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
bool mlir::tosa::validIntegerRange | ( | IntegerType | ty, |
int64_t | value | ||
) |
Definition at line 50 of file ConversionUtils.cpp.