MLIR  16.0.0git
Namespaces | Macros | Functions | Variables
SPIRVOps.cpp File Reference
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/IR/ParserUtils.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVEnums.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOpTraits.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
#include "mlir/Dialect/SPIRV/IR/TargetAndABI.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/FunctionImplementation.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/CallInterfaces.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/bit.h"
#include <numeric>
#include "mlir/Dialect/SPIRV/IR/SPIRVAvailability.cpp.inc"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.cpp.inc"
#include "mlir/Dialect/SPIRV/IR/SPIRVOpAvailabilityImpl.inc"
+ Include dependency graph for SPIRVOps.cpp:

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::spirv
 

Macros

#define GET_OP_CLASSES
 

Functions

static ParseResult parseOneResultSameOperandTypeOp (OpAsmParser &parser, OperationState &result)
 
static void printOneResultOp (Operation *op, OpAsmPrinter &p)
 
static bool isNestedInFunctionOpInterface (Operation *op)
 Returns true if the given op is a function-like op or nested in a function-like op without a module-like op in the middle. More...
 
static bool isDirectInModuleLikeOp (Operation *op)
 Returns true if the given op is an module-like op that maintains a symbol table. More...
 
static LogicalResult extractValueFromConstOp (Operation *op, int32_t &value)
 
template<typename Ty >
static ArrayAttr getStrArrayAttrForEnumList (Builder &builder, ArrayRef< Ty > enumValues, function_ref< StringRef(Ty)> stringifyFn)
 
template<typename EnumClass >
static ParseResult parseEnumStrAttr (EnumClass &value, OpAsmParser &parser, StringRef attrName=spirv::attributeName< EnumClass >())
 Parses the next string attribute in parser as an enumerant of the given EnumClass. More...
 
template<typename EnumAttrClass , typename EnumClass = typename EnumAttrClass::ValueType>
static ParseResult parseEnumStrAttr (EnumClass &value, OpAsmParser &parser, OperationState &state, StringRef attrName=spirv::attributeName< EnumClass >())
 Parses the next string attribute in parser as an enumerant of the given EnumClass and inserts the enumerant into state as an 32-bit integer attribute with the enum class's name as attribute name. More...
 
template<typename EnumAttrClass , typename EnumClass = typename EnumAttrClass::ValueType>
static ParseResult parseEnumKeywordAttr (EnumClass &value, OpAsmParser &parser, OperationState &state, StringRef attrName=spirv::attributeName< EnumClass >())
 Parses the next keyword in parser as an enumerant of the given EnumClass and inserts the enumerant into state as an 32-bit integer attribute with the enum class's name as attribute name. More...
 
template<typename EnumAttrClass , typename EnumClass >
static ParseResult parseControlAttribute (OpAsmParser &parser, OperationState &state, StringRef attrName=spirv::attributeName< EnumClass >())
 Parses Function, Selection and Loop control attributes. More...
 
static ParseResult parseMemoryAccessAttributes (OpAsmParser &parser, OperationState &state)
 Parses optional memory access attributes attached to a memory access operand/pointer. More...
 
static ParseResult parseSourceMemoryAccessAttributes (OpAsmParser &parser, OperationState &state)
 
template<typename MemoryOpTy >
static void printMemoryAccessAttribute (MemoryOpTy memoryOp, OpAsmPrinter &printer, SmallVectorImpl< StringRef > &elidedAttrs, Optional< spirv::MemoryAccess > memoryAccessAtrrValue=None, Optional< uint32_t > alignmentAttrValue=None)
 
template<typename MemoryOpTy >
static void printSourceMemoryAccessAttribute (MemoryOpTy memoryOp, OpAsmPrinter &printer, SmallVectorImpl< StringRef > &elidedAttrs, Optional< spirv::MemoryAccess > memoryAccessAtrrValue=None, Optional< uint32_t > alignmentAttrValue=None)
 
static ParseResult parseImageOperands (OpAsmParser &parser, spirv::ImageOperandsAttr &attr)
 
static void printImageOperands (OpAsmPrinter &printer, Operation *imageOp, spirv::ImageOperandsAttr attr)
 
template<typename Op >
static LogicalResult verifyImageOperands (Op imageOp, spirv::ImageOperandsAttr attr, Operation::operand_range operands)
 
static LogicalResult verifyCastOp (Operation *op, bool requireSameBitWidth=true, bool skipBitWidthCheck=false)
 
template<typename MemoryOpTy >
static LogicalResult verifyMemoryAccessAttribute (MemoryOpTy memoryOp)
 
template<typename MemoryOpTy >
static LogicalResult verifySourceMemoryAccessAttribute (MemoryOpTy memoryOp)
 
static LogicalResult verifyMemorySemantics (Operation *op, spirv::MemorySemantics memorySemantics)
 
template<typename LoadStoreOpTy >
static LogicalResult verifyLoadStorePtrAndValTypes (LoadStoreOpTy op, Value ptr, Value val)
 
template<typename BlockReadWriteOpTy >
static LogicalResult verifyBlockReadWritePtrAndValTypes (BlockReadWriteOpTy op, Value ptr, Value val)
 
static ParseResult parseVariableDecorations (OpAsmParser &parser, OperationState &state)
 
static void printVariableDecorations (Operation *op, OpAsmPrinter &printer, SmallVectorImpl< StringRef > &elidedAttrs)
 
static unsigned getBitWidth (Type type)
 
static Type getElementType (Type type, ArrayRef< int32_t > indices, function_ref< InFlightDiagnostic(StringRef)> emitErrorFn)
 Walks the given type hierarchy with the given indices, potentially down to component granularity, to select an element type. More...
 
