Crate spirt

source ·
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.1.0’s README
    (click through for the full version)

Check out also the EmbarkStudios/spirt GitHub repository, for any additional developments.

Notable types/modules
IR data types
Utilities and passes

Modules

Control-flow graph (CFG) abstractions and utilities.
context 🔒
Context and related types/traits.
Traversal helpers for intra-function entities.
IR transformations (typically whole-Module).
Pretty-printing anything in the IR, from whole Modules to their leaves.
SPIR-V support, mainly conversions to/from SPIR-T (lower/lift).
Mutable IR traversal.
Immutable IR traversal.

Structs

Interned handle for an AttrSetDef (a set of Attrs).
Definition for an AttrSet: a set of Attrs.
Interned handle for a ConstDef (a constant value).
Definition for a Const: a constant value.
Context object with global resources for SPIR-T.
Entity handle for a ControlNodeDef (a control-flow operator or leaf).
Definition for a ControlNode: a control-flow operator or leaf.
Entity handle for a ControlRegionDef (a control-flow region).
Definition for a ControlRegion: a control-flow region.
Entity handle for a DataInstDef (an SSA instruction).
Definition for a DataInst: an SSA instruction.
Collection holding the actual definitions for Context-allocated entities.
Doubly-linked list, “intrusively” going through E::Def, which must be an EntityListNode<E, _> (to hold the “previous/next node” links).
EntityList<E> iterator, but with a different API than Iterator.
Map with K keys and V values, that is:
Entity handle for a FuncDecl (a function).
Declaration/definition for a Func: a function.
The body of a Func definition.
Entity handle for a GlobalVarDecl (a global variable).
Declaration/definition for a GlobalVar: a global variable.
The body of a GlobalVar definition.
Interned handle for a str.
Wrapper to limit Ord for interned index types (e.g. InternedStr) to only situations where the interned index reflects contents (i.e. equality).
Interned handle for a TypeDef.
Definition for a Type.

Enums

Any semantic or non-semantic (debuginfo) decoration/modifier, that can be optionally applied to some declaration/definition.
Const “constructor”: a ConstDef wiithout any nested Consts.
Declarations (GlobalVarDecl, FuncDecl) can contain a full definition, or only be an import of a definition (e.g. from another module).
An unique identifier (e.g. a link name, or “symbol”) for a module export.
A definition exported out of a module (see also ExportKey).
An identifier (e.g. a link name, or “symbol”) for an import declaration.
Non-semantic details (i.e. debuginfo) of a SPIR-Y module (not tied to any declarations/definitions).
Semantic properties of a SPIR-T module (not tied to any declarations/definitions).
Type “constructor”: a TypeDef wiithout any TypeCtorArgs (Types/Consts).

Traits

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 finite enums).