MLIR
20.0.0git
|
A SPIR-V module serializer. More...
#include "Target/SPIRV/Serialization/Serializer.h"
Public Member Functions | |
Serializer (spirv::ModuleOp module, const SerializationOptions &options) | |
Creates a serializer for the given SPIR-V module . More... | |
LogicalResult | serialize () |
Serializes the remembered SPIR-V module. More... | |
void | collect (SmallVectorImpl< uint32_t > &binary) |
Collects the final SPIR-V binary . More... | |
void | printValueIDMap (raw_ostream &os) |
(For debugging) prints each value and its corresponding result <id>. More... | |
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 with the layout:
| <word-count>|<opcode> | <operand> | <operand> | ... | | <---— word ----—> | <– word --> | <– word --> | ... |
For the first word, the 16 high-order bits are the word count of the instruction, the 16 low-order bits are the opcode enumerant. The instructions then belong to different sections, which must be laid out in the particular order as specified in "2.4 Logical Layout of a Module" of the SPIR-V spec.
Definition at line 42 of file Serializer.h.
|
explicit |
Creates a serializer for the given SPIR-V module
.
Definition at line 85 of file Serializer.cpp.
void mlir::spirv::Serializer::collect | ( | SmallVectorImpl< uint32_t > & | binary | ) |
Collects the final SPIR-V binary
.
Definition at line 113 of file Serializer.cpp.
References mlir::spirv::appendModuleHeader(), and mlir::spirv::kHeaderWordCount.
void mlir::spirv::Serializer::printValueIDMap | ( | raw_ostream & | os | ) |
(For debugging) prints each value and its corresponding result <id>.
Definition at line 139 of file Serializer.cpp.
References mlir::Value::getDefiningOp(), mlir::Operation::getName(), and mlir::Block::getParentOp().
LogicalResult mlir::spirv::Serializer::serialize | ( | ) |
Serializes the remembered SPIR-V module.
Definition at line 89 of file Serializer.cpp.