Documentation
¶
Overview ¶
Package conformance runs the conformance functions of core/compute/conformance: their Go execution over fixed test vectors under the entry wrapper contract is the reference, and a backend passes when its emitted entry points produce the same output and byte buffer contents bit for bit. The package names no backend. devicetest runs the entries on each backend's device and compares.
Index ¶
- Constants
- Variables
- func AllSources() (parent, sub compile.Source)
- func CheckRoundState(name string, got, want *compute.RoundState, asked uint32) error
- func DeviceInputs(n int) (in, mid, out compute.LineRecords)
- func Inputs(in compute.Layer, mem *compute.VDP2VRAM)
- func Lower() (*compile.Module, error)
- func Names() []string
- func NewRoundState() *compute.RoundState
- func Probes() [2]conformance.Probe
- func RoundStateOf(stamps, heads, pool []byte) *compute.RoundState
- func RoundStateSources() (parent, sub compile.Source)
- func RunDeviceGo(in, mid, out compute.LineRecords)
- func RunGo(e Entry, in compute.Layer, mem *compute.VDP2VRAM, out compute.Layer, ...)
- func RunRoundStateGo(name string, rs *compute.RoundState) error
- func RunRoundStateThreads(name string, rs *compute.RoundState, n uint32) error
- func RunVariableArrayGo(v *rules.Views, out compute.LineRecords)
- func RunVariableBytesGo(in, out compute.LineColor)
- func RunVariableGo(in, out compute.LineRecords)
- func RunVariableHalfwordsGo(in, out compute.VDP1FB)
- func Sources() (parent, sub compile.Source)
- func VariableArrayInputs(n int) (v rules.Views, out compute.LineRecords)
- func VariableByteInputs(n int) (in, out compute.LineColor)
- func VariableHalfwordInputs(n int) (in, out compute.VDP1FB)
- func VariableInputs(n int) (in, out compute.LineRecords)
- func VariableSources() (parent, sub compile.Source)
- type Entry
- type GroupFn
- type IndexFn
- type SpanFn
Constants ¶
const ( VariableEntry = "VariableWords" VariableByteEntry = "VariableBytes" VariableHalfwordEntry = "VariableHalfwords" VariableArrayEntry = "VariableArray" )
VariableEntry names the variable word buffer conformance entry, VariableByteEntry and VariableHalfwordEntry the variable byte buffer ones, and VariableArrayEntry the array of variable word buffers one.
const LayerWords = 1 << 19
LayerWords is the length of the input and output layer buffers a suite test binds: a power of two, as every variable-length buffer's is, past the Threads by 8 words the inputs and outputs use.
const RoundStateGroups = 2
RoundStateGroups is the groups each round state entry is dispatched over, each with its own params row, so the two rows of Probes serve.
const RoundStateThreads = 512
RoundStateThreads is the threads a test gives each group, more than one workgroup on every backend so the group form spanning workgroups is what the device runs. A backend rounds it up to whole workgroups of its own size, and the entries record the group size they ran with.
const RoundStateWords = 1 << 18
RoundStateWords is the length of each region a round state test binds: a power of two, as every variable-length buffer's is, past every word the entries touch.
const Threads = 4096
Threads is the number of test vectors for the index entries, one per thread.
Variables ¶
var Entries = []Entry{ index("Wrap8", conformance.Wrap8), index("Wrap16", conformance.Wrap16), index("Wrap32", conformance.Wrap32), index("Shifts", conformance.Shifts), index("DivRem", conformance.DivRem), index("Convert", conformance.Convert), index("Int64", conformance.Int64), index("Layout", conformance.Layout), index("Bytes", conformance.Bytes), index("Words", conformance.Words), index("ShortCircuit", conformance.ShortCircuit), index("Tables", conformance.Tables), index("Control", conformance.Control), {Name: "Segments", Span: conformance.Segments, BoundX: 1003, BoundY: 2, Rows: 2, Segment: 8}, {Name: "DoubleSegments", Span: conformance.DoubleSegments, BoundX: 1000, BoundY: 2, Rows: 2, Segment: 16}, {Name: "Group", Group: conformance.Group, BoundY: 2, Rows: 2}, {Name: "Wide", Index: conformance.Wide, BoundX: conformance.WideThreads, BoundY: 1, Rows: 1}, }
Entries lists the conformance functions in the order the compile stage is given them, so entry point i is Entries[i].
var RoundStateEntries = [...]string{"RaiseWords", "AddWords", "SwapChain"}
RoundStateEntries names the conformance entries for the round state's shared-word helpers: group entries over the RoundState buffer group, one region and one operation each, with a params row per group.
var VariableEntries = [...]string{VariableHalfwordEntry, VariableArrayEntry, VariableByteEntry, VariableEntry}
VariableEntries names the variable-buffer conformance entries.
var VariableSizes = [...]int{4, 256, 1 << 21}
VariableSizes covers input lengths from a few words to a buffer past the record reservation the VDP1 starts a frame with, so no mask of a fixed size can stand in for the bound the binding supplies. Each is a power of two, as every dynamic length is. The byte entry takes the same numbers as byte lengths, each a whole number of words.
Functions ¶
func AllSources ¶
AllSources builds every conformance entry as one module: the base entries, the atomic entries, and the variable-buffer entries, for a backend that compiles its shaders ahead of time and looks each up by name.
func CheckRoundState ¶
func CheckRoundState(name string, got, want *compute.RoundState, asked uint32) error
CheckRoundState holds a backend's result for one round state entry, run over RoundStateGroups groups of threads threads each. The raise entry must equal the Go execution word for word across every region, which also holds the group's binding order: a backend binding the regions out of order raises the wrong one. The add entry's ranges land in the device's order and its counter counts the threads, so it is held to what any order gives: the counter at four per thread and every word of the reserved ranges marked with the group's value. The swap entry's chains are walked: from each group's head, every thread's slot once. The add and swap entries are held to the group size each group recorded, which must be at least asked, the threads the test gave each group, and every word outside the counters, the sizes, and the ranges they touch, in their own region and the other two, must equal the Go execution's, so a stray write shows.
func DeviceInputs ¶
func DeviceInputs(n int) (in, mid, out compute.LineRecords)
DeviceInputs makes the views of a round trip through a working buffer by the variable word entry: the input of n words, the working buffer's of 2n, and the output of 4n, the last two filled, so a dropped write shows as a word that kept its fill.
func Inputs ¶
Inputs fills the input words and the byte buffer deterministically: the first threads take every pair of edge words, the rest a fixed- seed generator.
func Lower ¶
Lower runs the compile stage on the conformance package and returns the lowered module, entry i being Entries[i].
func NewRoundState ¶
func NewRoundState() *compute.RoundState
NewRoundState allocates a round state with every region at RoundStateWords, zeroed.
func Probes ¶
func Probes() [2]conformance.Probe
Probes returns the params rows: row 0 is the probe every index entry receives, row 1 differs in every field for the span entry's second row.
func RoundStateOf ¶
func RoundStateOf(stamps, heads, pool []byte) *compute.RoundState
RoundStateOf views three buffers' bytes as a round state, in the group's field order.
func RoundStateSources ¶
RoundStateSources builds the round state conformance entries.
func RunDeviceGo ¶
func RunDeviceGo(in, mid, out compute.LineRecords)
RunDeviceGo is the Go reference every backend's working buffer test compares with: the variable word entry from in into mid, then from mid into out.
func RunGo ¶
func RunGo(e Entry, in compute.Layer, mem *compute.VDP2VRAM, out compute.Layer, probes *[2]conformance.Probe)
RunGo executes one entry on the Go side under the wrapper contract, over the grid its bounds give: for every grid position, the row's params and the segment range or the index. A group entry runs as one thread per group, thread 0 of 1, which executes the phases in order.
func RunRoundStateGo ¶
func RunRoundStateGo(name string, rs *compute.RoundState) error
RunRoundStateGo runs one round state entry on the Go side: one thread per group, which runs every thread's work in order. An unknown name is an error.
func RunRoundStateThreads ¶
func RunRoundStateThreads(name string, rs *compute.RoundState, n uint32) error
RunRoundStateThreads runs one round state entry on the Go side with n threads per group, each group's threads in order. An unknown name is an error.
func RunVariableArrayGo ¶
func RunVariableArrayGo(v *rules.Views, out compute.LineRecords)
RunVariableArrayGo is the Go reference every backend's array test compares with: one thread per output word.
func RunVariableBytesGo ¶
RunVariableBytesGo is the Go reference every backend's variable byte buffer test compares with: one thread per output byte.
func RunVariableGo ¶
func RunVariableGo(in, out compute.LineRecords)
RunVariableGo is the Go reference every backend's variable-buffer test compares with: one thread per output word, the wrapper's bound.
func RunVariableHalfwordsGo ¶
RunVariableHalfwordsGo is the Go reference every backend's variable halfword test compares with: one thread per output halfword.
func Sources ¶
Sources are the compile stage's inputs for the conformance package: the parent compute package and the conformance package with every entry named.
func VariableArrayInputs ¶
func VariableArrayInputs(n int) (v rules.Views, out compute.LineRecords)
VariableArrayInputs makes the array entry's buffers: the first of n words, the second of 4n, with different data, and the output of 8n words filled, so threads past the first buffer's end read it masked and a dropped write shows as a word that kept its fill.
func VariableByteInputs ¶
VariableByteInputs makes the byte entry's two buffers of n and 2n bytes: the input a byte pattern, the output filled, so a dropped write shows as a byte that kept its fill.
func VariableHalfwordInputs ¶
VariableHalfwordInputs makes the halfword entry's two buffers of n and 2n bytes: the input a byte pattern, the output filled, so a dropped write shows as a byte that kept its fill.
func VariableInputs ¶
func VariableInputs(n int) (in, out compute.LineRecords)
VariableInputs makes the entry's two views: the output is twice the input's length, so the threads past the input's end read it at the index masked with its length. Both start filled, so a dropped access shows as a word that kept its fill.
func VariableSources ¶
VariableSources builds the variable-buffer conformance entries.
Types ¶
type Entry ¶
type Entry struct {
Name string
Index IndexFn
Span SpanFn
Group GroupFn
BoundX uint32
BoundY uint32
Rows int // params rows: the stride is the Probe size when more than one
Segment uint32
}
Entry pairs an entry point's name with its Go function, one of the three kinds, and its dispatch: bounds, the params rows, and for a span entry the segment length.
type GroupFn ¶
type GroupFn func(in compute.Layer, mem *compute.VDP2VRAM, out compute.Layer, p *conformance.Probe, t, n, g uint32)
GroupFn is a group entry: the thread's index in its group, the group's size, and the group's index.