MLIR
17.0.0git
|
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable component. More...
#include "mlir/IR/Types.h"
Public Types | |
template<typename ConcreteType , typename BaseType , typename StorageType , template< typename T > class... Traits> | |
using | TypeBase = detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits... > |
Utility class for implementing types. More... | |
using | ImplType = TypeStorage |
using | AbstractTy = AbstractType |
Public Member Functions | |
constexpr | Type ()=default |
Type (const ImplType *impl) | |
Type (const Type &other)=default | |
Type & | operator= (const Type &other)=default |
bool | operator== (Type other) const |
bool | operator!= (Type other) const |
operator bool () const | |
bool | operator! () const |
template<typename... Tys> | |
bool | isa () const |
template<typename... Tys> | |
bool | isa_and_nonnull () const |
template<typename U > | |
U | dyn_cast () const |
template<typename U > | |
U | dyn_cast_or_null () const |
template<typename U > | |
U | cast () const |
TypeID | getTypeID () |
Return a unique identifier for the concrete type. More... | |
MLIRContext * | getContext () const |
Return the MLIRContext in which this type was uniqued. More... | |
Dialect & | getDialect () const |
Get the dialect this type is registered to. More... | |
bool | isIndex () const |
bool | isFloat8E5M2 () const |
bool | isFloat8E4M3FN () const |
bool | isBF16 () const |
bool | isF16 () const |
bool | isF32 () const |
bool | isF64 () const |
bool | isF80 () const |
bool | isF128 () const |
bool | isInteger (unsigned width) const |
Return true if this is an integer type with the specified width. More... | |
bool | isSignlessInteger () const |
Return true if this is a signless integer type (with the specified width). More... | |
bool | isSignlessInteger (unsigned width) const |
bool | isSignedInteger () const |
Return true if this is a signed integer type (with the specified width). More... | |
bool | isSignedInteger (unsigned width) const |
bool | isUnsignedInteger () const |
Return true if this is an unsigned integer type (with the specified width). More... | |
bool | isUnsignedInteger (unsigned width) const |
unsigned | getIntOrFloatBitWidth () const |
Return the bit width of an integer or a float type, assert failure on other types. More... | |
bool | isSignlessIntOrIndex () const |
Return true if this is a signless integer or index type. More... | |
bool | isSignlessIntOrIndexOrFloat () const |
Return true if this is a signless integer, index, or float type. More... | |
bool | isSignlessIntOrFloat () const |
Return true of this is a signless integer or a float type. More... | |
bool | isIntOrIndex () const |
Return true if this is an integer (of any signedness) or an index type. More... | |
bool | isIntOrFloat () const |
Return true if this is an integer (of any signedness) or a float type. More... | |
bool | isIntOrIndexOrFloat () const |
Return true if this is an integer (of any signedness), index, or float type. More... | |
void | print (raw_ostream &os) const |
Print the current type. More... | |
void | print (raw_ostream &os, AsmState &state) const |
void | dump () const |
const void * | getAsOpaquePointer () const |
Methods for supporting PointerLikeTypeTraits. More... | |
template<template< typename T > class Trait> | |
bool | hasTrait () |
Returns true if the type was registered with a particular trait. More... | |
const AbstractTy & | getAbstractType () const |
Return the abstract type descriptor for this type. More... | |
ImplType * | getImpl () const |
Return the Type implementation. More... | |
void | walkImmediateSubElements (function_ref< void(Attribute)> walkAttrsFn, function_ref< void(Type)> walkTypesFn) const |
Walk all of the immediately nested sub-attributes and sub-types. More... | |
auto | replaceImmediateSubElements (ArrayRef< Attribute > replAttrs, ArrayRef< Type > replTypes) const |
Replace the immediately nested sub-attributes and sub-types with those provided. More... | |
template<WalkOrder Order = WalkOrder::PostOrder, typename... WalkFns> | |
auto | walk (WalkFns &&...walkFns) |
Walk this type and all attibutes/types nested within using the provided walk functions. More... | |
template<typename... ReplacementFns> | |
auto | replace (ReplacementFns &&...replacementFns) |
Recursively replace all of the nested sub-attributes and sub-types using the provided map functions. More... | |
Static Public Member Functions | |
static Type | getFromOpaquePointer (const void *pointer) |
Protected Attributes | |
ImplType * | impl {nullptr} |
Friends | |
::llvm::hash_code | hash_value (Type arg) |
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable component.
They wrap a pointer to the storage object owned by MLIRContext. Therefore, instances of Type are passed around by value.
Some types are "primitives" meaning they do not have any parameters, for example the Index type. Parametric types have additional information that differentiates the types of the same class, for example the Integer type has bitwidth, making i8 and i16 belong to the same kind by be different instances of the IntegerType. Type parameters are part of the unique immutable key. The mutable component of the type can be modified after the type is created, but cannot affect the identity of the type.
Types are constructed and uniqued via the 'detail::TypeUniquer' class.
Derived type classes are expected to implement several required implementation hooks:
Type storage objects inherit from TypeStorage and contain the following:
using mlir::Type::AbstractTy = AbstractType |
using mlir::Type::ImplType = TypeStorage |
using mlir::Type::TypeBase = detail::StorageUserBase<ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits...> |
|
constexprdefault |
Referenced by getFromOpaquePointer().
|
default |
U mlir::Type::cast |
Definition at line 318 of file Types.h.
Referenced by addBodyWithPayloadOp(), mlir::bufferization::allocateTensorForShapedValue(), applyPad(), mlir::sparse_tensor::Merger::buildExp(), mlir::LLVMTypeConverter::canConvertToBarePtr(), castAllocFuncResult(), mlir::quant::QuantizedType::castFromExpressedType(), mlir::quant::QuantizedType::castFromStorageType(), mlir::bufferization::castOrReallocMemRefValue(), mlir::quant::QuantizedType::castToExpressedType(), mlir::quant::QuantizedType::castToStorageType(), mlir::linalg::collapseGenericOpIterationDims(), convertArrayType(), convertOmpAtomicRead(), mlir::tensor::createCanonicalRankReducingExtractSliceOp(), mlir::tensor::createCanonicalRankReducingInsertSliceOp(), mlir::memref::createCanonicalRankReducingSubViewOp(), createConstantAllBitsSet(), mlir::tensor::createDimValues(), mlir::tensor::createDynamicDimValues(), createElementFPowIFunc(), createFoldedDimOp(), mlir::linalg::createFoldedDimOp(), createFPConstant(), createGlobalVarForEntryPointArgument(), createInitialValueForReduceOp(), createLinalgBodyCalculationForElementwiseOp(), createScalarOrSplatConstant(), createSubViewIntersection(), defaultUnknownTypeConverter(), doubleBuffer(), ensureToMemrefOpIsValid(), extendVectorRank(), extractLastDimSlice(), extractOne(), mlir::quant::ExpressedToQuantizedConverter::forInputType(), generateCopy(), generatePointWiseCopy(), genExpand(), mlir::DenseElementsAttr::get(), getBufferizationOptions(), mlir::spirv::SampledImageType::getCapabilities(), mlir::spirv::ArrayType::getCapabilities(), mlir::spirv::PointerType::getCapabilities(), mlir::spirv::RuntimeArrayType::getCapabilities(), mlir::spirv::CooperativeMatrixNVType::getCapabilities(), mlir::spirv::JointMatrixINTELType::getCapabilities(), mlir::spirv::MatrixType::getCapabilities(), mlir::AffineDmaStartOp::getDstMemorySpace(), mlir::AffineDmaStartOp::getDstMemRefRank(), mlir::AffineDmaStartOp::getDstMemRefType(), mlir::linalg::getDynOperands(), mlir::MemRefDescriptor::getElementPtrType(), mlir::ShapeAdaptor::getElementType(), mlir::spirv::SampledImageType::getExtensions(), mlir::spirv::ArrayType::getExtensions(), mlir::spirv::PointerType::getExtensions(), mlir::spirv::RuntimeArrayType::getExtensions(), mlir::spirv::CooperativeMatrixNVType::getExtensions(), mlir::spirv::JointMatrixINTELType::getExtensions(), mlir::spirv::MatrixType::getExtensions(), getFullMemRefAsRegion(), mlir::arith::getIdentityValueAttr(), getInsertExtractValueElementType(), getIntegerDotProductCapabilities(), mlir::AllocationOpLLVMLowering::getMemRefResultType(), mlir::bufferization::getMemRefType(), mlir::bufferization::getMemRefTypeWithFullyDynamicLayout(), mlir::bufferization::getMemRefTypeWithStaticIdentityLayout(), mlir::memref::getMixedSizes(), mlir::tensor::getMixedSizes(), getMultiLevelStrides(), mlir::sparse_tensor::getOneAttr(), mlir::spirv::getOpenCLElementPtr(), mlir::bufferization::getPartialBufferizationOptions(), getPointerDataLayoutEntry(), getPushConstantVariable(), mlir::quant::QuantizedType::getQuantizedElementType(), getReshapeOutputShapeFromInputShape(), getShapeDimSize(), getShapeDimSizes(), mlir::spirv::ArrayType::getSizeInBytes(), mlir::AffineDmaStartOp::getSrcMemorySpace(), mlir::AffineDmaStartOp::getSrcMemRefType(), mlir::AffineDmaStartOp::getTagMemRefRank(), mlir::AffineDmaWaitOp::getTagMemRefRank(), mlir::AffineDmaStartOp::getTagMemRefType(), mlir::AffineDmaWaitOp::getTagMemRefType(), mlir::nvgpu::getWarpMatrixInfo(), getZero(), mlir::Builder::getZeroAttr(), mlir::LLVM::detail::handleMultidimensionalVectors(), inferDynamicDimsForConv(), inferIntrinsicResultType(), insertCopies(), insertCopyLoops(), insertLastDimSlice(), insertOne(), mlir::quant::QuantizedType::isCompatibleExpressedType(), isComplexOfIntType(), mlir::LLVM::isScalableVectorType(), mlir::linalg::makeMemRefCopyOp(), mlir::linalg::makeTransposeOp(), mlir::OperandElementTypeIterator::mapElement(), mlir::ResultElementTypeIterator::mapElement(), CmpFIntToFPConst::matchAndRewrite(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::OpToFuncCallLowering< SourceOp >::matchAndRewrite(), ConvertLoad::matchAndRewrite(), MaxPool2dIsNoOp::matchAndRewrite(), ReshapeConstOptimization::matchAndRewrite(), mlir::vector::ContractionOpToMatmulOpLowering::matchAndRewrite(), ReduceMultiDimReductionRank::matchAndRewrite(), mlir::MemRefDescriptor::MemRefDescriptor(), minMaxValueForFloat(), minMaxValueForSignedInt(), minMaxValueForUnsignedInt(), minusOneIntegerAttribute(), mlir::normalizeMemRef(), mlir::bufferization::populateDynamicDimSizes(), produceSliceErrorMsg(), produceSubViewErrorMsg(), promoteSubViews(), mlir::replaceAllMemRefUsesWith(), replaceUsesAndPropagateType(), reshapeLoad(), reshapeLowerToHigher(), reshapeStore(), mlir::linalg::rewriteAsPaddedOp(), mlir::spirv::Serializer::processOp< spirv::GenericCastToPtrExplicitOp >(), mlir::sparse_tensor::sizesFromSrc(), mlir::vector::splitFullAndPartialTransfer(), mlir::linalg::splitReductionByScaling(), tileAndFuseFirstExtractUse(), tileAndFuseFirstExtractUseThroughContainingOpBlockArgument(), transposeOneLinalgOperandAndReplace(), unpackOperandVector(), vectorizeAsLinalgGeneric(), mlir::linalg::vectorizeCopy(), mlir::spirv::MatrixType::verify(), verifyAtomicUpdateOp(), verifyBlockReadWritePtrAndValTypes(), verifyCastOp(), verifyExtOp(), verifyLoadStorePtrAndValTypes(), verifyPointerAndCoopMatrixType(), verifyPointerAndJointMatrixType(), verifyReductionVarList(), verifyTruncateOp(), and wrapExternalFunction().
void Type::dump | ( | ) | const |
Definition at line 3557 of file AsmPrinter.cpp.
References print().
U mlir::Type::dyn_cast |
Definition at line 308 of file Types.h.
Referenced by appendMangledType(), appendX1Dim(), mlir::bufferization::func_ext::FuncOpInterface::bufferize(), mlir::bufferization::BufferizeTypeConverter::BufferizeTypeConverter(), mlir::tosa::buildConvOpQuantizationAttr(), mlir::tosa::buildConvOpResultTypeInfo(), mlir::tosa::buildMatMulOpQuantizationAttr(), buildMatMulOpWithQuantInfo(), mlir::tosa::buildPadOpQuantizationAttr(), mlir::tosa::buildQTypeFromMinMax(), mlir::tosa::buildUnaryOpQuantizationAttr(), mlir::spirv::SPIRVType::classof(), mlir::spirv::ScalarType::classof(), mlir::spirv::CompositeType::classof(), mlir::linalg::computeSliceParameters(), mlir::sparse_tensor::constantOne(), mlir::sparse_tensor::constantZero(), mlir::quant::ExpressedToQuantizedConverter::convert(), mlir::LLVMTypeConverter::convertCallingConventionType(), mlir::LLVMTypeConverter::convertFunctionTypeCWrapper(), convertIntrinsicResult(), convertMemrefType(), mlir::convertScalarToDtype(), convertTensorType(), createFPConstant(), createNonLdMatrixLoads(), createScalarOrSplatConstant(), deduceCanonicalResource(), defaultIsSmallAlloc(), dropTrailingX1Dim(), elementwiseMatchAndRewriteHelper(), ensureToMemrefOpIsValid(), extractVectorElementType(), foldExtractFromBroadcast(), mlir::bufferization::foldToMemrefToTensorPair(), mlir::sparse_tensor::genIsNonzero(), getBitWidth(), mlir::bufferization::getBuffer(), mlir::bufferization::func_ext::getBufferizedFunctionArgType(), mlir::detail::getDefaultABIAlignment(), mlir::detail::getDefaultPreferredAlignment(), mlir::detail::getDefaultTypeSizeInBits(), mlir::detail::getDenseElementBitWidth(), getElementPtrType(), getElementType(), mlir::getElementTypeOrSelf(), getI1SameShape(), getInsertExtractValueElementType(), getIntegerDotProductCapabilities(), getIntegerWidth(), mlir::tosa::ValueKnowledge::getKnowledgeFromType(), getLoadStoreElementType(), mlir::bufferization::getMemRefTypeWithFullyDynamicLayout(), mlir::bufferization::getMemRefTypeWithStaticIdentityLayout(), getMmaSyncVectorOperandType(), mlir::linalg::getNeutralElement(), getNumBits(), mlir::sparse_tensor::getOneAttr(), mlir::tensor::getOrCreateDestination(), mlir::quant::QuantizedType::getQuantizedElementType(), mlir::pdl::getRangeElementTypeOrSelf(), getRuntimeArrayElementType(), getScalarOrVectorI32Constant(), getShape(), mlir::sparse_tensor::getSparseTensorEncoding(), mlir::ConstantIntRanges::getStorageBitwidth(), getTensorOrVectorElementType(), mlir::memref::getTensorTypeFromMemRefType(), getTypeNumBytes(), getUnaryOpResultType(), mlir::getValueOrCreateCastToIndexLike(), mlir::Builder::getZeroAttr(), mlir::hasNonIdentityLayout(), PadOpVectorizationWithTransferWritePattern::hasSameTensorSize(), insertCasts(), isAllocationSupported(), isBoolScalarOrVector(), mlir::vector::isBroadcastableTo(), mlir::LLVM::isCompatibleOuterType(), mlir::LLVM::isCompatibleVectorType(), mlir::shape::isExtentTensorType(), mlir::VulkanLayoutUtils::isLegalType(), isLegalType(), mlir::isOpaqueTypeWithName(), isSameTypesWithoutEncoding(), isSignedIntegerOrVector(), isSupportedSourceType(), isUnsignedIntegerOrVector(), mlir::DataDescriptor::isValid(), mlir::spirv::MatrixType::isValidColumnType(), isValidIntOrFloat(), mlir::sparse_tensor::isZeroRankedTensorOrScalar(), matchAndReplaceDepthwiseConv(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::vector::ContractionOpToMatmulOpLowering::matchAndRewrite(), mlir::linalg::materializeTiledShape(), mlir::spirv::MemorySpaceToStorageClassConverter::MemorySpaceToStorageClassConverter(), mfmaConcatIfNeeded(), mfmaOpToIntrinsic(), minusOneIntegerAttribute(), mlir::nvgpu::optimizeSharedMemoryReadsAndWrites(), optionallyBroadcast(), mlir::sparse_tensor::overheadTypeEncoding(), parseAndVerifyMatrixType(), parseAndVerifyType(), parseArithmeticExtendedBinaryOp(), parseAtomicCompareExchangeImpl(), parseAtomicUpdateOp(), parseAwaitResultType(), mlir::AsmParser::parseColonType(), mlir::AsmParser::parseCustomTypeWithFallback(), mlir::detail::Parser::parseDecOrHexAttr(), mlir::detail::Parser::parseDenseResourceElementsAttr(), mlir::detail::Parser::parseElementsLiteralType(), parseGlobalMemrefOpTypeAndInitialValue(), parseOneResultSameOperandTypeOp(), mlir::AsmParser::parseType(), mlir::tensor::preservesStaticInformation(), mlir::sparse_tensor::primaryTypeEncoding(), mlir::ExtensibleDialect::printIfDynamicType(), mlir::LLVM::ModuleImport::processFunction(), promoteSubViews(), mlir::DialectBytecodeReader::readType(), reduceIfNeeded(), replaceUnitExtents(), reshapeLowerToHigher(), mlir::linalg::DownscaleSizeOneWindowed2DConvolution< Conv2DOp, Conv1DOp >::returningMatchAndRewrite(), mlir::linalg::DownscaleDepthwiseConv2DNhwcHwcOp::returningMatchAndRewrite(), mlir::impl::scalarizeVectorOp(), mlir::ShapeAdaptor::ShapeAdaptor(), mlir::SPIRVTypeConverter::SPIRVTypeConverter(), mlir::structFuncArgTypeConverter(), mlir::DenseElementsAttr::tryGetComplexFloatValues(), mlir::DenseElementsAttr::tryGetFloatValues(), vectorShape(), mlir::quant::QuantizedType::verify(), verifyCastOp(), mlir::verifyCompatibleShape(), verifyConstantType(), verifyIntegerDotProduct(), verifyOutputShape(), and verifyTransferOp().
U mlir::Type::dyn_cast_or_null |
Definition at line 313 of file Types.h.
Referenced by convertMemrefType(), and getBoolAttribute().
|
inline |
Return the abstract type descriptor for this type.
Definition at line 186 of file Types.h.
Referenced by hasTrait(), replaceImmediateSubElements(), and walkImmediateSubElements().
|
inline |
Methods for supporting PointerLikeTypeTraits.
Definition at line 172 of file Types.h.
References impl.
Referenced by llvm::PointerLikeTypeTraits< mlir::Type >::getAsVoidPointer().
MLIRContext * Type::getContext | ( | ) | const |
Return the MLIRContext in which this type was uniqued.
Definition at line 35 of file Types.cpp.
Referenced by combineOneSpec(), mlir::quant::fakeQuantAttrsToType(), mlir::gpu::MMAMatrixType::get(), mlir::spirv::MatrixType::get(), mlir::spirv::RuntimeArrayType::get(), mlir::spirv::CooperativeMatrixNVType::get(), mlir::spirv::JointMatrixINTELType::get(), mlir::spirv::ArrayType::get(), mlir::quant::CalibratedQuantizedType::get(), mlir::spirv::SampledImageType::get(), mlir::DataLayoutEntryAttr::get(), mlir::spirv::PointerType::get(), mlir::quant::UniformQuantizedPerAxisType::get(), mlir::quant::UniformQuantizedType::get(), mlir::quant::AnyQuantizedType::get(), mlir::sparse_tensor::get1DMemRefType(), mlir::gpu::MMAMatrixType::getChecked(), mlir::spirv::MatrixType::getChecked(), mlir::quant::CalibratedQuantizedType::getChecked(), mlir::spirv::SampledImageType::getChecked(), mlir::quant::UniformQuantizedPerAxisType::getChecked(), mlir::quant::UniformQuantizedType::getChecked(), mlir::quant::AnyQuantizedType::getChecked(), mlir::Value::getContext(), mlir::detail::getDefaultABIAlignment(), mlir::detail::getDefaultPreferredAlignment(), mlir::detail::getDefaultTypeSizeInBits(), getGetValueTypeOpValueType(), getI1SameShape(), mlir::bufferization::getMemRefTypeWithFullyDynamicLayout(), getRegisterIndexToTileOffsetMap(), mlir::memref::getTensorTypeFromMemRefType(), getUnaryOpResultType(), getValAndBoolStructType(), inferIntrinsicResultType(), mlir::LLVM::isCompatibleType(), mlir::spirv::MemorySpaceToStorageClassConverter::MemorySpaceToStorageClassConverter(), mlir::UnrankedMemRefDescriptor::sizeBasePtr(), and mlir::arith::WideIntEmulationConverter::WideIntEmulationConverter().
|
inline |
Get the dialect this type is registered to.
Definition at line 118 of file Types.h.
Referenced by mlir::pdl::PDLType::classof(), mlir::quant::QuantizedType::classof(), mlir::spirv::SPIRVType::classof(), combineOneSpec(), mlir::TensorType::isValidElementType(), and parseAndVerifyType().
|
inlinestatic |
Definition at line 175 of file Types.h.
References Type().
Referenced by mlir::DiagnosticArgument::getAsType(), and llvm::PointerLikeTypeTraits< mlir::Type >::getFromVoidPointer().
|
inline |
unsigned Type::getIntOrFloatBitWidth | ( | ) | const |
Return the bit width of an integer or a float type, assert failure on other types.
Definition at line 109 of file Types.cpp.
Referenced by areSameBitwidthScalarType(), buildAttributeAPInt(), createElementIPowIFunc(), createInitialValueForReduceOp(), createLinalgBodyCalculationForElementwiseOp(), declareReduction(), deduceCanonicalResource(), findEntryForIntegerType(), genIndexLoad(), getBitWidth(), mlir::spirv::ScalarType::getCapabilities(), mlir::detail::getDefaultTypeSizeInBits(), mlir::detail::getDenseElementBitWidth(), mlir::spirv::ScalarType::getExtensions(), mlir::Builder::getIntegerAttr(), mlir::nvgpu::getLaneIdAndValueIdToOperandCoord(), mlir::nvgpu::getLdMatrixParams(), getNumBits(), getRegisterIndexToTileOffsetMap(), getScalarOrElementWidth(), mlir::spirv::ScalarType::getSizeInBytes(), getTileShape(), getTypeNumBytes(), mlir::nvgpu::inferTileWidthInBits(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::detail::Parser::parseDenseArrayAttr(), parseSwitchOpCases(), verifyCastOp(), and verifyMmaSyncOp().
|
inline |
Return a unique identifier for the concrete type.
This is used to support dynamic type casting.
Definition at line 112 of file Types.h.
Referenced by mlir::DataLayout::getTypeABIAlignment(), mlir::DataLayout::getTypePreferredAlignment(), mlir::DataLayout::getTypeSize(), mlir::DataLayout::getTypeSizeInBits(), mlir::DynamicType::isa(), and mlir::OpTrait::impl::verifyElementwise().
|
inline |
Returns true if the type was registered with a particular trait.
Definition at line 181 of file Types.h.
References getAbstractType(), and mlir::AbstractType::hasTrait().
Referenced by mlir::DynamicType::classof().
bool mlir::Type::isa |
Definition at line 298 of file Types.h.
Referenced by mlir::ArithBuilder::add(), mlir::bufferization::allocateTensorForShapedValue(), mlir::linalg::areElementwiseOpsFusable(), broadcast(), mlir::bufferization::func_ext::CallOpInterface::bufferize(), buildVectorWrite(), mlir::LLVMTypeConverter::canConvertToBarePtr(), mlir::quant::QuantizedType::castFromExpressedType(), mlir::quant::QuantizedType::castFromStorageType(), mlir::quant::QuantizedType::castToExpressedType(), mlir::quant::QuantizedType::castToStorageType(), mlir::spirv::SPIRVType::classof(), mlir::spirv::CompositeType::classof(), mlir::FloatType::classof(), mlir::TensorType::classof(), mlir::BaseMemRefType::classof(), mlir::linalg::computeAllSliceParameters(), mlir::convertScalarToDtype(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), createConstantAllBitsSet(), createContractArithOp(), createElementIPowIFunc(), createGroupReduceOp(), createInitialValueForReduceOp(), createLinalgBodyCalculationForElementwiseOp(), createLinalgBodyCalculationForReduceOp(), createNonLdMatrixLoads(), mlir::vector::createOrFoldDimOp(), createOrFoldDimOp(), mlir::linalg::createOrFoldDimOp(), mlir::bufferization::detail::defaultGetBufferType(), dispatchPrint(), fillStructuredOpRegion(), foldExtractStridedOpFromInsertChain(), mlir::memref::foldMemRefCast(), mlir::quant::ExpressedToQuantizedConverter::forInputType(), mlir::linalg::fuseElementwiseOps(), genIndexLoad(), mlir::sparse_tensor::genIsNonzero(), getBitWidth(), mlir::OpTrait::util::getBroadcastedType(), mlir::bufferization::getBufferType(), mlir::detail::getDefaultABIAlignment(), mlir::detail::getDefaultPreferredAlignment(), mlir::detail::getDefaultTypeSizeInBits(), getGenericEffectsImpl(), getGetValueTypeOpValueType(), getI1SameShape(), mlir::sparse_tensor::getOneAttr(), mlir::spirv::getOpenCLElementPtr(), getOperandTreePredicates(), mlir::LLVM::getPrimitiveTypeSizeInBits(), getProducerOfTensor(), mlir::quant::QuantizedType::getQuantizedElementType(), getTreePredicates(), getTypeNumBytes(), getUnderlyingType(), getVectorType(), getZero(), mlir::Builder::getZeroAttr(), mlir::spirv::CompositeType::hasCompileTimeKnownNumElements(), hasTensorOrVectorType(), insertCasts(), insertLastDimSlice(), isAccessIndexInvariant(), isaTensor(), mlir::quant::QuantizedType::isCompatibleExpressedType(), mlir::LLVM::isCompatibleFloatingPointType(), mlir::LLVM::isCompatibleOuterType(), mlir::LLVM::isCompatibleVectorType(), isComplexOfIntType(), isDefinedByCallTo(), isErrorPropagationPossible(), isGpuAsyncTokenType(), isQuantizablePrimitiveType(), mlir::async::isRefCounted(), mlir::LLVM::isScalableVectorType(), isSupportedCombiningKind(), mlir::LLVM::LLVMStructType::isValidElementType(), mlir::TensorType::isValidElementType(), mlir::BaseMemRefType::isValidElementType(), isValidIntOrFloat(), mlir::bufferization::AnalysisState::isValueRead(), mlir::transform::TransformState::mapBlockArgument(), mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite(), ConvertSameRankInsertStridedSliceIntoShuffle::matchAndRewrite(), ConvertAccessChain::matchAndRewrite(), mlir::vector::ContractionOpToMatmulOpLowering::matchAndRewrite(), mfmaOpToIntrinsic(), mlir::ArithBuilder::mul(), mlir::AffineDmaWaitOp::parse(), parseAndVerifySampledImageType(), mlir::detail::Parser::parseComplexType(), mlir::detail::Parser::parseDecOrHexAttr(), mlir::detail::Parser::parseFloatAttr(), mlir::OpAsmPrinter::printFunctionalType(), mlir::bufferization::replaceOpWithBufferizedValues(), mlir::impl::scalarizeVectorOp(), mlir::spirv::Serializer::processOp< spirv::FunctionCallOp >(), setInPlaceOpOperand(), mlir::ArithBuilder::sgt(), mlir::ArithBuilder::slt(), mlir::structFuncArgTypeConverter(), mlir::ArithBuilder::sub(), vectorizeOperand(), mlir::quant::CalibratedQuantizedType::verify(), mlir::spirv::SampledImageType::verify(), mlir::quant::UniformQuantizedPerAxisType::verify(), mlir::quant::UniformQuantizedType::verify(), mlir::quant::AnyQuantizedType::verify(), mlir::detail::verifyDestinationStyleOpInterface(), verifyOutputShape(), verifyPointerAndCoopMatrixType(), verifyPointerAndJointMatrixType(), mlir::transform::detail::verifyPossibleTopLevelTransformOpTrait(), verifyReduceOpAndType(), verifyShapeOrExtentTensorOp(), verifySizeOrIndexOp(), and visitUpward().
bool mlir::Type::isa_and_nonnull |
Definition at line 303 of file Types.h.
Referenced by destructureIndices().
bool Type::isBF16 | ( | ) | const |
Definition at line 39 of file Types.cpp.
Referenced by fltSemanticsForType(), mlir::spirv::ScalarType::isValid(), mfmaOpToIntrinsic(), parseAndVerifyType(), mlir::sparse_tensor::primaryTypeEncoding(), and verifyMmaSyncOp().
bool Type::isF128 | ( | ) | const |
Definition at line 44 of file Types.cpp.
Referenced by fltSemanticsForType().
bool Type::isF16 | ( | ) | const |
Definition at line 40 of file Types.cpp.
Referenced by floatCst(), fltSemanticsForType(), mlir::nvgpu::getMmaSyncRegisterType(), mlir::gpu::MMAMatrixType::isValidElementType(), mlir::math::ErfPolynomialApproximation::matchAndRewrite(), mfmaOpToIntrinsic(), mlir::sparse_tensor::primaryTypeEncoding(), and verifyMmaSyncOp().
bool Type::isF32 | ( | ) | const |
Definition at line 41 of file Types.cpp.
Referenced by convertFloatAttr(), floatCst(), fltSemanticsForType(), mlir::nvgpu::getMmaSyncRegisterType(), mlir::gpu::MMAMatrixType::isValidElementType(), mlir::math::ErfPolynomialApproximation::matchAndRewrite(), mfmaOpToIntrinsic(), mlir::sparse_tensor::primaryTypeEncoding(), and verifyMmaSyncOp().
bool Type::isF64 | ( | ) | const |
Definition at line 42 of file Types.cpp.
Referenced by fltSemanticsForType(), mlir::nvgpu::getMmaSyncRegisterType(), mfmaOpToIntrinsic(), mlir::sparse_tensor::primaryTypeEncoding(), and verifyMmaSyncOp().
bool Type::isF80 | ( | ) | const |
Definition at line 43 of file Types.cpp.
Referenced by fltSemanticsForType().
bool Type::isIndex | ( | ) | const |
Definition at line 46 of file Types.cpp.
Referenced by buildAttributeAPInt(), ceilDivPositive(), mlir::convertScalarToDtype(), mlir::detail::getDenseElementBitWidth(), mlir::Builder::getIntegerAttr(), mlir::ConstantIntRanges::getStorageBitwidth(), mlir::linalg::getUpperBoundForIndex(), mlir::getValueOrCreateCastToIndexLike(), getZero(), inferIndexCast(), isMatchingWidth(), mlir::isValidDim(), isValidIntOrFloat(), mlir::isValidSymbol(), mlir::sparse_tensor::overheadTypeEncoding(), unpackSingleIndexResultPDLOperations(), and mlir::detail::verifyShapedDimOpInterface().
bool Type::isInteger | ( | unsigned | width | ) | const |
Return true if this is an integer type with the specified width.
Definition at line 49 of file Types.cpp.
Referenced by castBoolToIntN(), castIntNToBool(), createInitialValueForReduceOp(), createLinalgBodyCalculationForElementwiseOp(), createLinalgBodyCalculationForReduceOp(), mlir::DenseElementsAttr::get(), getConstantUint32(), mlir::nvgpu::getMmaSyncRegisterType(), getScalarOrVectorI32Constant(), isBoolScalarOrVector(), isMatchingWidth(), mlir::DenseElementsAttr::isValidBool(), mfmaOpToIntrinsic(), mlir::detail::Parser::parseDenseArrayAttr(), mlir::sparse_tensor::primaryTypeEncoding(), and verifyMmaSyncOp().
bool Type::isIntOrFloat | ( | ) | const |
Return true if this is an integer (of any signedness) or a float type.
Definition at line 105 of file Types.cpp.
Referenced by areSameBitwidthScalarType(), getBitWidth(), getScalarOrElementWidth(), isAllocationSupported(), mlir::spirv::SPIRVType::isScalarOrVector(), mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite(), ConvertAccessChain::matchAndRewrite(), and mlir::vector::ContractionOpToMatmulOpLowering::matchAndRewrite().
bool Type::isIntOrIndex | ( | ) | const |
Return true if this is an integer (of any signedness) or an index type.
Definition at line 103 of file Types.cpp.
Referenced by mlir::sparse_tensor::genIsNonzero(), isSupportedCombiningKind(), mlir::detail::Parser::parseDenseArrayAttr(), and mlir::dataflow::IntegerRangeAnalysis::visitOperation().
bool Type::isIntOrIndexOrFloat | ( | ) | const |
Return true if this is an integer (of any signedness), index, or float type.
Definition at line 107 of file Types.cpp.
Referenced by mlir::DenseElementsAttr::get(), getZero(), mlir::vector::isBroadcastableTo(), isSupportedCombiningKind(), isSupportedSourceType(), mlir::BaseMemRefType::isValidElementType(), TwoDimMultiReductionToElementWise::matchAndRewrite(), mlir::detail::Parser::parseDenseArrayAttr(), and verifyRegionAttribute().
bool Type::isSignedInteger | ( | ) | const |
Return true if this is a signed integer type (with the specified width).
Definition at line 67 of file Types.cpp.
Referenced by buildAttributeAPInt(), mlir::Builder::getIntegerAttr(), and isSignedIntegerOrVector().
bool Type::isSignlessInteger | ( | ) | const |
Return true if this is a signless integer type (with the specified width).
Definition at line 55 of file Types.cpp.
Referenced by mlir::arith::ConstantIntOp::build().
bool Type::isSignlessIntOrFloat | ( | ) | const |
Return true of this is a signless integer or a float type.
Definition at line 99 of file Types.cpp.
Referenced by mlir::linalg::RegionMatcher::matchAsScalarBinaryOp().
bool Type::isSignlessIntOrIndex | ( | ) | const |
bool Type::isSignlessIntOrIndexOrFloat | ( | ) | const |
Return true if this is a signless integer, index, or float type.
Definition at line 95 of file Types.cpp.
Referenced by appendMangledType().
bool Type::isUnsignedInteger | ( | ) | const |
Return true if this is an unsigned integer type (with the specified width).
Definition at line 79 of file Types.cpp.
Referenced by createLinalgBodyCalculationForElementwiseOp(), isUnsignedIntegerOrVector(), and mlir::detail::Parser::parseDecOrHexAttr().
|
inlineexplicit |
|
inline |
|
inline |
void Type::print | ( | raw_ostream & | os | ) | const |
Print the current type.
Definition at line 3544 of file AsmPrinter.cpp.
References print().
Referenced by mlir::operator<<().
void Type::print | ( | raw_ostream & | os, |
AsmState & | state | ||
) | const |
Definition at line 3553 of file AsmPrinter.cpp.
References mlir::AsmState::getImpl(), and mlir::AsmPrinter::Impl::printType().
|
inline |
Recursively replace all of the nested sub-attributes and sub-types using the provided map functions.
Returns nullptr in the case of failure. See AttrTypeReplacer
for information on the support replacement function types.
Definition at line 225 of file Types.h.
References mlir::AttrTypeReplacer::addReplacement(), and mlir::AttrTypeReplacer::replace().
Referenced by mlir::gpu::populateMemorySpaceAttributeTypeConversions().
|
inline |
Replace the immediately nested sub-attributes and sub-types with those provided.
The order of the provided elements is derived from the order of the elements returned by the callbacks of walkImmediateSubElements
. The element at index 0 would replace the very first attribute given by walkImmediateSubElements
. On success, the new instance with the values replaced is returned. If replacement fails, nullptr is returned.
Definition at line 204 of file Types.h.
References getAbstractType(), and mlir::AbstractType::replaceImmediateSubElements().
|
inline |
Walk this type and all attibutes/types nested within using the provided walk functions.
See AttrTypeWalker
for information on the supported walk function types.
Definition at line 214 of file Types.h.
References mlir::AttrTypeWalker::addWalk(), and mlir::AttrTypeWalker::walk().
|
inline |
Walk all of the immediately nested sub-attributes and sub-types.
This method does not recurse into sub elements.
Definition at line 193 of file Types.h.
References getAbstractType(), and mlir::AbstractType::walkImmediateSubElements().
|
protected |
Definition at line 233 of file Types.h.
Referenced by getAsOpaquePointer(), getImpl(), operator bool(), and operator==().