static Type getElementType (Type type, Attribute indices, function_ref< InFlightDiagnostic(StringRef)> emitErrorFn)
 
static Type getElementType (Type type, Attribute indices, Location loc)
 
static Type getElementType (Type type, Attribute indices, OpAsmParser &parser, SMLoc loc)
 
static bool isMergeBlock (Block &block)
 Returns true if the given block only contains one spv.mlir.merge op. More...
 
static ParseResult parseAtomicUpdateOp (OpAsmParser &parser, OperationState &state, bool hasValue)
 
static void printAtomicUpdateOp (Operation *op, OpAsmPrinter &printer)
 
template<typename T >
static StringRef stringifyTypeName ()
 
template<>
StringRef stringifyTypeName< IntegerType > ()
 
template<>
StringRef stringifyTypeName< FloatType > ()
 
template<typename ExpectedElementType >
static LogicalResult verifyAtomicUpdateOp (Operation *op)
 
static ParseResult parseGroupNonUniformArithmeticOp (OpAsmParser &parser, OperationState &state)
 
static void printGroupNonUniformArithmeticOp (Operation *groupOp, OpAsmPrinter &printer)
 
static LogicalResult verifyGroupNonUniformArithmeticOp (Operation *groupOp)
 
static Type getUnaryOpResultType (Type operandType)
 Result of a logical op must be a scalar or vector of boolean type. More...
 
static LogicalResult verifyShiftOp (Operation *op)
 
static void buildLogicalBinaryOp (OpBuilder &builder, OperationState &state, Value lhs, Value rhs)
 
static void buildLogicalUnaryOp (OpBuilder &builder, OperationState &state, Value value)
 
static Type getElementPtrType (Type type, ValueRange indices, Location baseLoc)
 
template<typename Op >
static void printAccessChain (Op op, ValueRange indices, OpAsmPrinter &printer)
 
template<typename Op >
static LogicalResult verifyAccessChain (Op accessChainOp, ValueRange indices)
 
template<typename T >
static void printAtomicCompareExchangeImpl (T atomOp, OpAsmPrinter &printer)
 
static ParseResult parseAtomicCompareExchangeImpl (OpAsmParser &parser, OperationState &state)
 
template<typename T >
static LogicalResult verifyAtomicCompareExchangeImpl (T atomOp)
 
static LogicalResult verifyConstantType (spirv::ConstantOp op, Attribute value, Type opType)
 
static bool hasOneBranchOpTo (Block &srcBlock, Block &dstBlock)
 Returns true if the given srcBlock contains only one spv.Branch to the given dstBlock. More...
 
static LogicalResult verifyPointerAndCoopMatrixType (Operation *op, Type pointer, Type coopMatrix)
 
static LogicalResult verifyCoopMatrixMulAdd (spirv::CooperativeMatrixMulAddNVOp op)
 
static ParseResult parsePtrAccessChainOpImpl (StringRef opName, OpAsmParser &parser, OperationState &state)
 
template<typename Op >
static auto concatElemAndIndices (Op op)
 

Variables

constexpr char kMemoryAccessAttrName [] = "memory_access"
 
constexpr char kSourceMemoryAccessAttrName [] = "source_memory_access"
 
constexpr char kAlignmentAttrName [] = "alignment"
 
constexpr char kSourceAlignmentAttrName [] = "source_alignment"
 
constexpr char kBranchWeightAttrName [] = "branch_weights"
 
constexpr char kCallee [] = "callee"
 
constexpr char kClusterSize [] = "cluster_size"
 
constexpr char kControl [] = "control"
 
constexpr char kDefaultValueAttrName [] = "default_value"
 
constexpr char kExecutionScopeAttrName [] = "execution_scope"
 
constexpr char kEqualSemanticsAttrName [] = "equal_semantics"
 
constexpr char kFnNameAttrName [] = "fn"
 
constexpr char kGroupOperationAttrName [] = "group_operation"
 
constexpr char kIndicesAttrName [] = "indices"
 
constexpr char kInitializerAttrName [] = "initializer"
 
constexpr char kInterfaceAttrName [] = "interface"
 
constexpr char kMemoryScopeAttrName [] = "memory_scope"
 
constexpr char kSemanticsAttrName [] = "semantics"
 
constexpr char kSpecIdAttrName [] = "spec_id"
 
constexpr char kTypeAttrName [] = "type"
 
constexpr char kUnequalSemanticsAttrName [] = "unequal_semantics"
 
constexpr char kValueAttrName [] = "value"
 
constexpr char kValuesAttrName [] = "values"
 
constexpr char kCompositeSpecConstituentsName [] = "constituents"
 

Macro Definition Documentation

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

Definition at line 4547 of file SPIRVOps.cpp.

Function Documentation

◆ buildLogicalBinaryOp()

static void buildLogicalBinaryOp ( OpBuilder builder,
OperationState state,
Value  lhs,
Value  rhs 
)
static

Definition at line 948 of file SPIRVOps.cpp.

◆ buildLogicalUnaryOp()

static void buildLogicalUnaryOp ( OpBuilder builder,
OperationState state,
Value  value 
)
static

◆ concatElemAndIndices()

template<typename Op >
static auto concatElemAndIndices ( Op  op)
static

◆ extractValueFromConstOp()

static LogicalResult extractValueFromConstOp ( Operation op,
int32_t &  value 
)
static

Definition at line 134 of file SPIRVOps.cpp.

References mlir::failure(), and mlir::success().

Referenced by getElementPtrType(), and verifyGroupNonUniformArithmeticOp().

◆ getBitWidth()

static unsigned getBitWidth ( Type  type)
static

◆ getElementPtrType()

