MLIR
20.0.0git
|
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "SPIRVParsingUtils.h"
#include "mlir/Dialect/GPU/IR/CompilationInterfaces.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
#include "mlir/Dialect/SPIRV/IR/TargetAndABI.h"
#include "mlir/Dialect/UB/IR/UBOps.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/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 spirv.Return or spirv.ReturnValue ops. More... | |
template<typename ValTy > | |
static std::optional< ValTy > | parseAndVerify (SPIRVDialect const &dialect, DialectAsmParser &parser) |
template<> | |
std::optional< Type > | parseAndVerify< Type > (SPIRVDialect const &dialect, DialectAsmParser &parser) |
template<> | |
std::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 std::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 (CooperativeMatrixType 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 spirv.Return or spirv.ReturnValue ops.
Definition at line 47 of file SPIRVDialect.cpp.
References mlir::Block::getTerminator().
|
static |
Definition at line 456 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), and mlir::AsmParser::parseKeyword().
std::optional< Type > parseAndVerify< Type > | ( | SPIRVDialect const & | dialect, |
DialectAsmParser & | parser | ||
) |
Definition at line 456 of file SPIRVDialect.cpp.
std::optional< unsigned > parseAndVerify< unsigned > | ( | SPIRVDialect const & | dialect, |
DialectAsmParser & | parser | ||
) |
Definition at line 481 of file SPIRVDialect.cpp.
References max(), and mlir::AsmParser::parseInteger().
Referenced by parseOptionalArrayStride().
|
static |
Definition at line 481 of file SPIRVDialect.cpp.
|
static |
Definition at line 205 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), and mlir::AsmParser::parseType().
Referenced by parseMatrixType().
|
static |
Definition at line 241 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), and mlir::AsmParser::parseType().
Referenced by parseSampledImageType().
|
static |
Definition at line 161 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), mlir::Type::getDialect(), mlir::Type::isBF16(), mlir::spirv::ScalarType::isValid(), and mlir::AsmParser::parseType().
Referenced by parseArrayType(), parseCooperativeMatrixType(), parsePointerType(), and parseRuntimeArrayType().
|
static |
Definition at line 291 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::spirv::ArrayType::get(), mlir::AsmParser::getCurrentLocation(), parseAndVerifyType(), mlir::AsmParser::parseDimensionList(), mlir::AsmParser::parseGreater(), mlir::AsmParser::parseLess(), and parseOptionalArrayStride().
|
static |
Definition at line 330 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::spirv::CooperativeMatrixType::get(), mlir::AsmParser::getCurrentLocation(), parseAndVerifyType(), mlir::AsmParser::parseComma(), mlir::AsmParser::parseDimensionList(), mlir::spirv::parseEnumKeywordAttr(), mlir::AsmParser::parseGreater(), and mlir::AsmParser::parseLess().
|
static |
Definition at line 547 of file SPIRVDialect.cpp.
References mlir::spirv::ImageType::get(), mlir::AsmParser::parseGreater(), and mlir::AsmParser::parseLess().
|
static |
|
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 261 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), parseAndVerify< unsigned >(), mlir::AsmParser::parseEqual(), mlir::AsmParser::parseKeyword(), and mlir::AsmParser::parseOptionalComma().
Referenced by parseArrayType(), and parseRuntimeArrayType().
|
static |
Definition at line 374 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().
|
static |
Definition at line 401 of file SPIRVDialect.cpp.
References mlir::spirv::RuntimeArrayType::get(), parseAndVerifyType(), mlir::AsmParser::parseGreater(), mlir::AsmParser::parseLess(), and parseOptionalArrayStride().
|
static |
Definition at line 565 of file SPIRVDialect.cpp.
References mlir::spirv::SampledImageType::get(), parseAndVerifySampledImageType(), mlir::AsmParser::parseGreater(), and mlir::AsmParser::parseLess().
|
static |
Definition at line 580 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), mlir::OptionalParseResult::has_value(), mlir::AsmParser::parseComma(), mlir::AsmParser::parseCommaSeparatedList(), mlir::AsmParser::parseOptionalEqual(), mlir::AsmParser::parseOptionalInteger(), mlir::AsmParser::parseOptionalRSquare(), and mlir::AsmParser::parseRSquare().
Referenced by parseStructType().
|
static |
Definition at line 647 of file SPIRVDialect.cpp.
References mlir::AsmParser::emitError(), mlir::spirv::StructType::get(), mlir::spirv::StructType::getEmpty(), mlir::spirv::StructType::getIdentified(), mlir::AsmParser::getNameLoc(), mlir::AsmParser::parseComma(), mlir::AsmParser::parseGreater(), mlir::AsmParser::parseLess(), mlir::AsmParser::parseLParen(), mlir::AsmParser::parseOptionalComma(), mlir::AsmParser::parseOptionalGreater(), mlir::AsmParser::parseOptionalKeyword(), mlir::AsmParser::parseOptionalLSquare(), mlir::AsmParser::parseOptionalRParen(), mlir::AsmParser::parseRParen(), parseStructMemberDecorations(), mlir::AsmParser::parseType(), mlir::spirv::StructType::trySetBody(), and mlir::AsmParser::tryStartCyclicParse().
|
static |
Definition at line 769 of file SPIRVDialect.cpp.
References mlir::spirv::ArrayType::getArrayStride(), mlir::spirv::ArrayType::getElementType(), and mlir::spirv::ArrayType::getNumElements().
|
static |
Definition at line 846 of file SPIRVDialect.cpp.
References mlir::spirv::CooperativeMatrixType::getColumns(), mlir::spirv::CooperativeMatrixType::getElementType(), mlir::spirv::CooperativeMatrixType::getRows(), mlir::spirv::CooperativeMatrixType::getScope(), and mlir::spirv::CooperativeMatrixType::getUse().
|
static |
Definition at line 788 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 852 of file SPIRVDialect.cpp.
References mlir::spirv::MatrixType::getColumnType(), and mlir::spirv::MatrixType::getNumColumns().
|
static |
Definition at line 783 of file SPIRVDialect.cpp.
References mlir::spirv::PointerType::getPointeeType(), and mlir::spirv::PointerType::getStorageClass().
|
static |
Definition at line 776 of file SPIRVDialect.cpp.
References mlir::spirv::RuntimeArrayType::getArrayStride(), and mlir::spirv::RuntimeArrayType::getElementType().
|
static |
Definition at line 797 of file SPIRVDialect.cpp.
References mlir::spirv::SampledImageType::getImageType().
|
static |
Definition at line 801 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(), mlir::spirv::StructType::isIdentified(), and mlir::AsmPrinter::tryStartCyclicPrint().
|
static |
Verifies the given SPIR-V attribute
attached to a value of the given valueType
is valid.
Definition at line 908 of file SPIRVDialect.cpp.
References mlir::emitError(), mlir::spirv::getInterfaceVarABIAttrName(), mlir::NamedAttribute::getName(), mlir::NamedAttribute::getValue(), and mlir::Type::isIntOrIndexOrFloat().