MLIR
15.0.0git
|
This class is a general helper class for creating context-global objects like types, attributes, and affine expressions. More...
#include "mlir/IR/Builders.h"
Public Member Functions | |
Builder (MLIRContext *context) | |
Builder (Operation *op) | |
MLIRContext * | getContext () const |
Location | getUnknownLoc () |
Location | getFusedLoc (ArrayRef< Location > locs, Attribute metadata=Attribute()) |
FloatType | getBF16Type () |
FloatType | getF16Type () |
FloatType | getF32Type () |
FloatType | getF64Type () |
FloatType | getF80Type () |
FloatType | getF128Type () |
IndexType | getIndexType () |
IntegerType | getI1Type () |
IntegerType | getI8Type () |
IntegerType | getI32Type () |
IntegerType | getI64Type () |
IntegerType | getIntegerType (unsigned width) |
IntegerType | getIntegerType (unsigned width, bool isSigned) |
FunctionType | getFunctionType (TypeRange inputs, TypeRange results) |
TupleType | getTupleType (TypeRange elementTypes) |
NoneType | getNoneType () |
template<typename Ty , typename... Args> | |
Ty | getType (Args... args) |
Get or construct an instance of the type 'ty' with provided arguments. More... | |
NamedAttribute | getNamedAttr (StringRef name, Attribute val) |
UnitAttr | getUnitAttr () |
BoolAttr | getBoolAttr (bool value) |
DictionaryAttr | getDictionaryAttr (ArrayRef< NamedAttribute > value) |
IntegerAttr | getIntegerAttr (Type type, int64_t value) |
IntegerAttr | getIntegerAttr (Type type, const APInt &value) |
FloatAttr | getFloatAttr (Type type, double value) |
FloatAttr | getFloatAttr (Type type, const APFloat &value) |
StringAttr | getStringAttr (const Twine &bytes) |
ArrayAttr | getArrayAttr (ArrayRef< Attribute > value) |
Attribute | getZeroAttr (Type type) |
FloatAttr | getF16FloatAttr (float value) |
FloatAttr | getF32FloatAttr (float value) |
FloatAttr | getF64FloatAttr (double value) |
IntegerAttr | getI8IntegerAttr (int8_t value) |
IntegerAttr | getI16IntegerAttr (int16_t value) |
IntegerAttr | getI32IntegerAttr (int32_t value) |
IntegerAttr | getI64IntegerAttr (int64_t value) |
IntegerAttr | getIndexAttr (int64_t value) |
IntegerAttr | getSI32IntegerAttr (int32_t value) |
Signed and unsigned integer attribute getters. More... | |
IntegerAttr | getUI32IntegerAttr (uint32_t value) |
DenseIntElementsAttr | getBoolVectorAttr (ArrayRef< bool > values) |
Vector-typed DenseIntElementsAttr getters. values must not be empty. More... | |
DenseIntElementsAttr | getI32VectorAttr (ArrayRef< int32_t > values) |
DenseIntElementsAttr | getI64VectorAttr (ArrayRef< int64_t > values) |
DenseIntElementsAttr | getIndexVectorAttr (ArrayRef< int64_t > values) |
DenseIntElementsAttr | getI32TensorAttr (ArrayRef< int32_t > values) |
Tensor-typed DenseIntElementsAttr getters. More... | |
DenseIntElementsAttr | getI64TensorAttr (ArrayRef< int64_t > values) |
DenseIntElementsAttr | getIndexTensorAttr (ArrayRef< int64_t > values) |
ArrayAttr | getAffineMapArrayAttr (ArrayRef< AffineMap > values) |
ArrayAttr | getBoolArrayAttr (ArrayRef< bool > values) |
ArrayAttr | getI32ArrayAttr (ArrayRef< int32_t > values) |
ArrayAttr | getI64ArrayAttr (ArrayRef< int64_t > values) |
ArrayAttr | getIndexArrayAttr (ArrayRef< int64_t > values) |
ArrayAttr | getF32ArrayAttr (ArrayRef< float > values) |
ArrayAttr | getF64ArrayAttr (ArrayRef< double > values) |
ArrayAttr | getStrArrayAttr (ArrayRef< StringRef > values) |
ArrayAttr | getTypeArrayAttr (TypeRange values) |
AffineExpr | getAffineDimExpr (unsigned position) |
AffineExpr | getAffineSymbolExpr (unsigned position) |
AffineExpr | getAffineConstantExpr (int64_t constant) |
AffineMap | getEmptyAffineMap () |
Returns a zero result affine map with no dimensions or symbols: () -> (). More... | |
AffineMap | getConstantAffineMap (int64_t val) |
Returns a single constant result affine map with 0 dimensions and 0 symbols. More... | |
AffineMap | getDimIdentityMap () |
AffineMap | getMultiDimIdentityMap (unsigned rank) |
AffineMap | getSymbolIdentityMap () |
AffineMap | getSingleDimShiftAffineMap (int64_t shift) |
Returns a map that shifts its (single) input dimension by 'shift'. More... | |
AffineMap | getShiftedAffineMap (AffineMap map, int64_t shift) |
Returns an affine map that is a translation (shift) of all result expressions in 'map' by 'shift'. More... | |
Protected Attributes | |
MLIRContext * | context |
This class is a general helper class for creating context-global objects like types, attributes, and affine expressions.
Definition at line 49 of file Builders.h.
|
inlineexplicit |
Definition at line 51 of file Builders.h.
|
inlineexplicit |
Definition at line 52 of file Builders.h.
AffineExpr Builder::getAffineConstantExpr | ( | int64_t | constant | ) |
Definition at line 293 of file Builders.cpp.
References context, and mlir::getAffineConstantExpr().
Referenced by addLoopRangeConstraints(), getConstantAffineMap(), getType(), mlir::normalizeAffineParallel(), setInterTileBoundsParametric(), and setIntraTileBoundsParametric().
AffineExpr Builder::getAffineDimExpr | ( | unsigned | position | ) |
Definition at line 285 of file Builders.cpp.
References context, and mlir::getAffineDimExpr().
Referenced by addLoopRangeConstraints(), mlir::alignAffineMapWithValues(), augmentMapAndBounds(), mlir::coalesceLoops(), createDepthwiseConvCollapseMap(), createPrivateMemRef(), createReassociationMapsForCollapse(), generateCopy(), generatePointWiseCopy(), genVectorMask(), getCleanupLoopLowerBound(), getDimIdentityMap(), getIndexingMapInExpandedOp(), getMultiDimIdentityMap(), getSingleDimShiftAffineMap(), getType(), getXferIndices(), mlir::loopUnrollJamByFactor(), mlir::normalizeAffineFor(), processParallelLoop(), ReifyExpandOrCollapseShapeOp< OpTy >::reifyResultShapes(), resolveSourceIndices(), setIntraTileBoundsParametric(), splatZero(), and mlir::linalg::splitReduction().
Definition at line 258 of file Builders.cpp.
References getArrayAttr().
Referenced by collapseGenericOpIterationDims(), foldMemRefCast(), fuseElementwiseOpsImpl(), getGenericEffectsImpl(), getType(), mlir::linalg::interchangeGenericOp(), isSumOfMul(), mlir::linalg::makeTransposeOp(), and splatZero().
AffineExpr Builder::getAffineSymbolExpr | ( | unsigned | position | ) |
Definition at line 289 of file Builders.cpp.
References context, and mlir::getAffineSymbolExpr().
Referenced by mlir::alignAffineMapWithValues(), mlir::coalesceLoops(), genVectorMask(), getCollapsedOutputDimFromInputShape(), getExpandedOutputDimFromInputShape(), getSymbolIdentityMap(), getType(), processParallelLoop(), ReifyExpandOrCollapseShapeOp< OpTy >::reifyResultShapes(), resolveSourceIndices(), setInterTileBoundsParametric(), and setIntraTileBoundsParametric().
Definition at line 205 of file Builders.cpp.
References context.
Referenced by mlir::function_interface_impl::addArgAndResultAttrs(), mlir::sparse_tensor::constantOne(), mlir::sparse_tensor::constantZero(), getAffineMapArrayAttr(), getBoolArrayAttr(), getF32ArrayAttr(), getF64ArrayAttr(), getI32ArrayAttr(), getI64ArrayAttr(), getIndexArrayAttr(), mlir::getReassociationIndicesAttribute(), getStrArrayAttr(), getType(), getTypeArrayAttr(), TransferOpReduceRank::matchAndRewrite(), CanonicalizeSingleResultAffineMinMaxOp< T >::matchAndRewrite(), mlir::detail::Parser::parseAttribute(), parseCreateOperationOpAttributes(), parseOperandsOrIntegersImpl(), parseOperationOpAttributes(), parseVerCapExtAttr(), prependResAttrsToArgAttrs(), splatZero(), mlir::spirv::InterfaceVarABIAttr::verify(), verifyAtomicCompareExchangeImpl(), verifyConstantType(), verifyCoopMatrixMulAdd(), and wrapExternalFunction().
FloatType Builder::getBF16Type | ( | ) |
Definition at line 36 of file Builders.cpp.
References context, and mlir::FloatType::getBF16().
Referenced by getContext(), and mlir::detail::Parser::parseNonFunctionType().
ArrayAttr Builder::getBoolArrayAttr | ( | ArrayRef< bool > | values | ) |
Definition at line 209 of file Builders.cpp.
References getArrayAttr(), and getBoolAttr().
Referenced by foldExtractStridedOpFromInsertChain(), foldTransferInBoundsAttribute(), getType(), MaterializeTransferMask< ConcreteOp >::matchAndRewrite(), PadOpVectorizationWithTransferReadPattern::rewriteUser(), PadOpVectorizationWithTransferWritePattern::rewriteUser(), mlir::vector::splitFullAndPartialTransfer(), and transposeInBoundsAttr().
BoolAttr Builder::getBoolAttr | ( | bool | value | ) |
Definition at line 87 of file Builders.cpp.
References context, and mlir::BoolAttr::get().
Referenced by addResumeFunction(), convertBoolAttr(), copy(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), createDepthwiseConvCollapseMap(), createLinalgBodyCalculationForElementwiseOp(), getBoolArrayAttr(), mlir::scf::getParallelForInductionVarOwner(), getType(), hoistAffineIfOp(), CanonicalizeSingleResultAffineMinMaxOp< T >::matchAndRewrite(), mlir::detail::Parser::parseAttribute(), parseGlobalMemrefOpTypeAndInitialValue(), simplifyPassThroughBr(), and verifyConstantType().
DenseIntElementsAttr Builder::getBoolVectorAttr | ( | ArrayRef< bool > | values | ) |
Vector-typed DenseIntElementsAttr getters. values
must not be empty.
Definition at line 103 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getI1Type().
Referenced by getType().
AffineMap Builder::getConstantAffineMap | ( | int64_t | val | ) |
Returns a single constant result affine map with 0 dimensions and 0 symbols.
One constant result: () -> (val).
Definition at line 299 of file Builders.cpp.
References mlir::AffineMap::get(), and getAffineConstantExpr().
Referenced by getType(), CanonicalizeSingleResultAffineMinMaxOp< T >::matchAndRewrite(), and mlir::normalizeAffineFor().
|
inline |
Definition at line 54 of file Builders.h.
References context, getBF16Type(), getF128Type(), getF16Type(), getF32Type(), getF64Type(), getF80Type(), getFunctionType(), getFusedLoc(), getI1Type(), getI32Type(), getI64Type(), getI8Type(), getIndexType(), getIntegerType(), getNoneType(), getTupleType(), and getUnknownLoc().
Referenced by addResumeFunction(), mlir::linalg::addTileLoopIvsToIndexOpResults(), adjustMap(), augmentMapAndBounds(), mlir::tensor::bubbleUpPadSlice(), mlir::tosa::buildConvOpQuantizationAttr(), buildLLVMFunctionType(), mlir::tosa::buildMatMulOpQuantizationAttr(), mlir::tosa::buildPadOpQuantizationAttr(), mlir::tosa::buildUnaryOpQuantizationAttr(), canonicalizeMinMaxOp(), mlir::coalesceLoops(), computeTensorReshapeCollapsedType(), mlir::linalg::computeTileSizes(), mlir::TypeConverter::convertBlockSignature(), convertIntrinsicResult(), convertStructType(), copy(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), createAsyncDispatchFunction(), createDepthwiseConvCollapseMap(), createFullTiles(), mlir::LLVM::createGlobalString(), createI32ConstantOf(), createLinalgBodyCalculationForElementwiseOp(), mlir::tensor::createPadHighOp(), createReassociationMapsForCollapse(), declareReduction(), elementwiseMatchAndRewriteHelper(), encodeKernelName(), mlir::impl::ensureRegionTerminator(), mlir::AffineDmaWaitOp::fold(), foldMemRefCast(), generateCopy(), generatePointWiseCopy(), genFor(), genVectorMask(), getCleanupLoopLowerBound(), getDefaultABIAttrs(), getIndexArrayAttr(), getIndexingMapInExpandedOp(), mlir::nvgpu::getLaneIdAndValueIdToOperandCoord(), mlir::nvgpu::getLaneIdToLdMatrixMatrixCoord(), getLibraryCallSymbolRef(), getLoadStoreElementType(), HoistingAnalysis::getPackedTensorSizes(), mlir::gpu::getParallelLoopDimMappingAttr(), getPermutationMapAttr(), isZeroAttribute(), lookupSymbolInModule(), mlir::linalg::makeComposedExtractSliceOp(), mlir::linalg::makeMemRefCopyOp(), mlir::linalg::makeTiledShape(), mlir::linalg::makeTransposeOp(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::GPUIndexIntrinsicOpLowering< Op, XOp, YOp, ZOp >::matchAndRewrite(), mlir::OpToFuncCallLowering< SourceOp >::matchAndRewrite(), TransferWritePermutationLowering::matchAndRewrite(), mlir::ComposeReassociativeReshapeOps< ReshapeOpTy >::matchAndRewrite(), mlir::vector::ContractionOpToMatmulOpLowering::matchAndRewrite(), mlir::linalg::PadOpTransformationPattern::matchAndRewrite(), DeduplicateAffineMinMaxExpressions< T >::matchAndRewrite(), MergeAffineMinMaxOp< T >::matchAndRewrite(), CanonicalizeSingleResultAffineMinMaxOp< T >::matchAndRewrite(), mlir::x86vector::avx2::inline_asm::mm256BlendPsAsm(), mlir::normalizeAffineFor(), mlir::normalizeMemRefType(), mlir::outlineSingleBlockRegion(), parseScheduleClause(), parseWsLoopControl(), peelForLoop(), prependResAttrsToArgAttrs(), mlir::LLVMTypeConverter::promoteOneMemRefDescriptor(), reduceMatchAndRewriteHelper(), replaceUnitDimIndexOps(), replaceUnitExtents(), setInterTileBoundsParametric(), setIntraTileBoundsParametric(), sliceTransferIndices(), splatZero(), tileLinalgOpImpl(), tilePadOp(), mlir::scf::tileParallelLoop(), mlir::x86vector::avx2::transpose4x8xf32(), mlir::x86vector::avx2::transpose8x8xf32(), mlir::DataDescriptor::undef(), mlir::linalg::updateBoundsForCyclicDistribution(), updateExpandedGenericOpRegion(), verifyConstantType(), and wrapAsStructAttrs().
DictionaryAttr Builder::getDictionaryAttr | ( | ArrayRef< NamedAttribute > | value | ) |
Definition at line 91 of file Builders.cpp.
References context.
Referenced by mlir::function_interface_impl::addArgAndResultAttrs(), and getType().
AffineMap Builder::getDimIdentityMap | ( | ) |
Definition at line 304 of file Builders.cpp.
References mlir::AffineMap::get(), and getAffineDimExpr().
Referenced by buildAffineLoopFromValues(), getType(), mapParallelOp(), and mlir::promoteIfSingleIteration().
AffineMap Builder::getEmptyAffineMap | ( | ) |
Returns a zero result affine map with no dimensions or symbols: () -> ().
Definition at line 297 of file Builders.cpp.
References context, and mlir::AffineMap::get().
Referenced by getType(), mlir::replaceForOpWithNewYields(), verifyMemoryOpIndexing(), and verifyVectorMemoryOp().
FloatType Builder::getF128Type | ( | ) |
Definition at line 46 of file Builders.cpp.
References context, and mlir::FloatType::getF128().
Referenced by getContext(), and mlir::detail::Parser::parseNonFunctionType().
FloatAttr Builder::getF16FloatAttr | ( | float | value | ) |
FloatType Builder::getF16Type | ( | ) |
Definition at line 38 of file Builders.cpp.
References context, and mlir::FloatType::getF16().
Referenced by mlir::spirv::Deserializer::collect(), convertIntrinsicResult(), getContext(), getF16FloatAttr(), and mlir::detail::Parser::parseNonFunctionType().
ArrayAttr Builder::getF32ArrayAttr | ( | ArrayRef< float > | values | ) |
Definition at line 234 of file Builders.cpp.
References getArrayAttr(), and getF32FloatAttr().
Referenced by getType().
FloatAttr Builder::getF32FloatAttr | ( | float | value | ) |
Definition at line 185 of file Builders.cpp.
References getF32Type().
Referenced by convertFloatAttr(), createLinalgBodyCalculationForElementwiseOp(), createReassociationMapsForCollapse(), f32Cst(), getF32ArrayAttr(), getType(), and ClampClampOptimization::matchAndRewrite().
FloatType Builder::getF32Type | ( | ) |
Definition at line 40 of file Builders.cpp.
References context, and mlir::FloatType::getF32().
Referenced by mlir::spirv::Deserializer::collect(), convertIntrinsicResult(), createReassociationMapsForCollapse(), doSequentialDispatch(), exp2I32(), f32FromBits(), frexp(), getContext(), getF32FloatAttr(), insertCasts(), mlir::detail::Parser::parseNonFunctionType(), and unpackOperandVector().
ArrayAttr Builder::getF64ArrayAttr | ( | ArrayRef< double > | values | ) |
Definition at line 240 of file Builders.cpp.
References getArrayAttr(), and getF64FloatAttr().
Referenced by getType().
FloatAttr Builder::getF64FloatAttr | ( | double | value | ) |
Definition at line 181 of file Builders.cpp.
References getF64Type().
Referenced by getF64ArrayAttr(), and getType().
FloatType Builder::getF64Type | ( | ) |
Definition at line 42 of file Builders.cpp.
References context, and mlir::FloatType::getF64().
Referenced by mlir::spirv::Deserializer::collect(), convertIntrinsicResult(), getContext(), getF64FloatAttr(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::detail::Parser::parseFloatAttr(), mlir::detail::Parser::parseNonFunctionType(), and unpackOperandVector().
FloatType Builder::getF80Type | ( | ) |
Definition at line 44 of file Builders.cpp.
References context, and mlir::FloatType::getF80().
Referenced by getContext(), and mlir::detail::Parser::parseNonFunctionType().
FloatAttr Builder::getFloatAttr | ( | Type | type, |
double | value | ||
) |
Definition at line 193 of file Builders.cpp.
Referenced by mlir::arith::ConstantFloatOp::build(), convertTanhOp(), createDepthwiseConvCollapseMap(), createFPConstant(), createInitialValueForReduceOp(), createLinalgBodyCalculationForElementwiseOp(), createReassociationMapsForCollapse(), declareReduction(), mlir::sparse_tensor::getOneAttr(), getType(), getZeroAttr(), MaterializePadValue::matchAndRewrite(), and verifyConstantType().
FloatAttr Builder::getFloatAttr | ( | Type | type, |
const APFloat & | value | ||
) |
Definition at line 197 of file Builders.cpp.
Definition at line 67 of file Builders.cpp.
References context.
Referenced by createAsyncDispatchFunction(), mlir::ValueDecomposer::decomposeValue(), getContext(), getLibraryCallSymbolRef(), getParallelComputeFunctionType(), lowerAsEntryFunction(), lowerEntryPointABIAttr(), parseAttributions(), mlir::detail::Parser::parseFunctionType(), printCreateOperationOpResults(), mlir::SPIRVTypeConverter::SPIRVTypeConverter(), and verifyConstantType().
Definition at line 28 of file Builders.cpp.
References context.
Referenced by collapseGenericOpIterationDims(), executeGetOperandsResults(), and getContext().
IntegerAttr Builder::getI16IntegerAttr | ( | int16_t | value | ) |
Definition at line 162 of file Builders.cpp.
References getIntegerType().
Referenced by getType(), and verifyResultTypesAreInferrable().
IntegerType Builder::getI1Type | ( | ) |
Definition at line 50 of file Builders.cpp.
References context.
Referenced by addResumeFunction(), buildLogicalUnaryOp(), mlir::spirv::Deserializer::collect(), foldTransferInBoundsAttribute(), genVectorMask(), getBlockIt(), getBoolVectorAttr(), getContext(), mlir::scf::insideMutuallyExclusiveBranches(), isComputeOperation(), SelectToExtUI::matchAndRewrite(), MaterializeTransferMask< ConcreteOp >::matchAndRewrite(), outlineExecuteOp(), simplifyPassThroughBr(), and verifyAtomicCompareExchangeImpl().
ArrayAttr Builder::getI32ArrayAttr | ( | ArrayRef< int32_t > | values | ) |
Definition at line 215 of file Builders.cpp.
References getArrayAttr(), and getI32IntegerAttr().
Referenced by getFirstIntValue(), getLocalInvocationDimSize(), getType(), verifyAtomicCompareExchangeImpl(), and verifyConstantType().
IntegerAttr Builder::getI32IntegerAttr | ( | int32_t | value | ) |
Definition at line 148 of file Builders.cpp.
References getIntegerType().
Referenced by addResumeFunction(), broadcast(), mlir::tosa::buildConvOpQuantizationAttr(), mlir::tosa::buildMatMulOpQuantizationAttr(), mlir::tosa::buildPadOpQuantizationAttr(), mlir::tosa::buildUnaryOpQuantizationAttr(), castDataPtr(), mlir::spirv::Deserializer::collect(), convertIntrinsicResult(), createDepthwiseConvCollapseMap(), createI32Constant(), createReassociationMapsForCollapse(), getDimPosition(), getI32ArrayAttr(), getType(), hasOneBranchOpTo(), i32Cst(), isDefinedByCallTo(), lookupSymbolInModule(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), ConvertAccessChain::matchAndRewrite(), parseControlAttribute(), parseEnumKeywordAttr(), parseEnumStrAttr(), parseInterfaceVarABIAttr(), parseVerCapExtAttr(), printLaunchFuncOperands(), mlir::spirv::Serializer::processTypeDecoration< spirv::RuntimeArrayType >(), mlir::UnrankedMemRefDescriptor::sizeBasePtr(), unpackOperandVector(), mlir::spirv::InterfaceVarABIAttr::verify(), and verifyConstantType().
DenseIntElementsAttr Builder::getI32TensorAttr | ( | ArrayRef< int32_t > | values | ) |
Tensor-typed DenseIntElementsAttr getters.
values
can be empty. These are generally preferable for representing general lists of integers as attributes.
Definition at line 127 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getIntegerType().
Referenced by extractVectorElementType(), getType(), CanonicalizeSingleResultAffineMinMaxOp< T >::matchAndRewrite(), and parseGEPIndices().
IntegerType Builder::getI32Type | ( | ) |
Definition at line 54 of file Builders.cpp.
References context.
Referenced by addResumeFunction(), mlir::tosa::buildConvOpResultTypeInfo(), buildMatMulOpWithQuantInfo(), buildVectorComparison(), convertIntrinsicResult(), convertStructType(), createDepthwiseConvCollapseMap(), createI32Constant(), createI32ConstantOf(), createLinalgBodyCalculationForElementwiseOp(), createReassociationMapsForCollapse(), doSequentialDispatch(), genLoad(), getContext(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::GPUPrintfOpToLLVMCallLowering::matchAndRewrite(), ConvertAccessChain::matchAndRewrite(), parseSizeAssignment(), mlir::UnrankedMemRefDescriptor::sizeBasePtr(), and unpackOperandVector().
DenseIntElementsAttr Builder::getI32VectorAttr | ( | ArrayRef< int32_t > | values | ) |
Definition at line 109 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getIntegerType().
Referenced by mlir::gpu::addAsyncDependency(), buildStructuredOp(), buildVectorComparison(), foldTransferInBoundsAttribute(), getLoadStoreElementType(), getType(), mlir::scf::insideMutuallyExclusiveBranches(), isComputeOperation(), FoldLaunchArguments::matchAndRewrite(), parseCommonStructuredOpParts(), parseSizeAssignment(), printTransferAttrs(), printWsLoopControl(), verifyAtomicCompareExchangeImpl(), and verifyOpaquePtr().
ArrayAttr Builder::getI64ArrayAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 220 of file Builders.cpp.
References getArrayAttr(), and getI64IntegerAttr().
Referenced by convertContractOpToMmaSync(), convertIntrinsicResult(), mlir::tensor::createCanonicalRankReducingExtractSliceOp(), createReassociationMapsForCollapse(), elementwiseMatchAndRewriteHelper(), extractOne(), mlir::StructBuilder::extractPtr(), getGenericEffectsImpl(), mlir::getReassociationIndicesAttribute(), getType(), mlir::vector::getVectorReductionOp(), mlir::vector::getVectorSubscriptAttr(), insertOne(), Convert1DExtractStridedSliceIntoShuffle::matchAndRewrite(), BubbleDownVectorBitCastForExtract::matchAndRewrite(), BubbleDownBitCastForStridedSliceExtract::matchAndRewrite(), BubbleUpBitCastForStridedSliceInsert::matchAndRewrite(), CanonicalizeSingleResultAffineMinMaxOp< T >::matchAndRewrite(), mlir::LLVM::detail::nDVectorIterate(), mlir::MemRefDescriptor::offset(), mlir::LLVM::detail::oneToOneRewrite(), parseGlobalMemrefOpTypeAndInitialValue(), parseInferType(), reshapeLoad(), reshapeLowerToHigher(), reshapeStore(), mlir::MemRefDescriptor::setOffset(), mlir::StructBuilder::setPtr(), mlir::MemRefDescriptor::setSize(), mlir::MemRefDescriptor::setStride(), mlir::MemRefDescriptor::size(), mlir::MemRefDescriptor::stride(), unpackOperandVector(), verifyTensorReshapeOp(), and wrapExternalFunction().
IntegerAttr Builder::getI64IntegerAttr | ( | int64_t | value | ) |
Definition at line 99 of file Builders.cpp.
References getIntegerType().
Referenced by addResumeFunction(), allocBuffer(), mlir::bufferization::BufferizationOptions::createAlloc(), declareReduction(), findMatchingStartFinishInsts(), getExpandedOutputDimFromInputShape(), getI64ArrayAttr(), getLoadStoreElementType(), getType(), hasTrivialZeroTripCount(), isComputeOperation(), lookupSymbolInModule(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), ClampClampOptimization::matchAndRewrite(), CanonicalizeSingleResultAffineMinMaxOp< T >::matchAndRewrite(), parseAttributions(), parseGlobalMemrefOpTypeAndInitialValue(), parseOptionalLLVMKeyword(), printLaunchFuncOperands(), mlir::vector::splitFullAndPartialTransfer(), unpackOperandVector(), and verifyMemoryOpMetadata().
DenseIntElementsAttr Builder::getI64TensorAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 134 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getIntegerType().
Referenced by getType().
IntegerType Builder::getI64Type | ( | ) |
Definition at line 56 of file Builders.cpp.
References context.
Referenced by addResumeFunction(), buildVectorComparison(), createDepthwiseConvCollapseMap(), createI32Constant(), genIndexValue(), genLoad(), getContext(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), parseSynchronizationHint(), splatZero(), mlir::DataDescriptor::undef(), and unpackOperandVector().
DenseIntElementsAttr Builder::getI64VectorAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 115 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getIntegerType().
Referenced by buildVectorComparison(), createDepthwiseConvCollapseMap(), getType(), and mlir::linalg::ExtractSliceOfPadTensorSwapPattern::matchAndRewrite().
IntegerAttr Builder::getI8IntegerAttr | ( | int8_t | value | ) |
Definition at line 166 of file Builders.cpp.
References getIntegerType().
Referenced by createDepthwiseConvCollapseMap(), createReassociationMapsForCollapse(), getSrcVectorElementType(), and getType().
IntegerType Builder::getI8Type | ( | ) |
Definition at line 52 of file Builders.cpp.
References context.
Referenced by getContext(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), and unpackOperandVector().
ArrayAttr Builder::getIndexArrayAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 226 of file Builders.cpp.
References getArrayAttr(), getContext(), and getIntegerAttr().
Referenced by getType().
IntegerAttr Builder::getIndexAttr | ( | int64_t | value | ) |
Definition at line 95 of file Builders.cpp.
References getIndexType().
Referenced by applyPad(), mlir::tensor::bubbleUpPadSlice(), mlir::arith::ConstantIndexOp::build(), computeMemRefRankReductionMask(), convertTransferWriteOp(), convertTransferWriteToStores(), mlir::tensor::createCanonicalRankReducingExtractSliceOp(), mlir::tensor::createCanonicalRankReducingInsertSliceOp(), createNonLdMatrixLoads(), createReassociationMapsForCollapse(), createSubViewIntersection(), getGenericEffectsImpl(), mlir::sparse_tensor::getOneAttr(), getType(), getZeroAttr(), hasAtMostSingleNonScalar(), mlir::bufferization::insertSliceAnchoredAllocTensorEliminationStep(), joinShapes(), mlir::linalg::makeTiledShape(), mlir::linalg::GeneralizePadOpPattern::matchAndRewrite(), mlir::matchConstantIndex(), mlir::memref::multiBuffer(), parseInferType(), mlir::linalg::promoteSubviewAsNewBuffer(), and mlir::linalg::rewriteAsPaddedOp().
DenseIntElementsAttr Builder::getIndexTensorAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 141 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getIndexType().
Referenced by eachHasOnlyOneOfTypes(), and getType().
IndexType Builder::getIndexType | ( | ) |
Definition at line 48 of file Builders.cpp.
References context.
Referenced by mlir::gpu::addAsyncDependency(), addResumeFunction(), mlir::arith::ConstantIndexOp::build(), computeMemRefRankReductionMask(), convertTransferWriteToStores(), createAsyncDispatchFunction(), createForAllDimensions(), mlir::LLVM::createGlobalString(), mlir::ConvertToLLVMPattern::createIndexAttrConstant(), createIndexAttrConstant(), createNewDynamicSizes(), createNonLdMatrixLoads(), mlir::tensor::createPadScalarOp(), createReassociationMapsForCollapse(), doSequentialDispatch(), eachHasOnlyOneOfTypes(), extractOne(), mlir::AffineDmaWaitOp::fold(), foldTransferInBoundsAttribute(), genBuffers(), genIf(), genLoad(), genWhile(), getContext(), getIndexAttr(), getIndexTensorAttr(), getIndexVectorAttr(), mlir::sparse_tensor::getOverheadType(), getParallelComputeFunctionType(), insertCopyLoops(), insertOne(), mlir::scf::insideMutuallyExclusiveBranches(), joinShapes(), mlir::linalg::makeTiledShape(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::GPUPrintfOpToLLVMCallLowering::matchAndRewrite(), AllocaScopeHoister::matchAndRewrite(), CanonicalizeSingleResultAffineMinMaxOp< T >::matchAndRewrite(), outlineExecuteOp(), mlir::AffineDmaStartOp::parse(), mlir::AffineDmaWaitOp::parse(), parseAffineMinMaxOp(), parseBound(), mlir::parseDimAndSymbolList(), parseGlobalMemrefOpTypeAndInitialValue(), mlir::detail::Parser::parseNonFunctionType(), parseSizeAssignment(), printInitializationList(), printTransferAttrs(), reifyConstantDim(), mlir::replaceForOpWithNewYields(), mlir::vector::splitFullAndPartialTransfer(), mlir::scf::tileParallelLoop(), vectorizeLinalgIndex(), verifyDimAndSymbolIdentifiers(), verifyMemoryOpIndexing(), verifyVectorMemoryOp(), and wrapExternalFunction().
DenseIntElementsAttr Builder::getIndexVectorAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 121 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getIndexType().
Referenced by getType(), and vectorizeLinalgIndex().
IntegerAttr Builder::getIntegerAttr | ( | Type | type, |
int64_t | value | ||
) |
Definition at line 170 of file Builders.cpp.
References mlir::Type::getIntOrFloatBitWidth(), mlir::Type::isIndex(), mlir::Type::isSignedInteger(), and value.
Referenced by adjustAccessChainForBitwidth(), mlir::arith::ConstantIntOp::build(), castBoolToIntN(), convertIntegerAttr(), convertStructType(), createConst(), createDepthwiseConvCollapseMap(), mlir::LLVM::createGlobalString(), createI32ConstantOf(), mlir::ConvertToLLVMPattern::createIndexAttrConstant(), createIndexAttrConstant(), createInitialValueForReduceOp(), createLinalgBodyCalculationForElementwiseOp(), createNewDynamicSizes(), createReassociationMapsForCollapse(), declareReduction(), extractCompositeElement(), extractOne(), mlir::AffineDmaWaitOp::fold(), getIndexArrayAttr(), getOffsetForBitwidth(), mlir::sparse_tensor::getOneAttr(), getType(), getZeroAttr(), insertOne(), mlir::scf::insideMutuallyExclusiveBranches(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::GPUPrintfOpToLLVMCallLowering::matchAndRewrite(), MaterializePadValue::matchAndRewrite(), minusOneIntegerAttribute(), parseBound(), mlir::detail::Parser::parseDecOrHexAttr(), replaceTransferOpWithMubuf(), verifyConstantType(), and wrapExternalFunction().
IntegerAttr Builder::getIntegerAttr | ( | Type | type, |
const APInt & | value | ||
) |
Definition at line 177 of file Builders.cpp.
IntegerType Builder::getIntegerType | ( | unsigned | width | ) |
Definition at line 58 of file Builders.cpp.
References context.
Referenced by addResumeFunction(), adjustAccessChainForBitwidth(), allocBuffer(), broadcast(), mlir::arith::ConstantIntOp::build(), mlir::tosa::buildConvOpResultTypeInfo(), buildMatMulOpWithQuantInfo(), convertStructType(), createI32Constant(), createLinalgBodyCalculationForElementwiseOp(), createReassociationMapsForCollapse(), declareReduction(), frexp(), getContext(), getI16IntegerAttr(), getI32IntegerAttr(), getI32TensorAttr(), getI32VectorAttr(), getI64IntegerAttr(), getI64TensorAttr(), getI64VectorAttr(), getI8IntegerAttr(), getOffsetForBitwidth(), mlir::sparse_tensor::getOverheadType(), getSI32IntegerAttr(), getUI32IntegerAttr(), getUnaryOpResultType(), mlir::vector::getVectorSubscriptType(), hasOneBranchOpTo(), mlir::scf::insideMutuallyExclusiveBranches(), mlir::GPUPrintfOpToLLVMCallLowering::matchAndRewrite(), CanonicalizeSingleResultAffineMinMaxOp< T >::matchAndRewrite(), mlir::detail::Parser::parseDecOrHexAttr(), parseGlobalMemrefOpTypeAndInitialValue(), parseGroupNonUniformArithmeticOp(), parseMemoryAccessAttributes(), parseSourceMemoryAccessAttributes(), mlir::detail::Parser::parseSparseElementsAttr(), parseStorageType(), parseVariableDecorations(), replaceTransferOpWithMubuf(), shiftValue(), mlir::scf::tileParallelLoop(), unpackOperandVector(), verifyAtomicCompareExchangeImpl(), verifyConstantType(), and verifyPointerAndCoopMatrixType().
IntegerType Builder::getIntegerType | ( | unsigned | width, |
bool | isSigned | ||
) |
Definition at line 62 of file Builders.cpp.
References context, and mlir::quant::QuantizationFlags::Signed.
Definition at line 308 of file Builders.cpp.
References context, mlir::AffineMap::get(), and getAffineDimExpr().
Referenced by mlir::createAffineComputationSlice(), createDepthwiseConvCollapseMap(), createReassociationMapsForCollapse(), elementwiseMatchAndRewriteHelper(), findAncestorOpInRegion(), generateCopy(), getType(), mlir::linalg::PadOpTransformationPattern::matchAndRewrite(), mlir::normalizeMemRefType(), mlir::replaceAllMemRefUsesWith(), mlir::replaceForOpWithNewYields(), mlir::linalg::splitReduction(), mlir::linalg::vectorizeCopy(), verifyMemoryOpIndexing(), and verifyVectorMemoryOp().
NamedAttribute Builder::getNamedAttr | ( | StringRef | name, |
Attribute | val | ||
) |
Definition at line 81 of file Builders.cpp.
References getStringAttr().
Referenced by getType(), mlir::impl::parseOptionalVisibilityKeyword(), prependResAttrsToArgAttrs(), verifyAttributions(), wrapAsStructAttrs(), and wrapExternalFunction().
NoneType Builder::getNoneType | ( | ) |
Definition at line 75 of file Builders.cpp.
References context.
Referenced by mlir::spirv::Deserializer::collect(), getContext(), parseEnumStrAttr(), and mlir::detail::Parser::parseNonFunctionType().
Returns an affine map that is a translation (shift) of all result expressions in 'map' by 'shift'.
Eg: input: (d0, d1)[s0] -> (d0, d1 + s0), shift = 2 returns: (d0, d1)[s0] -> (d0 + 2, d1 + s0 + 2)
Definition at line 328 of file Builders.cpp.
References context, mlir::AffineMap::get(), mlir::AffineMap::getNumDims(), mlir::AffineMap::getNumResults(), mlir::AffineMap::getNumSymbols(), mlir::AffineMap::getResults(), and mlir::OpBuilder::Listener::~Listener().
Referenced by getType().
IntegerAttr Builder::getSI32IntegerAttr | ( | int32_t | value | ) |
Signed and unsigned integer attribute getters.
Definition at line 152 of file Builders.cpp.
References getIntegerType().
Referenced by getType().
AffineMap Builder::getSingleDimShiftAffineMap | ( | int64_t | shift | ) |
Returns a map that shifts its (single) input dimension by 'shift'.
(d0) -> (d0 + shift)
Definition at line 322 of file Builders.cpp.
References mlir::AffineMap::get(), and getAffineDimExpr().
Referenced by getType().
ArrayAttr Builder::getStrArrayAttr | ( | ArrayRef< StringRef > | values | ) |
Definition at line 246 of file Builders.cpp.
References getArrayAttr(), and getStringAttr().
Referenced by foldMemRefCast(), getStrArrayAttrForEnumList(), getType(), and mlir::linalg::makeTransposeOp().
StringAttr Builder::getStringAttr | ( | const Twine & | bytes | ) |
Definition at line 201 of file Builders.cpp.
References context.
Referenced by mlir::spirv::Deserializer::collect(), mlir::LLVM::createGlobalString(), foldMemRefCast(), getDefaultABIAttrs(), getNamedAttr(), getStrArrayAttr(), getType(), hasOneBranchOpTo(), hoistAffineIfOp(), isZeroAttribute(), lookupSymbolInModule(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::GPUPrintfOpToLLVMCallLowering::matchAndRewrite(), mlir::LLVM::detail::oneToOneRewrite(), mlir::DataLayoutEntryAttr::parse(), mlir::detail::Parser::parseAttributeDict(), mlir::detail::Parser::parseOpaqueElementsAttr(), mlir::detail::AsmParserImpl< BaseT >::parseOptionalSymbolName(), mlir::impl::parseOptionalVisibilityKeyword(), parseSymbolVisibility(), parseVerCapExtAttr(), printLaunchFuncOperands(), mlir::detail::pdl_function_builder::ProcessPDLValue< StringRef >::processAsResult(), mlir::detail::pdl_function_builder::ProcessPDLValue< std::string >::processAsResult(), mlir::linalg::LinalgTransformationFilter::replaceLinalgTransformationFilter(), mlir::LLVM::detail::vectorOneToOneRewrite(), mlir::spirv::InterfaceVarABIAttr::verify(), verifyAttributions(), verifyConstantType(), and verifyResultTypesAreInferrable().
AffineMap Builder::getSymbolIdentityMap | ( | ) |
Definition at line 317 of file Builders.cpp.
References mlir::AffineMap::get(), and getAffineSymbolExpr().
Referenced by getType().
TupleType Builder::getTupleType | ( | TypeRange | elementTypes | ) |
|
inline |
Get or construct an instance of the type 'ty' with provided arguments.
Definition at line 83 of file Builders.h.
References context, getAffineConstantExpr(), getAffineDimExpr(), getAffineMapArrayAttr(), getAffineSymbolExpr(), getArrayAttr(), getBoolArrayAttr(), getBoolAttr(), getBoolVectorAttr(), getConstantAffineMap(), getDictionaryAttr(), getDimIdentityMap(), getEmptyAffineMap(), getF16FloatAttr(), getF32ArrayAttr(), getF32FloatAttr(), getF64ArrayAttr(), getF64FloatAttr(), getFloatAttr(), getI16IntegerAttr(), getI32ArrayAttr(), getI32IntegerAttr(), getI32TensorAttr(), getI32VectorAttr(), getI64ArrayAttr(), getI64IntegerAttr(), getI64TensorAttr(), getI64VectorAttr(), getI8IntegerAttr(), getIndexArrayAttr(), getIndexAttr(), getIndexTensorAttr(), getIndexVectorAttr(), getIntegerAttr(), getMultiDimIdentityMap(), getNamedAttr(), getShiftedAffineMap(), getSI32IntegerAttr(), getSingleDimShiftAffineMap(), getStrArrayAttr(), getStringAttr(), getSymbolIdentityMap(), getTypeArrayAttr(), getUI32IntegerAttr(), getUnitAttr(), getZeroAttr(), and value.
Referenced by mlir::gpu::addAsyncDependency(), applyTilingToAll(), mlir::ValueDecomposer::decomposeValue(), eachHasOnlyOneOfTypes(), FoldLaunchArguments::matchAndRewrite(), parseAsyncDependencies(), and parseResultsValueType().
ArrayAttr Builder::getTypeArrayAttr | ( | TypeRange | values | ) |
IntegerAttr Builder::getUI32IntegerAttr | ( | uint32_t | value | ) |
UnitAttr Builder::getUnitAttr | ( | ) |
Definition at line 85 of file Builders.cpp.
References context.
Referenced by mlir::spirv::Deserializer::collect(), createBufferAllocation(), getLoadStoreElementType(), getType(), isZeroAttribute(), lookupSymbolInModule(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::detail::Parser::parseAttribute(), mlir::detail::Parser::parseAttributeDict(), parseAttributions(), parseCreateOperationOpResults(), parseInferType(), parseOptionalLLVMKeyword(), processParallelLoop(), tilePadOp(), and verifyMemoryOpMetadata().
Location Builder::getUnknownLoc | ( | ) |
Definition at line 26 of file Builders.cpp.
References context.
Referenced by mlir::tosa::buildQTypeFromMinMax(), encodeKernelName(), fillStructuredOpRegion(), foldMemRefCast(), getContext(), and mlir::detail::pdl_function_builder::verifyAsArgs().
Definition at line 264 of file Builders.cpp.
References mlir::Type::cast(), mlir::Type::dyn_cast(), mlir::DenseElementsAttr::get(), getFloatAttr(), getIndexAttr(), getIntegerAttr(), and mlir::Type::isa().
Referenced by mlir::arith::ConstantIndexOp::classof(), mlir::sparse_tensor::constantOne(), mlir::sparse_tensor::constantZero(), createDepthwiseConvCollapseMap(), createLinalgBodyCalculationForElementwiseOp(), createNonLdMatrixLoads(), createReassociationMapsForCollapse(), foldExtractStridedOpFromInsertChain(), getDimPosition(), getSrcVectorElementType(), getTargetShape(), getType(), handleMultidimensionalVectors(), DecomposeNDExtractStridedSlice::matchAndRewrite(), TwoDimMultiReductionToReduction::matchAndRewrite(), CanonicalizeContractAdd< AddOpType >::matchAndRewrite(), reshapeLoad(), signedCeilNonnegInputs(), splatZero(), and GenericPadOpVectorizationPattern::tryVectorizeCopy().
|
protected |
Definition at line 172 of file Builders.h.
Referenced by getAffineConstantExpr(), getAffineDimExpr(), getAffineSymbolExpr(), getArrayAttr(), getBF16Type(), getBoolAttr(), getContext(), getDictionaryAttr(), getEmptyAffineMap(), getF128Type(), getF16Type(), getF32Type(), getF64Type(), getF80Type(), getFunctionType(), getFusedLoc(), getI1Type(), getI32Type(), getI64Type(), getI8Type(), getIndexType(), getIntegerType(), getMultiDimIdentityMap(), getNoneType(), getShiftedAffineMap(), getStringAttr(), getTupleType(), getType(), getUnitAttr(), getUnknownLoc(), and mlir::OpBuilder::tryFold().