static Type getElementPtrType ( Type  type,
ValueRange  indices,
Location  baseLoc 
)
static

◆ getElementType() [1/4]

static Type getElementType ( Type  type,
ArrayRef< int32_t >  indices,
function_ref< InFlightDiagnostic(StringRef)>  emitErrorFn 
)
static

Walks the given type hierarchy with the given indices, potentially down to component granularity, to select an element type.

Returns null type and emits errors with the given loc on failure.

Definition at line 685 of file SPIRVOps.cpp.

References mlir::Type::dyn_cast().

Referenced by areSameBitwidthScalarType(), castBoolToIntN(), mlir::pdl::PDLType::classof(), mlir::detail::DenseResourceElementsAttrBase< T >::classof(), mlir::DenseElementsAttr::complex_float_value_begin(), mlir::DenseElementsAttr::complex_float_value_end(), mlir::DenseElementsAttr::complex_value_begin(), mlir::DenseElementsAttr::complex_value_end(), concatElemAndIndices(), mlir::convertMMAToLLVMType(), convertOmpAtomicRead(), convertStructType(), createDepthwiseConvCollapseMap(), createLinalgBodyCalculationForElementwiseOp(), mlir::LLVM::detail::extractNDVectorTypeInfo(), mlir::DenseElementsAttr::float_value_begin(), mlir::DenseElementsAttr::float_value_end(), foldExtractStridedOpFromInsertChain(), mlir::quant::ExpressedToQuantizedConverter::forInputType(), genLoad(), mlir::spirv::ImageType::get(), mlir::spirv::ArrayType::getCapabilities(), mlir::spirv::RuntimeArrayType::getCapabilities(), mlir::spirv::CooperativeMatrixNVType::getCapabilities(), mlir::DenseElementsAttr::getComplexFloatValues(), mlir::DenseElementsAttr::getComplexIntValues(), mlir::spirv::MatrixType::getElementType(), getElementType(), mlir::spirv::ArrayType::getExtensions(), mlir::spirv::RuntimeArrayType::getExtensions(), mlir::spirv::CooperativeMatrixNVType::getExtensions(), mlir::DenseElementsAttr::getFloatValues(), mlir::FloatType::getFPMantissaWidth(), getInsertExtractValueElementType(), getLocalInvocationDimSize(), getPushConstantVariable(), mlir::quant::QuantizedType::getQuantizedElementType(), mlir::spirv::ArrayType::getSizeInBytes(), getSrcVectorElementType(), mlir::getStridesAndOffset(), mlir::DenseElementsAttr::getValues(), handleMultidimensionalVectors(), hasSameBitwidth(), isAsyncWithOneDependency(), mlir::quant::QuantizedType::isCompatibleExpressedType(), isComplexOfIntType(), isMatchingWidth(), mlir::DenseElementsAttr::isValidBool(), mlir::DenseElementsAttr::isValidComplex(), mlir::TensorType::isValidElementType(), mlir::DenseElementsAttr::isValidIntOrFloat(), mlir::OperandElementTypeIterator::mapElement(), mlir::ResultElementTypeIterator::mapElement(), mlir::GPUFuncOpLowering::matchAndRewrite(), CanonicalizeContractAdd< AddOpType >::matchAndRewrite(), CollapseShapeOpMemRefCastFolder::matchAndRewrite(), mlirComplexTypeGetElementType(), mlirPDLRangeTypeGetElementType(), mlirShapedTypeGetElementType(), mlir::LLVM::GEPIndicesAdaptor< DynamicRange >::iterator::operator*(), mlir::DenseElementsAttr::ComplexIntElementIterator::operator*(), mlir::spirv::StructType::MemberDecorationInfo::operator<(), parseInferType(), mlir::bufferization::populateDynamicDimSizes(), printAtomicReductionRegion(), printOperation(), mlir::replaceAllMemRefUsesWith(), mlir::MemRefType::Builder::setMemorySpace(), mlir::linalg::splitReduction(), mlir::DenseElementsAttr::value_begin(), mlir::DenseElementsAttr::value_end(), vectorType(), verifyAtomicCompareExchangeImpl(), verifyCastOp(), verifyConvOp(), verifyStructIndices(), and writeAPIntsToBuffer().

◆ getElementType() [2/4]

static Type getElementType ( Type  type,
Attribute  indices,
function_ref< InFlightDiagnostic(StringRef)>  emitErrorFn 
)
static

Definition at line 711 of file SPIRVOps.cpp.

References mlir::Attribute::dyn_cast(), and getElementType().

◆ getElementType() [3/4]

static Type getElementType ( Type  type,
Attribute  indices,
Location  loc 
)
static

Definition at line 736 of file SPIRVOps.cpp.

References mlir::emitError(), and getElementType().

◆ getElementType() [4/4]

static Type getElementType ( Type  type,
Attribute  indices,
OpAsmParser parser,
SMLoc  loc 
)
static

Definition at line 743 of file SPIRVOps.cpp.

References mlir::AsmParser::emitError(), and getElementType().

◆ getStrArrayAttrForEnumList()

template<typename Ty >
static ArrayAttr getStrArrayAttrForEnumList ( Builder builder,
ArrayRef< Ty >  enumValues,
function_ref< StringRef(Ty)>  stringifyFn 
)
static

Definition at line 155 of file SPIRVOps.cpp.

References mlir::Builder::getStrArrayAttr().

◆ getUnaryOpResultType()

static Type getUnaryOpResultType ( Type  operandType)
static

Result of a logical op must be a scalar or vector of boolean type.

Definition at line 930 of file SPIRVOps.cpp.

References mlir::Type::dyn_cast(), mlir::Type::getContext(), and mlir::Builder::getIntegerType().

