My Project
Namespaces | Classes | Functions | Variables
mlir::spirv Namespace Reference

Namespaces

 detail
 
 TypeKind
 

Classes

class  ArrayType
 
class  CompositeType
 
class  ImageType
 
class  PointerType
 
class  RuntimeArrayType
 
class  SPIRVDialect
 
class  StructType
 

Functions

std::unique_ptr< OpPassBase< mlir::ModuleOp > > createDecorateSPIRVCompositeTypeLayoutPass ()
 
std::unique_ptr< OpPassBase< spirv::ModuleOp > > createLowerABIAttributesPass ()
 
LogicalResult serialize (ModuleOp module, SmallVectorImpl< uint32_t > &binary)
 
Optional< ModuleOpdeserialize (ArrayRef< uint32_t > binary, MLIRContext *context)
 
void appendModuleHeader (SmallVectorImpl< uint32_t > &header, uint32_t idBound)
 Appends a SPRI-V module header to header with the given idBound. More...
 
uint32_t getPrefixedOpcode (uint32_t wordCount, spirv::Opcode opcode)
 Returns the word-count-prefixed opcode for an SPIR-V instruction. More...
 
LogicalResult encodeStringLiteralInto (SmallVectorImpl< uint32_t > &binary, StringRef literal)
 Encodes an SPIR-V literal string into the given binary vector. More...
 
enum BuiltIn uint32_t Value getBuiltinVariableValue (Operation *op, BuiltIn builtin, OpBuilder &builder)
 
LogicalResult setABIAttrs (FuncOp funcOp, EntryPointABIAttr entryPointInfo, ArrayRef< InterfaceVarABIAttr > argABIInfo)
 
enum StorageClass uint32_t StringRef getInterfaceVarABIAttrName ()
 Attribute name for specifying argument ABI information. More...
 
InterfaceVarABIAttr getInterfaceVarABIAttr (unsigned descriptorSet, unsigned binding, StorageClass storageClass, MLIRContext *context)
 Get the InterfaceVarABIAttr given its fields. More...
 
StringRef getEntryPointABIAttrName ()
 Attribute name for specifying entry point information. More...
 
EntryPointABIAttr getEntryPointABIAttr (ArrayRef< int32_t > localSize, MLIRContext *context)
 Get the EntryPointABIAttr given its fields. More...
 

Variables

constexpr unsigned kHeaderWordCount = 5
 SPIR-V binary header word count. More...
 
constexpr uint32_t kMagicNumber = 0x07230203
 SPIR-V magic number. More...
 
constexpr uint32_t kGeneratorNumber = 22
 The serializer tool ID registered to the Khronos Group. More...
 

Function Documentation

◆ appendModuleHeader()

void mlir::spirv::appendModuleHeader ( SmallVectorImpl< uint32_t > &  header,
uint32_t  idBound 
)

Appends a SPRI-V module header to header with the given idBound.

◆ createDecorateSPIRVCompositeTypeLayoutPass()

std::unique_ptr< OpPassBase< ModuleOp > > mlir::spirv::createDecorateSPIRVCompositeTypeLayoutPass ( )

Creates a module pass that converts composite types used by objects in the StorageBuffer, PhysicalStorageBuffer, Uniform, and PushConstant storage classes with layout information. Right now this pass only supports Vulkan layout rules.

◆ createLowerABIAttributesPass()

std::unique_ptr< OpPassBase< spirv::ModuleOp > > mlir::spirv::createLowerABIAttributesPass ( )

Creates a module pass that lowers the ABI attributes specified during SPIR-V Lowering. Specifically, 1) Creates the global variables for arguments of entry point function using the specification in the ABI attributes for each argument. 2) Inserts the EntryPointOp and the ExecutionModeOp for entry point functions using the specification in the EntryPointAttr.

◆ deserialize()

Optional< spirv::ModuleOp > mlir::spirv::deserialize ( ArrayRef< uint32_t >  binary,
MLIRContext context 
)

Deserializes the given SPIR-V binary module and creates a MLIR ModuleOp in the given context. Returns the ModuleOp on success; otherwise, reports errors to the error handler registered with context and returns llvm::None.

◆ encodeStringLiteralInto()

LogicalResult mlir::spirv::encodeStringLiteralInto ( SmallVectorImpl< uint32_t > &  binary,
StringRef  literal 
)

Encodes an SPIR-V literal string into the given binary vector.

◆ getBuiltinVariableValue()

enum BuiltIn uint32_t Value mlir::spirv::getBuiltinVariableValue ( Operation op,
BuiltIn  builtin,
OpBuilder builder 
)
strong

Returns a value that represents a builtin variable value within the SPIR-V module.

◆ getEntryPointABIAttr()

mlir::spirv::EntryPointABIAttr mlir::spirv::getEntryPointABIAttr ( ArrayRef< int32_t >  localSize,
MLIRContext context 
)

Get the EntryPointABIAttr given its fields.

◆ getEntryPointABIAttrName()

StringRef mlir::spirv::getEntryPointABIAttrName ( )

Attribute name for specifying entry point information.

◆ getInterfaceVarABIAttr()

InterfaceVarABIAttr mlir::spirv::getInterfaceVarABIAttr ( unsigned  descriptorSet,
unsigned  binding,
StorageClass  storageClass,
MLIRContext context 
)

Get the InterfaceVarABIAttr given its fields.

◆ getInterfaceVarABIAttrName()

StringRef mlir::spirv::getInterfaceVarABIAttrName ( )
strong

Attribute name for specifying argument ABI information.

◆ getPrefixedOpcode()

uint32_t mlir::spirv::getPrefixedOpcode ( uint32_t  wordCount,
spirv::Opcode  opcode 
)

Returns the word-count-prefixed opcode for an SPIR-V instruction.

◆ serialize()

LogicalResult mlir::spirv::serialize ( ModuleOp  module,
SmallVectorImpl< uint32_t > &  binary 
)

Serializes the given SPIR-V module and writes to binary. On failure, reports errors to the error handler registered with the MLIR context for module.

◆ setABIAttrs()

LogicalResult mlir::spirv::setABIAttrs ( FuncOp  funcOp,
EntryPointABIAttr  entryPointInfo,
ArrayRef< InterfaceVarABIAttr >  argABIInfo 
)

Sets the InterfaceVarABIAttr and EntryPointABIAttr for a function and its arguments.

Variable Documentation

◆ kGeneratorNumber

constexpr uint32_t mlir::spirv::kGeneratorNumber = 22

The serializer tool ID registered to the Khronos Group.

◆ kHeaderWordCount

constexpr unsigned mlir::spirv::kHeaderWordCount = 5

SPIR-V binary header word count.

◆ kMagicNumber

constexpr uint32_t mlir::spirv::kMagicNumber = 0x07230203

SPIR-V magic number.