Documentation
¶
Index ¶
- func DynamicBindings(buffers []BufferBinding) uint32
- func Invoke[B, V any](r compute.Operations[B, V], op *Operation, buf B, args []V) V
- type ArrayType
- type Assign
- type Binary
- type Block
- type Break
- type BufferBinding
- type BufferType
- type Call
- type Case
- type Composite
- type Const
- type Continue
- type Convert
- type Entry
- type Error
- type ErrorList
- type Expr
- type ExprStmt
- type Field
- type FieldRef
- type For
- type Func
- type If
- type IndexRef
- type Kind
- type LoadStruct
- type Local
- type LocalRef
- type Mask
- type Module
- type Op
- type OpCall
- type Operation
- type Package
- type ParamKind
- type Program
- type Return
- type Scalar
- type Source
- type Stmt
- type StructRef
- type StructType
- type Switch
- type Table
- type TableRef
- type Tuple
- type Type
- type Unary
- type VarDecl
- type Zero
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DynamicBindings ¶
func DynamicBindings(buffers []BufferBinding) uint32
DynamicBindings is the variable-length bindings of an entry, one bit per binding index, for a backend to check the lengths it supplies against.
func Invoke ¶
func Invoke[B, V any](r compute.Operations[B, V], op *Operation, buf B, args []V) V
Invoke calls the renderer's method for op with the buffer, when the operation acts on one, and the value operands in order, and returns the result, or the zero value for an operation with none. An emitter implements compute.Operations over its own operand types and passes the operands it evaluated.
Types ¶
type Assign ¶
Assign stores Values into Targets. Several targets appear only for a multi-result call, which is then the single value.
type Binary ¶
Binary is an arithmetic, bitwise, shift, comparison, or logical operation; the emitter selects the form from the operand type.
type BufferBinding ¶
type BufferBinding struct {
Param int
Type BufferType
Binding int
}
BufferBinding is one buffer parameter of an entry point and its binding index, which is the parameter's position.
type BufferType ¶
type BufferType struct {
Name string
Word bool
Size int
Dynamic bool // slice-backed buffer, its length travels with the binding
Params bool
}
BufferType is an opaque buffer handle: byte-addressed or word-addressed, with its size constant (bytes or words), or Dynamic for a buffer whose length arrives with the binding, in bytes for a byte buffer and in words for a word buffer. Params marks the wrapper's params buffer, only ever read, and only through LoadStruct.
func (BufferType) Kind ¶
func (b BufferType) Kind() Kind
func (BufferType) String ¶
func (b BufferType) String() string
type Call ¶
Call calls a module function. A multi-result call has a Tuple type and appears only as the single value of a multi-target Assign.
type Composite ¶
Composite builds a struct or array value from positional elements, one per field or element.
type Entry ¶
type Entry struct {
Func int
Wrapper int // synthesized wrapper function
Span bool
Group bool
Buffers []BufferBinding
Params []int // locals holding the struct parameters, in order
Coords int // 1, 2, or 3 trailing coordinates
}
Entry is an entry point: a function plus its dispatch shape and the synthesized wrapper the emitted shell calls. A span entry ends in two int32 coordinates and renders a segment of dots per thread; an index entry ends in one uint32 coordinate, the thread's x; a group entry ends in three, the thread's index in its group, the group's size, and the group's index, and its params row is the group's. The workgroup an entry runs in is each backend's choice.
type ErrorList ¶
type ErrorList []Error
ErrorList collects every diagnostic of a run so a source with several violations reports all of them at once.
type ExprStmt ¶
type ExprStmt struct {
X Expr
}
ExprStmt evaluates an expression for effect: a call or an operation with no result, or the value of a blank assignment.
type For ¶
For is a loop. Cond and Post may be nil. A Go loop's init statement lowers into the block wrapping the loop.
type LoadStruct ¶
LoadStruct is the struct row at a byte address of a byte buffer. Only the synthesized entry wrappers use it, to fetch a row's params. It names the row, not a copy of it: an emitter may copy the row into a local or bind it by reference and read its fields in place.
func (*LoadStruct) Type ¶
func (e *LoadStruct) Type() Type
type LocalRef ¶
LocalRef reads or addresses a local or parameter by index. A ref parameter denotes the value it refers to.
type Mask ¶
Mask re-canonicalizes a narrow value held in a 32-bit register to its declared width: sign-extended for signed types, zero-extended for unsigned.
type Module ¶
type Module struct {
Structs []StructType
Tables []Table
Funcs []Func
Entries []Entry
}
Module is a lowered program.
type OpCall ¶
OpCall calls an operation of compute.Operations. A buffer operation takes the buffer as the first argument.
type Operation ¶
Operation is an operation of compute.Operations as the interface declares it, read from the interface's method: its name, whether its first parameter is the buffer it acts on, its value operands after that, and whether it has a result. The compile stage states nothing about an operation itself; an OpCall node names one, and Invoke calls it on a backend.
func (*Operation) Pure ¶
Pure reports an operation that reads and writes no buffer contents, so its evaluation order is not observable: one that acts on no buffer and yields a value (min and max), and Length, which takes a buffer but reads its length, not its contents. NextPhase acts on no buffer and yields nothing, and orders the buffer stores around it.
type Package ¶
type Package struct {
Path string
Files []*ast.File
Types *types.Package
Info *types.Info
Entries []string
}
Package is one type-checked compute package.
type Program ¶
Program is the loaded compute tree: the parent package and the validated subpackages, sharing one file set.
type Scalar ¶
type Scalar Kind
Scalar is a scalar type.
func (Scalar) Bytes ¶
Bytes is the scalar's size in a buffer: its width in bytes, and one for bool, the byte Go stores.
type Source ¶
Source is one compute package as the compile stage receives it: its import path and the file system holding its Go files. Files holds the package's subset source and nothing else: the compute packages name the files they embed one by one, so the stage takes every file it is given rather than filtering by name. Entries names the exported functions the renderer dispatches as compute entry points; every other function is a helper.
type Stmt ¶
type Stmt interface {
// contains filtered or unexported methods
}
Stmt is a statement node.
type StructRef ¶
type StructRef struct {
Index int
}
StructRef refers to a laid-out struct by its index in Module.Structs.
type StructType ¶
StructType is a laid-out struct: fields in declaration order with the offsets the layout rule assigns.
type Type ¶
Type is an IR type. Scalars are Scalar values; composites and buffers are the other implementations.