◆ hasOneBranchOpTo()

static bool hasOneBranchOpTo ( Block srcBlock,
Block dstBlock 
)
inlinestatic

Returns true if the given srcBlock contains only one spv.Branch to the given dstBlock.

Definition at line 3028 of file SPIRVOps.cpp.

References mlir::OperationState::addAttribute(), mlir::OperationState::addRegion(), mlir::OperationState::addTypes(), mlir::NamedAttrList::append(), mlir::OpBuilder::atBlockEnd(), mlir::OperationState::attributes, mlir::Block::back(), bindingName(), mlir::OpBuilder::create(), mlir::OpBuilder::createBlock(), descriptorSetName(), mlir::Type::dyn_cast(), mlir::AsmParser::emitError(), mlir::Operation::emitError(), mlir::Region::empty(), mlir::failed(), mlir::failure(), mlir::Block::front(), mlir::spirv::PointerType::get(), mlir::Builder::getAttr(), mlir::AsmParser::getBuilder(), mlir::AsmParser::getCurrentLocation(), mlir::Builder::getIntegerType(), mlir::AsmParser::getNameLoc(), getNumElements(), mlir::Block::getNumSuccessors(), mlir::Builder::getStringAttr(), mlir::Block::getSuccessor(), mlir::SymbolTable::getSymbolAttrName(), mlir::Block::getTerminator(), isMergeBlock(), kDefaultValueAttrName, kSpecIdAttrName, mlir::SymbolTable::lookup(), mlir::SymbolTable::lookupNearestSymbolFrom(), max(), None, mlir::OperationState::operands, mlir::AsmParser::parseAttribute(), mlir::AsmParser::parseColon(), parseControlAttribute(), parseEnumStrAttr(), mlir::AsmParser::parseEqual(), mlir::AsmParser::parseKeywordType(), mlir::AsmParser::parseLParen(), parseMemoryAccessAttributes(), mlir::OpAsmParser::parseOperand(), mlir::OpAsmParser::parseOperandList(), mlir::AsmParser::parseOptionalAttrDictWithKeyword(), mlir::AsmParser::parseOptionalKeyword(), mlir::AsmParser::parseOptionalSymbolName(), mlir::OpAsmParser::parseRegion(), mlir::AsmParser::parseRParen(), mlir::AsmParser::parseSymbolName(), mlir::AsmParser::parseType(), parseVariableDecorations(), print(), printMemoryAccessAttribute(), mlir::OpAsmPrinter::printOptionalAttrDict(), mlir::OpAsmPrinter::printOptionalAttrDictWithKeyword(), mlir::OpAsmPrinter::printRegion(), mlir::AsmPrinter::printSymbolName(), printVariableDecorations(), mlir::Region::push_back(), mlir::OpAsmParser::resolveOperand(), mlir::OpAsmParser::resolveOperands(), mlir::succeeded(), mlir::success(), value, mlir::verify(), verifyLoadStorePtrAndValTypes(), verifyMemoryAccessAttribute(), and verifyMemorySemantics().

◆ isDirectInModuleLikeOp()

static bool isDirectInModuleLikeOp ( Operation op)
static

Returns true if the given op is an module-like op that maintains a symbol table.

Definition at line 130 of file SPIRVOps.cpp.

References mlir::Operation::hasTrait().

◆ isMergeBlock()

static bool isMergeBlock ( Block block)
inlinestatic

Returns true if the given block only contains one spv.mlir.merge op.

Definition at line 752 of file SPIRVOps.cpp.

References mlir::Block::begin(), mlir::Block::empty(), mlir::Block::end(), and mlir::Block::front().

Referenced by hasOneBranchOpTo().

◆ isNestedInFunctionOpInterface()

static bool isNestedInFunctionOpInterface ( Operation op)
static

Returns true if the given op is a function-like op or nested in a function-like op without a module-like op in the middle.

Definition at line 118 of file SPIRVOps.cpp.

References mlir::Operation::getParentOp(), and mlir::Operation::hasTrait().

◆ parseAtomicCompareExchangeImpl()

static ParseResult parseAtomicCompareExchangeImpl ( OpAsmParser parser,
OperationState state 
)
static

◆ parseAtomicUpdateOp()

static ParseResult parseAtomicUpdateOp ( OpAsmParser parser,
OperationState state,
bool  hasValue 
)
static

◆ parseControlAttribute()

template<typename EnumAttrClass , typename EnumClass >
static ParseResult parseControlAttribute ( OpAsmParser parser,
OperationState state,
StringRef  attrName = spirv::attributeName<EnumClass>() 
)
static

Parses Function, Selection and Loop control attributes.

If no control is specified, "None" is used as a default.

Definition at line 227 of file SPIRVOps.cpp.

References mlir::OperationState::addAttribute(), mlir::failure(), mlir::Builder::getAttr(), mlir::AsmParser::getBuilder(), kControl, mlir::AsmParser::parseLParen(), mlir::AsmParser::parseOptionalKeyword(), mlir::succeeded(), and mlir::success().

Referenced by hasOneBranchOpTo().

◆ parseEnumKeywordAttr()

template<typename EnumAttrClass , typename EnumClass = typename EnumAttrClass::ValueType>
static ParseResult parseEnumKeywordAttr ( EnumClass &  value,
OpAsmParser parser,
OperationState state,
StringRef  attrName = spirv::attributeName<EnumClass>() 
)
static

Parses the next keyword in parser as an enumerant of the given EnumClass and inserts the enumerant into state as an 32-bit integer attribute with the enum class's name as attribute name.

Definition at line 213 of file SPIRVOps.cpp.

