MLIR  16.0.0git
Public Member Functions | List of all members
mlir::spirv::Deserializer Class Reference

A SPIR-V module serializer. More...

#include "Target/SPIRV/Deserialization/Deserializer.h"

Public Member Functions

 Deserializer (ArrayRef< uint32_t > binary, MLIRContext *context)
 Creates a deserializer for the given SPIR-V binary module. More...
 
LogicalResult deserialize ()
 Deserializes the remembered SPIR-V binary module. More...
 
OwningOpRef< spirv::ModuleOp > collect ()
 Collects the final SPIR-V ModuleOp. More...
 

Detailed Description

A SPIR-V module serializer.

A SPIR-V binary module is a single linear stream of instructions; each instruction is composed of 32-bit words. The first word of an instruction records the total number of words of that instruction using the 16 higher-order bits. So this deserializer uses that to get instruction boundary and parse instructions and build a SPIR-V ModuleOp gradually.

Definition at line 119 of file Deserializer.h.

Constructor & Destructor Documentation

◆ Deserializer()

spirv::Deserializer::Deserializer ( ArrayRef< uint32_t >  binary,
MLIRContext context 
)
explicit

Creates a deserializer for the given SPIR-V binary module.

The SPIR-V ModuleOp will be created into `context.

Definition at line 51 of file Deserializer.cpp.

Member Function Documentation

◆ collect()

OwningOpRef< spirv::ModuleOp > spirv::Deserializer::collect ( )

Collects the final SPIR-V ModuleOp.

Definition at line 101 of file Deserializer.cpp.

References mlir::Region::back(), mlir::Block::back(), mlir::Block::begin(), mlir::Type::cast(), mlir::Operation::clone(), mlir::spirv::BlockMergeInfo::continueBlock, mlir::spirv::BlockMergeInfo::control, mlir::Operation::create(), mlir::OpBuilder::create(), mlir::OpBuilder::createBlock(), mlir::debugString(), mlir::spirv::decodeStringLiteral(), mlir::Type::dyn_cast(), mlir::emitError(), mlir::Operation::emitOpError(), mlir::Operation::erase(), mlir::Block::erase(), mlir::failed(), mlir::failure(), mlir::Block::front(), mlir::spirv::VerCapExtAttr::get(), mlir::DenseElementsAttr::get(), mlir::spirv::ArrayType::get(), mlir::spirv::ImageType::get(), mlir::spirv::PointerType::get(), mlir::spirv::RuntimeArrayType::get(), mlir::spirv::SampledImageType::get(), mlir::spirv::StructType::get(), mlir::spirv::CooperativeMatrixNVType::get(), mlir::spirv::MatrixType::get(), mlir::Builder::getAttr(), mlir::Operation::getBlockOperands(), mlir::Region::getBlocks(), mlir::spirv::StructType::getEmpty(), mlir::Builder::getF16Type(), mlir::Builder::getF32Type(), mlir::Builder::getF64Type(), mlir::Builder::getI1Type(), mlir::Builder::getI32IntegerAttr(), mlir::spirv::StructType::getIdentified(), mlir::Builder::getNoneType(), mlir::Operation::getOpOperands(), mlir::Block::getParentOp(), mlir::Operation::getRegion(), mlir::Operation::getResult(), mlir::Builder::getStringAttr(), mlir::Block::getTerminator(), mlir::Builder::getUnitAttr(), mlir::Type::isa(), isFnEntryBlock(), mlir::Type::isIntOrFloat(), mlir::spirv::kHeaderWordCount, mlir::spirv::kMagicNumber, mlir::spirv::BlockMergeInfo::loc, mlir::BlockAndValueMapping::lookupOrNull(), mlir::BlockAndValueMapping::map(), mlir::spirv::BlockMergeInfo::mergeBlock, MIN_VERSION_CASE, mlir::Operation::print(), mlir::Block::print(), mlir::Block::push_back(), mlir::Operation::setAttr(), mlir::OpBuilder::setInsertionPointToEnd(), mlir::quant::QuantizationFlags::Signed, mlir::Block::splitBlock(), mlir::succeeded(), mlir::success(), mlir::Operation::use_empty(), value, and vectorType().

Referenced by mlir::spirv::deserialize().

◆ deserialize()

LogicalResult spirv::Deserializer::deserialize ( )

Deserializes the remembered SPIR-V binary module.

Definition at line 62 of file Deserializer.cpp.

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

Referenced by mlir::spirv::deserialize().


The documentation for this class was generated from the following files: