f02f3aec2c2a57773a8b3333c28734367bfdbcaa
2082
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f02f3aec2c |
🐛 The binding mask read zero for a module that declares six, because this device relocates a fragment stage past 255
`crates/reims-vgpu`, `runtime/gpu_hang_trail.rs` and its producer. Measurement only. The masks added one commit ago were `u32`, on the stated premise that "buffers sit below 32, sampled images at 32+ and samplers at 64+". Those are m2v's own bands. This device *relocates* on top of them whenever both stages carry buffers or sampled resources — `FRAG_BUFFER_BINDING_OFFSET` is 256 and `FRAG_SAMPLED_RESOURCE_BINDING_OFFSET` is 288 — and the running module is the relocated variant, not the one in the translated pool an offline walk reads. So the first boot read `fdecl=0x0` on every draw of the 95 212-word shader the field was built to look at, and `fprov=0x3f` — six bindings, all of them the *vertex* stage's, which are the only ones that stayed under 32. A field that reads zero because its representation cannot hold the answer is worse than no field: it reads as "nothing declared", which is exactly the reassuring direction. Replaced with counts plus the lowest four gap binding numbers. Not a wider mask: the numbers reach past 320, a mask that held them would be four words an entry, and the interesting answer is *which* binding rather than the set. `frag_gap` says when the four are a truncation. The mistake is recorded on `GAP_KEPT` rather than only here, because it is the one a future reader of this field is most likely to repeat. # Verified `the_gap_is_declared_minus_provided_and_names_its_lowest_members` covers the direction (provided-but-not-declared is not a gap, since a layout may legally carry a descriptor the module never mentions) and the truncation. Full `--lib` suite on the Vulkan arm: 1925 passed, 0 failed. Clippy `-D warnings` clean on `backend-vulkan,host-window` and `backend-metal`. Not verified: no boot has read the corrected field. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
68f56cde02 |
✨ The uber shader's twelve loop bounds all come from one storage buffer, and no guard in this crate can see whether it is bound
`crates/reims-vgpu` — `runtime/gpu_hang_trail.rs` and its producer in `runtime/draw/vulkan.rs`. Measurement only; nothing declines. # What the SPIR-V says A static walk of `pipe=41`'s fragment module — the 95 212-word CoreAnimation compositing shader the trail named in the window before four of one boot's twelve stalls — resolves its loop exit conditions to their sources. Of 58 loops, **12 exit on a value loaded through `set = 0, binding = 0`**, and that variable is a `StorageBuffer` pointing at a 20-member struct which the shader indexes at members 0, 2, 7, 9 and 11-16. It is CoreAnimation's per-draw parameter block, and a wrong value in it is a wrong loop bound. # Why no existing guard covers it Two exist and neither asks this question. `frag_unbound_scan` on the render path walks **m2v's reflection**, so a binding the translated module carries and the reflection omits is checked by nothing. It reads zero on macos-11, which is consistent with either "nothing is missing" or "the reflection never mentioned it". `descriptor_static_use` is the exact question and answers `NotDeclared` for anything that is not a `UniformConstant` — deliberately, so a storage buffer is never refused on a guess. That is a correct conservatism and it means a storage buffer is by construction outside it. `used_binding_absent_from_layout` is the compute path's backstop for exactly this shape, and its doc records why it matters on this host: Mesa's Intel driver sizes its binding array to `max_binding + 1` and zero-fills every number the layout did not declare. The render path has no equivalent. # What this adds Two masks on each trail entry — the set-0 bindings under 32 the fragment module carries a `Binding` decoration for, and the ones this draw will put in the layout — and their difference, printed as `fdecl`/`fprov`/`fgap`. `declared_binding_numbers` is one linear pass and is class-blind, so the gap is a superset of the violation rather than the violation; it is the cheap question asked per draw, and it is the only one that can be asked of a storage buffer at all. Bindings past the mask's width are absent from *both* sides, so they can never appear as a phantom gap. Provided-but-not-declared is not a gap either: a layout may legally carry a descriptor the module never mentions. # Verified Full `--lib` suite on the Vulkan arm: 1925 passed, 0 failed, including a new test for the mask's width and the gap's direction. Clippy `-D warnings` clean on `backend-vulkan,host-window` and on `backend-metal` via `--target aarch64-apple-darwin`. Also verified, and separately: a full four-rail app sweep at `bfa84e74` — the commit before this one — with **no guest kernel panic on any rail**. macos-13 and macos-14 pass all seven legs. macos-11 passes five of seven (Maps freezes on the GPU hang; the Launchpad leg reported NO-LAUNCH) and macos-12 six of seven (the Launchpad leg freezes on the same hang). So today's three correctness fixes regressed nothing, and the two failing rails fail on the one open defect. Not verified: no boot has read `fgap` yet. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
bfa84e7407 |
✨ The A/B loop that scores frames, because the hang loop scores kernel resets and neither can be read as the other
`scripts/perf-ab/perf-ab.sh` — new, no crate change. Every performance constant in `AGENTS.md` was priced on a discrete NVIDIA host. This machine is now an Intel Arrow Lake iGPU, so the whole verification section's timings need taking again here, and there was no harness for it: `hang-bisect.sh` is the same boot loop but scored on kernel `GPU HANG` lines. This is the boot loop scored on the census. It reuses the race-avoidance the sweep scripts already carry — `stop-previous-vm.sh`, waiting on the fail log rather than on ssh, `guest-authorize.sh`, `wait-for-desktop.sh`, a bracketed `pkill` pattern, arms exported and never passed as argv — and adds the four rules that belong to scoring rather than to booting: - arms are interleaved round-robin, because a macos-13 boot latches one of two compositing regimes for its life and the *rate* it picks the slow one drifts across a day; - `present_hz` and `offered_hz` are both columns, because the presenter passes what it is offered and one without the other cannot say which moved; - `regime` is a column and the band between the two populations reports `?` rather than being binned, so a boot that lands in the empty gap is looked at; - `probe` is a column, because a bursty interaction probe and a sustained one rank this device's costs in a different order. The per-window census fields are summed and the per-second ones taken as a median — a mean would let one census second inside a stall outweigh a whole healthy boot. A `guest kernel panic` in the boot's own stdout overrides the regime, because it can land after the probe has already reported success. # Verified `bash -n` only. No arm has been run through it yet; the first use is the macos-13 baseline this exists to take. Also in this commit: nothing else. The 25 s `FENCE_TIMEOUT_NS` probe run alongside it was restored to 5 s by hand, and its result — negative, the GPU genuinely wedges and the kernel's own detector agrees — is in `kb/`. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
36d0880e89 |
✨ The trail named a ninety-five-thousand-word fragment module in the window before four stalls, and the next question is how often it runs at all
`crates/reims-vgpu` — `runtime/gpu_hang_trail.rs` and `runtime/draw/render_target.rs`. # What the trail read First driven macos-11 boot with the trail in. Twelve `sync_exec_lock_hold` records, each a five-second fence timeout, each followed by its trail. The last twelve draws before every one of them are trivial — fragment modules of 136-2 387 words, 6 to 54 vertices, one instance, extents of 64x64 to 1026x808. But `pipe=41`, whose fragment module is **95 212 words**, appears in the trail of the **first four** stalls and in none of the eight after them, at positions 8-11, 1-6, 2, and 6-11 of twelve. That is the CoreAnimation compositing uber shader a previous session found in the translated pool and measured at 58 loops, and it is the only thing in any trail that is not ordinary. This does not yet establish cause. A draw in the twelve-draw window before a stall is a coincidence if that draw is constant traffic, and the trail cannot say — it only prints after a stall, so it has no denominator. # What this adds `fragwords_*`, a five-band census of every draw's fragment module size, so a boot answers the denominator directly: a module that hangs every time it runs and a module that is merely marginal read the same in a trail and differently here. The bands tile `u32` so their sum is the draw count, held by a test. # The type-5 view alarm went non-zero, and is not repaired here `rt_type5_view_differs` is documented as a healthy zero whose first firing names a surface being rendered at the wrong geometry. On this rail it read 1 against `same` 1 271: `sid=56 view=1024x768 fmt=0x51 base=1024x768 fmt=0x50`. Geometry agrees; 0x50 and 0x51 are `BGRA8Unorm` and `BGRA8Unorm_sRGB`, so this device renders into a target the guest declared sRGB using a UNORM attachment and the hardware's encode-on-write does not happen. The repair is one line — `effective_view_sample_format` already refuses an override at a different bytes-per-texel, so handing it the view's format is safe by construction. What is *not* known is whether the same surface also resolves `same` elsewhere in a boot, because honouring the view would then key two residents on one surface and the frame would alternate between them, which is a worse defect than the one being fixed. So this splits the counter into `differs_format_only` against `differs_geometry` and adds `rt_type5_view_sid_both_ways`, which is the reading that licenses the repair. The watch is bounded and stops admitting rather than evicting, because a forgotten surface answers "not seen before" — the direction that reports the repair safe when it is not. # Verified Five new tests: the size bands tile every `u32`, and the differing-view watch bounds by refusing admission rather than by forgetting. Full `--lib` suite on the Vulkan arm: 1923 passed, 0 failed. Clippy `-D warnings` clean on `backend-vulkan,host-window` and `backend-metal`. The translator pin was checked before any of this: `git ls-remote` puts `1b013834…` at upstream `HEAD`, so there is no fix waiting for us there. Not verified: the `fragwords_*` census has not been read on a boot, and the two new `rt_type5_view_*` splits have not either. The hang rate on this rail is noisy enough that it is not a comparison this commit makes: three macos-11 boots today read 2, 13 and 6 kernel `GPU HANG` lines with no arm difference that explains it. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
2a6bb2dae0 |
✨ A fence that stops signalling says a submission hung and nothing anywhere says which one, so the last dozen draws are kept
`crates/reims-vgpu`, `runtime/gpu_hang_trail.rs` (new), producer in `runtime/draw/vulkan.rs`, reader in `runtime/drain`. Plus a `kb/` note. # What could not be asked When the host GPU wedges, this device sees a fence that never signals. By then the batch is gone: `wait_error` knows only that a wait timed out, and every refusal downstream of it is a consequence of the device loss. Two sessions have looked for the cause by bisecting the narrowing switches, which asks whether a *rail* is responsible and never which submission was — and the answer came back "none of them": on macos-11 the shipping arm logged 2 kernel `GPU HANG` lines and an arm with ten narrowing switches off logged 13. The kernel's own line does not say either, and this commit's `kb/` note records why: its process name identifies the thread that created the i915 context, not the one that submitted the batch. On this host the device is created lazily by the host window thread and recreated by the drain worker, so every episode reads `reims-vgpu-wind` once and `qemu-system-x86` thereafter — ten episodes for ten, which looked like a finding about the presenter and is arithmetic about `owner.ensure`. # What this adds A fixed twelve-entry ring of the last draws recorded, each carrying the guest pipeline ref, both translated module word counts, the render extent, and the vertex and instance counts. Recorded at the one point where the guest's ref and both modules are in scope together — past it the engine keys on digests and the ref is gone. Printed when a drain tranche is caught holding the engine past `SYNC_EXEC_STALL_US`, which on every boot measured so far is the moment the engine wedges, and which fires on the drain thread while it is blocked — so the tail of the trail is the work it is blocked on. Emitted as its own record beside the existing count rather than folded into it, because the two have different lengths and a reader greps one or the other. The module word counts are the point: a compositing uber shader and an ordinary blit are one `pipe=` either way, and the standing hypothesis for this hang is a fragment module whose loop bound comes from a descriptor. A static walk of the largest blob in the translated pool puts 12 of its 58 loops' exit conditions on a descriptor load, so the size column is the cheapest discriminator available. Only the Vulkan draw path writes it. Two of the fields do not exist on the Metal-direct arm, where AIR never becomes SPIR-V; the module doc says so and says a Metal trail belongs in its own type rather than in this one with two columns zeroed. # Verified Three tests: the ring keeps the newest entries and reports them oldest first, the total says how much the trail is not showing, and an empty trail answers `None` so a caller emits no line. Full `--lib` suite on the Vulkan arm: 1922 passed, 0 failed. Clippy `-D warnings` clean on `backend-vulkan,host-window` and on `backend-metal` via `--target aarch64-apple-darwin`. Not verified: no boot has read a trail yet. That is the next run, and it is what this exists for. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
032b202cee |
🐛 Three gathers were exempted from the settle on an argument about submitted work, and an owed frame is not submitted
`crates/reims-vgpu`, `runtime/draw` — the three zero-copy sampled rails, both backends. # What the guest saw `try_type11_sample_zero_copy`, `try_type5_sample_zero_copy` and `try_linear_sample_zero_copy` hand the engine guest-RAM runs and let the GPU read them when the draw's command buffer executes. All three are exempt from the settle that every CPU loader takes, and the linear rail's comment gives the argument: a guest-page writeback is a GPU command on the same single queue and `copy_image_level0_to_buffer` submits it before returning, so queue order already puts the writeback ahead of this gather and a CPU fence wait buys nothing. That is true of a **submitted** writeback and false of an owed one. A writeback debt is a frame this device rendered and deliberately did not write down: there is no command anywhere for queue order to order, and the surface's pages hold the frame before the one the resident holds. The gather bound them anyway. `settle_for_mapping`'s doc states the rule these three fell out of — the payment and the wait "are one obligation and are spelled as one function so a new site cannot discharge half of it". These three sites discharge neither, because they were removed from the settle set in `e67b330c` for the queue-order reason above, and the debt rail in `b14e0a58` then added the payment to the settle set they were no longer in. Neither commit was wrong about what it changed. The settle genuinely stays unnecessary and the exemption stays; only the payment is owed. Both comments now say which half is which, so the next reader does not delete the payment on the exemption's argument. # Where the call goes After each rail's own gates and before its window walk, which is also before `gather_witness::note_gather` — the payment writes those pages, and a witness that vouched first would vouch for bytes that changed underneath it. A rail that declines pays nothing here and needs to: every consumer below it settles, and a settle pays. `pay_for_texture` for the linear rail rather than `pay_for_mapping`, because a linear texture's bytes may alias a surface and only that call crosses the two id namespaces. It is the same call the rail's own CPU twin makes. Its `_texture_ref` parameter had no use and now has one. # Verified `the_type11_zero_copy_gather_pays_the_frame_those_pages_owe` arms a debt, drives the rail to actually take (`stable_map_pages`, and over the 64 KiB floor that is the only gate this rail has ever declined on), and asserts the ledger no longer owes. Confirmed red with the payment removed and green with it. Full `--lib` suite on the Vulkan arm: 1919 passed, 0 failed. Clippy `-D warnings` clean on `backend-vulkan,host-window` and on `backend-metal` via `--target aarch64-apple-darwin`. Not verified: no live boot, and no reading of how often a debt was outstanding at one of these three binds. The type-5 and linear rails have no test of their own here — the type-11 one covers the shared shape and the other two are one call each, placed identically. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
b9b71a0d7f |
🐛 The lazy Store published a frame the host cache went on contradicting, and the rung that reads it sits above every rung that could correct it
`crates/reims-vgpu`, x86/Vulkan and arm64 alike — the rail is `runtime/draw`, not a backend. # What the guest saw `arm_surface_writeback_debt` is the lazy type-11 Store: it records that a mapping is owed this frame, stamps the resident as holding it, and writes nothing. It is the largest measured win in this device (`REIMS_VGPU_LAZY_WRITEBACK`, default on) and it left one consumer behind. The eager Store's GPU-direct arm ends with `surface_cache::forget`, and its comment states the rule: nothing here leaves a host copy of the frame, so the surface cache must not go on naming one. The lazy arm publishes a strictly *newer* frame — `note_surface_content_published` advances the content epoch and `stamp_resident_content_epoch` marks the resident — and never touched the cache. The reader is the type-11 sampled ladder's host-cache rung. It is gated on `guest_replaced` alone, which is the *guest*-write witness and by construction cannot see a publish this device made itself, so a warm entry from the previous flush answers with no hash and no compare. That rung's own comment records the aggravating property: it sits above both rungs that read the guest's own pages, so a stale hit is never corrected by anything below it. Reachable whenever rung 0 declines while a debt is outstanding — a channel-remapping view (`t11rung_resident_swizzled`) is the clearest case, since a swizzled bind cannot take the resident directly and falls to exactly this rung. The layer then composites one frame behind until the debt is paid, which is what makes it a flicker rather than a stuck surface, and why it reads as occasional transient corruption rather than as a broken rail. # The fix was already written and had no caller `surface_cache::cede_surface_to_resident` documents this exact state — "a Store that skipped its readback has already superseded them, and a consumer served the previous frame renders a whole compositing layer one frame behind with no report" — and had no production caller anywhere in the crate. It is the right callee rather than `forget` because here the resident genuinely does hold the frame; the cession leaves the entry present, empty and re-generationed, which every reader already treats as a miss. Its contract also says a geometry this cache would not have stored must make the caller refuse to arm rather than leave a live entry beside a resident-authoritative window, so the `false` return declines the lazy rail and sends the Store down the eager one (`wbdebt_uncedable_geometry`). # Verified `arming_a_writeback_debt_stops_the_host_cache_naming_the_previous_frame`, which asserts through `get_shared_with_gen` — the accessor the rung actually calls, and the one that distinguishes a cession from a bare key removal. Confirmed red with the cession stubbed out and green with it. Full `--lib` suite on the Vulkan arm: 1918 passed, 0 failed. Clippy `-D warnings` clean on the `backend-vulkan,host-window` and `backend-metal` (`--target aarch64-apple-darwin`) arms. Not verified live: no boot has yet been taken with this in. The rung's own counters (`t11rung_host_cache` against `t11rung_resident_swizzled`) are what would size how often the stale window was entered, and that reading has not been taken. Found by an audit of "which optimizations here can hand the guest stale bytes". Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
5702597108 |
🐛 A retire forgets an object exactly as a clear does, and only one of the two told its readers
`crates/reims-vgpu` (both backends; the type is pure logic and its tests run on every arm), plus the hang-bisect harness under `scripts/app-sweep-probe/`. # The device change `BufferWriteGens` hands a reader a `(epoch, gen)` stamp and answers `quiet_since` by comparing both. The epoch exists so that a *forgetting* cannot read as "unchanged": the whole-map clear at `MAX` bumps it, and the doc says why in the direction that matters — an object forgotten silently reports a cache hit for a window whose bytes moved. `retire_task` forgot without bumping. Dropping `(5, 7)` at generation 3 and letting a later task 5 declare three writes to a later object 7 puts the counter back at 3 under an unchanged epoch, so a stamp taken before the retire compares equal to one taken after across entirely unrelated bytes. The existing `retiring_a_task_forgets_its_objects` did not catch it because it retired at generation 1 and compared against 0, which differs by luck of the count. Bumped, and only when an entry actually went — retiring a task that declared no writes must leave every other reader's stamp alone, or task teardown by itself would report every window as dirty. Nothing decides a skip on this today; it is the instrument that would license a content cache, so a false-quiet here is a wrong answer to the question "may a cache serve these bytes again". # The harness change `hang-bisect.sh` took one `NAME=value` per arm and unset three variables by name. It now accepts comma-joined pairs, so a single boot can run with every narrowing switch off at once — which is the first question to ask of a hang, and cheaper than bisecting a set that may contain no cause at all. The clear now derives its list from the environment rather than from three names written here, which could not go stale before and now cannot. # Verified `a_stamp_that_straddles_a_retire_is_not_quiet` and `retiring_an_untracked_task_leaves_every_stamp_alone` added; the first confirmed red with the epoch bump stubbed out (6 passed, 1 failed) and green with it. `cargo test --lib` filtered to the module: 7 passed. Clippy `-D warnings` clean on all three arms — `backend-metal` via `--target aarch64-apple-darwin`, `backend-vulkan,host-window` native and via `--target x86_64-unknown-linux-gnu`. Not verified: no live boot. The harness change is untested against a real arm and is exercised for the first time by the run that follows this commit. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
19585a934c |
✨ A runtime GPU hang cannot be found by sweeping a pool offline, so the blobs are filed with the time they were translated
`scripts/app-sweep-probe/collect-air.sh`, new. Host-side x86 harness. `m2v_cache::translate_air` writes each blob it is about to translate to a fixed scratch name per stage in `/tmp/reims-vgpu-m2v-cache-<pid>/`, keeping only the last one. `bugs/README.md` already describes polling that for a *translation* defect, where the pool can be swept offline afterwards and the failures fall out. That does not work for the failure being chased on macos-11. There the SPIR-V is valid, it compiles, and it then occupies the GPU past the host kernel's 7500 ms `preempt_timeout_ms` and takes a context reset. Nothing about the blob says so; the only usable question is *which shaders were translated just before the GPU stopped completing*, so this files each distinct blob with the wall clock at which it appeared and the device's own fail log supplies the other half. It works: on a macos-11 boot whose first `vk_engine_fence_timeout` landed at device t=73149 ms, the index named three fragment blobs and one vertex blob translated in one 220 ms burst at t≈68.5 s and nothing else in the preceding twenty seconds. `--out` inside the repository is refused. Every byte this writes is Apple's AIR; `bugs/` is gitignored for that reason but an arbitrary `--out` would not be, so the rule is enforced by the tool rather than by a reviewer remembering it. Verified: `bash -n`; the guard refuses a path under the repo and accepts one under /tmp; the correlation above is from a real boot. Not verified: nothing here identifies the hanging shader yet — the four correlated blobs translate to 173, 206, 630 and 785 words with **zero** loops between them, so none of them is a shader that fails to terminate, and the cause is still open. No Rust changed. |
||
|
|
9597687a42 |
🐛 A five-second sleep after killing the previous VM is not long enough for the one boot a sweep most wants to follow
`scripts/app-sweep-probe/stop-previous-vm.sh` (new), wired into `sweep-rails.sh`,
`hang-bisect.sh` and `desktop-rate.sh`. Host-side x86 harness.
All three killed the previous QEMU and then slept a fixed 5-6 s. `AGENTS.md`
already describes what a short wait does — the old QEMU still holds
`localhost:2222`, the next boot dies on
Could not set up host forwarding rule 'tcp::2222-:22'
and every other line of its output reads like a normal start — but the harnesses
were still guessing at a duration.
The guess fails in the worst possible place. A healthy QEMU is gone well inside
5 s; a macos-11 QEMU that has just taken a GPU reset is inside device recreation
and is not. That is precisely the boot a sweep follows with another one, so the
fixed sleep breaks on the rail under investigation and not on the quiet ones. It
did: in the four-rail sweep at /tmp/reims-rail-sweep3, macos-11 hung the GPU 16
times, its QEMU outlived the sleep, and **macos-12 was reported `no device came
up in 300s`** — a rail scored as a boot failure for a race with its predecessor.
The helper waits on the condition instead: process gone *and* nothing listening
on the port, SIGKILL at the halfway mark, and on giving up it names which of the
two it was still waiting for. Callers warn rather than abort, so a sweep still
runs and still says the boot was at risk.
Verified: `bash -n` on all four; the helper run standing alone with no VM up
exits 0. Not verified: it has not yet been exercised against a VM that is
actually wedged — the case it exists for — because reproducing that means hanging
the GPU again. No Rust changed.
|
||
|
|
81480edf2c |
🐛 The Launchpad leg photographed a running Screenshot.app and reported NO-LAUNCH, because the process is not called Screenshot
Two changes, both from the same sweep's artefacts. **`scripts/app-sweep-probe/app-sweep-probe.sh`.** The leg asked `pgrep -x Screenshot || pgrep -f 'Screenshot\.app'`. Neither can match: the app is a stub that launches `/System/Library/CoreServices/screencaptureui.app`, and the running process is `screencaptureui`. So the leg reported NO-LAUNCH on macos-11, macos-13 and macos-14 while its own `-launchpad-screenshot-app.png` for each of them shows the capture toolbar on screen — the step had worked every time. The check now names `screencaptureui`, keeping `Screenshot` as an alternative so a rail that does spell it that way still counts. This is the second defect in one leg: the previous commit fixed the trigger (F4 opened nothing), and with the trigger fixed the leg opened Launchpad, filtered it, launched the app — and still failed itself on the verdict. **`crates/reims-vgpu/src/runtime/drain/mod.rs`.** Comment only: records the after-measurement for the ONLINE-poll change. The same setup-to-online interval, read the same way from five macos-11 boots' own logs, now reads 1, 1, 1, 3 and 4 ms against the 2139-2365 ms before. The wait is gone rather than shortened, which is what says the divisor was the whole of it. Verified: `bash -n`; clippy clean with `-D warnings` on the host Vulkan arm (the Rust change is a comment, so the other two arms are unaffected and were green on this tree one commit ago). Not verified: `screencaptureui` has not been confirmed by name against a live guest — it is inferred from the app bundle layout and from the toolbar being visible in the captured frames. The next sweep exercises it. |
||
|
|
d96339293b |
⚡ The display waited fifty polls before it looked, and WindowServer gives up at thirteen seconds
Component: `crates/reims-vgpu`, `runtime::drain::try_display_online`. Affects every pathway; measured on x86/Vulkan, macos-11 and macos-12. `DISPLAY_ONLINE_POLL_DIVISOR` is the archive's cadence for **re-asserting** ONLINE — ~200 ms, Apple's own. It was also gating the read of the guest's enable mask, so the two questions "how often do I pulse" and "how often do I look" were one counter. `apply_setup_shared_state` zeroes `poll_ctr`, so a guest that set the enable bit immediately after registering its shared page was not observed for a full divisor. Measured as the interval between `display_shared_state_setup` and `display_online_signal` in three boots' own logs: **2365 ms, 2324 ms, 2139 ms** — fifty polls at the ~45 ms this is really called at during early boot, since the poll rides `gfx_update` and the drain and neither runs at the 4 ms heartbeat before the guest draws anything. Essentially the whole interval was this gate. That latency is spent racing the guest. macOS's WindowServer asks `AppleParavirtFramebuffer` for a mappable VRAM aperture about 13 s into boot and **aborts the process** when it does not get one: `IOConnectMapMemory VRAM failed … error 0xe00002c2` (`kIOReturnBadArgument`), then `Failed to create FB 1 of 1` and a `CGXMappedDisplayStart` assertion. The desktop then never appears for the life of the boot, while sshd answers, the key installs, and this device presents ~29 fps of a stale kernel console — so every signal the sweeps read says the guest is healthy. Onlining at 14.2 s loses that race; onlining at 11.9 s wins it. Reproduced live on macos-11 with a crash report timestamped inside the boot that produced it. The counter still advances every poll and the divisor still paces every pulse after the first. What changed is that the enable mask is now read on every poll and the first pulse goes on the poll that first observes it. Verified: `the_first_online_pulse_does_not_wait_out_the_reassert_cadence`, new, **confirmed to fail without this change** (`online_tries` 0 against 1) by restoring the old early return, running it red, and copying the file back — not by `git checkout`. Full Vulkan suite 1915 + 83 green, 6 ignored (the wire fixtures, absent on a non-Apple checkout). Clippy clean with `-D warnings` on all three arms: host Vulkan, `--target aarch64-apple-darwin --features backend-metal`, and `--target x86_64-unknown-linux-gnu`. Not verified: that this removes the WindowServer abort in practice. It removes ~2.3 s from a margin measured at ~1 s, which is the mechanism, but the abort is intermittent and banding its rate needs a run of boots — that is the next step, not a claim of this commit. The `backend-metal` tests remain unrun anywhere (no Apple host). |
||
|
|
6df477a539 |
🐛 The login-window detector tested for root, and the one login window measured here was owned by _windowserver
`scripts/app-sweep-probe/wait-for-desktop.sh`. Host-side x86 harness. The branch that types the password fired on `stat -f%Su /dev/console` being exactly `root`. That is the usual answer before anyone logs in, but it is not the only one: the macos-11 guest whose WindowServer had aborted answered `_windowserver`, measured live over ssh alongside `who` returning nothing and `pgrep -x Dock` failing. Against that guest the branch could never have fired, so the helper would have waited out its whole timeout on exactly the state it was written to fix. The test is now "is this an account a person could log in as" rather than "is it root": `root` and any leading-underscore daemon account count as nobody being logged in. An empty answer is treated as an ssh that did not land — it retries rather than typing a password at a guest it cannot see, which the previous `case` arm did by accident and this one does on purpose. Also corrects the reported state to name the console account, so a timeout says which login window it timed out at. Verified: `bash -n`. **Not verified against a live login window**, and the run that prompted this change is not evidence either way: four macos-12 boots with the helper wired in all reached a desktop, but their logs show it reported `desktop up (console user aneesiqbal)` every time — the guest autologged in on all four and the password branch never executed. The earlier 2-of-4 timeout rate is therefore still unexplained, and 4/4 must not be read as this helper fixing it. No Rust changed. |
||
|
|
e212b35cd8 |
⚡ Half of macos-12's boots stop at a login window, so the rate instrument has to log in before it can report a rate
`scripts/app-sweep-probe/desktop-rate.sh`. Host-side x86 harness. Four macos-12 boots: 2 reached a desktop, 2 timed out. Both timeouts were device-healthy — each boot's kept fail log carries `display_shared_state_setup` with a valid GPA, `display_online_signal` and `display_online_ack` at t=16-18 s, and three fail-channel lines in the whole boot, all of them normal display lifecycle. The device published the display and the guest onlined it. Nobody logged in. So the rail's autologin is unreliable at about one boot in two, and an instrument that scores that as a failure is measuring the rail's login and calling it the device. It now waits through `wait-for-desktop.sh`, which types the password when the console is still owned by root, and only what survives that is reported. `WS-CRASH` stays a separate verdict because it is the one failure in this family that is ours. Verified: `bash -n`, and the two timing-out boots' logs were read before the change — this commit's claim about them is from the artefacts in /tmp/reims-desktop-rate-12, not from memory. Not verified: `wait-for-desktop.sh` has still never driven a live login window; the next macos-12 run is its first exercise and the point of making this change now. No Rust changed. |
||
|
|
ad78417e40 |
♻️ Two sweeps waited for a Dock the same wrong way, so the rail that was waiting for a password read as the rail that never booted
`scripts/app-sweep-probe/{sweep-rails,hang-bisect}.sh`. Host-side x86 harness.
Both carried their own copy of the same `pgrep -x Dock` loop, and both copies
have the defect `wait-for-desktop.sh` was written for: they cannot tell a guest
that is still booting from one sitting at the login window, so a rail with no
autologin times out and is reported NO-DESKTOP. They now call the shared helper,
which asks the console user and types the password when that is what the wait is
for.
For `hang-bisect.sh` this is not only tidier. An arm that never reaches a desktop
drives no applications, so its GPU-hang count is a reading of an idle GPU — and
the bisect scores arms against each other by exactly that count. A NO-DESKTOP arm
silently contributes a zero that looks like the arm having fixed the hang.
Verified: `bash -n` on both. Not verified: neither script has been re-run
end-to-end since the change — a `desktop-rate` run is using the machine. No Rust
changed.
|
||
|
|
2e042621b7 |
✨ The rail that "never showed a desktop" was a window server aborting on our framebuffer, and one boot cannot tell that from a slow one
`scripts/app-sweep-probe/desktop-rate.sh`, new. Host-side x86 harness.
Boots one rail N times and reports how many reached a desktop, keeping each
boot's device fail log and, where there is one, the guest's own crash report.
The failure it exists to catch was found on macos-11 and is invisible to every
signal the sweep already reads. WindowServer aborts about 13 s into boot; the
screen then keeps showing the verbose kernel console because nothing else is
drawing. Meanwhile sshd answers, `guest-authorize.sh` installs its key and
reports Apple Events consented, the device presents ~29 fps of fresh frames, and
the fail log carries no fail-channel record at all. The guest's own crash report
is the only thing that says what happened:
IOConnectMapMemory VRAM failed: port 0x… error 0xe00002c2
Failed to create FB 1 of 1 (Failed to map VRAM)
Assertion failed … CGXMappedDisplayStart … MappedDisplay.cpp
`0xe00002c2` is `kIOReturnBadArgument`, and the refusing party is
`AppleParavirtFramebuffer` — so this is a statement about what this device
published, not about the guest.
It is intermittent, which is why this is a rate and not a boot: of the two
macos-11 boots observed so far one aborted this way and one reached a full
desktop and ran seven applications. The same `AGENTS.md` rule that governs guest
kernel panics applies — a single green run says nothing and so does a single red
one — and a `pgrep -x Dock` loop cannot distinguish "still booting" from
"WindowServer is gone", so both sweeps here have been reporting the second as the
first.
Keeping a failing and a passing boot's fail log side by side is the point: the
difference between them is the bug.
Verified: `bash -n`, and every signal quoted above was read off a live macos-11
boot (crash report fetched to /tmp, not committed — it is Apple's). Not verified:
the script has not completed a full run yet; that is the next step. No Rust
changed.
|
||
|
|
3779bad897 |
✨ A rail that stopped at the login window read as a rail with no desktop, and every signal a harness checks said it was healthy
`scripts/app-sweep-probe/wait-for-desktop.sh`, new. Host-side x86 harness. macos-12 was reported NO-DESKTOP by a four-rail sweep. It had booted. Its serial log repeats `IOConsoleUsers: ... lin 0, llk 1` and `gIOScreenLockState 3` — the login window, with nobody logged in — while sshd answered, `guest-authorize.sh` installed its key and reported Apple Events already consented, and the device presented a first frame at 1921x1079. Every signal the sweep reads says the guest is fine, because it is. The rail simply has no autologin, and `pgrep -x Dock` cannot tell "still booting" from "waiting for a password". The console user separates them for one ssh round trip: `stat -f%Su /dev/console` is `root` at the login window and the account name once a session owns the console. This waits on the Dock as the old inline loops did, and when it finds the console owned by root it types the password at the login window through QMP, host-side, because the guest cannot log itself in. Two attempts at most — the second leads with a Return for the case where the window is showing the user list rather than a focused password field — and a timeout now names which of the two states it timed out in, which the inline loop could not. The password default is the one `vm/guest-authorize.sh` already documents for these throwaway rails, overridable with `REIMS_GUEST_PASSWORD`. Verified: `bash -n`. Not verified against a live guest — macos-12 is the rail it was written for and the machine is running an unrelated bisect. `sweep-rails.sh` and `hang-bisect.sh` are not yet wired to it; that is deliberate, since editing a running bash script corrupts it and the bisect is mid-flight. No Rust changed. |
||
|
|
abe10c1a39 |
🐛 The hang bisect died on its first leg, and the freeze detector it needed was switched off by the same flag that was not passed
`scripts/app-sweep-probe/app-sweep-probe.sh`, host-side x86 harness. Three defects, all found by running the probe the way `hang-bisect.sh` runs it. **It aborted after the first application.** `run_app` declared `hash` with `local` and then assigned it only inside `if [ -n "$SHOTS" ]`, so with no `--shots` the read at the stall check hit `set -u`: `line 218: hash: unbound variable`. Every arm of a bisect would have reported one leg and a truthy `freezes=0`, which reads as the arm passing. `shot` and `hash` are now initialised at declaration. **The stall detector was gated on where the frame is filed.** Comparing this app's frame to the previous app's is the probe's only evidence for a host window that has stopped updating while the census keeps ticking from another thread — which is exactly the macos-11 symptom the bisect exists to count. It ran only when `--shots` asked for the frames to be kept. The frame is now always taken, into `$WORK`; `--shots` chooses whether it is also copied out. **The Launchpad leg was not opening Launchpad.** F4 is the glyph on an Apple keyboard, where the key sends a HID consumer usage; QMP's usb-kbd sends the plain F4 keycode, which macOS has bound to nothing. Photographed on macos-13 and macos-14 in `/tmp/reims-rail-sweep/shots`: the desktop is unchanged across the F4, and the eight characters typed after it went into a Maps dialog that was still frontmost. The leg has been reporting `present_hz` for a static modal on both rails, under a comment asserting F4 was "the stock Launchpad binding on every rail here". It now opens it through LaunchServices (`open -a Launchpad`), which behaves the same on all four rails and needs no Apple Events consent, and it hashes the frame either side of the trigger: a full-screen blur that leaves the frame identical did not happen, and is reported as the new `NO-LAUNCHPAD` rather than folded into `NO-LAUNCH`. Verified: `bash -n`. Not verified: the `open -a Launchpad` route has not yet run against a live guest — the next bisect boot is its first exercise. No Rust changed, so no clippy or feature-matrix arm is affected. |
||
|
|
0894904948 |
⚡ A guest run that crosses a seam between two chunks of one RAMBlock is split at it, not refused at it
Component: `crates/reims-vgpu` — `runtime::guest_ram_map::references_for_runs`
and a private `Resolved::import_end`. Follow-up to `aba27790`, which began
importing each RAMBlock in chunks.
Chunking introduced one new decline. A `GuestRef` is an offset into a single
import, so a stretch the guest laid out as one GPA-contiguous run cannot be
described by one reference when it crosses the seam between two chunks:
`slice_for_gpa` refused it with `SliceEndPastImport` and `references_for_runs`
propagated that, dropping the **whole window** to the copying rail.
That was safe — a named decline, and the copying rail lands identical guest
memory — but it is a chunk size the guest cannot see leaking into this device's
throughput. A run is a guest allocator granule, so the chance any one of them
straddles a 2 GiB seam is about 1 in 131 000; a full-surface writeback walks
several hundred, which puts it near one writeback in 250.
The seam is now split rather than refused. Consumers already take a list of
runs, and a RAMBlock boundary has always been able to produce one, so two pieces
here are indistinguishable from two the guest's own page plan produced.
The loop makes progress on every branch: where an import ends past the current
address the piece is at least one byte long, and where nothing backs the address
the whole remainder is handed to `reference` so it names that refusal rather
than this loop inventing a second one. So it cannot spin, and it cannot ask for
a zero-length reference.
`import_end` is deliberately private. An import boundary is this module's own
bookkeeping and the only thing outside it may do with one is stop at it.
Verified: two new tests. `a_run_crossing_a_chunk_seam_is_split_and_the_pieces_
tile_the_window` asserts the tiling rather than the piece count — "two runs"
would still pass with the second one starting in the wrong place — and that the
two pieces name different imports, so a split that stayed inside one import
could not satisfy it. `a_run_inside_one_chunk_is_not_split` is the negative
control, without which an implementation that split every run in half would
pass. Confirmed the first fails without the change by stubbing the piece end to
the window end (file copied aside and copied back, never reverted through git):
it fails with exactly the refusal this commit removes,
`OutsideImport(SliceEndPastImport { end: 536875008, import_len: 536870912 })`,
while the negative control passes in both arms.
`cargo test -p reims-vgpu --no-default-features --features
backend-vulkan,host-window -- --test-threads=1`: 1997 passed, 0 failed. Clippy
`-D warnings` clean on all three arms.
Not verified: no live boot has been taken with this specific change, and the
rate above is arithmetic from the granule size rather than a measured
`guest_ram_map_*` counter delta. Nothing counts seam splits yet; if the rate
ever matters, that counter is the thing to add.
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|
|
bccf1f6004 |
🐛 A rail reported its desktop as 1920x24 and the probe drove it anyway
Component: `scripts/app-sweep-probe/`. Host-side harness only. `qmp.py size` reads QEMU's `DisplaySurface`. Under the host-owned window that is not the surface the guest draws into — it only *usually* still carries the right dimensions, which is the documented reason sizing is exempt from the screenshot ban. On macos-11 it reported **1920x24** for a fully composited desktop, and the sweep took it: the whole seven-application run drove a geometry that no result can be attributed to, and said `display=1920x24` in its own header without anything treating that as a problem. The size is now retried, and if it stays implausible the probe falls back to the device's own published scanout size — `host_window_start id=1 WxH`, which is what this device told the window system and the strongest available statement about how many pixels the guest has. The header names which source won, because a run driven against a fallback geometry is a different measurement from one driven against the guest's own, and a reader should not have to guess which they have. If neither source answers, the run refuses rather than driving blind. The 400-row floor is not tuned: it sits far below any desktop these rails boot at and far above the degenerate values seen, so it separates the two without the probe needing to know the rail's real size. Verified: `bash -n`, and the fallback pattern parses `1920x1080` out of a real boot's fail log. Not verified: the fallback arm has not yet been exercised on macos-11 itself — the rail sweep that found this is still running and a second VM beside it would measure contention. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
07a6110090 |
✨ Which rail of this device hangs the host GPU, counted by the kernel and bisected with the narrowing switches
Component: `scripts/app-sweep-probe/hang-bisect.sh`. Host-side harness only. A macos-11 sweep put six of seven application legs at FREEZE, and the cause is not a wedge in this device: the host kernel is resetting the GPU — `i915 … GPU HANG: ecode 12:1:85dff5fb … context reset due to GPU hang`, fourteen times in four minutes, the same ecode every time. The device survives each one by recreating, so the guest keeps running, but every recreate loses the writebacks in flight (`render_store_lost`, `wbdebt_pay_lost`) and stalls the drain for ten to twenty seconds. That is what the FREEZE verdict measured. The device's own log cannot name the submission that hung: by the time anything is observable the fence has already failed with `ERROR_DEVICE_LOST` and the batch is gone. So the instrument is the kernel's hang count per arm, and the arms are the `REIMS_VGPU_*` narrowing switches — each turns a rail off without turning anything on, which is the only direction AGENTS.md allows an override to move. Two things it does that a hand-run A/B here has got wrong before: the arm is exported rather than passed as argv, because a command line naming the arm is matched by the next round's own `pkill -f`; and the capability line is read back from the boot's log into the results table, so an override that was silently ignored cannot be scored as an arm that ran. Verified: `bash -n`. Not verified: not yet run — the rail sweep that motivated it is still going, and running a second VM beside it would measure the contention rather than the device. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
30b035b9ec |
✨ The loop around the app sweep, carrying the four rules a hand-run rail sweep has got wrong
Component: `scripts/app-sweep-probe/sweep-rails.sh`. Host-side harness only. `app-sweep-probe` judges one boot. This is the loop across rails, and everything it does beyond looping is an AGENTS.md rule that a hand-run sweep has previously got wrong: - the panic verdict outranks the probe's, because a guest kernel panic can land *after* the probe reports success — so the boot's own stdout is grepped for `guest kernel panic` after the probe, and reported per rail beside its exit; - the wait is on the fail log and not on ssh, because the previous boot's QEMU outlives its script long enough to hold localhost:2222, and a new boot that loses that race dies on the hostfwd rule while ssh answers at once from the *old* VM — which attributes every number to the wrong guest; - one character of the pkill pattern is bracketed, or the pattern matches the shell issuing it; - every rail is authorized, because only macos-13 carries the ssh key and BatchMode turns a password rail into a silent 'not up yet'; - the Dock is waited for, because sshd answers well before the desktop composites and a probe started at port-open photographs the progress bar. Verified: `bash -n`. Not verified: this commit is the runner only; its first real sweep is the next commit's evidence. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
87552c3490 |
🐛 The black-frame guard was measuring the alpha channel, so it read a solidly black boot as max=255 and waved it through
Component: `scripts/screenshot-when-kde-plasma-host/`. Host-side harness only; no device change. The guard exists so a black capture is never read as evidence that the guest rendered black. It could not fire, and the cost was immediate: a whole driven boot of a solidly black window was captured seven times, measured "max=255 mean=63.7673 colors=30" each time, passed as good frames, and used to judge a six-application rail sweep that reported `ok` for every leg. Two independent faults, and fixing either alone still passes a black frame. **It measured alpha.** `%[fx:maxima]` and `%[fx:mean]` are taken over every enabled channel, and spectacle writes RGBA with fully opaque alpha. On a black frame that is max=255 and mean=63.75 — which is 255/4, three zeroes and an opaque alpha, and the give-away that it was never looking at the picture. `-alpha off` makes both numbers describe what is on screen; the same capture then reads max=22, mean=0.024. **max is the wrong statistic even with alpha off.** A black *window* capture is not uniformly black: the corners are rounded and anti-aliased against the desktop behind them, so max=22 is still over the max<=8 threshold and would have passed a second time. Its 717 non-black pixels out of 920 320 are all corner artifacts. So there is now a second arm on `mean`, threshold 0.5. The margin is wide in both directions: the black capture is 0.024, twenty times below; a composited desktop measures 94-99, two hundred times above; and the darkest frame worth keeping — a macOS boot screen, black but for the Apple logo — is around 1.0 by that logo's area and brightness alone. The two arms report separately, because "nothing bright anywhere" and "black but for a handful of edge pixels" are different failures and the message should say which. The die message now also names the device as a possible cause. It listed only capture-path explanations, and this week the cause was the device: guest RAM was being gathered as garbage through a truncated host-pointer import. Verified against three real captures: the archived black boot (max=22 mean=0.0244) is refused by the new arm; a live composited Ventura desktop (max=255 mean=98.9) passes end to end through the real script; `bash -n` clean. Not verified: no synthetic frame near the 0.5 boundary was constructed, so the threshold's headroom is argued from the three measurements above rather than bisected. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
aba27790f7 |
🐛 A fourteen-gigabyte import gave a two-gigabyte window and the driver said nothing, so three quarters of guest RAM read as garbage and the screen was black
Component: `crates/reims-vgpu` — `caps::host_pointer`, `runtime::guest_ram`, `runtime::guest_ram_map`. The x86/Vulkan and arm64/Vulkan pathways; the Metal-direct arm does not use `vkAllocateMemory` and is untouched. ## What was wrong This device imported each guest RAMBlock as one `vkAllocateMemory`. `VkMemoryAllocateInfo::allocationSize` is a `VkDeviceSize`, so a 14 GiB import is a legal request and Vulkan has nowhere to say otherwise. Mesa's Intel driver truncates it to 32 bits on the host-pointer import path. The readable window is exactly `allocationSize mod 2^32`, and every byte past it reads back unrelated data. Nothing in the API surface objects: `vkAllocateMemory` returns `VK_SUCCESS`, `vkCreateBuffer` accepts a buffer far larger than the window (it does not police `maxBufferSize` either), `vkBindBufferMemory` accepts the pair, and only the reads are wrong. A 14 GiB RAMBlock therefore gave a 2 GiB window. Roughly three quarters of this guest's RAM gathered as garbage, and the host window on this machine was **solidly black** for a whole boot while the guest ran fine, ssh answered, the Dock came up, and the device reported presenting 20-32 frames a second from guest residents. No counter could see it: the gather's only integrity check is `covered == src.total_len`, and the regions were the right size, they just moved the wrong bytes. Not one import-related refusal appeared in the log. ## The measurement Bisected at 4096-byte granularity with a standalone `ash` probe against the live GPU. Sizes whose value mod 2^32 is non-zero are accepted and readable only up to that remainder — 5 GiB gives 1 GiB, 6 GiB gives 2 GiB, 7 GiB gives 3 GiB, cliff exactly at the remainder each time. A size that is an exact multiple of 2^32 is rejected outright with `ERROR_INVALID_EXTERNAL_HANDLE` (largest accepted 0xFFFFF000, smallest rejected 0x1_0000_0000). Identical on all five memory types, on both anonymous and memfd backing, and on both the `vkCmdCopyBuffer` and compute-dispatch gather rails. Chunked imports of the same pages read correctly at every offset. Out-of-bounds reads are **not** reliably zero — one returned the sentinel of a different page of the same import — so zeroes are not a detection signal and nothing could have been gated on them. ## The fix `caps::host_pointer` publishes a `span_max`: the largest single import this device will ask any driver for. It is the minimum of `maxMemoryAllocationSize` (1.1 core), `maxBufferSize` when the device is 1.3 — a real limit this crate was violating and never read — and `IMPORT_SPAN_CEILING`, masked to the import granularity. `guest_ram_map` then imports each RAMBlock in chunks no larger than that. Chunking needed nothing else: a window already resolved against whichever import backs its GPA, and one straddling two of them already grouped into two `VkBuffer` sources, because a RAMBlock boundary could always split one. `IMPORT_SPAN_CEILING` is 2 GiB rather than the measured 4 GiB − 4096: it is a power of two so splitting is a shift, it cannot land on the one size that fails loudly, and it costs nothing to be wrong about — chunking is invisible to a driver that handles the full size, which simply receives more, smaller allocations it would have accepted anyway. Deliberately not a driver-name branch, which AGENTS.md forbids and which would leave every other truncating driver broken. `Resolved::reference` is now a binary search over gpa-sorted imports instead of a linear `find`. That is not tidying: chunking takes an ordinary guest from 4 imports to 10, and this runs once per run of a scattered window — 9 to 32 runs a bind, thousands of binds a second — so a scan would have traded this host's correctness for the dGPU rail's throughput. The count now stops mattering. `guest_ram_map`'s own doc named these two as the blockers to chunking; both are answered, and `ImportExceedsHeap`'s note is corrected to say what is left ( eviction, which a 70 GiB heap against a 16 GiB guest cannot measure). ## Verification Live boot, macos-13 rail, x86/Vulkan on Intel Arrow Lake / Mesa ANV 26.1.5. Before: `host_pointer_import=supported`, 4 imports, largest 14336 MiB, host window RGB max=22 mean=0.02 — black. After: 10 imports, largest 2047 MiB, host window RGB max=255 mean=98.8 and a correct Ventura desktop, byte-comparable with the same boot's `REIMS_VGPU_GUEST_IMPORT=off` reference, which was the only way to get a picture on this host before this change. Three new tests: `chunking_tiles_the_block_exactly` (walked rather than compared against a hand-written list, because an expected list carries the same off-by-one as the code), `no_import_is_longer_than_the_span_the_backend_published` (asserts the length rule on every import, not the chunk count, which is only a consequence), and `a_chunked_block_resolves_at_every_boundary_and_still_refuses_the_hole`. Confirmed the last one catches a broken search by weakening `<=` to `<` in `partition_point` (file copied aside and copied back, never reverted through git): it fails. `cargo test … backend-vulkan,host-window -- --test-threads=1`: 1995 passed, 0 failed. Clippy `-D warnings` clean on all three arms. Not verified: only this one driver was measured. RADV, NVIDIA and MoltenVK each need their own reading before anything is claimed about them — the fix is correct on them regardless, because it only narrows what is asked for, but the *defect* is one driver's. Writes through the import were not tested, only reads; the truncation is in the allocation, so writes past the window are presumably also lost, but that is inference. No rail other than macos-13 has been booted with this yet. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
72ac1cb778 |
🐛 A hundred-byte bind could read the twenty-eight bytes of the bind before it, and the safety net that was supposed to stop it was clamping against the bucket
Component: `crates/reims-vgpu` Vulkan engine — storage-buffer descriptor writes on both the draw path (`exec`) and the compute path (`exec_compute`). Affects every Vulkan host; not driver-specific. ## What was wrong Both paths wrote `range(vk::WHOLE_SIZE)`. A staged bind's `VkBuffer` is created at a **power-of-two bucket** at least as large as the bytes written, and `write_staging` deliberately does not zero the tail — so a 100-byte bind lands in a 128-byte buffer whose last 28 bytes are still the previous tenant's. `robustBufferAccess` is enabled, but it clamps against the **descriptor range**. With `WHOLE_SIZE` that range is the whole bucket, so those bytes are in bounds of the binding and there is nothing to clamp: a shader reading past its own declared object gets another guest draw's constants. Commit 0005766b's body rests the extent-narrowing rail on the opposite claim — "`robustBufferAccess` bounds-clamps an over-read rather than leaving it undefined, so the failure mode is visibly wrong rather than unsound". It was not clamping, and stale bytes from an unrelated bind are strictly harder to see than zeroes. Exposure is bounded by `next_pow2(len) - len` and stays inside device-private pool memory, so this is guest-to-guest, not a host out-of-bounds. ## The fix One helper, `exec::descriptor_range`, used by both paths: the descriptor gets the bind's own length. Zero keeps `WHOLE_SIZE`, because a zero `range` is not a legal descriptor and a zero-length storage bind is degenerate either way. Stated consequence: for an SSBO whose last member is a runtime array, `OpArrayLength` now derives from this range rather than from the bucket. That is the true size of what was staged, so it is the answer the shader should have been getting. The two paths moved together, in one function, because a range that is exact on one of them and not the other is the same bug with half the coverage. ## Verification New GPU test `a_short_bind_cannot_read_the_tail_of_the_slot_it_was_given` in `tests/vk_engine_compute.rs`, with a purpose-built SPIR-V kernel that loads word 30 — byte 120, inside a 128-byte bucket and outside any bind shorter than 124 bytes — and stores it at word 0. The fixture dirties the bucket with a 128-byte bind of `0xAA`, then binds 100 bytes of zeroes into the slot the free list hands back. Confirmed it catches the defect rather than passing for another reason: with `descriptor_range` stubbed back to `WHOLE_SIZE` (file copied aside and copied back, never reverted through git) it fails with **`returned 0xaaaaaaaa`** — the previous bind's bytes, read on real hardware. That also rules out the one way the test could pass vacuously, a slot that was never reused. Measured on Intel Arrow Lake / Mesa ANV 26.1.5 only. The pooling and the descriptor write are host-independent, but the observation is one driver's. `cargo test -p reims-vgpu --no-default-features --features backend-vulkan,host-window -- --test-threads=1`: 1992 passed, 0 failed — the GPU-touching parity and compute suites included, so exact ranges did not break any existing draw. Clippy `-D warnings` clean on all three arms. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
1adb8d0623 |
🐛 A pipeline resolution outlived the address space it was resolved in, and three packets that say so retired the wrong map
Component: `crates/reims-vgpu` runtime — `pipeline_resolve`'s memo of resolved
render pipelines. Guest-facing on every pathway; the memo is on by default
(`REIMS_VGPU_PIPELINE_MEMO`).
## What was wrong
The memo is keyed `(task_id, pipeline_ref)` and its identity was three
`ListObjectEntry` values — `{object_type, descriptor_length, descriptor_gva}`
for the pipeline object and both function objects. That is a complete identity
only *within one address space*: the same GVA under two page-table roots names
two different physical descriptors, and `read_identity` never dereferences
`descriptor_gva` to notice.
The memo's only invalidation was `forget_all()`, from `device_reset`. Three
packets move a task's address space out from under it, each retiring the sibling
bound-buffer registry and leaving this map standing — and two of them carry
comments stating precisely the rule they were violating:
- `apply_delete_task` — "the task's GVA space goes with it"
- `apply_set_object_list` — "no resolution keyed by reference survives it"
- `apply_define_task2` — "every GVA this task resolved through the old one may
translate elsewhere now"
This memo *is* a resolution keyed by reference. A false hit serves the previous
incarnation's `Arc<CachedShader>` pair and its `VertexBindPlan` — wrong shaders
and a wrong vertex-attribute bind plan — counted as a `pipe_memo_hit`. The
redefine case is not hypothetical: `define_task_redefined_live_new_root` is
counted in `model::state`, with the in-tree note that macOS 13 does not do this
and macOS 26 does.
`TaskEntry::define` zeroing `object_list_pfn` partly hid it — lookups miss until
the guest republishes a list — but every stale entry for that task id stays in
the map, aged out only by the 1024-entry insertion-order eviction.
## The fix
The identity now carries the task's `directory_pfn`, `object_list_pfn` and
`object_list_count` alongside the three entries, so a lookup made under a
different root simply fails to match.
Carried rather than invalidated deliberately. Adding a fourth call site beside
those three would leave the same shape of bug waiting for a fifth packet;
carrying the coordinates means there is no call site to remember, which is
AGENTS.md's "make the invariant unrepresentable" over a rule enforced by review.
The fields are already in `TaskEntry`, so it costs one map lookup and no extra
guest reads.
Deliberately not distinguished: a task deleted and recreated with the same id,
root, object list and identical entries. The entries are re-read through the
current root on every check, so such a task genuinely resolves to the same
pipeline. The module doc's two documented gaps — a descriptor or an MTLB
rewritten *in place* — are unchanged.
## Verification
New test `the_task_address_space_is_part_of_the_identity` republishes a
byte-identical object list at a different page, which is what
`apply_set_object_list` does. It asserts first that the three entries alone
cannot tell the two lists apart — without that the second assertion could pass
for an unrelated reason — and then that the identity differs. Confirmed it fails
without the change by stubbing the space to zeroes (file copied aside and copied
back, never reverted through git); it fails on exactly the second assertion.
`cargo test -p reims-vgpu --no-default-features --features
backend-vulkan,host-window -- --test-threads=1`: 1991 passed, 0 failed.
Clippy `-D warnings` clean on all three arms.
Not verified: no live-VM boot. The x86 host this was written on cannot currently
display a guest frame at all for an unrelated reason (an ANV host-pointer import
defect, being fixed separately), so no driven boot can yet judge pixels or
compare `pipe_memo_hit`/`pipe_memo_stale` before and after. The claim is the
identity and the test that pins it.
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|
|
e606b23caf |
🐛 The bind cache was keyed on a heap address it had already let go of, and one draw in eight could be handed another draw's bytes
Component: `crates/reims-vgpu` Vulkan engine — `pools::cb_bound_buffers`, the
per-command-buffer memo of buffer binds already staged or gathered. Affects both
x86/Vulkan and arm64, any host: it is a host-allocator lifetime bug, not a
driver one.
## What was wrong
The memo is keyed on `(Arc address, length)` of the bind's content and stored a
bare `BoundBuffer`, which is `Copy` and owns nothing. Its justification was that
"the runtime holds one `Arc` per resolved `(task, reference, offset)`".
That is true of the `GuestRuns` arm, whose `Arc` lives in the bound-buffer
registry. It is false of the `Bytes` arm: `BufferContent::from(Vec<u8>)` is
`Arc::new` per bind over a freshly read span, and the owning `DrawRequest` is a
local that drops before the next draw is built. The memo, however, lives to the
end of the command buffer — up to `BATCH_MAX_DRAWS` = 32 draws.
`ArcInner<Vec<u8>>` is a fixed 40-byte allocation whatever the payload, so the
allocator hands the freed address straight back. Draw N stages a CPU-read span
of length L into slot S and records `(P, L) -> S`; draw N's request drops,
freeing P; draw N+1 reads a *different* span of length L, its fresh `Arc` lands
at P, the lookup hits, and draw N+1 renders through draw N's bytes — counted as
a `buffer_bind_reuses` win. `Arc<Vec<GuestRun>>` is the same 40-byte size class
and the key carries no variant tag, so a `Bytes` key could also collide with a
freed `GuestRuns` key and be served a gathered device-local buffer for an
unrelated window.
Reachability is not marginal. `zc_buffer_below_floor` is 19 218 against 126 693
gathered on a driven boot — about one bind in eight takes the CPU `Bytes` path —
and nothing excludes such a draw from batching. Extent narrowing then sized
those staged reads to the shader-declared object size, median 64 bytes and max
512 across the captured blobs, so the `len` half of the key collapsed onto a
handful of values and stopped discriminating. This is the intermittent
corruption class: transient, content-dependent, and invisible to every counter.
## The fix
`CbBind` pairs the identity with a strong reference to the allocation that
identity names, and `note_cb_bound_buffer` takes it **by value**. There is no
longer any way to record an entry without handing over the `Arc`, so a new call
site cannot reintroduce this — a raw `(usize, u64)` never reaches the map's API.
Cost is one `Arc` clone per bind, two atomics, against a bind that already
hashes and probes a map.
It closes the `GuestRuns` variant of the same class for free: after a registry
retirement the re-walk cannot land on the held address, so it misses and
re-resolves instead of being served the pre-retirement window.
`CbBindOwner`'s payloads are never read and carry an `#[allow(dead_code)]` with
that stated — they contribute a `Drop` time, not a value.
The crate already states this rule correctly twice, in `caches.rs`'s
`ShaderDigestIndex` ("drop the `Arc` from the entry and this becomes a
use-after-free dressed as a cache hit") and in `buffer_gather_working_set`,
which is keyed identically and says it does not owe the `Arc` because it is
measure-only. This map is looked up for a bind and did owe it.
## Verification
New test `a_remembered_bind_holds_the_allocation_its_key_names`. Confirmed it
fails without the change by stubbing the insert to drop the owner (file copied
aside and copied back, not reverted through git), and that the pre-existing
`a_remembered_bind_does_not_survive_the_three_things_that_end_it` passes in both
arms — so the lifetime test never covered identity. Asserted through a `Weak`
rather than by provoking a collision: a test that frees an address and allocates
again is at the allocator's discretion and would be flaky in the direction that
reads as passing.
`cargo test -p reims-vgpu --no-default-features --features
backend-vulkan,host-window -- --test-threads=1`: 1990 passed, 0 failed.
Clippy `-D warnings` clean on all three arms — vulkan/host-window (host),
`--target x86_64-unknown-linux-gnu`, and `--target aarch64-apple-darwin
--features backend-metal`.
Not verified: no live-VM boot has been taken with this change yet, and no
before/after counter comparison of `buffer_bind_reuses` exists — the x86 host
this was written on cannot currently display a guest frame at all for an
unrelated reason (an ANV host-pointer import defect, being fixed separately), so
a driven boot cannot yet judge pixels. The claim here is the lifetime invariant
and the test that pins it, not a measured change in output.
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|
|
7c0435cea7 |
✨ Launchpad is three loads, and photographing the blur skips the two that matter
Component: `scripts/app-sweep-probe/`, host-side probe harness. No device change. The Launchpad leg opened the layer, photographed it and pressed Escape. That captures the full-screen blur and nothing else, and the blur is the easiest of the three things Launchpad does. It now types `screenshot` into the search field — which has focus the moment Launchpad opens, so no click is needed — and presses Return. Two loads the photograph missed: - the grid re-filters live on every keystroke, icons fading out and the survivors re-laid-out, once per character; - Return launches Screenshot.app out of the blurred full-screen layer while that layer tears down underneath it. A real app launch out of a full-screen composite is the step that has to survive; the static blur is not. Two screenshots now, `-launchpad.png` and `-launchpad-screenshot-app.png`, so the two states are separable when one of them is the wrong one. New verdict NO-LAUNCH, asked *before* the Escape that tears the capture UI down rather than after — `pgrep` for Screenshot is the only evidence that the Return landed on Screenshot rather than on whatever else the grid had filtered to. It is not a device failure, but it is not a pass either: it means the leg's whole point did not happen and the counters are a blurred desktop's. Screenshot.app presents a floating capture bar rather than a window, so it is dismissed with Escape, not Command-Q. Verified: `bash -n`. Not verified: no rail has run this leg yet. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
9dba0338ed |
✨ Six stock applications and a tab-churning Safari, judged on the census that stops rather than the one that complains
Component: `scripts/app-sweep-probe/`, host-side probe harness. No Rust or QEMU change; nothing in the device moves. Every probe in this tree drives one motion of this repository's own choosing — `window-drag-probe` repositions a window, `sustained-animation-probe` runs a rAF loop, `spotlight-probe` opens one panel — and all three measure throughput. None answers whether an ordinary user opening ordinary applications gets a freeze or a panic, which is the question a rail sweep has to answer. The six targets are not interchangeable stressors. Safari is layer-backed compositing and tab churn; Maps is the only stock app holding a high-frequency render loop open with no user input; App Store populates a collection view asynchronously so its draws arrive in bursts separated by real idle; Contacts is a vibrancy sidebar; Reminders is list animation and sheet presentation; and Launchpad blurs the entire desktop, which is the largest single composite these guests perform. Three verdicts, and they fail differently: - FREEZE is a gap in `drain_duty` wider than 8 s. Every census in this device is written at the *end* of a drain tranche, so a drain thread that never returns emits nothing while `display_vbl` and `host_window_loop` keep ticking from other threads — the boot then reads healthy. The gap is measured from each line's own `t=`, device milliseconds, never from the host clock. - GUEST-GONE is the guest not answering ssh. The panic verdict itself stays with `vm/boot-x86.sh`, which owns the serial log and exits 126; this probe supplies the evidence, not the name. - STALL is two different applications photographing byte-identical. A latched compositor is invisible to every counter this device has, and only the screenshots can see it — which is why they are hashed rather than left for a human to leaf through. Driving is host-side over QMP's usb-tablet and usb-kbd, per AGENTS.md: a guest-side probe does not degrade on macOS 26, it fails to build. Launching is the one step that still needs ssh, and it is bounded by `timeout` so its failure reports as a launch failure rather than as a device result. `present_hz` is reported per app but is explicitly not a ranking instrument here — AGENTS.md records that a bursty interaction probe measures the gaps between its bursts, so these rates must not be quoted against a code change. Verified: `bash -n` on the shell, and the reducer run against a captured driven boot log from `journal/`, where it returns a 1.0 s worst gap over 76 drain censuses and 65 cadence lines with 0 alarms — i.e. it reads a healthy boot as healthy. Not yet verified: no rail has been swept with it, and no FREEZE or STALL verdict has been observed firing against a known-bad boot. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
20c4cfeeb2 |
Merge pull request #38 from steelbrain-bot/fixture-watch-never-stale
Make rebuilds faster |
||
|
|
5b9ec53510 |
⚡ A rerun-if-changed naming a file that is not there is dirty forever, and the fixtures are not there on any checkout without a Mac
`crates/reims-vgpu-wire`, build script only. No product behaviour changes, no
guest-visible path is touched, and the emitted `cfg`s are the same ones for the
same inputs — this changes only which paths cargo watches to decide staleness.
## What was wrong
`oracle/fixture_presence.rs` is `include!`d by both `reims-vgpu-wire/build.rs`
and `reims-vgpu/build.rs`. It emitted `cargo:rerun-if-changed` for
`fixtures/fixtures.json` and `fixtures/inventory.json` unconditionally, whether
or not they exist, with a comment saying cargo re-runs on a watched path
appearing as well as changing. That much is true. What it does not say is what
absence costs.
Cargo cannot stat a missing watched path and reads that as changed, so the build
script was dirty on **every** invocation:
dirty: FsStatusOutdated(StaleItem(MissingFile {
path: ".../crates/reims-vgpu-wire/fixtures/fixtures.json" }))
A dependent's fingerprint includes its build script's, so this recompiled
`reims-vgpu-wire`, `reims-vgpu` and `reims-vgpu-paging` from scratch every time.
The fixtures are gitignored and only an Apple host with `scripts/wire-oracle`
produces them, so the permanently-dirty state is the state every non-Apple
checkout is in — the `fixtures/` directory does not even exist here.
Two things kept it from reading as a bug. It is invisible from inside the Rust
suite, since a full rebuild is a slow green run rather than a red one. And
`vendor/qemu/hw/display/meson.build` declares the staticlib `build_always_stale`
on purpose, so cargo is meant to be the incremental decider for a boot and
nothing upstream of it looked wrong. `vm/boot-x86.sh` therefore paid a ~28 s
recompile before every single boot, which on a rail sweep is minutes of wall
clock buying nothing.
Worth stating plainly: this is a test-only fact. The `cfg`s it emits are read by
`#[cfg_attr(..., ignore = "…")]` on the layout-truth tests and by nothing else.
But a build script is per package, not per target — cargo runs it for every
build of that package whatever the profile, and `cargo:rustc-cfg` reaches the
lib and the test binaries alike. There is no way to probe only when tests are in
the target set, so the shipping staticlib pays for it and must not be made
stale by it.
## What changed
- A fixture file is watched by name only when it is on disk.
- When one is absent, the *containing directory* is watched instead — or that
directory's parent when the directory itself is absent, which is the usual
case here. A directory's recorded mtime moves when a file is created inside
it, so the property the by-name watch was for survives: a capture taken after
a build is still picked up without a manual touch.
- The climb stops after one level, so a `REIMS_WIRE_FIXTURES_DIR` pointing into
a tree that does not exist watches nothing rather than handing cargo some
large ancestor to walk recursively.
The comment at the site now records what absence costs, since that is the half
that was missing and the half that will be re-broken otherwise.
## Verification
All four states exercised by hand on Linux x86_64, from a cold build each time,
with `cargo build --release -p reims-vgpu --no-default-features --features
backend-vulkan,host-window`:
| state | result |
|---|---|
| fixtures absent, built twice | second build `Finished in 0.05s`, no recompile (was a full ~28 s rebuild) |
| `fixtures.json` created afterwards | rebuild triggered, `--cfg wire_fixtures` reaches both crates |
| steady state with a fixture present | no-op |
| `fixtures/` removed again | rebuild triggered, cfg gone |
Through the boot's own path, `scripts/qemu-build --target x86_64 --backend
vulkan` on an unchanged tree now completes in **0.58 s** total: cargo
short-circuits in 0.09 s, meson's `cmp -s` sees the staticlib is byte-identical
and skips the copy, so ninja does not relink QEMU either. The option ROM builder
that `vm/boot-x86.sh` also runs unconditionally was already incremental at
0.08 s and was never part of this.
Clippy with `-D warnings` clean on all three arms: the Vulkan host arm, the
cross-compiled `aarch64-apple-darwin` / `backend-metal` arm, and the explicit
`x86_64-unknown-linux-gnu` arm.
## Not verified
No test covers this. A build-script staleness property is not reachable from
either suite, and the instrument that could see it would have to read the build
script as text, which `AGENTS.md` bans outright. The doc comment at the site
carries the invariant instead.
Not run on an Apple host, so the fixtures-present arm was exercised only with
files stood up by hand, never against a real `scripts/wire-oracle` capture. The
Metal arm was compiled, not booted, and no VM was booted for this at all — the
staticlib is byte-identical either way, which is what `cmp -s` skipping the copy
demonstrates.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
6e75ae3e8a |
Merge pull request #34 from steelbrain-bot/compatibility-maxing
Compatibility fixes |
||
|
|
de37dc579b |
🐛 The census line named its fields by hand and had fallen thirty-five counters behind the vocabulary
`crates/reims-vgpu`, Vulkan pathway, observability only — no product behaviour
changes and no guest-visible path is touched.
## What was wrong
`engine_counters!` generates the atomic struct, the snapshot, the reset and the
delta from one list of names, precisely so a counter cannot half-exist. The
line that *prints* them was not generated: `census::emit_engine_delta` carried a
hand-written format string naming 58 fields, against a vocabulary of 102.
So 44 counters were incremented correctly by product code and printed nowhere.
Nine of those are legitimately absent — they are absolute high-waters that
`registry_pressure` prints beside the prose explaining each — leaving **35 rate
counters that no boot could be asked for**. A counter in that state reads
exactly like a code path that never runs, which is this module's own documented
trap for a missing `delta_since` arm, one step further along.
That cost real work: a twelve-boot interleaved A/B was running to read the four
`dynstate_*_held` counters and could not have answered its own question, because
all four were among the 35. It was stopped rather than finished.
## What changed
- `engine_counters!` gains a fourth group, `pool_levels`, holding the nine
high-waters and instantaneous levels. It is merged from `ResourcePools` like
`pool_sourced`, but `delta_since` now **carries these through unchanged**
rather than subtracting: a high-water minus an earlier high-water is not a
high-water, and it reads as a plausible zero once the true maximum is behind
the window.
- The macro generates `CounterSnapshot::delta_fields`, one `(name, value)` per
rate counter in declaration order, `pool_levels` excluded.
- `emit_engine_delta` walks that instead of naming anything. The line now
carries every rate counter, 94 fields, and cannot drift from the vocabulary
again — this is "derive, don't duplicate and compare" from `AGENTS.md`, with
the second spelling deleted rather than checked.
Putting a level in the wrong group is now the only way to get it onto the
per-interval line, and that is a visible edit rather than an omission. Field
names and `name=value` spelling are unchanged, so any parser keyed on those is
unaffected; the field *count* per line rises from 58 to 94.
## What this measured
One driven macos-13 boot (rail macos-13, sustained-animation probe, 35 s, host
quiesced, `rm`'d fail log, `vk_caps` confirms exactly one boot in the log, no
`guest kernel panic` in the boot's stdout). 88 census windows, 1 019 548 chains,
1 016 068 batched draws at 14.8 draws/CB.
The question the stopped run existed to answer, now answerable:
| counter | share of `chain_phase chains` |
|---|---|
| `dynstate_pipeline_held` | 75.9 % |
| `dynstate_viewport_held` | 75.9 % |
| `dynstate_scissor_held` | 71.2 % |
So `pools::CbGraphicsState` (
|
||
|
|
5fb5414f48 |
⚡ The viewport a draw asks for is the one the driver already has, nineteen draws in twenty
crates/reims-vgpu, Vulkan backend, both pathways (recording is shared; measured
on x86/dGPU).
Two commits' worth of reading landed first, then a third change built on it.
## What the twelve interleaved boots said about the previous two
Two pins differing only by `ShaderVariant` and `VertexBindPlan`, A,B,A,B on one
quiesced host, scored over the fast population. Per draw:
before (n=4) after (n=6)
reflect_us 0.340 [0.332..0.345] 0.021 [0.020..0.021]
sampled_us 1.911 [1.861..1.972] 1.640 [1.574..1.691]
engine_us 6.235 [6.065..6.338] 6.208 [6.033..6.283]
binds_us 2.477 [2.418..2.525] 2.636 [2.510..2.695]
draw_us/draw 13.33 [13.05..13.61] 13.03 [12.82..13.44]
present_hz 114.25 [112.90..115.40] 114.16 [113.40..115.30]
`reflect_us` −94 % and `sampled_us` −14 %, both disjoint, with `engine_us` — a
phase neither change touches — flat as the control. `binds_us` moved the *wrong*
way with ranges that touch, and the sub-column where `VertexBindPlan` removed
two set builds rose 0.04 us, which removing work cannot cause; that is
boot-to-boot spread, and its doc now says the change is unconfirmed rather than
claiming it. Frames did not move, which is what a 2.3 % per-draw change is
supposed to look like here. Both readings are recorded next to the code.
A first attempt ran the pins in sequence and read `engine_us` **+18 %** with
`gpu occupancy` up and `present_hz` down — the GPU clocking down between the
groups. Interleaving is not optional for a pin comparison on this host, and
`AGENTS.md` now carries the `pkill` rule that made the first interleaved attempt
kill its own runner.
## What this commit adds
Every batched draw re-recorded `vkCmdBindPipeline`, `vkCmdSetViewport` and
`vkCmdSetScissor` whatever its predecessor in the same command buffer had
already bound, and built two fresh `Vec`s to do it. Pipeline binding and dynamic
state are properties of a command buffer's *recording*, invalidated at
`vkBeginCommandBuffer` and not at a render pass boundary — which is what makes
skipping them legal on a path where every draw opens and closes its own pass.
`CbGraphicsState` remembers what the recording command buffer carries. The one
rule that makes it sound is that **a pipeline change clears the dynamic half**:
a pipeline declaring a state statically stops it being dynamic, this device does
not build every pipeline with the same dynamic-state list
(`STENCIL_REFERENCE` only appears on stencil pipelines), so a cached dynamic
value cannot cross a pipeline change. One line, and nobody has to answer "which
states did which pipeline declare".
The two `Vec`s become pools-owned scratch, swapped with the bound array rather
than cloned, so the comparison costs no allocation and the per-draw allocation
goes away with it.
Counted on `EngineCounters` atomics, not `note_store_route`: four route calls a
draw is four global-mutex acquisitions, which at 30 000 draws a second would
have cost more than the skips save. `dynstate_pipeline_held` is the one to read
first — it is the ceiling on the other three by construction.
`forget_pass_echo` drops this state with the echo, because they are one fact and
the new half is the dangerous one: a stale echo makes a draw skip an instrument,
a stale `CbGraphicsState` makes it skip a real `vkCmdSetViewport` on a handle a
`vkBeginCommandBuffer` has since reset.
Tests: five over the two matchers, per field and per length, because a missed
field renders the draw through its predecessor's viewport with no error
anywhere. Bit patterns and not `==`, with a test pinning that `-0.0` does not
match `0.0` — resending is always safe and the comparison may be stricter than
float equality but never looser.
Verified: `cargo test -p reims-vgpu --no-default-features
--features backend-vulkan,host-window -- --test-threads=1` — 1907+4+3+1+10+12+53
passed, 0 failed, 5 ignored. Clippy clean with `-D warnings` on the Vulkan arm
and on `--target aarch64-apple-darwin --features backend-metal`.
Not verified: this commit's own change is not booted. Its A/B and the
`dynstate_*_held` rates are the next step — if `dynstate_pipeline_held` is near
zero, consecutive draws never share a pipeline and the cache is inert.
|
||
|
|
f879e0de10 |
📝 The bracket in a pkill pattern protects one shell, and the runner that launched it is not that shell
AGENTS.md, verification section. The existing rule says to bracket one character of every `pkill -f` pattern because the shell issuing it carries the pattern in its own command line. True, and incomplete in a way that cost a chain run here: the bracket protects the *issuing* shell and nothing above it. `kb/harness/binab.sh` takes two pinned QEMU paths as argv. Both contain `reims-vgpu` after `qemu-system-x86_64`, so its own command line matches `ab.sh`'s bracketed `qemu-system-x86_6[4].*reims-vgpu`, and the first boot it starts kills its parent. The run printed one `=== round 1 arm A ===` line, wrote `MEMOABDONE`, and the systemd unit reported success — a twelve-boot A/B that produced nothing and looked finished. The rule is now stated as the fix rather than as the mechanism: a pinned path crosses as an exported variable, never as an argument, because an environment variable is not in `/proc/pid/cmdline`. Verified: no code change. Documentation only. |
||
|
|
4c5d0c902b |
⚡ The module walk two draws in one apart could not disagree about, answered once per shader
crates/reims-vgpu, runtime, both backends (the walk is backend-independent; measured on x86/Vulkan). `sampled_phase`'s `Part::Reflect` brackets two per-draw walks and its module doc already named the fix: "computing both at translate time and holding them in `m2v_cache`". On a driven macos-13 sustained-animation boot it reads 10 486 us/s over 29 944 draws — **0.35 us a draw**, 2.6 % of a ~13.3 us draw. The larger half is `spirv_bind::sampler_bindings`, a walk of **every instruction** in the module, run twice a draw (vertex and fragment) for an answer that depends on nothing but the module. It now runs once per shader variant. The smaller half — the constexpr static-sampler scan of `reflection.bindings` — is left where it is: it walks a handful of entries and its arms return typed declines the memo would have to carry. ## Why a struct and not a second cache `CachedShader::fragment_words` becomes `CachedShader::variant`, returning a `ShaderVariant` that carries the words **and** the walk of those words together, memoized on one key. That shape is the point rather than tidiness. Relocation renumbers a module's descriptor bindings, so `sampler_bindings` taken over the unrelocated words is a wrong answer for a draw that relocated them — a real sampler bound at the wrong number, with nothing to say so. The draw path took the relocation flags at line 5557 and walked the words at line 6206, four hundred lines apart, and the two agreed only because both call sites happened to be handed the same pair. With one key there is one call and the disagreement cannot be written. `(false, false)` is now a variant like any other rather than a short-circuit, because it is the one a vertex module always takes and its walk is worth caching for the same reason. ## Tests - `every_variants_sampler_bindings_are_a_walk_of_that_variants_words` — over all four flag pairs, against a fresh walk of that variant's own words. This is the drift the struct exists to prevent. - `a_variant_is_memoized_rather_than_rewalked` — `Arc::ptr_eq` on two calls, so the per-shader claim is checked and not just asserted in prose. - `test_module_with_samplers` joins `test_module_with_two_sampled_images` in `spirv_bind`, for the reason that fixture's doc already gives: the opcode numbers are constants in that file. A sampler and not a sampled image, because `sampler_bindings` partitions set 0 by pointee type and an image fixture would make the test vacuous. - `fragment_words_variants_match_direct_relocation_and_cache` renamed and repointed; it still checks the relocation itself. The first test was written asserting the fixture's own binding numbers and failed: `CachedShader::new` runs `widen_sampled_bands` over every module, so the base variant is already in the device's numbering. The assertion was wrong, not the code, and it now says so. Verified: `cargo test -p reims-vgpu --no-default-features --features backend-vulkan,host-window -- --test-threads=1` — 1902+4+3+1+10+12+53 passed, 0 failed, 5 ignored. Clippy clean with `-D warnings` on the Vulkan arm and on `--target aarch64-apple-darwin --features backend-metal`. Not verified: not booted. 0.35 us of 13.3 is 2.6 %, and the elasticity beside `VBL_REPORT_EARLY` puts that under the frame-rate noise floor — `sampled_phase`'s `reflect_us` collapsing toward zero is the reading that would confirm it, not `present_hz`. |
||
|
|
026ff43cf7 |
⚡ The pass pair costs three percent of a draw and no frames, and two sets a pipeline already knew
crates/reims-vgpu, Vulkan backend, x86/dGPU pathway. One measured verdict that
closes a candidate, one work reduction, one doc note about a pathway this host
cannot boot.
## The verdict: do not build the render-pass merge here
Twenty interleaved driven macos-13 sustained-animation boots on one pin,
quiesced, ten an arm of `REIMS_VGPU_PASS_CHURN`. Scored on the driven window
and within the fast population only:
n mean range
draw_us/draw off 7 13.33 13.01 .. 14.12
on 4 13.75 13.63 .. 13.83
present_hz off 7 113.54 111.40 ..115.80
on 4 112.83 112.00 ..113.50
Six of seven `off` boots read below every `on` boot, so the per-draw column
separates at **+3.2 %, ~0.42 us of a ~13.3 us draw**. The frame rate does not:
−0.6 %, ranges nested, exactly what a 3.2 % arm looks like at this elasticity.
`passheld_*` put the reachable share at 82 % of draws, so the merge is
0.82 x 0.42 us — ~2.6 % of per-draw CPU, ~1.5 % of frames — against a second
command buffer per batch, a rewritten submission path, and a deferred pass end
whose failure mode is a render-pass scope violation on a host with no
validation layer installed. That trade is not worth taking, and the reasoning
now sits in `env::PASS_CHURN` and beside `PassObstacles` so it is not
rediscovered. Same shape as `LAYOUT_CHURN`'s verdict and for the same reason:
it is a tiler and iGPU lever, and this project has no such host.
Recorded as non-findings so they are not read as any: the `on` arm drew 4 fast
boots of 10 against `off`'s 7, which ten boots an arm cannot separate; and one
`on` boot wedged at 5.7 Hz, excluded as slow.
## What did land: `VertexBindPlan`
Two `BTreeSet<u32>` were built per draw from `desc.vertex_attributes` — which
buffer indices feed a Constant-step attribute, and which the attribute list
names at all. Both are functions of the pipeline alone, so they move to the
memoized resolution as sorted slices searched by `binary_search`; the
population is single-digit, where a tree is a pointer chase per level. Two heap
allocations and two tree builds leave the path `chain_phase` reports as
`binds_us`, this draw path's largest column at 2.90 us a draw.
Attribute it on `bind_phase`, not on frames: the unaccounted remainder of
`binds_us` (binds_us less vertex+fragment+attrs) was 0.60 us a draw on the
reference boot and this is part of it. A change that size does not separate on
`present_hz` and this commit does not claim it does.
Tests: `the_bind_plan_separates_constant_step_from_merely_named` pins the
classification rather than the code shape — a Constant-step attribute with
`format == 0` or `stride == 0` is skipped by the draw's attribute walk and must
therefore keep the zero-copy rail, while still counting as named, because that
second set is deliberately unfiltered. `an_empty_attribute_list_names_nothing`
covers the fullscreen-pass shape.
## The arm64 note
`backend::metal::render::render_core_mrt` gets a doc section recording what
reading it establishes and nothing more: it is one `MTLCommandBuffer`, one
`MTLRenderCommandEncoder`, one `commit` and one `waitUntilCompleted` **per
draw**, against the Vulkan arm's 14.6 draws per command buffer with no wait on
the recording thread. The three costs are ranked for whoever has a Mac; no
number is claimed, because this host cannot produce one.
Verified: `cargo test -p reims-vgpu --no-default-features
--features backend-vulkan,host-window -- --test-threads=1` — 1900+4+3+1+10+12+53
passed, 0 failed, 5 ignored. Clippy clean with `-D warnings` on the Vulkan arm
and on `--target aarch64-apple-darwin --features backend-metal`.
Not verified: `VertexBindPlan` has not been booted — it is a strict work
reduction with the same answers, and the boot that would score it cannot
resolve a change this size. Nothing under `backend/metal/` is test-executed on
this Linux host.
|
||
|
|
1440e4ec2b |
🔍 The merge this device could not take locally, and the probe that prices taking it at all
crates/reims-vgpu, Vulkan backend, x86/dGPU pathway. Reading plus one
default-off probe. Nothing shipping records differently.
## What `passheld_*` read
Two driven macos-13 sustained-animation boots on the previous commit's
instrument, quiesced, sum identity exact on both families of both boots:
bucket b1 (113 Hz) b2 (59 Hz)
outside_gather 849 627 81.6% 482 542 81.4%
outside_snapshot 74 540 7.2% 42 211 7.1%
no_join 64 735 6.2% 38 004 6.4%
pass_differs 42 068 4.0% 22 878 3.9%
outside_resident_layout 10 772 1.0% 6 805 1.1%
outside_sampled_upload 102 0.0% 96 0.0%
reachable 0 0 0 0
`reachable` is **zero**, and the two boots latched opposite populations and
still agree to a tenth of a point, so this is a property of the workload and
not of a boot's pace.
Every draw the attachment transition was hiding is hiding a guest gather behind
it. A gather is a `vkCmdDispatch`, which Vulkan forbids inside a render pass
instance, so holding the pass open buys nothing on its own. `dbe9b7a2` reported
the 82 % as the size of the merge; it is the size of the merge *conditional on
the gathers moving*, and that distinction is now in the code beside the ladder.
Where they would move is recorded there too: a second command buffer per batch,
dispatches into `pre` and draws into `main`, both in one `vkQueueSubmit` with a
single compute->vertex barrier at the end of `pre` replacing the ~1.3 per-draw
barriers recorded today. That needs no lookahead, because the two buffers are
recorded in parallel rather than in order. The 8.2 % in `outside_snapshot` and
`outside_resident_layout` cannot follow — both order against a write an earlier
draw of the same batch makes, so hoisting them would put them before it.
## Why a probe before that change
The ring change is large and this device has no number for what the pass pair
it removes costs. `REIMS_VGPU_PASS_CHURN=on` records one extra empty render
pass instance per loading draw — the transition a second instance needs, then a
begin/end pair on the same pass, framebuffer and area, with no draw inside it.
Pixel-neutral by construction: `LOAD`/`STORE` preserves the attachment. Gated
on loading draws because a `CLEAR` instance replayed there would clear away the
draw's own output, and because a clearing joiner gets a different `VkRenderPass`
and could never have shared an instance anyway.
Same shape as `REIMS_VGPU_LAYOUT_CHURN`: an arm that pays a cost twice prices
it once. The extra transition is not a confound — that switch's six boots put a
full-attachment transition on this host below the boot-to-boot spread.
Verified: `cargo test -p reims-vgpu --no-default-features
--features backend-vulkan,host-window -- --test-threads=1` — 1898+4+3+1+10+12+52
passed, 0 failed, 6 ignored. Clippy clean with `-D warnings` on the Vulkan arm
and on `--target aarch64-apple-darwin --features backend-metal`.
Not verified: the probe has not been booted — its A/B is the next step. macos-13
/ x86 / Vulkan / one discrete NVIDIA host only; nothing here says what a tiler
or an iGPU pays for the same pair.
|
||
|
|
f67f89549e |
🔍 The obstacle that hid every other obstacle, read past
crates/reims-vgpu, Vulkan backend, x86/dGPU pathway. Instrument only — nothing recorded changes. `de331138`'s `passmerge_*` ladder charges each draw's *nearest* obstacle to continuing the render pass its predecessor left standing. `dbe9b7a2` read it: 82.4 % of draws land in `outside_target_layout`, and `outside_gather` is zero. That answered its own question and hid the next one. The attachment transition is the single obstacle that holding the pass open removes *by construction* — `get_or_create_pass` ends every pass at `TRANSFER_SRC_OPTIMAL` and the next draw barriers it back, so a pass that never ended never left the layout and has nothing to undo — which means the published reading says which obstacle is nearest and nothing at all about what a merge is worth. This adds the second reading. `PassObstacle` replaces the ten hand-written route strings with a type, so the two ladders cannot come apart: a new obstacle fails to compile until both spellings exist. `PassObstacle::is_pass_end_artifact` names the two variants — `TargetLayout` and `MrtLayout` — that exist only because the previous draw's pass was closed, and its doc states why exactly those two: every other obstacle is work the draw owes whatever the pass did. `passheld_*` is the same exhaustive ladder with those two removed. `passheld_reachable` is what a local merge with no lookahead could take; whichever bucket holds the rest names what would have to be hoisted. The suspect is `passheld_outside_gather` — `buffer_guest_gathers` runs 1.34 per draw and a gather is a compute dispatch, which Vulkan forbids inside a pass instance — but that is a prediction, not a reading, and this is the reading. Both families stay exhaustive over draws that reach the `vkCmdBeginRenderPass`, so each sums to `chain_phase chains` and `*_no_join` equals that count less `engine_delta batch_joins`. That identity is the check on a misplaced `note`. Verified: `cargo test -p reims-vgpu --no-default-features --features backend-vulkan,host-window -- --test-threads=1` — 1898+4+3+1+10+12+52 passed, 0 failed, 6 ignored (the wire fixtures, absent on this checkout). Clippy clean with `-D warnings` on the Vulkan arm and on `--target aarch64-apple-darwin --features backend-metal`. Not verified: no boot yet — the reading this exists for is the next step. The Metal arm compiles but none of its tests run on a Linux host. |
||
|
|
e4a725bffc |
📝 The probe this harness was told not to rank changes with is the one that separates them disjointly
Component: `scripts/gpu-load-probe/gpu-load-probe.sh` — header doc only. No behaviour change; `bash -n` clean. That probe's header opened by explaining that the sustained-animation probe had saturated: ~26 800 draws and ~76 presented frames a second whatever the device did, drain duty 0.83, and a 3.9 us/chain saving worth under 0.1 % of `draws_s`. The conclusion drawn from it — "a probe the device cannot fall behind cannot rank a device change, in either direction" — is the first thing a session reads when choosing how to measure, and it is now wrong. Both premises have moved. The presenter no longer clamps at ~41 frames a second, and the device is faster: drain duty is 0.55-0.58 and a fast-latching macos-13 boot presents 109-119 Hz. On that tree the twenty-four interleaved boots of `f1765e27`, scored over their fast boots only, separate **disjointly** on this very probe — 113.2 Hz mean against 105.5 for a device doing 20.6 % more GPU work per draw, the slowest shipping boot above the fastest slowed one — while `us/draw` overlaps across the same fourteen boots. Corrected in place rather than appended to, with the original reading kept and marked as taken on a slower device, because the *shape* of that argument is still how a saturated probe should be recognised if one ever saturates again. The second claim further down — "it remains the arm for ranking a change" for the reason "that probe reaches duty 0.83 and this one does not" — is repaired to rest on the disjointness instead, since the duty figure it cited is no longer the one that boot produces. This probe keeps its own job, which the same paragraph already stated: loading one particular rail harder than a compositing page does, which is why it is worth having even when it is not the ranking arm. Verified: `bash -n` clean. No boot — this commit changes no code and asserts no new measurement; the numbers quoted are `f1765e27`'s captures re-read in `e196a3b0`. Not verified: macos-13 / x86 / Vulkan / one discrete host. Whether the sustained probe saturates again on a future faster device is exactly the thing this doc now tells the reader to re-check rather than assume. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
dbe9b7a2b5 |
📝 This device ends every render pass ready for a read that one draw in twenty wants, and the other nineteen pay to undo it
Component: `crates/reims-vgpu` — doc at the `passmerge_*` emission in
`backend/vulkan/engine/exec.rs`. No behaviour change.
# The reading
Two driven macos-13 sustained-animation boots on `de331138`'s instrument,
quiesced host, no guest panic, both fast (`present_hz` 115.0 and 114.0). Routes
summed across every census window of each boot — `store_routes` is per-window and
the last sample is not the total:
bucket b1 b2
outside_target_layout 850 698 82.4% 871 180 82.3%
outside_snapshot 75 010 7.3% 77 740 7.3%
no_join 64 295 6.2% 66 396 6.3%
pass_differs 41 904 4.1% 43 262 4.1%
reachable 0 0 0 0
The sum identity holds exactly on both — the buckets total `chain_phase chains`
(1 031 907 and 1 058 578) and `no_join` equals that count less
`engine_delta batch_joins` to the draw. The instrument is not reporting a clean
sweep of a population it cannot see.
# What it says, which is not what was predicted
The gather was the prediction and the gather is **not** the obstacle: nothing
lands in `outside_gather`. The obstacle is a layout transition this device
creates for itself.
`get_or_create_pass` ends every pass with `final_layout = TRANSFER_SRC_OPTIMAL`,
so a present blit or a guest-page readback can read the target without
transitioning it. The `LOAD` pass then declares
`initial_layout = COLOR_ATTACHMENT_OPTIMAL`, so the next draw into the same
target barriers the image all the way back.
The trade is badly priced. `target_reads` is **1 199 a second** — the present
capture and the deferred-window flush, the only consumers the transfer-src ending
exists for — against roughly **24 000 draws a second** that immediately undo it.
On this discrete host that is a barrier and probably little else. On anything
with framebuffer compression — every iGPU, every tiler, AMD DCC, Intel CCS — it
is a decompress and a recompress of the attachment per draw, which is why this
matters more off this host than on it.
# What the reading does not say
The ladder charges each draw to its **nearest** obstacle, so `outside_gather=0`
means no draw reached the gather site with nothing recorded before it — not that
gathers are rare. `buffer_guest_gathers` is 34 564/s and they are still there,
behind the layout barrier that precedes them in record order. "82.4 % becomes
mergeable if the barrier goes" is exactly what this cannot claim; what lies
behind it is the next thing to measure, after it moves.
Verified: two boots as above, sum identity exact on both, `grep 'guest kernel
panic'` clean on both boot logs, screenshots present. `cargo doc` intra-doc link
pass — 157 warnings, unchanged, none on the two links added.
Not verified: macos-13 / x86 / Vulkan / one discrete host, sustained-animation
probe only. No frame-rate claim — this run changed nothing and was not an A/B.
The compression cost asserted for tilers and iGPUs is an argument from how those
drivers work, not a measurement; no such host has been booted.
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|
|
de331138af |
🔍 Every batched draw opens its own render pass, and nothing said how many of them had to
Component: `crates/reims-vgpu` — Vulkan engine (`backend/vulkan/engine/exec.rs` and `pools/`). Observation only: nothing branches on the new state and the pass is begun exactly as before. # Why `exec.rs` already carries the note that per-draw render passes are "the ceiling on the largest GPU-side saving this device has not taken", and `join_same_target` puts that ceiling at **23 216 of 29 541 draws a second** on a driven macos-13 sustained-animation boot — 78.6 %, all rendering into the batch's own target. The ceiling is not the answer. A draw can only continue its predecessor's pass if it also records *nothing* between the two, and this device records plenty there: gather dispatches, snapshot copies, sampled uploads and four kinds of layout barrier. `buffer_guest_gathers` is 34 564/s against 29 541 draws, so a first guess is that the gather alone closes most of the 78.6 % — but 1.17 gathers per draw is a mean, and a mean cannot say whether it is one gather on every draw or five on a fifth of them. Those are a 0 % merge and a 60 % one. On this discrete host a redundant pass is cheap; the attachment stays in VRAM and `LOAD`/`STORE` cost close to nothing. On a tiler or an iGPU each pass loads and stores the whole attachment, which is the difference between a workload that fits in memory bandwidth and one that does not — so the number is worth having before either host is available to boot. # What was added `PassEcho` (pools) records the render pass instance, framebuffer and render area the last draw opened, and the command buffer it opened them in. It is forgotten wherever that CB stops being the one a draw would record into — `begin_entry`, the batch flush, teardown — and the CB handle is compared as a second lock, because command buffer handles are recycled. `exec.rs` threads one `Option<&'static str>` through the record span. Every site that emits a barrier, copy or dispatch names itself, after whatever `continue` decides the site is a no-op for that draw. The first name wins: the question is what ended the standing pass, so the first thing recorded is the answer. It holds the route name itself rather than a tag translated later, so there is no second spelling to go an arm short. Each draw is then charged to exactly one `passmerge_*` route: `no_join`, `pass_differs`, one of nine `outside_*`, or `reachable`. The buckets are exhaustive, which is the check on the instrument rather than a scan of it: summed over a census window they equal `chain_phase chains`, and `passmerge_no_join` alone equals that count less `engine_delta batch_joins`. Verified: clippy `-D warnings` clean on all three arms (Vulkan host, Vulkan `--target x86_64-unknown-linux-gnu`, `backend-metal --target aarch64-apple-darwin`); `cargo test -p reims-vgpu --features backend-vulkan,host-window -- --test-threads=1` green, 1898 + 82 passing, no count lost. Not verified: no boot yet — the counter has not been read on a live device, so neither the distribution nor the sum identity above is confirmed. That is the next step and the reason this lands separately from anything that acts on it. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
e196a3b04a |
📝 A free-running guest pays this device back in frames, and the frame rate says so more clearly than the microseconds do
Component: `crates/reims-vgpu` — doc on `runtime::drain::census`'s
`VBL_REPORT_EARLY`, and the scoring rules in `AGENTS.md`. No behaviour change.
# The reading that was already on disk
`f1765e27` ran twenty-four interleaved driven macos-13 boots with the device
pushed 20.6 % the wrong way on purpose (`REIMS_VGPU_COMPUTE_GATHER=off`, whose
positive control was checked on every boot of the arm), and scored only which
population each boot latched into. The run also holds the answer to a different
question nobody asked it: what the *fast* boots did with the extra work.
Scored over fast boots only, driven-window medians per boot:
arm n fast present_hz mean (range) us/draw mean (range)
shipping 5 113.2 (109.8-116.3) 13.21 (12.66-14.02)
20.6 % more GPU work per draw 9 105.5 (101.4-107.7) 15.07 (13.92-16.16)
The frame rates are disjoint: the slowest shipping boot beats the fastest slowed
one. Welch t≈6.0 on n=5 vs n=9.
# Why it matters more than the 7.3 %
Two rules come out of it, and both change what a session does next.
`us/draw` **overlaps** across the same fourteen boots (14.02 against 13.92) where
`present_hz` separates them completely. The frame rate is therefore the sharper
of the two instruments, not the noisier one, and it is what a per-draw change
should be ranked by. `AGENTS.md` said the opposite — "anything normalized per
draw stays the right way to rank a change about per-draw cost" — and that is now
narrowed to attribution.
It also puts a number on the free-running branch the census doc describes.
"Work-limited" was read out of the guest's frame-scheduling contract; this makes
it a measurement, at about **0.35 frames per unit of per-draw GPU work**. That is
the sizing rule for every candidate from here: 5 % per draw is worth a boot
chain, 2 % is not measurable on this host.
Together they retire the last of the "bought microseconds and zero frames"
puzzle. Those wins were measured through a presenter that clamped at ~41 Hz. It
does not clamp now, and this run shows the frames arriving.
Verified: `cargo doc` intra-doc link pass — no new warnings (157 pre-existing,
none in the edited block; the added prose links nothing new). No boots: the
underlying twenty-four are `f1765e27`'s, re-read from their captures rather than
re-run.
Not verified: one interleaved run, macos-13 / x86 / Vulkan / one discrete host,
sustained-animation probe only. n=5 in the shipping arm is thin — the disjointness
is what carries it, not the count. The elasticity is a single point on a single
axis (GPU work per draw) and must not be assumed linear or transferred to a CPU-
side saving without measuring one.
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|
|
90ce18da7a |
📝 The 60-vs-120 split is a constant the guest defaults to and can never correct, not anything this device delivers
Component: `crates/reims-vgpu` — `runtime::drain::census` (`VBL_REPORT_EARLY`'s doc and a new `note_irq_coalesced` counter), `qemu::host_ops::enqueue`, and the boot-comparison rules in `AGENTS.md`. Six device-side hypotheses for the boot-random 60-vs-120 split have come back null this session. All six were null for one reason, now established: each was about how fast this device delivers VBL, and the guest's frame period is not derived from that. # The chain 1. The guest's compositor schedules each frame on a timer at `lastVBL + period`. Nothing in it measures VBL arrivals, divides a rate, or counts missed frames; `period` is taken verbatim from the kernel. 2. The kernel display-pipe layer ships `(lastVBL, lastVBL + fRefreshPeriod)` on every VBL notification, so `period` **is** `fRefreshPeriod`. 3. `fRefreshPeriod` is written in exactly one place, on display-mode change. It is initialised to a synthesised 1/60 s = 16 666 666 ns and only then replaced by `IOFBCurrentPixelCount * 1e9 / IOFBCurrentPixelClock`. Five early returns leave the 60 Hz default standing. 4. Those two `IOFramebuffer` properties are published only when the mode's detailed timing is marked valid, and the paravirtual framebuffer driver clears that valid bit and fills the timing with nothing — so the framebuffer layer removes both properties. Confirmed live rather than argued: over eleven driven macos-13 boots `ioreg` finds neither property on any boot — not on the 59.5-60.1 Hz ones and not on the 97.5-114.3 Hz ones. The same dump carries the detailed timing the guest built out of our timing table (pixel clock 15 848 840 000 Hz, 1920 + 10 000 by 1080 + 10 000), which works out to 8 333 332 ns, i.e. 120.00 Hz to five figures. The guest holds the inputs and the path that would use them is closed. Our 16.16 refresh encoding is confirmed correct and is not implicated. # Why it is bimodal and sticky `fRefreshPeriod` is never recomputed once set, so a boot ends on one of two values: 16 666 666 ns, where the compositor paces on it and produces exactly 60 Hz; or 0, when the first notification is sent before the mode-change path has run, which puts the next wake time in the past and lets the compositor free-run. The populations already on record are that fingerprint and nothing else: every slow boot sits in 59.5-60.5 Hz, a constant, and every fast one in 94.8-117.0 Hz, a 22 Hz spread. A paced compositor cannot vary that much; a free-running one cannot be that flat. This was visible in the data for several runs and was not read, because both populations were being summarised by a median. So the fast boots are the ones where the guest never learned a period, and the correctly-configured outcome on this pathway is the slow one. The docs say that before proposing a fix, because the obvious lever — forcing a second display-mode change, which this device owns through an offline/online cycle — would set `fRefreshPeriod` on every boot and take the good 70 % down to 60 Hz. # The counter that came with it `qemu::host_ops::enqueue` coalesces an interrupt pulse into an undelivered pulse of the same kind. That is free for a status the guest reads back and not free for an event it timestamps. `irq_coalesced_gfx` now counts it, and the first reading explains itself: 2440 coalesced against 3212 delivered on a 60 Hz boot, because a guest latched at 60 arms every 16.67 ms while this device ticks every 8.33 ms. It is a consequence of the latch rather than a cause, and it is the cheapest device-side read of which population a boot is in. Its doc states plainly that `display_vbl delivered` counts what this device wrote, not what the guest received, and that the two must not be quoted as one. Verified: 1898 lib tests plus every integration target green serially; clippy `-D warnings` clean on all three arms; `cargo doc` intra-doc link pass clean. Eleven driven macos-13 boots for the `ioreg` result, no guest panic. Not verified: no fix is landed and none is proposed here. The free-run/paced choice is a race inside the guest that this device cannot observe. Whether the same chain applies to the arm64 rail is untested and there is reason to think it differs — the guest's 60 Hz default is computed through the mach timebase with a 32-bit multiply that does not overflow at x86's 1/1 timebase and does at Apple Silicon's. macos-13 / x86 / Vulkan only. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
63d610c2c6 |
📝 A slow boot reads 10% slower per draw for a reason that has nothing to do with the device
Component: `AGENTS.md`, the boot-comparison rules. No code change. |
||
|
|
03b8205611 |
📝 The slow-latching boots are not low-clock boots, and that was the last device-side cause anyone here could name
Component: `crates/reims-vgpu` — doc on `runtime::drain::census`'s
`VBL_REPORT_EARLY`, and the exclusion list in `AGENTS.md`. No behaviour change.
|
||
|
|
f1765e271c |
📝 Making this device 20% slower did not push boots over the vsync cliff, because there is no cliff
Component: `crates/reims-vgpu` — doc on `runtime::drain::census`'s `VBL_REPORT_EARLY`, and the boot-comparison rules in `AGENTS.md`. No behaviour change. # The hypothesis worth killing A guest holding a correctly-acquired 120 Hz link ( |
||
|
|
8473b76222 |
📝 The boots that present 60 frames a second selected the 120 Hz mode, same as the ones that present 117
Component: `crates/reims-vgpu` — doc on `runtime::drain::fill_display_descriptor`, plus `kb/harness/animrefresh.sh` (gitignored) as the probe. No behaviour change. About three macos-13 boots in ten present ~60 frames a second for their whole life rather than ~100-117 ( |
||
|
|
49701ba36e |
📝 The early window that predicted the latch eight times out of eight predicts nothing, and one slow boot was the whole sample
Component: `crates/reims-vgpu` — docs on `runtime::drain::census`'s `VBL_REPORT_EARLY` and on `signal_display_refresh_classes`. No behaviour change. |
||
|
|
7e68dba216 |
📝 Forty interleaved boots say the vblank ordering does not move the latch, and that three boots in ten lose half their frame rate
Component: `crates/reims-vgpu` — doc on `runtime::drain::signal_display_refresh_classes`. No behaviour change. |