References mlir::OperationState::addAttribute(), mlir::failure(), mlir::Builder::getAttr(), mlir::AsmParser::getBuilder(), mlir::parseEnumKeywordAttr(), mlir::success(), and value.

◆ parseEnumStrAttr() [1/2]

template<typename EnumClass >
static ParseResult parseEnumStrAttr ( EnumClass &  value,
OpAsmParser parser,
StringRef  attrName = spirv::attributeName<EnumClass>() 
)
static

◆ parseEnumStrAttr() [2/2]

template<typename EnumAttrClass , typename EnumClass = typename EnumAttrClass::ValueType>
static ParseResult parseEnumStrAttr ( EnumClass &  value,
OpAsmParser parser,
OperationState state,
StringRef  attrName = spirv::attributeName<EnumClass>() 
)
static

Parses the next string attribute in parser as an enumerant of the given EnumClass and inserts the enumerant into state as an 32-bit integer attribute with the enum class's name as attribute name.

Definition at line 198 of file SPIRVOps.cpp.

References mlir::OperationState::addAttribute(), mlir::failure(), mlir::Builder::getAttr(), mlir::AsmParser::getBuilder(), parseEnumStrAttr(), mlir::success(), and value.

◆ parseGroupNonUniformArithmeticOp()

static ParseResult parseGroupNonUniformArithmeticOp ( OpAsmParser parser,
OperationState state 
)
static

◆ parseImageOperands()

static ParseResult parseImageOperands ( OpAsmParser parser,
spirv::ImageOperandsAttr &  attr 
)
static

◆ parseMemoryAccessAttributes()

static ParseResult parseMemoryAccessAttributes ( OpAsmParser parser,
OperationState state 
)
static

Parses optional memory access attributes attached to a memory access operand/pointer.

Specifically, parses the following syntax: ([ memory-access ])? where: memory-access ::= "None" | "Volatile" | "Aligned", integer-literal | "NonTemporal"

Definition at line 250 of file SPIRVOps.cpp.

References mlir::OperationState::attributes, mlir::failure(), mlir::AsmParser::getBuilder(), mlir::Builder::getIntegerType(), kAlignmentAttrName, kMemoryAccessAttrName, mlir::AsmParser::parseAttribute(), mlir::AsmParser::parseComma(), mlir::AsmParser::parseOptionalLSquare(), mlir::AsmParser::parseRSquare(), and mlir::success().

Referenced by hasOneBranchOpTo(), verifyConstantType(), verifyCoopMatrixMulAdd(), and verifyPointerAndCoopMatrixType().

◆ parseOneResultSameOperandTypeOp()

static ParseResult parseOneResultSameOperandTypeOp ( OpAsmParser parser,
OperationState result 
)
static

◆ parsePtrAccessChainOpImpl()

static ParseResult parsePtrAccessChainOpImpl ( StringRef  opName,
OpAsmParser parser,
OperationState state 
)
static

◆ parseSourceMemoryAccessAttributes()

static ParseResult parseSourceMemoryAccessAttributes ( OpAsmParser parser,
OperationState state 
)
static

◆ parseVariableDecorations()

static ParseResult parseVariableDecorations ( OpAsmParser parser,
OperationState state 
)
static

◆ printAccessChain()

template<typename Op >
static void printAccessChain ( Op  op,
ValueRange  indices,
OpAsmPrinter printer 
)
static

Definition at line 1079 of file SPIRVOps.cpp.

References mlir::ValueRange::getTypes(), and print().

Referenced by concatElemAndIndices().

◆ printAtomicCompareExchangeImpl()

template<typename T >
static void printAtomicCompareExchangeImpl ( atomOp,
OpAsmPrinter printer 
)
static

Definition at line 1137 of file SPIRVOps.cpp.

Referenced by verifyAtomicCompareExchangeImpl().

◆ printAtomicUpdateOp()

static void printAtomicUpdateOp ( Operation op,
OpAsmPrinter printer 
)
static

◆ printGroupNonUniformArithmeticOp()

static void printGroupNonUniformArithmeticOp ( Operation groupOp,
OpAsmPrinter printer 
)
static

◆ printImageOperands()

static void printImageOperands ( OpAsmPrinter printer,
Operation imageOp,
spirv::ImageOperandsAttr  attr 
)
static

Definition at line 380 of file SPIRVOps.cpp.

◆ printMemoryAccessAttribute()

template<typename MemoryOpTy >
static void printMemoryAccessAttribute ( MemoryOpTy  memoryOp,
OpAsmPrinter printer,
SmallVectorImpl< StringRef > &  elidedAttrs,
Optional< spirv::MemoryAccess >  memoryAccessAtrrValue = None,
Optional< uint32_t >  alignmentAttrValue = None 
)
static

◆ printOneResultOp()

static void printOneResultOp ( Operation op,
OpAsmPrinter p 
)
static

◆ printSourceMemoryAccessAttribute()

template<typename MemoryOpTy >
static void printSourceMemoryAccessAttribute ( MemoryOpTy  memoryOp,
OpAsmPrinter printer,
SmallVectorImpl< StringRef > &  elidedAttrs,
Optional< spirv::MemoryAccess >  memoryAccessAtrrValue = None,
Optional< uint32_t >  alignmentAttrValue = None 
)
static

Definition at line 337 of file SPIRVOps.cpp.

References kSourceAlignmentAttrName, and kSourceMemoryAccessAttrName.

Referenced by verifyCoopMatrixMulAdd().

◆ printVariableDecorations()

static void printVariableDecorations ( Operation op,
OpAsmPrinter printer,
SmallVectorImpl< StringRef > &  elidedAttrs 
)
static

◆ stringifyTypeName()

