Commit graph

9 commits

Author SHA1 Message Date
OpenCode Agent
2364311f19 fix(core): one GPU reset is one strike, however many losses it brings
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.
2026-11-23 12:24:55 +00:00
OpenCode Agent
0a6b8ba1b4 feat(core): browser-style GPU hangs: two strikes in 30 s stop a run
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.
2026-11-23 10:50:35 +00:00
OpenCode Agent
810f458dea test(core): error-too-many-draws gets its batches from its source
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.
2026-11-23 10:31:18 +00:00
OpenCode Agent
3efef1c622 test(core): GPU fixtures prove non-finite numbers stay numbers
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.
2026-11-23 03:06:37 +00:00
OpenCode Agent
6fefac75b2 test(core): GPU fixtures for the batch's shape and the canvases it stops
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.
2026-11-23 01:48:42 +00:00
OpenCode Agent
7111a03254 test(core): GPU fixtures record frame requests without a batch
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.
2026-11-23 00:26:15 +00:00
OpenCode Agent
8d5400dd45 feat(core): settle the widget GPU findings from the native and web hosts
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.
2026-11-23 00:19:16 +00:00
OpenCode Agent
b18aa923d3 perf(core): live-only code moves to a live prelude, served only in live programs
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.
2026-11-23 00:00:17 +00:00
OpenCode Agent
0786c7331c feat(core): widget.gpu, the WebGPU subset for live widgets, with host checks and conformance fixtures
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).
2026-11-22 23:51:45 +00:00