MLIR
17.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 | getFloat8E5M2Type () |
FloatType | getFloat8E4M3FNType () |
FloatType | getBF16Type () |
FloatType | getF16Type () |
FloatType | getF32Type () |
FloatType | getF64Type () |
FloatType | getF80Type () |
FloatType | getF128Type () |
IndexType | getIndexType () |
IntegerType | getI1Type () |
IntegerType | getI2Type () |
IntegerType | getI4Type () |
IntegerType | getI8Type () |
IntegerType | getI16Type () |
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... | |
template<typename Attr , typename... Args> | |
Attr | getAttr (Args &&...args) |
Get or construct an instance of the attribute Attr 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) |
DenseBoolArrayAttr | getDenseBoolArrayAttr (ArrayRef< bool > values) |
Tensor-typed DenseArrayAttr getters. More... | |
DenseI8ArrayAttr | getDenseI8ArrayAttr (ArrayRef< int8_t > values) |
DenseI16ArrayAttr | getDenseI16ArrayAttr (ArrayRef< int16_t > values) |
DenseI32ArrayAttr | getDenseI32ArrayAttr (ArrayRef< int32_t > values) |
DenseI64ArrayAttr | getDenseI64ArrayAttr (ArrayRef< int64_t > values) |
DenseF32ArrayAttr | getDenseF32ArrayAttr (ArrayRef< float > values) |
DenseF64ArrayAttr | getDenseF64ArrayAttr (ArrayRef< double > 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 50 of file Builders.h.
|
inlineexplicit |
Definition at line 52 of file Builders.h.
|
inlineexplicit |
Definition at line 53 of file Builders.h.
AffineExpr Builder::getAffineConstantExpr | ( | int64_t | constant | ) |
Definition at line 335 of file Builders.cpp.
References context, and mlir::getAffineConstantExpr().
Referenced by addLoopRangeConstraints(), createPrivateMemRef(), getConstantAffineMap(), isTransposeMatrixLoadMap(), setInterTileBoundsParametric(), setIntraTileBoundsParametric(), mlir::simplifyConstrainedMinMaxOp(), and transferReadSupportsMMAMatrixType().
AffineExpr Builder::getAffineDimExpr | ( | unsigned | position | ) |
Definition at line 327 of file Builders.cpp.
References context, and mlir::getAffineDimExpr().
Referenced by mlir::alignAffineMapWithValues(), augmentMapAndBounds(), mlir::coalesceLoops(), constructTiledIndexSetHyperRect(), createDepthwiseConvCollapseMap(), createPrivateMemRef(), createReassociationMapsForCollapse(), doubleBuffer(), generateCopy(), generatePointWiseCopy(), getCleanupLoopLowerBound(), mlir::getDelinearizedAffineExpr(), getDimIdentityMap(), mlir::getLinearAffineExpr(), getMultiDimIdentityMap(), getSingleDimShiftAffineMap(), getXferIndices(), isTransposeMatrixLoadMap(), mlir::loopUnrollJamByFactor(), TransferWriteNonPermutationLowering::matchAndRewrite(), mlir::normalizeAffineFor(), packLinalgMetadataOnce(), processParallelLoop(), reduceMatchAndRewriteHelper(), resolveSourceIndicesSubView(), setIntraTileBoundsParametric(), mlir::simplifyConstrainedMinMaxOp(), mlir::linalg::splitReduction(), and transferReadSupportsMMAMatrixType().
Definition at line 300 of file Builders.cpp.
References getArrayAttr().
Referenced by mlir::linalg::fuseElementwiseOps(), mlir::linalg::interchangeGenericOp(), and mlir::nvgpu::PrepareContractToGPUMMASync::matchAndRewrite().
AffineExpr Builder::getAffineSymbolExpr | ( | unsigned | position | ) |
Definition at line 331 of file Builders.cpp.
References context, and mlir::getAffineSymbolExpr().
Referenced by addLoopRangeConstraints(), mlir::alignAffineMapWithValues(), mlir::coalesceLoops(), mlir::linalg::computeMultiTileSizes(), getCollapsedOutputDimFromInputShape(), getExpandedOutputDimFromInputShape(), getSymbolIdentityMap(), processParallelLoop(), resolveSourceIndicesSubView(), setInterTileBoundsParametric(), setIntraTileBoundsParametric(), and mlir::simplifyConstrainedMinMaxOp().
Definition at line 247 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(), getTypeArrayAttr(), mlir::linalg::interchangeGenericOp(), TransferOpReduceRank::matchAndRewrite(), mlir::detail::Parser::parseAttribute(), parseCreateOperationOpAttributes(), parseOperationOpAttributes(), parseVerCapExtAttr(), and prependResAttrsToArgAttrs().
|
inline |
Get or construct an instance of the attribute Attr
with provided arguments.
Definition at line 96 of file Builders.h.
References context.
Referenced by mlir::tosa::buildConvOpQuantizationAttr(), mlir::tosa::buildMatMulOpQuantizationAttr(), mlir::tosa::buildPadOpQuantizationAttr(), mlir::tosa::buildUnaryOpQuantizationAttr(), mlir::gpu::mapParallelOp(), parseControlAttribute(), parseEnumKeywordAttr(), and parseEnumStrAttr().
FloatType Builder::getBF16Type | ( | ) |
Definition at line 44 of file Builders.cpp.
References context, and mlir::FloatType::getBF16().
Referenced by mlir::detail::Parser::parseNonFunctionType().
ArrayAttr Builder::getBoolArrayAttr | ( | ArrayRef< bool > | values | ) |
Definition at line 251 of file Builders.cpp.
References getArrayAttr(), and getBoolAttr().
Referenced by mlir::bufferization::allocateTensorForShapedValue(), buildVectorWrite(), foldTransferInBoundsAttribute(), mlir::bufferization::insertTensorCopies(), inverseTransposeInBoundsAttr(), MaterializeTransferMask< ConcreteOp >::matchAndRewrite(), TransferWriteNonPermutationLowering::matchAndRewrite(), PadOpVectorizationWithTransferReadPattern::rewriteUser(), PadOpVectorizationWithTransferWritePattern::rewriteUser(), mlir::vector::splitFullAndPartialTransfer(), and vectorizeAsLinalgGeneric().
BoolAttr Builder::getBoolAttr | ( | bool | value | ) |
Definition at line 101 of file Builders.cpp.
References context, and mlir::BoolAttr::get().
Referenced by convertBoolAttr(), copy(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), createLinalgBodyCalculationForElementwiseOp(), getBoolArrayAttr(), hoistAffineIfOp(), and mlir::detail::Parser::parseAttribute().
DenseIntElementsAttr Builder::getBoolVectorAttr | ( | ArrayRef< bool > | values | ) |
Vector-typed DenseIntElementsAttr getters. values
must not be empty.
Definition at line 117 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getI1Type().
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 341 of file Builders.cpp.
References mlir::AffineMap::get(), and getAffineConstantExpr().
Referenced by mlir::normalizeAffineFor(), parseBound(), and resolveSourceIndicesCollapseShape().
|
inline |
Definition at line 55 of file Builders.h.
References context.
Referenced by adjustMap(), augmentMapAndBounds(), mlir::tensor::bubbleUpPadSlice(), buildLLVMFunctionType(), calculateTileOffsetsAndSizes(), mlir::coalesceLoops(), mlir::linalg::computeSliceParameters(), mlir::linalg::computeTileSizes(), constructTiledIndexSetHyperRect(), convertFuncOpTypes(), convertIntrinsicResult(), copy(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), createAsyncDispatchFunction(), createElementIPowIFunc(), createFullTiles(), mlir::LLVM::createGlobalString(), createGroupReduceOpImpl(), createI32ConstantOf(), createLinalgBodyCalculationForElementwiseOp(), mlir::tensor::createPadHighOp(), createPrintMsg(), elementwiseMatchAndRewriteHelper(), mlir::tensor::ExtractSliceFromCollapseHelper::emitLoopNestBody(), mlir::impl::ensureRegionTerminator(), generateCopy(), generatePointWiseCopy(), getBoundedTileSize(), getCleanupLoopLowerBound(), mlir::getDivMod(), getIndexArrayAttr(), getIndexingMapInExpandedOp(), getIndexProduct(), mlir::nvgpu::getLaneIdAndValueIdToOperandCoord(), mlir::nvgpu::getLaneIdToLdMatrixMatrixCoord(), getLibraryCallSymbolRef(), HoistingAnalysis::getPackedTensorSizes(), invertSliceIndexing(), isTransposeMatrixLoadMap(), mlir::linalg::makeMemRefCopyOp(), mlir::linalg::makeTransposeOp(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::GPUIndexIntrinsicOpLowering< Op, XOp, YOp, ZOp >::matchAndRewrite(), mlir::ComposeReassociativeReshapeOps< ReshapeOpTy >::matchAndRewrite(), DeduplicateAffineMinMaxExpressions< T >::matchAndRewrite(), MergeAffineMinMaxOp< T >::matchAndRewrite(), mlir::linalg::PadOpTransformationPattern::matchAndRewrite(), mlir::nvgpu::PrepareContractToGPUMMASync::matchAndRewrite(), mlir::vector::ContractionOpToMatmulOpLowering::matchAndRewrite(), mlir::vector::ContractionOpToDotLowering::matchAndRewrite(), TransferWritePermutationLowering::matchAndRewrite(), materializeConstants(), mlir::AffineBuilder::max(), mlir::mergeOffsetsSizesAndStrides(), mlir::AffineBuilder::min(), mlir::x86vector::avx2::inline_asm::mm256BlendPsAsm(), mlir::normalizeAffineFor(), mlir::linalg::offsetIndices(), mlir::outlineSingleBlockRegion(), parseLoopControl(), parseScheduleClause(), peelForLoop(), prependResAttrsToArgAttrs(), reduceMatchAndRewriteHelper(), mlir::LLVM::ModuleImport::setFastmathFlagsAttr(), setInterTileBoundsParametric(), setIntraTileBoundsParametric(), sliceTransferIndices(), mlir::linalg::splitOp(), tileLinalgOpImpl(), tilePadOp(), mlir::scf::tileParallelLoop(), mlir::linalg::tileToForeachThreadOpUsingTileSizes(), mlir::x86vector::avx2::transpose4x8xf32(), mlir::x86vector::avx2::transpose8x8xf32(), transposeOneLinalgOperandAndReplace(), mlir::DataDescriptor::undef(), mlir::linalg::updateBoundsForCyclicDistribution(), updateExpandedGenericOpRegion(), and wrapAsStructAttrs().
DenseBoolArrayAttr Builder::getDenseBoolArrayAttr | ( | ArrayRef< bool > | values | ) |
Tensor-typed DenseArrayAttr getters.
Definition at line 141 of file Builders.cpp.
References context, and mlir::detail::DenseArrayAttrImpl< T >::get().
DenseF32ArrayAttr Builder::getDenseF32ArrayAttr | ( | ArrayRef< float > | values | ) |
Definition at line 161 of file Builders.cpp.
References context, and mlir::detail::DenseArrayAttrImpl< T >::get().
DenseF64ArrayAttr Builder::getDenseF64ArrayAttr | ( | ArrayRef< double > | values | ) |
Definition at line 165 of file Builders.cpp.
References context, and mlir::detail::DenseArrayAttrImpl< T >::get().
DenseI16ArrayAttr Builder::getDenseI16ArrayAttr | ( | ArrayRef< int16_t > | values | ) |
Definition at line 149 of file Builders.cpp.
References context, and mlir::detail::DenseArrayAttrImpl< T >::get().
DenseI32ArrayAttr Builder::getDenseI32ArrayAttr | ( | ArrayRef< int32_t > | values | ) |
Definition at line 153 of file Builders.cpp.
References context, and mlir::detail::DenseArrayAttrImpl< int32_t >::get().
Referenced by mlir::gpu::addAsyncDependency(), buildStructuredOp(), mlir::GPUIndexIntrinsicOpLowering< Op, XOp, YOp, ZOp >::matchAndRewrite(), and parseCommonStructuredOpParts().
DenseI64ArrayAttr Builder::getDenseI64ArrayAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 157 of file Builders.cpp.
References context, and mlir::detail::DenseArrayAttrImpl< T >::get().
Referenced by elementwiseMatchAndRewriteHelper(), TransposeIsReshape::matchAndRewrite(), mlir::parseDynamicIndexList(), mlir::transform::parsePackedOrDynamicIndexList(), parseSwitchCases(), and reshapeLowerToHigher().
DenseI8ArrayAttr Builder::getDenseI8ArrayAttr | ( | ArrayRef< int8_t > | values | ) |
Definition at line 145 of file Builders.cpp.
References context, and mlir::detail::DenseArrayAttrImpl< T >::get().
DictionaryAttr Builder::getDictionaryAttr | ( | ArrayRef< NamedAttribute > | value | ) |
Definition at line 105 of file Builders.cpp.
References context.
Referenced by mlir::function_interface_impl::addArgAndResultAttrs().
AffineMap Builder::getDimIdentityMap | ( | ) |
Definition at line 346 of file Builders.cpp.
References mlir::AffineMap::get(), and getAffineDimExpr().
Referenced by buildAffineLoopFromValues(), constructTiledIndexSetHyperRect(), mlir::gpu::mapParallelOp(), and mlir::promoteIfSingleIteration().
AffineMap Builder::getEmptyAffineMap | ( | ) |
Returns a zero result affine map with no dimensions or symbols: () -> ().
Definition at line 339 of file Builders.cpp.
References context, and mlir::AffineMap::get().
Referenced by parseAffineMapWithMinMax().
FloatType Builder::getF128Type | ( | ) |
Definition at line 54 of file Builders.cpp.
References context, and mlir::FloatType::getF128().
Referenced by mlir::detail::Parser::parseNonFunctionType().
FloatAttr Builder::getF16FloatAttr | ( | float | value | ) |
Definition at line 231 of file Builders.cpp.
References getF16Type().
FloatType Builder::getF16Type | ( | ) |
Definition at line 46 of file Builders.cpp.
References context, and mlir::FloatType::getF16().
Referenced by convertIntrinsicResult(), getF16FloatAttr(), and mlir::detail::Parser::parseNonFunctionType().
ArrayAttr Builder::getF32ArrayAttr | ( | ArrayRef< float > | values | ) |
Definition at line 276 of file Builders.cpp.
References getArrayAttr(), and getF32FloatAttr().
FloatAttr Builder::getF32FloatAttr | ( | float | value | ) |
Definition at line 227 of file Builders.cpp.
References getF32Type().
Referenced by convertFloatAttr(), createLinalgBodyCalculationForElementwiseOp(), f32Cst(), getF32ArrayAttr(), and ClampClampOptimization::matchAndRewrite().
FloatType Builder::getF32Type | ( | ) |
Definition at line 48 of file Builders.cpp.
References context, and mlir::FloatType::getF32().
Referenced by convertIntrinsicResult(), exp2I32(), f32FromBits(), frexp(), getF32FloatAttr(), insertCasts(), mlir::detail::Parser::parseNonFunctionType(), and unpackOperandVector().
ArrayAttr Builder::getF64ArrayAttr | ( | ArrayRef< double > | values | ) |
Definition at line 282 of file Builders.cpp.
References getArrayAttr(), and getF64FloatAttr().
FloatAttr Builder::getF64FloatAttr | ( | double | value | ) |
Definition at line 223 of file Builders.cpp.
References getF64Type().
Referenced by getF64ArrayAttr().
FloatType Builder::getF64Type | ( | ) |
Definition at line 50 of file Builders.cpp.
References context, and mlir::FloatType::getF64().
Referenced by convertIntrinsicResult(), getF64FloatAttr(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite(), mlir::detail::Parser::parseFloatAttr(), mlir::detail::Parser::parseNonFunctionType(), and unpackOperandVector().
FloatType Builder::getF80Type | ( | ) |
Definition at line 52 of file Builders.cpp.
References context, and mlir::FloatType::getF80().
Referenced by mlir::detail::Parser::parseNonFunctionType().
FloatType Builder::getFloat8E4M3FNType | ( | ) |
Definition at line 40 of file Builders.cpp.
References context, and mlir::FloatType::getFloat8E4M3FN().
Referenced by mlir::detail::Parser::parseNonFunctionType().
FloatType Builder::getFloat8E5M2Type | ( | ) |
Definition at line 36 of file Builders.cpp.
References context, and mlir::FloatType::getFloat8E5M2().
Referenced by mlir::detail::Parser::parseNonFunctionType().
FloatAttr Builder::getFloatAttr | ( | Type | type, |
const APFloat & | value | ||
) |
Definition at line 239 of file Builders.cpp.
FloatAttr Builder::getFloatAttr | ( | Type | type, |
double | value | ||
) |
Definition at line 235 of file Builders.cpp.
Referenced by mlir::arith::ConstantFloatOp::build(), convertTanhOp(), createFPConstant(), createInitialValueForReduceOp(), createLinalgBodyCalculationForElementwiseOp(), declareReduction(), floatCst(), mlir::arith::getIdentityValueAttr(), mlir::linalg::getNeutralElement(), mlir::sparse_tensor::getOneAttr(), getZeroAttr(), and MaterializePadValue::matchAndRewrite().
Definition at line 81 of file Builders.cpp.
References context.
Referenced by createAsyncDispatchFunction(), getLibraryCallSymbolRef(), getParallelComputeFunctionType(), lowerAsEntryFunction(), and mlir::detail::Parser::parseFunctionType().
Definition at line 28 of file Builders.cpp.
References context.
Referenced by generateLocationsFromIR().
IntegerAttr Builder::getI16IntegerAttr | ( | int16_t | value | ) |
Definition at line 204 of file Builders.cpp.
References getIntegerType().
IntegerType Builder::getI16Type | ( | ) |
Definition at line 66 of file Builders.cpp.
References context.
IntegerType Builder::getI1Type | ( | ) |
Definition at line 58 of file Builders.cpp.
References context.
Referenced by genExpand(), getBoolVectorAttr(), MaterializeTransferMask< ConcreteOp >::matchAndRewrite(), and vectorizeTensorExtract().
IntegerType Builder::getI2Type | ( | ) |
Definition at line 60 of file Builders.cpp.
References context.
ArrayAttr Builder::getI32ArrayAttr | ( | ArrayRef< int32_t > | values | ) |
Definition at line 257 of file Builders.cpp.
References getArrayAttr(), and getI32IntegerAttr().
Referenced by mlir::spirv::getDefaultResourceLimits().
IntegerAttr Builder::getI32IntegerAttr | ( | int32_t | value | ) |
Definition at line 190 of file Builders.cpp.
References getIntegerType().
Referenced by broadcast(), convertIntrinsicResult(), getI32ArrayAttr(), mlir::spirv::getPushConstantValue(), getScalarOrVectorI32Constant(), i32Cst(), ConvertAccessChain::matchAndRewrite(), parseInterfaceVarABIAttr(), and parseVerCapExtAttr().
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 169 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getIntegerType().
Referenced by parseAffineMapWithMinMax().
IntegerType Builder::getI32Type | ( | ) |
Definition at line 68 of file Builders.cpp.
References context.
Referenced by mlir::tosa::buildConvOpResultTypeInfo(), buildMatMulOpWithQuantInfo(), buildVectorComparison(), convertIntrinsicResult(), createI32Constant(), createI32ConstantOf(), createLinalgBodyCalculationForElementwiseOp(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::GPUPrintfOpToLLVMCallLowering::matchAndRewrite(), mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite(), ConvertAccessChain::matchAndRewrite(), ConvertLoad::matchAndRewrite(), ConsolidateTransposeOptimization::matchAndRewrite(), and unpackOperandVector().
DenseIntElementsAttr Builder::getI32VectorAttr | ( | ArrayRef< int32_t > | values | ) |
Definition at line 123 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getIntegerType().
Referenced by buildVectorComparison(), getScalarOrVectorI32Constant(), and setProfilingAttrs().
IntegerType Builder::getI4Type | ( | ) |
Definition at line 62 of file Builders.cpp.
References context.
ArrayAttr Builder::getI64ArrayAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 262 of file Builders.cpp.
References getArrayAttr(), and getI64IntegerAttr().
Referenced by convertContractOpToMmaSync(), createNonLdMatrixLoads(), mlir::decomposeMixedValues(), foldExtractFromBroadcast(), foldExtractFromExtractStrided(), foldExtractFromShapeCast(), foldExtractOpFromExtractChain(), foldExtractStridedOpFromInsertChain(), mlir::getReassociationIndicesAttribute(), mlir::vector::getVectorSubscriptAttr(), Convert1DExtractStridedSliceIntoShuffle::matchAndRewrite(), BubbleUpBitCastForStridedSliceInsert::matchAndRewrite(), BubbleDownVectorBitCastForExtract::matchAndRewrite(), BubbleDownBitCastForStridedSliceExtract::matchAndRewrite(), reshapeLoad(), and reshapeStore().
IntegerAttr Builder::getI64IntegerAttr | ( | int64_t | value | ) |
Definition at line 113 of file Builders.cpp.
References getIntegerType().
Referenced by mlir::bufferization::allocateTensorForShapedValue(), allocBuffer(), mlir::bufferization::BufferizationOptions::createAlloc(), dropRefIfNoUses(), getExpandedOutputDimFromInputShape(), getI64ArrayAttr(), getMixedTilesImpl(), mlir::getMixedValues(), ClampClampOptimization::matchAndRewrite(), parseAtomicBinOp(), parseAtomicOrdering(), parseCmpOp(), reifyConstantDim(), mlir::vector::splitFullAndPartialTransfer(), and unpackOperandVector().
DenseIntElementsAttr Builder::getI64TensorAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 176 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getIntegerType().
IntegerType Builder::getI64Type | ( | ) |
Definition at line 70 of file Builders.cpp.
References context.
Referenced by buildVectorComparison(), genIndexLoad(), mlir::bufferization::getGlobalFor(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite(), parseMapClause(), parseSynchronizationHint(), mlir::LLVMTypeConverter::promoteOneMemRefDescriptor(), mlir::DataDescriptor::undef(), and unpackOperandVector().
DenseIntElementsAttr Builder::getI64VectorAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 129 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getIntegerType().
Referenced by buildVectorComparison(), mlir::linalg::DownscaleSizeOneWindowed2DConvolution< Conv2DOp, Conv1DOp >::returningMatchAndRewrite(), and mlir::linalg::DownscaleDepthwiseConv2DNhwcHwcOp::returningMatchAndRewrite().
IntegerAttr Builder::getI8IntegerAttr | ( | int8_t | value | ) |
Definition at line 208 of file Builders.cpp.
References getIntegerType().
IntegerType Builder::getI8Type | ( | ) |
Definition at line 64 of file Builders.cpp.
References context.
Referenced by createPrintMsg(), mlir::sparse_tensor::getOpaquePointerType(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), and unpackOperandVector().
ArrayAttr Builder::getIndexArrayAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 268 of file Builders.cpp.
References getArrayAttr(), getContext(), and getIntegerAttr().
IntegerAttr Builder::getIndexAttr | ( | int64_t | value | ) |
Definition at line 109 of file Builders.cpp.
References getIndexType().
Referenced by applyPad(), mlir::tensor::bubbleUpPadSlice(), mlir::arith::ConstantIndexOp::build(), calculateTileOffsetsAndSizes(), mlir::linalg::computeSliceParameters(), mlir::linalg::computeTileOffsets(), constifyIndexValues(), convertTransferReadOp(), convertTransferWriteOp(), convertTransferWriteToStores(), mlir::tensor::createCanonicalRankReducingExtractSliceOp(), mlir::tensor::createCanonicalRankReducingInsertSliceOp(), mlir::memref::createCanonicalRankReducingSubViewOp(), mlir::tensor::createDimValues(), createFoldedDimOp(), mlir::linalg::createFoldedDimOp(), mlir::ConvertToLLVMPattern::createIndexAttrConstant(), createIndexAttrConstant(), createNonLdMatrixLoads(), createSplitPart(), createSubViewIntersection(), fuse(), mlir::sparse_tensor::genToIndices(), mlir::sparse_tensor::genToPointers(), mlir::memref::getMixedSizes(), mlir::tensor::getMixedSizes(), mlir::sparse_tensor::getOneAttr(), mlir::tensor::getOrCreateDestination(), getShapeDimSize(), getTiledProducer(), getZeroAttr(), mlir::linalg::hoistPaddingOnTensors(), mlir::linalg::makeTiledLoopRanges(), mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite(), mlir::linalg::GeneralizeOuterUnitDimsPackOpPattern::matchAndRewrite(), mlir::linalg::GeneralizePadOpPattern::matchAndRewrite(), mlir::linalg::GeneralizeOuterUnitDimsUnPackOpPattern::matchAndRewrite(), materializeConstants(), mlir::memref::multiBuffer(), packGemmGreedily(), mlir::LLVMTypeConverter::promoteOneMemRefDescriptor(), mlir::linalg::promoteSubviewAsNewBuffer(), mlir::linalg::rewriteAsPaddedOp(), mlir::tensor::simplifyCollapseShapeWithRankReducingExtractSlice(), tileLinalgOpImpl(), tilePadOp(), mlir::linalg::tileReductionUsingForeachThread(), mlir::scf::tileReductionUsingScf(), tileToForeachThreadOpImpl(), and yieldTiledValues().
DenseIntElementsAttr Builder::getIndexTensorAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 183 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getIndexType().
IndexType Builder::getIndexType | ( | ) |
Definition at line 56 of file Builders.cpp.
References context.
Referenced by mlir::arith::ConstantIndexOp::build(), calculateGatherOffset(), convertTransferWriteToStores(), createAsyncDispatchFunction(), createForAllDimensions(), createNewDynamicSizes(), createNonLdMatrixLoads(), deduplicateAndResolveOperands(), doSequentialDispatch(), mlir::sparse_tensor::LoopEmitter::enterCoIterationOverTensorsAtDims(), extractOne(), generateGpuBlockIds(), genExpand(), genIf(), genIndexAndValueForSparse(), genIndexLoad(), genInsertionStore(), getIndexAttr(), getIndexTensorAttr(), getIndexVectorAttr(), mlir::sparse_tensor::getOverheadType(), getParallelComputeFunctionType(), mlir::sparse_tensor::SparseTensorSpecifier::getSpecifierField(), insertCopyLoops(), insertOne(), mlir::makeComposedAffineMin(), makeComposedFoldedMinMax(), materializeConstants(), mlir::AffineDmaStartOp::parse(), mlir::AffineDmaWaitOp::parse(), parseAffineMinMaxOp(), parseBound(), mlir::parseDimAndSymbolList(), mlir::detail::Parser::parseNonFunctionType(), reifyConstantDim(), mlir::sparse_tensor::reshapeValuesToLevels(), rewriteOneForeachThreadToGpuThreads(), mlir::impl::scalarizeVectorOp(), mlir::vector::splitFullAndPartialTransfer(), mlir::scf::tileParallelLoop(), vectorizeLinalgIndex(), and wrapExternalFunction().
DenseIntElementsAttr Builder::getIndexVectorAttr | ( | ArrayRef< int64_t > | values | ) |
Definition at line 135 of file Builders.cpp.
References mlir::DenseIntElementsAttr::get(), and getIndexType().
Referenced by vectorizeLinalgIndex().
IntegerAttr Builder::getIntegerAttr | ( | Type | type, |
const APInt & | value | ||
) |
Definition at line 219 of file Builders.cpp.
IntegerAttr Builder::getIntegerAttr | ( | Type | type, |
int64_t | value | ||
) |
Definition at line 212 of file Builders.cpp.
References mlir::Type::getIntOrFloatBitWidth(), mlir::Type::isIndex(), and mlir::Type::isSignedInteger().
Referenced by addIntegerAttrs(), adjustAccessChainForBitwidth(), mlir::arith::ConstantIntOp::build(), convertIntegerAttr(), createConst(), createElementIPowIFunc(), createI32ConstantOf(), createInitialValueForReduceOp(), createLinalgBodyCalculationForElementwiseOp(), createNewDynamicSizes(), createScalarOrSplatConstant(), declareReduction(), extractOne(), mlir::arith::getIdentityValueAttr(), getIndexArrayAttr(), mlir::linalg::getNeutralElement(), getOffsetForBitwidth(), mlir::sparse_tensor::getOneAttr(), getZeroAttr(), insertOne(), CmpFIntToFPConst::matchAndRewrite(), MaterializePadValue::matchAndRewrite(), mfmaConcatIfNeeded(), minusOneIntegerAttribute(), mlir::detail::Parser::parseDecOrHexAttr(), parseMapClause(), subIntegerAttrs(), and wrapExternalFunction().
IntegerType Builder::getIntegerType | ( | unsigned | width | ) |
Definition at line 72 of file Builders.cpp.
References context.
Referenced by adjustAccessChainForBitwidth(), allocBuffer(), broadcast(), mlir::arith::ConstantIntOp::build(), mlir::tosa::buildConvOpResultTypeInfo(), buildMatMulOpWithQuantInfo(), createLinalgBodyCalculationForElementwiseOp(), frexp(), getI16IntegerAttr(), getI32IntegerAttr(), getI32TensorAttr(), getI32VectorAttr(), getI64IntegerAttr(), getI64TensorAttr(), getI64VectorAttr(), getI8IntegerAttr(), getOffsetForBitwidth(), mlir::sparse_tensor::getOverheadType(), getSI32IntegerAttr(), getUI32IntegerAttr(), getUnaryOpResultType(), mlir::vector::getVectorSubscriptType(), mlir::GPUPrintfOpToLLVMCallLowering::matchAndRewrite(), mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite(), mfmaConcatIfNeeded(), mlir::detail::Parser::parseDecOrHexAttr(), parseGroupNonUniformArithmeticOp(), parseMemoryAccessAttributes(), parseSourceMemoryAccessAttributes(), mlir::detail::Parser::parseSparseElementsAttr(), parseStorageType(), parseVariableDecorations(), shiftValue(), mlir::linalg::splitReductionByScaling(), mlir::scf::tileParallelLoop(), and unpackOperandVector().
IntegerType Builder::getIntegerType | ( | unsigned | width, |
bool | isSigned | ||
) |
Definition at line 76 of file Builders.cpp.
References context, and mlir::quant::QuantizationFlags::Signed.
AffineMap Builder::getMultiDimIdentityMap | ( | unsigned | rank | ) |
Definition at line 350 of file Builders.cpp.
References context, mlir::AffineMap::get(), and getAffineDimExpr().
Referenced by mlir::createAffineComputationSlice(), elementwiseMatchAndRewriteHelper(), generateCopy(), mlir::linalg::PadOpTransformationPattern::matchAndRewrite(), mlir::replaceAllMemRefUsesWith(), mlir::linalg::splitReduction(), mlir::linalg::splitReductionByScaling(), and mlir::linalg::vectorizeCopy().
NamedAttribute Builder::getNamedAttr | ( | StringRef | name, |
Attribute | val | ||
) |
Definition at line 95 of file Builders.cpp.
References getStringAttr().
Referenced by mlir::impl::parseOptionalVisibilityKeyword(), prependResAttrsToArgAttrs(), and wrapAsStructAttrs().
NoneType Builder::getNoneType | ( | ) |
Definition at line 89 of file Builders.cpp.
References context.
Referenced by 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 370 of file Builders.cpp.
References context, mlir::AffineMap::get(), mlir::AffineMap::getNumDims(), mlir::AffineMap::getNumResults(), mlir::AffineMap::getNumSymbols(), and mlir::AffineMap::getResults().
Referenced by mlir::affineForOpBodySkew().
IntegerAttr Builder::getSI32IntegerAttr | ( | int32_t | value | ) |
Signed and unsigned integer attribute getters.
Definition at line 194 of file Builders.cpp.
References getIntegerType().
AffineMap Builder::getSingleDimShiftAffineMap | ( | int64_t | shift | ) |
Returns a map that shifts its (single) input dimension by 'shift'.
(d0) -> (d0 + shift)
Definition at line 364 of file Builders.cpp.
References mlir::AffineMap::get(), and getAffineDimExpr().
Referenced by constructTiledIndexSetHyperRect().
ArrayAttr Builder::getStrArrayAttr | ( | ArrayRef< StringRef > | values | ) |
Definition at line 288 of file Builders.cpp.
References getArrayAttr(), and getStringAttr().
Referenced by getStrArrayAttrForEnumList().
StringAttr Builder::getStringAttr | ( | const Twine & | bytes | ) |
Definition at line 243 of file Builders.cpp.
References context.
Referenced by addBodyWithPayloadOp(), mlir::linalg::computeMultiTileSizes(), mlir::LLVM::createGlobalString(), emitIsPositiveIndexAssertion(), generateLocationsFromIR(), mlir::bufferization::getGlobalFor(), getNamedAttr(), getStrArrayAttr(), hoistAffineIfOp(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::GPUPrintfOpToLLVMCallLowering::matchAndRewrite(), mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite(), mlir::LLVM::detail::oneToOneRewrite(), mlir::DataLayoutEntryAttr::parse(), mlir::detail::Parser::parseAttributeDict(), mlir::detail::AsmParserImpl< BaseT >::parseOptionalSymbolName(), mlir::impl::parseOptionalVisibilityKeyword(), parseVerCapExtAttr(), mlir::detail::pdl_function_builder::ProcessPDLValue< StringRef >::processAsResult(), mlir::detail::pdl_function_builder::ProcessPDLValue< std::string >::processAsResult(), and mlir::LLVM::detail::vectorOneToOneRewrite().
AffineMap Builder::getSymbolIdentityMap | ( | ) |
Definition at line 359 of file Builders.cpp.
References mlir::AffineMap::get(), and getAffineSymbolExpr().
Referenced by parseBound().
TupleType Builder::getTupleType | ( | TypeRange | elementTypes | ) |
Definition at line 85 of file Builders.cpp.
References context.
|
inline |
Get or construct an instance of the type Ty
with provided arguments.
Definition at line 89 of file Builders.h.
References context.
Referenced by padOperandToSmallestStaticBoundingBox(), parseAsyncDependencies(), parseResultsValueType(), and parseTileLikeOp().
ArrayAttr Builder::getTypeArrayAttr | ( | TypeRange | values | ) |
Definition at line 294 of file Builders.cpp.
References getArrayAttr().
IntegerAttr Builder::getUI32IntegerAttr | ( | uint32_t | value | ) |
Definition at line 199 of file Builders.cpp.
References getIntegerType().
UnitAttr Builder::getUnitAttr | ( | ) |
Definition at line 99 of file Builders.cpp.
References context.
Referenced by annotateConflict(), annotateNonWritableTensor(), convertTransferReadOp(), mlir::GPUFuncOpLowering::matchAndRewrite(), outlineKernelFuncImpl(), mlir::detail::Parser::parseAttribute(), mlir::detail::Parser::parseAttributeDict(), and parseCreateOperationOpResults().
Location Builder::getUnknownLoc | ( | ) |
Definition at line 26 of file Builders.cpp.
References context.
Referenced by addBodyWithPayloadOp(), mlir::tosa::buildQTypeFromMinMax(), fillStructuredOpRegion(), and mlir::detail::pdl_function_builder::verifyAsArgs().
Definition at line 306 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::sparse_tensor::Merger::buildExp(), mlir::sparse_tensor::constantOne(), mlir::sparse_tensor::constantZero(), createLinalgBodyCalculationForElementwiseOp(), createNonLdMatrixLoads(), mlir::arith::getIdentityValueAttr(), handleMultidimensionalVectors(), CanonicalizeContractAdd< AddOpType >::matchAndRewrite(), Convert1DExtractStridedSliceIntoExtractInsertChain::matchAndRewrite(), DecomposeNDExtractStridedSlice::matchAndRewrite(), mlir::vector::ContractionOpToDotLowering::matchAndRewrite(), TwoDimMultiReductionToReduction::matchAndRewrite(), TransposeOpLowering::matchAndRewrite(), mlir::linalg::pack(), reshapeLoad(), GenericPadOpVectorizationPattern::tryVectorizeCopy(), and vectorizeTensorExtract().
|
protected |
Definition at line 194 of file Builders.h.
Referenced by getAffineConstantExpr(), getAffineDimExpr(), getAffineSymbolExpr(), getArrayAttr(), getAttr(), getBF16Type(), getBoolAttr(), getContext(), getDenseBoolArrayAttr(), getDenseF32ArrayAttr(), getDenseF64ArrayAttr(), getDenseI16ArrayAttr(), getDenseI32ArrayAttr(), getDenseI64ArrayAttr(), getDenseI8ArrayAttr(), getDictionaryAttr(), getEmptyAffineMap(), getF128Type(), getF16Type(), getF32Type(), getF64Type(), getF80Type(), getFloat8E4M3FNType(), getFloat8E5M2Type(), getFunctionType(), getFusedLoc(), getI16Type(), getI1Type(), getI2Type(), getI32Type(), getI4Type(), getI64Type(), getI8Type(), getIndexType(), getIntegerType(), getMultiDimIdentityMap(), getNoneType(), getShiftedAffineMap(), getStringAttr(), getTupleType(), getType(), getUnitAttr(), getUnknownLoc(), and mlir::OpBuilder::tryFold().