template<typename T >
static StringRef stringifyTypeName ( )
static

Referenced by printAtomicUpdateOp().

◆ stringifyTypeName< FloatType >()

template<>
StringRef stringifyTypeName< FloatType > ( )

Definition at line 813 of file SPIRVOps.cpp.

◆ stringifyTypeName< IntegerType >()

template<>
StringRef stringifyTypeName< IntegerType > ( )

Definition at line 808 of file SPIRVOps.cpp.

◆ verifyAccessChain()

template<typename Op >
static LogicalResult verifyAccessChain ( Op  accessChainOp,
ValueRange  indices 
)
static

◆ verifyAtomicCompareExchangeImpl()

template<typename T >
static LogicalResult verifyAtomicCompareExchangeImpl ( atomOp)
static

Definition at line 1177 of file SPIRVOps.cpp.

References mlir::OperationState::addAttribute(), mlir::OperationState::addOperands(), mlir::OperationState::addSuccessors(), mlir::OperationState::addTypes(), mlir::AsmParser::addTypesToList(), mlir::AsmParser::addTypeToList(), mlir::OperationState::attributes, mlir::Attribute::cast(), mlir::Type::cast(), mlir::Attribute::dyn_cast(), mlir::Type::dyn_cast(), mlir::AsmParser::emitError(), mlir::emitError(), mlir::failure(), mlir::Builder::getArrayAttr(), getBitWidth(), mlir::AsmParser::getBuilder(), mlir::AsmParser::getContext(), mlir::AsmParser::getCurrentLocation(), mlir::Builder::getDenseI32ArrayAttr(), getElementType(), mlir::Builder::getI1Type(), mlir::Builder::getI32ArrayAttr(), mlir::Builder::getIntegerType(), mlir::AsmParser::getNameLoc(), mlir::Value::getType(), mlir::Type::isa(), kBranchWeightAttrName, kIndicesAttrName, kMemoryScopeAttrName, kSemanticsAttrName, kValueAttrName, mlir::OperationState::location, mlir::OperationState::operands, parseAtomicCompareExchangeImpl(), parseAtomicUpdateOp(), mlir::AsmParser::parseAttribute(), mlir::AsmParser::parseColonType(), mlir::AsmParser::parseComma(), mlir::AsmParser::parseKeywordType(), mlir::OpAsmParser::parseOperand(), mlir::OpAsmParser::parseOperandList(), mlir::AsmParser::parseOptionalLSquare(), mlir::AsmParser::parseRSquare(), mlir::OpAsmParser::parseSuccessorAndUseList(), print(), printAtomicCompareExchangeImpl(), printAtomicUpdateOp(), mlir::OpAsmPrinter::printSuccessorAndUseList(), mlir::OpAsmParser::resolveOperand(), mlir::OpAsmParser::resolveOperands(), mlir::succeeded(), mlir::success(), mlir::OperationState::types, value, vectorType(), and mlir::verify().

◆ verifyAtomicUpdateOp()

template<typename ExpectedElementType >
static LogicalResult verifyAtomicUpdateOp ( Operation op)
static

◆ verifyBlockReadWritePtrAndValTypes()

template<typename BlockReadWriteOpTy >
static LogicalResult verifyBlockReadWritePtrAndValTypes ( BlockReadWriteOpTy  op,
Value  ptr,
Value  val 
)
static

Definition at line 586 of file SPIRVOps.cpp.

References mlir::Type::cast(), mlir::Value::getType(), and mlir::success().

Referenced by verifyConstantType().

◆ verifyCastOp()

static LogicalResult verifyCastOp ( Operation op,
bool  requireSameBitWidth = true,
bool  skipBitWidthCheck = false 
)
static

◆ verifyConstantType()

static LogicalResult verifyConstantType ( spirv::ConstantOp  op,
Attribute  value,
Type  opType 
)
static

Definition at line 1826 of file SPIRVOps.cpp.

