Expand description
§
SPIR-🇹⋯🢒 🇹arget 🠆 🇹ransform 🠆 🇹ranslate ⋯🢒
SPIR-🇹 is a research project aimed at exploring shader-oriented IR designs derived from SPIR-V, and producing a framework around such an IR to facilitate advanced compilation pipelines, beyond what existing SPIR-V tooling allows for.
🚧 This project is in active design and development, many details can and will change 🚧
—
spirt @ 0.4.0-36-ge8757ad’sREADME
(click through for the full version)
Check out also the rust-gpu/spirt GitHub repository,
for any additional developments.
§Notable types/modules
§IR data types
Context: handles interning (Types,Consts, etc.) and allocating entity handlesModule: ownsFuncs andGlobalVars (rooted byexports)FuncDefBody: ownsRegions andDataInsts (rooted bybody)
§Utilities and passes
print: pretty-printer with (styled and hyperlinked) HTML outputspv::lower/spv::lift: conversion from/to SPIR-Vcfg::Structurizer: (re)structurization from arbitrary control-flow
Modules§
- cfg
- Control-flow graph (CFG) abstractions and utilities.
- cfgssa
- Tools for working with control-flow graphs that contain SSA dataflow
(often abbreviated to
CFG<SSA>or similar). - context 🔒
Contextand related types/traits.- func_at
- Traversal helpers for intra-function entities.
- passes
- IR transformations (typically whole-
Module). - Pretty-printing anything in the IR, from whole
Modules to their leaves. - qptr
QPtr-related type definitions and passes.- spv
- SPIR-V support, mainly conversions to/from SPIR-T (
lower/lift). - transform
- Mutable IR traversal.
- visit
- Immutable IR traversal.
Structs§
- AttrSet
- Interned handle for an
AttrSetDef(a set ofAttrs). - Attr
SetDef - Definition for an
AttrSet: a set ofAttrs. - Const
- Interned handle for a
ConstDef(a constant value). - Const
Def - Definition for a
Const: a constant value. - Context
- Context object with global resources for SPIR-T.
- Data
Inst - Entity handle for a
DataInstDef(a leaf instruction). - Data
Inst Def - Definition for a
DataInst: a leaf (non-control-flow) instruction. - DbgSrc
Loc - Simple
file:line:column-style debuginfo, similar to SPIR-VOpLine, but also supporting(line, column)ranges, and inlined locations. - Diag
- Diagnostics produced by SPIR-T passes, and recorded in
Attr::Diagnostics. - Entity
Defs - Collection holding the actual definitions for
Context-allocated entities. - Entity
List - Doubly-linked list, “intrusively” going through
E::Def, which must be anEntityListNode<E, _>(to hold the “previous/next node” links). - Entity
List Iter EntityList<E>iterator, but with a different API thanIterator.- Entity
Oriented Dense Map - Map with
Kkeys andVvalues, that is: - Func
- Entity handle for a
FuncDecl(a function). - Func
Decl - Declaration/definition for a
Func: a function. - Func
DefBody - The body of a
Funcdefinition. - Func
Param - Global
Var - Entity handle for a
GlobalVarDecl(a global variable). - Global
VarDecl - Declaration/definition for a
GlobalVar: a global variable. - Global
VarDef Body - The body of a
GlobalVardefinition. - Interned
Str - Interned handle for a
str. - Module
- Node
- Entity handle for a
NodeDef(a control-flow operator or leaf). - NodeDef
- Definition for a
Node: a control-flow operator or leaf. - Node
Output Decl - OrdAssert
Eq - Wrapper to limit
Ordfor interned index types (e.g.InternedStr) to only situations where the interned index reflects contents (i.e. equality). - Region
- Entity handle for a
RegionDef(a control-flow region). - Region
Def - Definition for a
Region: a control-flow region. - Region
Input Decl - Type
- Interned handle for a
TypeDef. - TypeDef
- Definition for a
Type.
Enums§
- Addr
Space - Attr
- Any semantic or non-semantic (debuginfo) decoration/modifier, that can be optionally applied to some declaration/definition.
- Const
Kind - Data
Inst Kind - DeclDef
- Declarations (
GlobalVarDecl,FuncDecl) can contain a full definition, or only be an import of a definition (e.g. from another module). - Diag
Level - The “severity” level of a
Diagnostic. - Diag
MsgPart - One part of a
Diagnostic message, allowing rich interpolation. - Export
Key - An unique identifier (e.g. a link name, or “symbol”) for a module export.
- Exportee
- A definition exported out of a module (see also
ExportKey). - Import
- An identifier (e.g. a link name, or “symbol”) for an import declaration.
- Module
Debug Info - Non-semantic details (i.e. debuginfo) of a SPIR-Y module (not tied to any declarations/definitions).
- Module
Dialect - Semantic properties of a SPIR-T module (not tied to any declarations/definitions).
- Node
Kind - Selection
Kind - Type
Kind - Type
OrConst - Value
Traits§
- Entity
Oriented MapKey EntityOriented*Map<Self, V>support trait, implemented for entity types, but which can also be implemented by users for their own newtypes and other types wrapping entity types (such as finiteenums).