MLIR
15.0.0git
|
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/ParserUtils.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.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/DialectImplementation.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/Parser/Parser.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/raw_ostream.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOpsDialect.cpp.inc"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.cpp.inc"
Go to the source code of this file.
Macros | |
#define | GET_OP_LIST |
Functions | |
static bool | containsReturn (Region ®ion) |
Returns true if the given region contains spv.Return or spv.ReturnValue ops. More... | |
template<typename ValTy > | |
static Optional< ValTy > | parseAndVerify (SPIRVDialect const &dialect, DialectAsmParser &parser) |
template<> | |
Optional< Type > | parseAndVerify< Type > (SPIRVDialect const &dialect, DialectAsmParser &parser) |
template<> | |
Optional< unsigned > | parseAndVerify< unsigned > (SPIRVDialect const &dialect, DialectAsmParser &parser) |
static Type | parseAndVerifyType (SPIRVDialect const &dialect, DialectAsmParser &parser) |
static Type | parseAndVerifyMatrixType (SPIRVDialect const &dialect, DialectAsmParser &parser) |
static Type | parseAndVerifySampledImageType (SPIRVDialect const &dialect, DialectAsmParser &parser) |
static LogicalResult | parseOptionalArrayStride (const SPIRVDialect &dialect, DialectAsmParser &parser, unsigned &stride) |
Parses an optional , stride = N assembly segment. More... | |
static Type | parseArrayType (SPIRVDialect const &dialect, DialectAsmParser &parser) |
static Type | parseCooperativeMatrixType (SPIRVDialect const &dialect, DialectAsmParser &parser) |
static Type | parsePointerType (SPIRVDialect const &dialect, DialectAsmParser &parser) |
static Type | parseRuntimeArrayType (SPIRVDialect const &dialect, DialectAsmParser &parser) |
static Type | parseMatrixType (SPIRVDialect const &dialect, DialectAsmParser &parser) |
template<typename IntTy > | |
static Optional< IntTy > | parseAndVerifyInteger (SPIRVDialect const &dialect, DialectAsmParser &parser) |
static Type | parseImageType (SPIRVDialect const &dialect, DialectAsmParser &parser) |
static Type | parseSampledImageType (SPIRVDialect const &dialect, DialectAsmParser &parser) |
static ParseResult | parseStructMemberDecorations (SPIRVDialect const &dialect, DialectAsmParser &parser, ArrayRef< Type > memberTypes, SmallVectorImpl< StructType::OffsetInfo > &offsetInfo, SmallVectorImpl< StructType::MemberDecorationInfo > &memberDecorationInfo) |
static Type | parseStructType (SPIRVDialect const &dialect, DialectAsmParser &parser) |
static void | print (ArrayType type, DialectAsmPrinter &os) |
static void | print (RuntimeArrayType type, DialectAsmPrinter &os) |
static void | print (PointerType type, DialectAsmPrinter &os) |
static void | print (ImageType type, DialectAsmPrinter &os) |
static void | print (SampledImageType type, DialectAsmPrinter &os) |
static void | print (StructType type, DialectAsmPrinter &os) |
static void | print (CooperativeMatrixNVType type, DialectAsmPrinter &os) |
static void | print (MatrixType type, DialectAsmPrinter &os) |
static LogicalResult | verifyRegionAttribute (Location loc, Type valueType, NamedAttribute attribute) |
Verifies the given SPIR-V attribute attached to a value of the given valueType is valid. More... | |
#define GET_OP_LIST |
|
inlinestatic |
Returns true if the given region contains spv.Return or spv.ReturnValue ops.
Definition at line 43 of file SPIRVDialect.cpp.
References mlir::OpBuilder::create(), mlir::DialectInlinerInterface::DialectInlinerInterface(), mlir::Operation::erase(), mlir::Operation::getLoc(), mlir::Region::getParentOp(), mlir::Operation::getRegion(), mlir::Block::getTerminator(), isLegalToInline(), parseAndVerify(), parseAndVerify< Type >(), and parseAndVerify< unsigned >().
|
static |
Definition at line 442 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), and mlir::AsmParser::parseKeyword().
Referenced by containsReturn().
Optional< Type > parseAndVerify< Type > | ( | SPIRVDialect const & | dialect, |
DialectAsmParser & | parser | ||
) |
Definition at line 457 of file SPIRVDialect.cpp.
References parseAndVerifyType().
Referenced by containsReturn().
Optional< unsigned > parseAndVerify< unsigned > | ( | SPIRVDialect const & | dialect, |
DialectAsmParser & | parser | ||
) |
Definition at line 476 of file SPIRVDialect.cpp.
References mlir::failed(), mlir::AsmParser::parseComma(), and value.
Referenced by containsReturn(), and parseOptionalArrayStride().
|
static |
Definition at line 467 of file SPIRVDialect.cpp.
References max(), and mlir::AsmParser::parseInteger().
|
static |
Definition at line 199 of file SPIRVDialect.cpp.
References mlir::Type::dyn_cast(), mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), and mlir::AsmParser::parseType().
Referenced by parseMatrixType().
|
static |
Definition at line 235 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), mlir::Type::isa(), and mlir::AsmParser::parseType().
Referenced by parseSampledImageType().
|
static |
Definition at line 155 of file SPIRVDialect.cpp.
References mlir::Type::dyn_cast(), mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), mlir::Type::getDialect(), mlir::Type::isBF16(), mlir::spirv::ScalarType::isValid(), and mlir::AsmParser::parseType().
Referenced by parseAndVerify< Type >(), parseArrayType(), parseCooperativeMatrixType(), parsePointerType(), and parseRuntimeArrayType().
|
static |
Definition at line 285 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::failed(), mlir::spirv::ArrayType::get(), mlir::AsmParser::getCurrentLocation(), parseAndVerifyType(), mlir::AsmParser::parseDimensionList(), mlir::AsmParser::parseGreater(), mlir::AsmParser::parseLess(), and parseOptionalArrayStride().
Referenced by parseStructType().
|
static |
Definition at line 323 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::spirv::CooperativeMatrixNVType::get(), mlir::AsmParser::getCurrentLocation(), parseAndVerifyType(), mlir::AsmParser::parseComma(), mlir::AsmParser::parseDimensionList(), mlir::parseEnumKeywordAttr(), mlir::AsmParser::parseGreater(), and mlir::AsmParser::parseLess().
Referenced by parseStructType().
|
static |
Definition at line 531 of file SPIRVDialect.cpp.
References mlir::spirv::ImageType::get(), mlir::AsmParser::parseGreater(), mlir::AsmParser::parseLess(), and value.
Referenced by parseStructType().
|
static |
Definition at line 406 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::spirv::MatrixType::get(), mlir::AsmParser::getCurrentLocation(), parseAndVerifyMatrixType(), mlir::AsmParser::parseDimensionList(), mlir::AsmParser::parseGreater(), and mlir::AsmParser::parseLess().
Referenced by parseStructType().
|
static |
Parses an optional , stride = N
assembly segment.
If no parsing failure occurs, writes N
to stride
if existing and writes 0 to stride
if missing.
Definition at line 255 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::failed(), mlir::failure(), mlir::AsmParser::getCurrentLocation(), parseAndVerify< unsigned >(), mlir::AsmParser::parseEqual(), mlir::AsmParser::parseKeyword(), mlir::AsmParser::parseOptionalComma(), and mlir::success().
Referenced by parseArrayType(), and parseRuntimeArrayType().
|
static |
Definition at line 360 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::spirv::PointerType::get(), mlir::AsmParser::getCurrentLocation(), parseAndVerifyType(), mlir::AsmParser::parseComma(), mlir::AsmParser::parseGreater(), mlir::AsmParser::parseKeyword(), and mlir::AsmParser::parseLess().
Referenced by parseStructType().
|
static |
Definition at line 387 of file SPIRVDialect.cpp.
References mlir::failed(), mlir::spirv::RuntimeArrayType::get(), parseAndVerifyType(), mlir::AsmParser::parseGreater(), mlir::AsmParser::parseLess(), and parseOptionalArrayStride().
Referenced by parseStructType().
|
static |
Definition at line 549 of file SPIRVDialect.cpp.
References mlir::spirv::SampledImageType::get(), parseAndVerifySampledImageType(), mlir::AsmParser::parseGreater(), and mlir::AsmParser::parseLess().
Referenced by parseStructType().
|
static |
Definition at line 564 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::failed(), mlir::failure(), mlir::AsmParser::getCurrentLocation(), mlir::OptionalParseResult::hasValue(), mlir::AsmParser::parseComma(), mlir::AsmParser::parseCommaSeparatedList(), mlir::AsmParser::parseOptionalEqual(), mlir::AsmParser::parseOptionalInteger(), mlir::AsmParser::parseOptionalRSquare(), mlir::AsmParser::parseRSquare(), mlir::succeeded(), and mlir::success().
Referenced by parseStructType().
|
static |
Definition at line 631 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::failed(), mlir::spirv::StructType::get(), mlir::spirv::StructType::getEmpty(), mlir::spirv::StructType::getIdentified(), mlir::AsmParser::getNameLoc(), parseArrayType(), mlir::AsmParser::parseComma(), parseCooperativeMatrixType(), mlir::AsmParser::parseGreater(), parseImageType(), mlir::AsmParser::parseKeyword(), mlir::AsmParser::parseLess(), mlir::AsmParser::parseLParen(), parseMatrixType(), mlir::AsmParser::parseOptionalComma(), mlir::AsmParser::parseOptionalGreater(), mlir::AsmParser::parseOptionalKeyword(), mlir::AsmParser::parseOptionalLSquare(), mlir::AsmParser::parseOptionalRParen(), parsePointerType(), mlir::AsmParser::parseRParen(), parseRuntimeArrayType(), parseSampledImageType(), parseStructMemberDecorations(), mlir::LLVM::detail::parseType(), mlir::AsmParser::parseType(), and mlir::succeeded().
|
static |
Definition at line 774 of file SPIRVDialect.cpp.
References mlir::spirv::ArrayType::getArrayStride(), mlir::spirv::ArrayType::getElementType(), and mlir::spirv::ArrayType::getNumElements().
Referenced by print().
|
static |
Definition at line 781 of file SPIRVDialect.cpp.
References mlir::spirv::RuntimeArrayType::getArrayStride(), and mlir::spirv::RuntimeArrayType::getElementType().
|
static |
Definition at line 788 of file SPIRVDialect.cpp.
References mlir::spirv::PointerType::getPointeeType(), and mlir::spirv::PointerType::getStorageClass().
|
static |
Definition at line 793 of file SPIRVDialect.cpp.
References mlir::spirv::ImageType::getArrayedInfo(), mlir::spirv::ImageType::getDepthInfo(), mlir::spirv::ImageType::getDim(), mlir::spirv::ImageType::getElementType(), mlir::spirv::ImageType::getImageFormat(), mlir::spirv::ImageType::getSamplerUseInfo(), and mlir::spirv::ImageType::getSamplingInfo().
|
static |
Definition at line 802 of file SPIRVDialect.cpp.
References mlir::spirv::SampledImageType::getImageType().
|
static |
Definition at line 806 of file SPIRVDialect.cpp.
References mlir::spirv::StructType::getElementType(), mlir::spirv::StructType::getIdentifier(), mlir::spirv::StructType::getMemberDecorations(), mlir::spirv::StructType::getMemberOffset(), mlir::spirv::StructType::getNumElements(), mlir::spirv::StructType::hasOffset(), and mlir::spirv::StructType::isIdentified().
|
static |
|
static |
Definition at line 860 of file SPIRVDialect.cpp.
References mlir::OpBuilder::create(), mlir::Operation::emitError(), mlir::spirv::MatrixType::getColumnType(), mlir::spirv::getEntryPointABIAttrName(), mlir::NamedAttribute::getName(), mlir::spirv::MatrixType::getNumColumns(), mlir::spirv::getTargetEnvAttrName(), mlir::NamedAttribute::getValue(), mlir::Attribute::isa(), materializeConstant(), print(), mlir::LLVM::detail::printType(), mlir::success(), and value.
|
static |
Verifies the given SPIR-V attribute
attached to a value of the given valueType
is valid.
Definition at line 913 of file SPIRVDialect.cpp.
References mlir::Attribute::dyn_cast(), mlir::emitError(), mlir::Operation::emitError(), mlir::Region::getArgument(), mlir::spirv::getInterfaceVarABIAttrName(), mlir::Operation::getLoc(), mlir::NamedAttribute::getName(), mlir::Operation::getRegion(), mlir::Value::getType(), mlir::NamedAttribute::getValue(), mlir::Type::isIntOrIndexOrFloat(), and mlir::success().