|
MLIR 24.0.0git
|
Namespaces | |
| namespace | impl |
Classes | |
| struct | MatMulTOperands |
| struct | OpComplianceInfo |
| class | ProfileInfoDepot |
| class | TargetEnv |
| This class represents the capability enabled in the target implementation such as profile, extension, and level. More... | |
| struct | TosaAttachTargetOptions |
| struct | TosaConvertIntegerTypesBitwidthPassOptions |
| struct | TosaInferShapesPassOptions |
| struct | TosaInputShapeOptions |
| struct | TosaLayerwiseConstantFoldPassOptions |
| struct | TosaLevel |
| struct | TosaNarrowF32ToF16PassOptions |
| struct | TosaNarrowF64ToF32PassOptions |
| struct | TosaNarrowI64ToI32PassOptions |
| class | TosaProfileCompliance |
| class | TosaSpecificationVersion |
| A thin wrapper around the SpecificationVersion enum to represent and provide utilities around the TOSA specification version. More... | |
| struct | TosaValidationOptions |
| struct | TypeInfo |
| struct | TypeInfoRef |
| struct | ValueKnowledge |
| Statically known information for a particular Value. More... | |
| struct | VersionedTypeInfo |
Typedefs | |
| using | IndexPool = llvm::DenseMap<int64_t, Value> |
| Caches the arith.constant index values created for a set of dimension indices so that broadcasting helpers can avoid emitting redundant constants. | |
| using | OperationProfileComplianceMap |
| using | OperationExtensionComplianceMap |
Enumerations | |
| enum | CheckCondition { invalid , anyOf , allOf } |
Variables | |
| constexpr llvm::StringLiteral | graphARMInterfaceVarABIAttrName |
| constexpr llvm::StringLiteral | graphARMGraphConstantIdAttrName |
| static constexpr TosaLevel | TOSA_LEVEL_EIGHTK |
| static constexpr TosaLevel | TOSA_LEVEL_NONE |
| constexpr int64_t | kInferableDimSize = -1 |
| Represents a dimension in the shape of a tensor that can be inferred based on the other provided dimensions. | |
| using mlir::tosa::IndexPool = llvm::DenseMap<int64_t, Value> |
Caches the arith.constant index values created for a set of dimension indices so that broadcasting helpers can avoid emitting redundant constants.
Callers own the pool and reuse it across related queries.
Definition at line 71 of file TosaToLinalg.h.
Definition at line 98 of file TosaProfileCompliance.h.
Definition at line 96 of file TosaProfileCompliance.h.
| Enumerator | |
|---|---|
| invalid | |
| anyOf | |
| allOf | |
Definition at line 43 of file TosaProfileCompliance.h.
| void mlir::tosa::addTosaToLinalgPasses | ( | OpPassManager & | pm, |
| const TosaToLinalgOptions & | options, | ||
| const TosaToLinalgNamedOptions & | tosaToLinalgNamedOptions = TosaToLinalgNamedOptions(), | ||
| std::optional< tosa::TosaValidationOptions > | validationOptions = tosa::TosaValidationOptions{false, false}, | ||
| std::optional< TosaAttachTargetOptions > | attachTargetOptions = std::nullopt ) |
Populates passes to convert from TOSA to Linalg.
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 89 of file TosaToLinalgPass.cpp.
References mlir::OpPassManager::addNestedPass(), mlir::OpPassManager::addPass(), mlir::createCanonicalizerPass(), createTosaAttachTarget(), createTosaInferShapesPass(), createTosaLayerwiseConstantFoldPass(), createTosaMakeBroadcastablePass(), createTosaOptionalDecompositionsPass(), createTosaToLinalg(), createTosaToLinalgNamed(), createTosaValidation(), and options.
Referenced by registerTosaToLinalgPipelines().
| void mlir::tosa::addTosaToSCFPasses | ( | OpPassManager & | pm | ) |
Populates passes to convert from TOSA to SCF.
Definition at line 49 of file TosaToSCFPass.cpp.
References mlir::OpPassManager::addNestedPass(), and mlir::createTosaToSCFPass().
| SmallVector< T > mlir::tosa::applyTOSAPermutation | ( | ArrayRef< T > | input, |
| ArrayRef< int32_t > | perms ) |
Definition at line 231 of file ConversionUtils.h.
| 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 202 of file QuantUtils.cpp.
References mlir::Builder::getAttr(), and getConvZeroPoints().
Referenced by buildConvOpWithQuantInfo(), 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 293 of file QuantUtils.cpp.
References GET_QTYPE, mlir::Builder::getI32Type(), mlir::Builder::getIntegerType(), and mlir::Value::getType().
Referenced by buildConvOpWithQuantInfo(), 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 218 of file QuantUtils.cpp.
References b, GET_UQTYPE, mlir::Builder::getAttr(), and mlir::Value::getType().
Referenced by buildMatMulLikeOpWithQuantInfo().
Builds PadOpQuantizationAttr, called from PadOpQuantInfoBuilder: inputZp: input zeropoint.
Definition at line 273 of file QuantUtils.cpp.
References GET_UQTYPE, mlir::Builder::getAttr(), and mlir::Value::getType().
Referenced by 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 393 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 325 of file QuantUtils.cpp.
References 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 247 of file QuantUtils.cpp.
References GET_UQTYPE, mlir::Builder::getAttr(), and mlir::Value::getType().
Referenced by buildAvgPool2dAdaptiveOpWithQuantInfo(), buildAvgPool2dOpWithQuantInfo(), and buildNegateOpWithQuantInfo().
| std::optional< SmallVector< Value > > mlir::tosa::checkHasDynamicBatchDims | ( | PatternRewriter & | rewriter, |
| Op | op, | ||
| ArrayRef< Value > | params ) |
Definition at line 64 of file ConversionUtils.h.
References mlir::OpState::getLoc(), and mlir::RewriterBase::notifyMatchFailure().
| Value mlir::tosa::clampFloatHelper | ( | Location | loc, |
| Value | arg, | ||
| Value | min, | ||
| Value | max, | ||
| OpBuilder & | rewriter ) |
Definition at line 35 of file ConversionUtils.cpp.
Referenced by createLinalgBodyCalculationForElementwiseOp().
| Value mlir::tosa::clampIntHelper | ( | Location | loc, |
| Value | arg, | ||
| Value | min, | ||
| Value | max, | ||
| OpBuilder & | rewriter, | ||
| bool | isUnsigned ) |
Definition at line 41 of file ConversionUtils.cpp.
Referenced by createLinalgBodyCalculationForElementwiseOp().
| bool 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 95 of file QuantUtils.cpp.
References computeMultiplierAndShiftTosaScale16(), and computeMultiplierAndShiftTosaScale32().
| std::pair< OpFoldResult, Value > mlir::tosa::computeTargetSize | ( | PatternRewriter & | rewriter, |
| Location | loc, | ||
| IndexPool & | indexPool, | ||
| ValueRange | operands, | ||
| int64_t | dim ) |
Compute the broadcasted runtime size of dimension dim of an elementwise operation whose operands all share the same rank (TOSA's SameOperandsAndResultRank and ResultsBroadcastableShape traits).
The returned size is either a static IndexAttr or an SSA Value holding the runtime size, so dynamic dimensions (fixed rank, unknown size) are handled correctly. The second element of the pair is the operand that solely determines the size, or nullptr when it is inferred from several operands. indexPool caches constant index values across calls.
Definition at line 816 of file TosaToLinalg.cpp.
References mlir::Builder::getIndexAttr(), getTensorDim(), and mlir::Value::getType().
Referenced by computeTargetShape(), and normalizeMatMulBatchDimensions().
| SmallVector< Value > mlir::tosa::condenseValues | ( | const SmallVector< Value > & | values | ) |
Definition at line 27 of file ConversionUtils.cpp.
Referenced by inferDynamicDimsForConv(), and prepareMatMulOperands().
| spirv::TargetEnvAttr mlir::tosa::constructTargetEnvAttrWithCapExtDefaults | ( | MLIRContext * | context, |
| spirv::ResourceLimitsAttr | limits = {}, | ||
| spirv::ClientAPI | clientAPI = spirv::ClientAPI::Unknown, | ||
| spirv::Vendor | vendorID = spirv::Vendor::Unknown, | ||
| spirv::DeviceType | deviceType = spirv::DeviceType::Unknown, | ||
| uint32_t | deviceID = spirv::TargetEnvAttr::kUnknownDeviceID ) |
Definition at line 95 of file TosaToSPIRVTosaPass.cpp.
References mlir::spirv::TargetEnvAttr::get(), mlir::spirv::getDefaultResourceLimits(), and getDefaultVerCapExtAttr().
| SmallVector< int64_t > mlir::tosa::convertFromIntAttr | ( | const DenseElementsAttr & | attr, |
| const int | rank ) |
Definition at line 215 of file ConversionUtils.cpp.
References mlir::DenseElementsAttr::getSplatValue(), and mlir::DenseElementsAttr::isSplat().
| SmallVector< int64_t > mlir::tosa::convertFromMlirShape | ( | ArrayRef< int64_t > | shape | ) |
Definition at line 191 of file ConversionUtils.cpp.
Referenced by buildVariableOp(), and getTosaConstShape().
| TosaOp mlir::tosa::CreateOpAndInferShape | ( | ImplicitLocOpBuilder & | builder, |
| Type | resultTy, | ||
| Args &&... | args ) |
Definition at line 155 of file ConversionUtils.h.
References createOpAndInferShape(), and EqualizeRanks().
Referenced by CreateOpAndInferShape().
| TosaOp mlir::tosa::CreateOpAndInferShape | ( | PatternRewriter & | rewriter, |
| Location | loc, | ||
| Type | resultTy, | ||
| Args &&... | args ) |
Definition at line 222 of file ConversionUtils.h.
References CreateOpAndInferShape().
| TosaOp mlir::tosa::createOpAndInferShape | ( | ImplicitLocOpBuilder & | builder, |
| Type | resultTy, | ||
| Args &&... | args ) |
Definition at line 103 of file ConversionUtils.h.
References mlir::tosa::ValueKnowledge::getKnowledgeFromType(), mlir::ImplicitLocOpBuilder::getLoc(), mlir::tosa::ValueKnowledge::getPessimisticValueState(), mlir::tosa::ValueKnowledge::join(), and result.
Referenced by CreateOpAndInferShape().
| Value mlir::tosa::createPadConstTensor | ( | OpBuilder & | builder, |
| Location | loc, | ||
| Value | src, | ||
| int32_t | val = 0 ) |
Definition at line 300 of file TosaOps.cpp.
References mlir::DenseElementsAttr::get(), mlir::getElementTypeOrSelf(), mlir::Builder::getFloatAttr(), mlir::Builder::getIntegerAttr(), and getStorageElementTypeOrSelf().
Referenced by buildPadOpWithQuantInfo().
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaArithConstantToTosaConstPass | ( | ) |
We declare an explicit private instantiation because Pass classes should only be visible by the current library.
Definition at line 100 of file TosaArithConstantToConst.cpp.
References mlir::RewritePatternSet::add(), mlir::applyPatternsGreedily(), and getContext().
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaAttachTarget | ( | ) |
Definition at line 217 of file TosaAttachTarget.cpp.
Referenced by addTosaToLinalgPasses().
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaAttachTarget | ( | TosaAttachTargetOptions | options | ) |
Definition at line 221 of file TosaAttachTarget.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaConvertIntegerTypesBitwidthPass | ( | ) |
Definition at line 399 of file TosaConvertIntegerTypesBitwidth.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaConvertIntegerTypesBitwidthPass | ( | TosaConvertIntegerTypesBitwidthPassOptions | options | ) |
Definition at line 403 of file TosaConvertIntegerTypesBitwidth.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaConvertIntegerTypeToSignless | ( | ) |
We declare an explicit private instantiation because Pass classes should only be visible by the current library.
Definition at line 302 of file TosaConvertIntegerTypeToSignless.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaDowngrade1p1To1p0Pass | ( | ) |
We declare an explicit private instantiation because Pass classes should only be visible by the current library.
Definition at line 484 of file TosaDowngrade1p1To1p0.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaGatherScatterHardeningPass | ( | ) |
We declare an explicit private instantiation because Pass classes should only be visible by the current library.
Definition at line 565 of file TosaGatherScatterHardening.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaInferShapesPass | ( | ) |
Definition at line 666 of file TosaInferShapes.cpp.
Referenced by addTosaToLinalgPasses().
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaInferShapesPass | ( | TosaInferShapesPassOptions | options | ) |
Definition at line 670 of file TosaInferShapes.cpp.
| std::unique_ptr< Pass > mlir::tosa::createTosaInputShapePass | ( | std::vector< std::string > | args = {} | ) |
Definition at line 183 of file TosaInputShape.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaLayerwiseConstantFoldPass | ( | ) |
Definition at line 842 of file TosaLayerwiseConstantFoldPass.cpp.
Referenced by addTosaToLinalgPasses().
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaLayerwiseConstantFoldPass | ( | TosaLayerwiseConstantFoldPassOptions | options | ) |
Definition at line 846 of file TosaLayerwiseConstantFoldPass.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaMakeBroadcastablePass | ( | ) |
We declare an explicit private instantiation because Pass classes should only be visible by the current library.
Definition at line 927 of file TosaMakeBroadcastable.cpp.
Referenced by addTosaToLinalgPasses().
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaNarrowF32ToF16Pass | ( | ) |
Definition at line 1030 of file TosaNarrowTypes.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaNarrowF32ToF16Pass | ( | TosaNarrowF32ToF16PassOptions | options | ) |
Definition at line 1034 of file TosaNarrowTypes.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaNarrowF64ToF32Pass | ( | ) |
Definition at line 1134 of file TosaNarrowTypes.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaNarrowF64ToF32Pass | ( | TosaNarrowF64ToF32PassOptions | options | ) |
Definition at line 1138 of file TosaNarrowTypes.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaNarrowI64ToI32Pass | ( | ) |
Definition at line 1238 of file TosaNarrowTypes.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaNarrowI64ToI32Pass | ( | TosaNarrowI64ToI32PassOptions | options | ) |
Definition at line 1242 of file TosaNarrowTypes.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaOptionalDecompositionsPass | ( | ) |
We declare an explicit private instantiation because Pass classes should only be visible by the current library.
Definition at line 1323 of file TosaOptionalDecompositions.cpp.
Referenced by addTosaToLinalgPasses().
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaReduceReshapes | ( | ) |
We declare an explicit private instantiation because Pass classes should only be visible by the current library.
Definition at line 1404 of file TosaReduceReshapes.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaReduceTransposes | ( | ) |
We declare an explicit private instantiation because Pass classes should only be visible by the current library.
Definition at line 1485 of file TosaReduceTransposes.cpp.
| std::unique_ptr< Pass > mlir::tosa::createTosaTestQuantUtilAPIPass | ( | ) |
| std::unique_ptr< Pass > mlir::tosa::createTosaToLinalg | ( | const TosaToLinalgOptions & | options = TosaToLinalgOptions() | ) |
Definition at line 85 of file TosaToLinalgPass.cpp.
References options.
Referenced by addTosaToLinalgPasses().
| std::unique_ptr< Pass > mlir::tosa::createTosaToLinalgNamed | ( | const TosaToLinalgNamedOptions & | options = TosaToLinalgNamedOptions() | ) |
Definition at line 103 of file TosaToLinalgNamedPass.cpp.
References options.
Referenced by addTosaToLinalgPasses().
| std::unique_ptr< Pass > mlir::tosa::createTosaToSPIRVTosa | ( | ) |
Definition at line 279 of file TosaToSPIRVTosaPass.cpp.
| std::unique_ptr< Pass > mlir::tosa::createTosaToSPIRVTosaMarkGraphConstants | ( | ) |
Definition at line 88 of file TosaToSPIRVTosaConstants.cpp.
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaValidation | ( | ) |
Definition at line 1588 of file TosaValidation.cpp.
Referenced by addTosaToLinalgPasses().
| std::unique_ptr<::mlir::Pass > mlir::tosa::createTosaValidation | ( | TosaValidationOptions | options | ) |
Definition at line 1592 of file TosaValidation.cpp.
| std::optional< Value > mlir::tosa::createZeroPointTensor | ( | OpBuilder & | builder, |
| Location | loc, | ||
| Type | srcElemType, | ||
| int64_t | zp = 0 ) |
Definition at line 5548 of file TosaOps.cpp.
References mlir::DenseElementsAttr::get(), mlir::Builder::getFloatAttr(), mlir::Builder::getIntegerAttr(), and getStorageElementTypeOrSelf().
Referenced by buildAvgPool2dAdaptiveOpWithQuantInfo(), buildAvgPool2dOpWithQuantInfo(), buildNegateOpWithQuantInfo(), and createZPsAsConst().
| std::pair< Value, Value > mlir::tosa::createZPsAsConst | ( | OpBuilder & | builder, |
| Value | input, | ||
| Value | weight ) |
Definition at line 162 of file QuantUtils.cpp.
References createZeroPointTensor(), getConvZeroPoints(), mlir::getElementTypeOrSelf(), mlir::Builder::getF32Type(), mlir::Value::getLoc(), and mlir::Value::getType().
Referenced by buildConvOpWithQuantInfo(), buildMatMulLikeOpWithQuantInfo(), and buildTransConvOpWithQuantInfo().
|
static |
Definition at line 558 of file TosaProfileCompliance.cpp.
References allOf.
Referenced by emitProfileOrExtensionError().
|
static |
Definition at line 574 of file TosaProfileCompliance.cpp.
References emitModeRequirements(), mlir::Operation::emitOpError(), entriesAtVersion(), mlir::tosa::TargetEnv::getSpecVersion(), mlir::tosa::TosaSpecificationVersion::isBackwardsCompatibleWith(), satisfiesComplianceRequirements(), and stringifyVersion().
Referenced by mlir::tosa::TosaProfileCompliance::checkCompliance().
|
static |
Definition at line 550 of file TosaProfileCompliance.cpp.
Referenced by mlir::tosa::TosaProfileCompliance::checkCompliance(), and emitProfileOrExtensionError().
| LogicalResult mlir::tosa::EqualizeRanks | ( | ImplicitLocOpBuilder & | builder, |
| Value & | input1, | ||
| Value & | input2 ) |
Definition at line 122 of file ConversionUtils.cpp.
References getTosaConstShape(), mlir::Value::getType(), and success().
| LogicalResult mlir::tosa::EqualizeRanks | ( | PatternRewriter & | rewriter, |
| Location | loc, | ||
| Value & | input1, | ||
| Value & | input2 ) |
Common code to create the reshape op where necessary to make the rank of two values equal.
input1 and input2 will be updated when the rank has changed. The caller is expected to use these to rewrite the original operator with the RESHAPE now in the graph.
Definition at line 116 of file ConversionUtils.cpp.
References EqualizeRanks().
Referenced by CreateOpAndInferShape(), and EqualizeRanks().
Definition at line 1599 of file TosaToLinalg.cpp.
References mlir::Type::getContext(), and mlir::Type::isBF16().
Referenced by reduceMatchAndRewriteHelper().
Definition at line 315 of file TosaOps.cpp.
References getBitWidth(), and mlir::Type::getIntOrFloatBitWidth().
Referenced by getBitWidth().
| template FailureOr< int32_t > mlir::tosa::getConstantScalarIntValue< int32_t > | ( | Value | val | ) |
Definition at line 260 of file ConversionUtils.cpp.
References mlir::m_Constant(), and mlir::matchPattern().
Referenced by RowGatherToGather::matchAndRewrite().
| bool mlir::tosa::getConstShapeValues | ( | Operation * | op, |
| llvm::SmallVector< int64_t > & | result_shape ) |
Definition at line 196 of file ConversionUtils.cpp.
References mlir::DenseElementsAttr::getValues(), and mlir::DenseElementsAttr::size().
Referenced by extractAdaptivePoolingConstShapeOperands(), ConvInferShapeAdaptor< Conv2DBlockScaledOp::Adaptor >::getSpatialParameters(), AvgPool2dAdaptiveToAvgPool2d::matchAndRewrite(), and MaxPool2dAdaptiveToMaxPool2d::matchAndRewrite().
| Value mlir::tosa::getConstTensorInt | ( | OpBuilder & | builder, |
| Location | loc, | ||
| ArrayRef< IntType > | vec ) |
Definition at line 36 of file QuantUtils.h.
References mlir::DenseElementsAttr::get(), and mlir::Builder::getIntegerType().
| SmallVector< Profile, 2 > mlir::tosa::getCooperativeProfiles | ( | Extension | ext | ) |
Definition at line 73 of file TargetEnv.cpp.
Referenced by mlir::tosa::TargetEnv::verifyTargetInformation().
| TargetEnvAttr mlir::tosa::getDefaultTargetEnv | ( | MLIRContext * | context | ) |
Definition at line 195 of file TargetEnv.cpp.
Referenced by lookupTargetEnvOrDefault().
| spirv::VerCapExtAttr mlir::tosa::getDefaultVerCapExtAttr | ( | MLIRContext * | context | ) |
Definition at line 67 of file TosaToSPIRVTosaPass.cpp.
References mlir::spirv::VerCapExtAttr::get().
Referenced by constructTargetEnvAttrWithCapExtDefaults().
| APFloat mlir::tosa::getFloatMinMaxIdentity | ( | const llvm::fltSemantics & | semantics, |
| bool | negative, | ||
| bool | allowNonFinites ) |
Definition at line 65 of file ConversionUtils.cpp.
Referenced by createInitialValueForReduceOp().
| TosaSpecificationVersion mlir::tosa::getMinVersion | ( | const Extension & | extension | ) |
Definition at line 41 of file TargetEnv.cpp.
| TosaSpecificationVersion mlir::tosa::getMinVersion | ( | const Level & | level | ) |
Definition at line 106 of file TargetEnv.cpp.
| TosaSpecificationVersion mlir::tosa::getMinVersion | ( | const Profile & | profile | ) |
Definition at line 30 of file TargetEnv.cpp.
Referenced by mlir::tosa::TargetEnv::verifyTargetInformation().
| SmallVector< utils::IteratorType > mlir::tosa::getNParallelLoopsAttrs | ( | unsigned | nParallelLoops | ) |
Definition at line 21 of file ConversionUtils.cpp.
Referenced by broadcastDynamicDimension(), emitElementwiseComputation(), linalgBroadcastAndMaybeExt(), linalgIntBroadcastExtSIAdd(), reduceMatchAndRewriteHelper(), and truncateToOutputType().
| Type mlir::tosa::getStorageElementTypeFromQuantized | ( | quant::QuantizedType | quantizedType | ) |
Definition at line 403 of file QuantUtils.cpp.
References mlir::quant::QuantizedType::getStorageType(), and mlir::quant::QuantizedType::isSigned().
Referenced by getStorageElementTypeOrSelf(), ClampClampOptimization::matchAndRewrite(), and verifyConvOp().
Definition at line 269 of file TosaOps.cpp.
References mlir::getElementTypeOrSelf(), and getStorageElementTypeFromQuantized().
Referenced by buildMatMulLikeOpWithQuantInfo(), createPadConstTensor(), createZeroPointTensor(), getStorageElementTypeOrSelf(), verifyAvgPoolCommonTypeAndZpChecks(), verifyConvOp(), verifyMatMulZeroPointType(), and verifyRescaleValueAndZpTypes().
Definition at line 276 of file TosaOps.cpp.
References getStorageElementTypeOrSelf(), and mlir::Value::getType().
| Value mlir::tosa::getTosaConstShape | ( | ImplicitLocOpBuilder & | builder, |
| llvm::ArrayRef< int64_t > | shape ) |
Definition at line 177 of file ConversionUtils.cpp.
References convertFromMlirShape(), mlir::Builder::getContext(), mlir::Builder::getIndexTensorAttr(), and mlir::Operation::getResult().
Referenced by buildAvgPool2dAdaptiveOpWithQuantInfo(), EqualizeRanks(), getTosaConstShape(), ConcatSliceOptimization::matchAndRewrite(), PadSliceOptimization::matchAndRewrite(), SliceDynamicSizeCanonicalization::matchAndRewrite(), and TransposeIsReshape::matchAndRewrite().
| Value mlir::tosa::getTosaConstShape | ( | PatternRewriter & | rewriter, |
| Location | loc, | ||
| llvm::ArrayRef< int64_t > | shape ) |
Definition at line 185 of file ConversionUtils.cpp.
References getTosaConstShape().
| TosaLevel mlir::tosa::getTosaLevelFromEnum | ( | const Level | level | ) |
Definition at line 15 of file TargetEnv.cpp.
References TOSA_LEVEL_EIGHTK, and TOSA_LEVEL_NONE.
Referenced by ConsecutiveConcatOptimization::matchAndRewrite().
| std::string mlir::tosa::getTosaTensorTypeErrorMessage | ( | mlir::Type | type | ) |
Definition at line 493 of file TosaOps.cpp.
References mlir::emitError(), mlir::Type::getContext(), and verifyBlockScaledTensorType().
| RankedTensorType mlir::tosa::getVariableType | ( | VariableOp | variableOp | ) |
References mlir::emitError().
Referenced by verifyVariableOpErrorIf().
| bool mlir::tosa::hasUniqueConstantScatterIndices | ( | ShapedType | indicesType, |
| DenseIntElementsAttr | indicesAttr ) |
Definition at line 231 of file ConversionUtils.cpp.
| bool mlir::tosa::isa_tosa_shape_type | ( | mlir::Type | t | ) |
Definition at line 5572 of file TosaOps.cpp.
| std::optional< linalg::ElementwiseKind > mlir::tosa::isConvertibleToLinalgElementwise | ( | Operation * | op | ) |
Returns the linalg.elementwise kind that the TosaToLinalgNamed conversion lowers op to, or std::nullopt if op has no such counterpart.
Definition at line 144 of file TosaToLinalgNamed.cpp.
References getElementwiseKind(), mlir::Operation::getNumResults(), mlir::Operation::getOperands(), mlir::Operation::getResult(), and mlir::Value::getType().
|
static |
Definition at line 534 of file TosaProfileCompliance.cpp.
References allOf, mlir::tosa::TargetEnv::allowsAllOf(), mlir::tosa::TargetEnv::allowsAnyOf(), mlir::tosa::OpComplianceInfo< T >::condition, and mlir::tosa::OpComplianceInfo< T >::mode.
Referenced by mlir::tosa::TosaProfileCompliance::checkCompliance(), and satisfiesComplianceRequirements().
| TargetEnvAttr mlir::tosa::lookupTargetEnv | ( | Operation * | op | ) |
Definition at line 179 of file TargetEnv.cpp.
References mlir::Operation::getDiscardableAttrOfType(), mlir::SymbolTable::getNearestSymbolTable(), and mlir::Operation::getParentOp().
Referenced by lookupTargetEnvOrDefault(), and ConsecutiveConcatOptimization::matchAndRewrite().
| TargetEnvAttr mlir::tosa::lookupTargetEnvOrDefault | ( | Operation * | op | ) |
Queries the target environment recursively from enclosing symbol table ops containing the given op or returns the default target environment as returned by getDefaultTargetEnv() if not provided.
Definition at line 200 of file TargetEnv.cpp.
References mlir::Operation::getContext(), getDefaultTargetEnv(), and lookupTargetEnv().
| ParseResult mlir::tosa::parseVariableOpTypeOrInitialValue | ( | OpAsmParser & | parser, |
| DenseElementsAttr & | varShapeAttr, | ||
| TypeAttr & | typeAttr, | ||
| Attribute & | initialValueAttr ) |
Definition at line 211 of file TosaOps.cpp.
References mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), mlir::AsmParser::parseAttribute(), mlir::AsmParser::parseColonType(), and mlir::AsmParser::parseOptionalEqual().
| void mlir::tosa::populateTosaConstantReduction | ( | MLIRContext * | ctx, |
| RewritePatternSet & | patterns, | ||
| bool | aggressiveReduceConstant ) |
Definition at line 469 of file TosaFolders.cpp.
References mlir::RewritePatternSet::add().
| void mlir::tosa::populateTosaDecomposeDepthwise | ( | MLIRContext * | ctx, |
| RewritePatternSet & | patterns ) |
Definition at line 197 of file TosaDecomposeDepthwise.cpp.
References mlir::RewritePatternSet::add().
| void mlir::tosa::populateTosaDecomposeTransposeConv | ( | MLIRContext * | ctx, |
| RewritePatternSet & | patterns ) |
Definition at line 345 of file TosaDecomposeTransposeConv.cpp.
References mlir::RewritePatternSet::add().
| void mlir::tosa::populateTosaFoldConstantReciprocalPatterns | ( | MLIRContext * | ctx, |
| RewritePatternSet & | patterns ) |
Definition at line 491 of file TosaFolders.cpp.
References mlir::RewritePatternSet::add().
| void mlir::tosa::populateTosaFoldConstantTransposePatterns | ( | MLIRContext * | ctx, |
| RewritePatternSet & | patterns ) |
Definition at line 486 of file TosaFolders.cpp.
References mlir::RewritePatternSet::add().
| void mlir::tosa::populateTosaRescaleToArithConversionPatterns | ( | RewritePatternSet * | patterns, |
| bool | include32Bit = false ) |
Definition at line 258 of file TosaToArith.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
| void mlir::tosa::populateTosaToArithConversionPatterns | ( | RewritePatternSet * | patterns | ) |
Definition at line 253 of file TosaToArith.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
| void mlir::tosa::populateTosaToLinalgConversionPatterns | ( | const TypeConverter & | converter, |
| RewritePatternSet * | patterns, | ||
| const TosaToLinalgOptions & | options = TosaToLinalgOptions() ) |
Populates conversion passes from TOSA dialect to Linalg dialect.
Definition at line 3541 of file TosaToLinalg.cpp.
References mlir::RewritePatternSet::add(), mlir::RewritePatternSet::getContext(), and options.
| void mlir::tosa::populateTosaToLinalgNamedConversionPatterns | ( | const TypeConverter & | converter, |
| RewritePatternSet * | patterns, | ||
| const TosaToLinalgNamedOptions & | options ) |
Populates conversion passes from TOSA dialect to Linalg named operations.
Definition at line 1523 of file TosaToLinalgNamed.cpp.
References mlir::RewritePatternSet::add(), mlir::RewritePatternSet::getContext(), and options.
| void mlir::tosa::populateTosaToMLProgramConversionPatterns | ( | RewritePatternSet * | patterns | ) |
Definition at line 72 of file TosaToMLProgram.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
| void mlir::tosa::populateTosaToSCFConversionPatterns | ( | RewritePatternSet * | patterns | ) |
Definition at line 181 of file TosaToSCF.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
| void mlir::tosa::populateTosaToSPIRVTosaConversionPatterns | ( | SPIRVTypeConverter & | typeConverter, |
| RewritePatternSet & | patterns, | ||
| spirv::TargetEnvAttr | targetAttr ) |
Definition at line 173 of file TosaToSPIRVTosa.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
| void mlir::tosa::populateTosaToSPIRVTosaCustomConversionPatterns | ( | SPIRVTypeConverter & | typeConverter, |
| RewritePatternSet & | patterns, | ||
| llvm::StringMap< int32_t > | domainToOpcode ) |
Definition at line 100 of file TosaToSPIRVTosaCustom.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
| void mlir::tosa::populateTosaToSPIRVTosaOpsConversionPatterns | ( | SPIRVTypeConverter & | typeConverter, |
| RewritePatternSet & | patterns ) |
Definition at line 483 of file TosaToSPIRVTosaOps.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
| void mlir::tosa::populateTosaToTensorConversionPatterns | ( | const TypeConverter & | converter, |
| RewritePatternSet * | patterns ) |
Definition at line 425 of file TosaToTensor.cpp.
References mlir::RewritePatternSet::add(), and mlir::RewritePatternSet::getContext().
| void mlir::tosa::populateTosaTypeConversion | ( | TypeConverter & | converter | ) |
Definition at line 20 of file TosaTypeConverters.cpp.
References mlir::Type::getContext(), mlir::Type::getIntOrFloatBitWidth(), and mlir::Type::isUnsignedInteger().
| MatMulTOperands mlir::tosa::prepareMatMulOperands | ( | PatternRewriter & | rewriter, |
| Location | loc, | ||
| Value | a, | ||
| Value | b, | ||
| RankedTensorType | outputType, | ||
| bool | transposeB ) |
Broadcast the batch dimensions of the ranked operands and create a zero-filled result tensor for either MATMUL_T lowering pattern.
Definition at line 1563 of file TosaToLinalg.cpp.
References b, condenseValues(), mlir::tensor::getMixedSize(), mlir::getValueOrCreateConstantIndexOp(), mlir::Builder::getZeroAttr(), normalizeMatMulBatchDimensions(), and result.
| void mlir::tosa::printVariableOpTypeOrInitialValue | ( | OpAsmPrinter & | p, |
| Operation * | op, | ||
| DenseElementsAttr | varShapeAttr, | ||
| TypeAttr | typeAttr, | ||
| Attribute | initialValueAttr ) |
Definition at line 236 of file TosaOps.cpp.
References convertToMlirShape(), mlir::DenseElementsAttr::getValues(), and mlir::AsmPrinter::printAttribute().
| void mlir::tosa::registerAllExtensions | ( | DialectRegistry & | registry | ) |
Register all extensions of the Tosa dialect.
This should generally only be used by tools, or other use cases that really do want all extensions of the dialect. All other cases should prefer to instead register the specific extensions they intend to take advantage of.
Definition at line 14 of file AllExtensions.cpp.
References registerShardingInterfaceExternalModels().
Referenced by mlir::registerAllExtensions().
| void mlir::tosa::registerShardingInterfaceExternalModels | ( | DialectRegistry & | registry | ) |
Definition at line 114 of file ShardingInterfaceImpl.cpp.
References mlir::DialectRegistry::addExtension().
Referenced by registerAllExtensions().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 2017 of file Passes.h.
Referenced by mlir::registerAllPasses().
|
inline |
|
inline |
| void mlir::tosa::registerTosaToLinalgPipelines | ( | ) |
Populates TOSA to linalg pipelines Currently, this includes only the "tosa-to-linalg-pipeline".
Definition at line 143 of file TosaToLinalgPass.cpp.
References addTosaToLinalgPasses().
Referenced by mlir::registerAllPasses().
|
static |
Definition at line 542 of file TosaProfileCompliance.cpp.
References isModeSupported().
Referenced by mlir::tosa::TosaProfileCompliance::checkCompliance(), and emitProfileOrExtensionError().
| llvm::SmallString< 4 > mlir::tosa::stringifyVersion | ( | TosaSpecificationVersion | version | ) |
Definition at line 25 of file TargetEnv.cpp.
References mlir::tosa::TosaSpecificationVersion::getMajor(), mlir::tosa::TosaSpecificationVersion::getMinor(), and mlir::tosa::TosaSpecificationVersion::isDraft().
Referenced by emitProfileOrExtensionError(), and mlir::tosa::TargetEnv::verifyTargetInformation().
| Value mlir::tosa::truncateToOutputType | ( | PatternRewriter & | rewriter, |
| Location | loc, | ||
| Value | input, | ||
| RankedTensorType | targetType ) |
Truncate an FP32 tensor to BF16 without changing shape or encoding.
Definition at line 1606 of file TosaToLinalg.cpp.
References mlir::Builder::getMultiDimIdentityMap(), getNParallelLoopsAttrs(), mlir::AffineMap::getResult(), mlir::Value::getType(), and mlir::Type::isBF16().
| std::optional< ArrayRef< T > > mlir::tosa::tryGetDenseResourceValues | ( | ElementsAttr | attr | ) |
Definition at line 263 of file ConversionUtils.h.
References mlir::AsmResourceBlob::getData(), and mlir::DenseElementsAttr::isValidRawBuffer().
Definition at line 51 of file ConversionUtils.cpp.
| LogicalResult mlir::tosa::verifyBlockScaledTensorType | ( | mlir::Type | type, |
| llvm::function_ref< mlir::InFlightDiagnostic()> | emitError = nullptr, | ||
| bool | allowScaleValues = false ) |
Definition at line 428 of file TosaOps.cpp.
References mlir::emitError(), and success().
Referenced by getTosaTensorTypeErrorMessage().
|
constexpr |
Definition at line 41 of file TosaToSPIRVTosa.h.
|
constexpr |
Definition at line 36 of file TosaToSPIRVTosa.h.
|
constexpr |
Represents a dimension in the shape of a tensor that can be inferred based on the other provided dimensions.
For example, in a reshape operation, -1 can be used to indicate a size that is the remainder of the other dimensions.
Definition at line 97 of file TosaOps.h.
Referenced by PadSliceOptimization::matchAndRewrite(), and SliceDynamicSizeCanonicalization::matchAndRewrite().
|
staticconstexpr |
Definition at line 43 of file TargetEnv.h.
Referenced by getTosaLevelFromEnum().
|
staticconstexpr |
Definition at line 45 of file TargetEnv.h.
Referenced by getTosaLevelFromEnum().