Documentation
¶
Overview ¶
Package devicetest holds the device tests every backend runs on its own opened device, written once over the hostgpu interfaces. A backend's test file opens its device and calls them.
Index ¶
- func CloseWhileEncoding(t *testing.T, dev hostgpu.Device)
- func CommandsNoAllocs(t *testing.T, dev hostgpu.Device)
- func Conformance(t *testing.T, dev hostgpu.Device)
- func EncodeAfterCommit(t *testing.T, dev hostgpu.Device)
- func HostErrorReported(t *testing.T, dev hostgpu.Device)
- func ReadBack(tb testing.TB, dev hostgpu.Device, b hostgpu.Buffer) []byte
- func RoundTrip(t *testing.T, dev hostgpu.Device)
- func SubmissionsReleased(t *testing.T, dev hostgpu.Device)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseWhileEncoding ¶
CloseWhileEncoding leaves a submission being encoded, with a command recorded, for the caller's cleanup to close the device on: Close abandons the encoder rather than submitting it, and a Close that panics or blocks on it fails the test. What Close releases is not observable through the device.
func CommandsNoAllocs ¶
CommandsNoAllocs checks that a submission's encode, commit, and wait allocate nothing on the Go side once the first submission has run. It covers an index dispatch, a group dispatch, an index grid and a fill each past one dispatch, a barrier, and a copy. The binding list is built outside the cycle, as the renderer's is. One measured run: AllocsPerRun divides the count by the runs, so a run of several would hide an allocation made every other cycle.
func Conformance ¶
Conformance runs every conformance and buffer test on the device, each a subtest.
func EncodeAfterCommit ¶
EncodeAfterCommit checks that a command on a committed submission is refused as the contract says: it is not encoded, the next Begin reports ErrClosed, and the Begin after that opens a submission.
func HostErrorReported ¶
HostErrorReported checks that a refused command is reported by the Wait on its submission as the host error it is, and that the commands after it in the submission are not encoded: a buffer filled with one word, then a submission whose copy reaches past the buffer's end and whose fill after it would change every word. The buffer keeps the first fill, and the device opens the next submission as usual.
func ReadBack ¶
ReadBack returns a copy of a working or upload buffer's bytes, copied into a readback buffer in a submission waited for at once.
func RoundTrip ¶
RoundTrip dispatches the Words entry over an overshooting grid, waits, and reads the output back through a readback buffer, holding every word of it to the Go execution: the words past the bound stay zero, so a wrapper that let a thread past the bound run would show.
func SubmissionsReleased ¶
SubmissionsReleased checks the submission contract on a freshly opened device: a Begin while a submission is being encoded is refused, sequence numbers rise by one per commit from 1, a wait on a later submission completes an earlier one not waited on, so a wait on the earlier one after it reports nothing, and a wait on a sequence number no commit has returned is an error. The release of the earlier submission is not observable through the device; it is the ledger's, which ledger_test.go holds.
Types ¶
This section is empty.