References mlir::function_interface_impl::addArgAndResultAttrs(), mlir::OperationState::addAttribute(), mlir::OperationState::addRegion(), mlir::OperationState::addTypes(), mlir::WalkResult::advance(), mlir::NamedAttrList::append(), mlir::OperationState::attributes, mlir::Attribute::cast(), mlir::Type::cast(), mlir::OpBuilder::create(), mlir::Attribute::dyn_cast(), mlir::Type::dyn_cast(), mlir::AsmParser::emitError(), mlir::Region::empty(), mlir::failed(), mlir::failure(), mlir::DenseElementsAttr::get(), mlir::spirv::PointerType::get(), mlir::DenseFPElementsAttr::get(), mlir::Builder::getArrayAttr(), mlir::Builder::getAttr(), mlir::Builder::getBoolAttr(), mlir::AsmParser::getBuilder(), mlir::Builder::getContext(), mlir::AsmParser::getCurrentLocation(), mlir::spirv::getDefaultTargetEnv(), mlir::Type::getDialect(), mlir::spirv::ArrayType::getElementType(), mlir::Builder::getFloatAttr(), mlir::function_interface_impl::getFunctionType(), mlir::Builder::getFunctionType(), mlir::Builder::getI32ArrayAttr(), mlir::Builder::getI32IntegerAttr(), mlir::Builder::getIntegerAttr(), mlir::spirv::ArrayType::getNumElements(), mlir::Builder::getStringAttr(), mlir::SymbolTable::getSymbolAttrName(), mlir::Value::getType(), mlir::function_interface_impl::getTypeAttrName(), getZero(), mlir::OptionalParseResult::has_value(), mlir::Attribute::isa(), mlir::Type::isa(), kCallee, kFnNameAttrName, kInitializerAttrName, kInterfaceAttrName, kTypeAttrName, kValuesAttrName, mlir::SymbolTable::lookupNearestSymbolFrom(), mlir::spirv::lookupTargetEnvOrDefault(), None, mlir::OperationState::operands, mlir::AsmParser::parseAttribute(), mlir::AsmParser::parseColon(), mlir::AsmParser::parseColonType(), mlir::AsmParser::parseCommaSeparatedList(), parseEnumStrAttr(), mlir::function_interface_impl::parseFunctionSignature(), parseGroupNonUniformArithmeticOp(), mlir::AsmParser::parseLParen(), parseMemoryAccessAttributes(), parseOneResultSameOperandTypeOp(), mlir::OpAsmParser::parseOperand(), mlir::OpAsmParser::parseOperandList(), mlir::AsmParser::parseOptionalAttrDict(), mlir::AsmParser::parseOptionalAttrDictWithKeyword(), mlir::AsmParser::parseOptionalComma(), mlir::AsmParser::parseOptionalKeyword(), mlir::OpAsmParser::parseOptionalRegion(), mlir::OpAsmParser::parseRegion(), mlir::AsmParser::parseRParen(), mlir::AsmParser::parseSymbolName(), mlir::AsmParser::parseType(), parseVariableDecorations(), print(), mlir::function_interface_impl::printFunctionAttributes(), mlir::function_interface_impl::printFunctionSignature(), printGroupNonUniformArithmeticOp(), printMemoryAccessAttribute(), printOneResultOp(), mlir::OpAsmPrinter::printOperands(), mlir::OpAsmPrinter::printOptionalAttrDict(), mlir::OpAsmPrinter::printRegion(), mlir::AsmPrinter::printSymbolName(), printVariableDecorations(), mlir::OpAsmParser::resolveOperand(), mlir::OpAsmParser::resolveOperands(), mlir::succeeded(), mlir::success(), value, vectorType(), mlir::verify(), verifyBlockReadWritePtrAndValTypes(), verifyCastOp(), verifyGroupNonUniformArithmeticOp(), verifyLoadStorePtrAndValTypes(), verifyMemoryAccessAttribute(), verifyMemorySemantics(), and mlir::detail::walk().

◆ verifyCoopMatrixMulAdd()

static LogicalResult verifyCoopMatrixMulAdd ( spirv::CooperativeMatrixMulAddNVOp  op)
static

Definition at line 3871 of file SPIRVOps.cpp.

References mlir::OperationState::addAttribute(), mlir::OperationState::addRegion(), mlir::OperationState::addTypes(), mlir::OperationState::attributes, mlir::Region::back(), mlir::Block::begin(), mlir::Type::cast(), mlir::OpBuilder::create(), mlir::Type::dyn_cast(), mlir::emitError(), mlir::failed(), mlir::failure(), mlir::Block::front(), mlir::spirv::PointerType::get(), mlir::Builder::getArrayAttr(), mlir::spirv::ImageType::getArrayedInfo(), mlir::AsmParser::getBuilder(), mlir::spirv::CooperativeMatrixNVType::getColumns(), mlir::AsmParser::getContext(), mlir::spirv::ImageType::getDim(), mlir::spirv::StructType::getElementType(), mlir::spirv::CooperativeMatrixNVType::getElementType(), mlir::spirv::MatrixType::getElementType(), mlir::spirv::SampledImageType::getImageType(), mlir::Operation::getLoc(), mlir::spirv::MatrixType::getNumColumns(), mlir::spirv::CompositeType::getNumElements(), mlir::spirv::StructType::getNumElements(), getNumElements(), mlir::spirv::MatrixType::getNumRows(), mlir::Operation::getOperands(), mlir::Block::getOperations(), mlir::Operation::getResult(), mlir::spirv::CooperativeMatrixNVType::getRows(), mlir::spirv::ImageType::getSamplerUseInfo(), mlir::spirv::ImageType::getSamplingInfo(), mlir::spirv::CooperativeMatrixNVType::getScope(), mlir::SymbolTable::getSymbolAttrName(), mlir::Value::getType(), mlir::Operation::hasTrait(), mlir::Type::isa(), kCompositeSpecConstituentsName, kTypeAttrName, mlir::OperationState::location, mlir::SymbolTable::lookupNearestSymbolFrom(), mlir::OperationState::operands, mlir::AsmParser::parseAttribute(), mlir::AsmParser::parseColon(), mlir::AsmParser::parseColonType(), mlir::AsmParser::parseComma(), parseEnumStrAttr(), mlir::OpAsmParser::parseGenericOperation(), mlir::AsmParser::parseKeyword(), mlir::AsmParser::parseLParen(), parseMemoryAccessAttributes(), mlir::OpAsmParser::parseOperand(), mlir::AsmParser::parseOptionalAttrDict(), mlir::AsmParser::parseOptionalComma(), mlir::AsmParser::parseRParen(), parseSourceMemoryAccessAttributes(), mlir::AsmParser::parseSymbolName(), mlir::AsmParser::parseType(), print(), mlir::OpAsmPrinter::printGenericOp(), printMemoryAccessAttribute(), mlir::OpAsmPrinter::printOptionalAttrDict(), printSourceMemoryAccessAttribute(), mlir::AsmPrinter::printSymbolName(), mlir::Region::push_back(), mlir::OpAsmParser::resolveOperand(), mlir::OpBuilder::setInsertionPointToEnd(), mlir::success(), vectorType(), mlir::verify(), verifyImageOperands(), verifyMemoryAccessAttribute(), verifyShiftOp(), and verifySourceMemoryAccessAttribute().

◆ verifyGroupNonUniformArithmeticOp()

static LogicalResult verifyGroupNonUniformArithmeticOp ( Operation groupOp)
static

◆ verifyImageOperands()

template<typename Op >
static LogicalResult verifyImageOperands ( Op  imageOp,
spirv::ImageOperandsAttr  attr,
Operation::operand_range  operands 
)
static

Definition at line 389 of file SPIRVOps.cpp.

References mlir::OpState::emitError(), and mlir::success().

Referenced by verifyCoopMatrixMulAdd().

◆ verifyLoadStorePtrAndValTypes()

template<typename LoadStoreOpTy >
static LogicalResult verifyLoadStorePtrAndValTypes ( LoadStoreOpTy  op,
Value  ptr,
Value  val 
)
static

Definition at line 571 of file SPIRVOps.cpp.

References mlir::Type::cast(), mlir::Value::getType(), and mlir::success().

Referenced by hasOneBranchOpTo(), and verifyConstantType().

◆ verifyMemoryAccessAttribute()

template<typename MemoryOpTy >
static LogicalResult verifyMemoryAccessAttribute ( MemoryOpTy  memoryOp)
static

◆ verifyMemorySemantics()

static LogicalResult verifyMemorySemantics ( Operation op,
spirv::MemorySemantics  memorySemantics 
)
static

◆ verifyPointerAndCoopMatrixType()

static LogicalResult verifyPointerAndCoopMatrixType ( Operation op,
Type  pointer,
Type  coopMatrix 
)
static

◆ verifyShiftOp()

static LogicalResult verifyShiftOp ( Operation op)
static

◆ verifySourceMemoryAccessAttribute()

template<typename MemoryOpTy >
static LogicalResult verifySourceMemoryAccessAttribute ( MemoryOpTy  memoryOp)
static

Variable Documentation

◆ kAlignmentAttrName

constexpr char kAlignmentAttrName[] = "alignment"

◆ kBranchWeightAttrName

constexpr char kBranchWeightAttrName[] = "branch_weights"

Definition at line 43 of file SPIRVOps.cpp.

Referenced by verifyAtomicCompareExchangeImpl().

◆ kCallee

constexpr char kCallee[] = "callee"

Definition at line 44 of file SPIRVOps.cpp.

Referenced by verifyConstantType().

◆ kClusterSize

constexpr char kClusterSize[] = "cluster_size"

◆ kCompositeSpecConstituentsName

constexpr char kCompositeSpecConstituentsName[] = "constituents"

Definition at line 62 of file SPIRVOps.cpp.

Referenced by verifyCoopMatrixMulAdd().

◆ kControl

constexpr char kControl[] = "control"

Definition at line 46 of file SPIRVOps.cpp.

Referenced by parseControlAttribute().

◆ kDefaultValueAttrName

constexpr char kDefaultValueAttrName[] = "default_value"

Definition at line 47 of file SPIRVOps.cpp.

Referenced by hasOneBranchOpTo().

◆ kEqualSemanticsAttrName

constexpr char kEqualSemanticsAttrName[] = "equal_semantics"

Definition at line 49 of file SPIRVOps.cpp.

Referenced by parseAtomicCompareExchangeImpl().

◆ kExecutionScopeAttrName

constexpr char kExecutionScopeAttrName[] = "execution_scope"

◆ kFnNameAttrName

constexpr char kFnNameAttrName[] = "fn"

Definition at line 50 of file SPIRVOps.cpp.

Referenced by verifyConstantType().

◆ kGroupOperationAttrName

constexpr char kGroupOperationAttrName[] = "group_operation"

◆ kIndicesAttrName

constexpr char kIndicesAttrName[] = "indices"

Definition at line 52 of file SPIRVOps.cpp.

Referenced by verifyAtomicCompareExchangeImpl().

◆ kInitializerAttrName

constexpr char kInitializerAttrName[] = "initializer"

Definition at line 53 of file SPIRVOps.cpp.

Referenced by verifyConstantType().

◆ kInterfaceAttrName

constexpr char kInterfaceAttrName[] = "interface"

Definition at line 54 of file SPIRVOps.cpp.

Referenced by verifyConstantType().

◆ kMemoryAccessAttrName

constexpr char kMemoryAccessAttrName[] = "memory_access"

◆ kMemoryScopeAttrName

constexpr char kMemoryScopeAttrName[] = "memory_scope"

◆ kSemanticsAttrName

constexpr char kSemanticsAttrName[] = "semantics"

◆ kSourceAlignmentAttrName

constexpr char kSourceAlignmentAttrName[] = "source_alignment"

◆ kSourceMemoryAccessAttrName

constexpr char kSourceMemoryAccessAttrName[] = "source_memory_access"

◆ kSpecIdAttrName

constexpr char kSpecIdAttrName[] = "spec_id"

Definition at line 57 of file SPIRVOps.cpp.

Referenced by hasOneBranchOpTo().

◆ kTypeAttrName

constexpr char kTypeAttrName[] = "type"

Definition at line 58 of file SPIRVOps.cpp.

Referenced by verifyConstantType(), and verifyCoopMatrixMulAdd().

◆ kUnequalSemanticsAttrName

constexpr char kUnequalSemanticsAttrName[] = "unequal_semantics"

Definition at line 59 of file SPIRVOps.cpp.

Referenced by parseAtomicCompareExchangeImpl().

◆ kValueAttrName

constexpr char kValueAttrName[] = "value"

Definition at line 60 of file SPIRVOps.cpp.

Referenced by verifyAtomicCompareExchangeImpl().

◆ kValuesAttrName

constexpr char kValuesAttrName[] = "values"

Definition at line 61 of file SPIRVOps.cpp.

Referenced by verifyConstantType().