devicetest

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: GPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseWhileEncoding

func CloseWhileEncoding(t *testing.T, dev hostgpu.Device)

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

func CommandsNoAllocs(t *testing.T, dev hostgpu.Device)

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

func Conformance(t *testing.T, dev hostgpu.Device)

Conformance runs every conformance and buffer test on the device, each a subtest.

func EncodeAfterCommit

func EncodeAfterCommit(t *testing.T, dev hostgpu.Device)

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

func HostErrorReported(t *testing.T, dev hostgpu.Device)

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

func ReadBack(tb testing.TB, dev hostgpu.Device, b hostgpu.Buffer) []byte

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

func RoundTrip(t *testing.T, dev hostgpu.Device)

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

func SubmissionsReleased(t *testing.T, dev hostgpu.Device)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL