A loss is a strike only if the run's GPU work finished on a device since its previous strike (or
its start): a recovery that discards each new device's first work lost Rune's device four times
and stopped an innocent widget. LiveWidget.loseDevice takes { inFlight, finished }; fixture loss
inputs carry finished; hang-one-reset-several-losses shows three losses in one reset stop nothing.
widgets-gpu.md drops the 30 ms aborted-work and 250 ms-at-loss rules, keeps the 250 ms unfinished
rule, and adds strikes: a device loss while a run has GPU work in flight is a strike, and two 30 s
apart or less stop every GPU canvas of the run ('the GPU work hung; the canvas is stopped').
LiveWidget.loseDevice takes inFlight and applies it; fixture loss inputs carry inFlight, and two
new fixtures show a stop and a loss with no work in flight being no strike.
Its 20,000 generated ops aren't recorded: "batches": "from-source" tells drivers to run the
source for them, as they run raw programs. The GPU fixtures go from 668,839 to 147,200 bytes.
error-nan-rows-per-image (writeTexture rowsPerImage NaN) and error-infinite-depth-clear-value
(depthClearValue Infinity) fail where null would pass. Recorded batches write a number JSON can't
hold as { "$num": "NaN" | "Infinity" | "-Infinity" }, only there.
raw-bytes-not-an-array-buffer posts valid ops into scene with a Uint8Array for bytes (stops
["scene"]); raw-ops-not-a-list posts a string for ops (stops all). Raw fixtures of the wrong shape
keep their batches, with bytes null when they aren't an ArrayBuffer and ops as posted.
batches now has each bare frame request in its place as { frame: true, ops: [], bytes: "" }, so a
driver replaying them ends each frame, and resets the per-frame counts, where the program did.
Only frame-counts-reset-at-a-bare-frame gains an entry.
widgets-gpu.md: a pass renders into a canvas through its resolveTarget too; a batch from before
the program learned of a device loss is dropped quietly; canvases are clamped to 4096 with their
aspect ratio kept; per-frame counts reset at every frame request; a canvas is cleared once per
frame; batch-shape checks may come from the host's conversion; a canvas an error stopped stays
stopped for the run and a new device doesn't restart it; validation messages are the GPU
implementation's own.
gpu.ts and LiveWidget follow, with five new GPU fixtures and a test for stopped canvases.
prelude-live.js holds widget (with widget.gpu) and __widget_live; a step widget template's program
is prelude + "\n" + source, a live one's prelude + "\n" + livePrelude + "\n" + source, and
versions hash the program as served. Lint reserves both preludes' names; positions stay
source-relative per mode. Steps compile and run faster than before widget.gpu.
Also lands the widgets-gpu.md changes 0786c7331 described but didn't carry: the live input's gpu,
the flag globals, the normalised op shapes, error ops, which canvases an error stops, Host checks
and Conformance; and widgets-live.md's rule that GPU batches never overtake waiting posts.
The prelude records WebGPU's API (devices, contexts by canvas key, resources, pipelines, bind
groups, command encoders and passes) into batches of ops and bytes with prelude-assigned handles
and every default filled in; batches ride frame requests, or go before other waits and at the
end. device.lost, unavailable GPUs and encoder misuse (error ops) are handled.
The TypeScript host (LiveWidget) passes { available, format } in the live input and checks
batches without a GPU: op shapes, handles and limits, with exact messages; an error stops the
canvases its batch renders into, else all. GPU batches never overtake waiting renders or draws.
widgets-gpu.md gains the normalised op shapes, the host checks and the conformance driver;
test/fixtures/gpu holds 34 fixtures, among them four example widget templates (a lit cube, a
textured quad, post-processing, a first-person maze).