Commit Graph
191 Commits
Author SHA1 Message Date
Anees Iqbal 30c7cd604b 🆕 Capture the pointer with the keyboard, held over the image
A click into the image captured only the keyboard: the host's pointer could
still leave the window for the bars, the title bar or another app, where a
click meant for the guest's edge landed on the host instead. Capture now takes
the pointer too, and never one without the other: while captured, the host's
pointer is held over the image, and ⌃⌥⌘ (Ctrl+Alt+Super on Linux), Release
Input, losing focus or closing frees both.

On AppKit's window the hold is NSWindow's mouseConfinementRect, the property
SDL3 confines its macOS windows with, which AppKit leaves out of its headers;
a window that does not answer it leaves the pointer free and logs one line.
On SDL's windows it is SDL's mouse rect, rounded out to whole points so the
image's last row and column stay in reach, which SDL keeps with the
compositor's pointer constraints on Wayland, XFixes barriers on X11 and the
same property on macOS; where SDL has no mouse rect, its mouse grab holds the
pointer in the whole window. In native full screen an image that reaches the
screen's top or bottom edge takes the pointer there, where macOS slides its
own menu bar or Dock in.

features.md, README.md, docs/api.md, docs/architecture.md and the module docs
say so. The macOS walk releases capture wherever a step needs the pointer off
the image, captures before Finder takes focus in C4, and walks the hold at
each edge and corner (C2), at the window's edge (C2e), across Mission Control
(C2m), in full screen (C2f) and after a mode change (M4), which only a
person's own mouse shows: a warped pointer, or one moved by events posted at
the HID tap, is not held.
2026-10-19 02:47:57 +03:00
Anees Iqbal afdb76f844 🆕 Give every x86-64 VM the IOSurface device over PCI
An x86-64 macOS guest running Apple's arm64 GPU driver, ported, needs the
IOSurface host device vmapple has as apple-gfx-mmio's second region: the
driver's start waits for its mapper's service, and every texture over an
IOSurface is a mapper texture. reims-ctl now gives every x86-64 VM on
reims-vgpu that device, with no opt-in, and Apple's own x86-64 driver keeps
running as before.

For the guest:
- apple-gfx-iosurface-pci (106b:eeef, ours) sits at 00:06.0 next to the GPU
  at 00:04.0: its registers in BAR 0 at 0x1000, 8-byte accesses passed
  whole, one MSI vector per completed command. A reset returns its
  registers to 0, ring size aside.
- 0x1028 offers the second, 0x400-byte descriptor form only where its table
  holds all 8192 mapping ids (16 KiB pages); on x86-64's 4 KiB pages it
  reads 0, and the guest's mapper takes the first form, which fills them.
- On apple-gfx-pci, a task other than task 0 runs isolated only if the
  IOSurface device has a descriptor table when the guest defines it, and
  device info offers argument buffers (key 33 bit 0x20, key 42) only while
  it has one. Apple's x86-64 driver, stock (binary version 6) or patched by
  reims-util (245), never programs the IOSurface device and makes ref
  textures whose backing is in task 0, which an isolated task does not
  serve (testing.md 6.20); its tasks stay in process and its device info
  is as without isolation. The ported driver's mapper programs the device
  before its GPU driver starts, and its tasks run isolated, which its info
  replies need. apple-gfx-mmio still isolates every task.

For the host:
- apple-gfx-pci has no option for this: adding apple-gfx-iosurface-pci is
  the only switch, and a VM without it runs as before. Its gpu link is
  optional, the machine's only apple-gfx-pci when unset. vendor/qemu moves
  to bd95509a.
- RvgDeviceConfig gains process_isolation_follows_guest at its end (64
  bytes; a host that passes 56 reads it false), and the Rust API's
  DeviceConfig the same field; apple-gfx-pci always sets it with
  use_iosurface_mapper and process_isolation. Each task made under it logs
  whether it runs isolated or in process, and device info logs each change
  of its argument-buffer answer.
- reims-ctl's q35-x86_64 profile adds
  apple-gfx-iosurface-pci,id=iosfc,gpu=gfx,addr=0x6; vmware-svga and
  vmapple VMs are unchanged. reims-ctl and QEMU from this commit go
  together, as its installer installs them.
- On Linux, the detach heap's temporary and a writable alias with zeros
  past its pages come from a range of a file of the library's own, so the
  Vulkan platform can alias and import them; QEMU no longer ends at an
  x86-64 guest's first such heap. macOS is unchanged.
- The first command given to a task whose service has died writes one
  warning naming the task.
- scripts/qtest_iosurface_pci.py checks the device under qtest (27 checks).

Checked: cargo xtask check and the suite on the M3 Max; reims-ctl's install
and a cold boot on um780; stock, reims-util and ported-driver guests booted
on gem10 and ms01 with the isolation rule, Apple's driver's tasks in
process at about 62 fps, the port's isolated.
2026-10-17 06:43:31 +03:00
Anees Iqbal c099dd5a4d 🐛 Put the committed Cargo.lock back before an update moves the tree
A user's build rewrites Cargo.lock: cargo adds the metal2vulkan git sources
the committed lock leaves out. A changed lock then stops both ways an update
moves the checkout: reims-ctl's channel switch (git switch) and the script's
git pull --ff-only, as soon as the target changes the lock too. The update
failed with "commit or set aside its local changes".

The lock is the build's to write, so nothing is lost: reims-ctl's switch and
install-ctl.sh --update check the committed one out before they move, and
the next build writes it again. The switch test now has branches whose locks
differ and a clone whose lock the build rewrote.
2026-10-15 00:26:09 +03:00
Anees Iqbal 11f6a6ef4b 🐛 Configure QEMU again when a library its build names is gone
meson writes the system libraries QEMU links into build.ninja by their paths,
some by their versioned file (/usr/lib/libsnappy.so.1.2.2; Homebrew's carry
the version in the Cellar path). Removing or upgrading one left the cached
build naming a file ninja cannot make, and since the installer configured
again only when its options or reims-vgpu.pc changed, every later
install-ctl.sh and reims-ctl update stopped there until the user removed the
build directory.

The installer now configures again when ninja's dry run fails, which recovers
in the same run. When build.ninja is itself out of date (a QEMU update that
touches meson files, or a newer /bin/chmod), the dry run passes without
checking, and meson's regeneration reuses the dependencies it found before, a
removed one too; so a build that fails also makes the next run configure
again. configure starts meson afresh and keeps the objects already built.
2026-10-14 22:02:56 +03:00
Anees Iqbal b1058d16fb 🆕 Say "click to capture input" in an uncaptured window's title
The title said nothing until input was captured, so someone new to the
window had no hint that a click into the image captures the keyboard, or
that it was not captured yet. Uncaptured, the title now ends " — click to
capture input", on macOS (AppKit's and SDL's window) and on Linux, and it
says so again after a release. Captured, it reads as before.

features.md's entries for the title now say both states, guarded by the
renamed capture::the_title_says_whether_input_is_captured; docs/api.md and
the macOS walk name the new title.
2026-10-14 12:23:53 +03:00
Anees Iqbal 7685e5027a 🆕 Let x86-64 VMs run on VMware SVGA in QEMU's own window
An x86-64 VM's edit form (e) and reims-ctl set --graphics now choose between
reims-vgpu and QEMU's VMware SVGA II, for when a guest should come up without
the library: the firmware's framebuffer, one display, no GPU acceleration.

With VMware SVGA the library takes no part: vmware-svga takes apple-gfx's slot
and its id, gfx, which the terminal viewer's screendumps and input name, the
library's window and GPU variables and warnings are left out, and QEMU's own
GTK window shows the display. install-ctl.sh builds Linux QEMU with GTK for
it; on a QEMU without it, start refuses and names reims-ctl update. With no
Wayland compositor or X server in QEMU's environment (reims-ctl's, under the
VM's extra environment), GTK would end QEMU at its start, so the VM runs
headless under -display none there, as the library's window does. The edit
form hides the display and GPU fields on VMware SVGA and keeps their values
for a switch back; a test pins that a field following one the form lacks (an
arm64 VM's, with no graphics choice) still shows.

Booted on msi-laptop (docs/qemu.md): macOS 26.6.1 reaches its desktop at
1280x720 in QEMU's window, the viewer's screendump and input work, and stop
shuts it down.
2026-10-14 00:33:10 +03:00
Anees Iqbal 39d6ca78ef 🆕 Make new x86-64 VMs from reims-util's macOS downloads
A new x86-64 VM needed an OpenCore image and an installer made by hand with
OSX-KVM or ULTMOS. reims-ctl now runs reims-util for both: pick a macOS
version (n in the interface, create --macos on the command line) and it
downloads the installer from Apple, makes the VM's OpenCore image with OVMF
and a Mac identity of its own, and makes the disk.

- create --macos VERSION downloads Apple's recovery image (about 1 GB), or
  with --offline an installer of one release (13 to 20 GB). Installers are
  kept in the data directory's installers for the next VM, one reims-util at
  a time writes there, and a stopped download continues. The download comes
  before the VM's directory, so stopping it leaves no VM half made, and
  reims-util ends with reims-ctl on Linux. What create is given (a disk, an
  installer, an OpenCore image and the OVMF beside it, reims-util itself) is
  checked before the download and the disk's copy, and the VM list is read
  again before the VM joins it, so VMs made or deleted during a download
  stay as they are.
- --opencore is optional: without it reims-util makes the image, with the
  VM's MAC as its ROM, and an iMacPro1,1 for macOS 10.13 and 10.14. An image
  of the user's brings OVMF_CODE.fd and OVMF_VARS.fd beside it, as
  reims-util writes them.
- The interface's form asks where macOS comes from, the version first; with
  no name, the VM takes the version's, skipping names a VM or a leftover
  directory has. A VM with an installer says in its details, and create
  prints, how to install macOS from it; one made from a disk is reminded to
  set Metal's error mode.
- A new disk needs an installer or a download: a VM of an empty disk and no
  installer is refused.
- Every installer attaches as a read-only disk (snapshot=on), a DMG
  converted to a raw image in the VM's directory, so the CD drive is gone: a
  change of installer applies at the next start. vm.toml's installer_kind
  is no longer written, and is ignored where an older vm.toml has it. A
  missing installer says how to eject it.
- reims-ctl __record-install, which scripts/install-ctl.sh runs last,
  installs reims-util at the commit reims_util.rs pins, so the update that
  brings this reims-ctl installs it too, though it runs the script it
  started with. doctor checks for it in place of the system's OVMF, and the
  install no longer adds the ovmf or edk2-ovmf package.
- vm.max_map_count: a new VM's default of up to 16 GiB needs about 1.13
  million mappings, more than the 1048576 suggested (CachyOS's stock
  value). The README, the install script, doctor and the start warning
  suggest 2097152, which covers 30 GiB, and check against what the VM, the
  largest VM or a new one's default needs.
- Updating from the interface while a create runs says the restart stops
  it, as quitting does.

Dropped, as reims-util's images leave nothing for them to cover:
- create --from-script and the interface's launch-script import, which read
  OSX-KVM's and ULTMOS's QEMU scripts. A VM made from one keeps working; its
  vm.toml names its own copies.
- The search for OVMF beside a user's OpenCore image in those projects'
  layouts, QEMU's edk2 build and the distributions' packages, and
  --firmware-code and --firmware-vars.
- create --disk-mode overlay: copy, a reflink where the file system can, or
  in-place covers an existing disk. A VM made with an overlay keeps working.
- --cpu-model and --cpu-flags on create and set, and the edit form's CPU
  fields: new VMs take Skylake-Client-noTSX-IBRS. vm.toml keeps cpu_model
  and cpu_flags, so an older VM keeps its model; docs/qemu.md says how to
  change it there.
- --installer's --iso and --cdrom aliases.

README, the help and the docs no longer point at OSX-KVM or ULTMOS. README
step 3 describes reims-util's OpenCore picker (5 seconds, which an arrow key
stops, measured on homelab-ms01), and architecture.md 11.4 counts its image
among those that keep AvoidRuntimeDefrag on.
2026-10-12 19:37:12 +03:00
Anees Iqbal 88c9d3e72d 🐛 Import pages RADV refuses as host memory as udmabuf dma-bufs
RADV imports host memory as an amdgpu userptr, which Mesa asks for with
AMDGPU_GEM_USERPTR_ANONONLY, so the kernel refuses every page with a file
behind it. The guest's RAM and every view the library makes are memfd pages,
so on an AMD GPU a macOS guest died at its first no-copy buffer.

The runtime (metal2vulkan 11715e2a3f) now asks the caller for dma-bufs of
the pages wherever the pointer import is refused, on any driver. The library
answers with /dev/udmabuf: it resolves the range through the backing table,
gives the shared block of zeros' pieces a file of the import's own, cuts the
runs into chunks within udmabuf's limits as the host has them (1024 pieces
and 64 MiB by default, which no one is asked to raise) at the runtime's bind
granule, and pads several chunks to the granule. The runtime binds them
behind one sparse buffer, and asks again for a texture's own pages. Its own
memfds are sealed against shrinking, which udmabuf requires. A refusal names
its cause in the death line.

reims-ctl and the installer warn when a VM that would run on an AMD GPU
cannot open /dev/udmabuf (the kvm group's on Ubuntu), and reims-ctl's logs
show the device and its limits.

On the Radeon 780M (RADV of Mesa 26.0.8, udmabuf at its defaults) the guest
now cold-boots to its desktop, and Safari loads a page and quits: 5,119
dma-buf requests, none refused. NVIDIA, which imports the pointer, and macOS
are unchanged.
2026-10-12 11:50:33 +03:00
Anees Iqbal 98fe2a3bd5 🆕 Replace the tree with libreims_vgpu and its C API
This repository now holds libreims_vgpu, a Rust library that is the host
side of the paravirtualized GPU macOS guests drive, in place of Apple's
ParavirtualizedGraphics.framework: the library and its C API
(reims_vgpu.h), the PCI device's option ROM, QEMU's apple-gfx on that API
(vendor/qemu), the behaviour-lock suite that drives the C API as QEMU
does, and reims-ctl, the VM manager users run. README.md says what it is
and how it is laid out, and AGENTS.md how to change it.

Every file of the earlier tree is replaced. vendor/qemu moves to the
steelbrain/reims-vgpu branch of the same public repository.
2026-10-11 20:27:17 +03:00
Anees IqbalandClaude Opus 5 0108dbbc36 feature-matrix: the note said Metal cannot be cross-checked off Apple, and the script it documents has been doing it all along
`feature-matrix.sh`'s own `--help` block says the Metal arm cross-checks from any
host, and explains why: `src/lib.rs` rejects `backend-metal` on
`not(target_os = "macos")`, which is a condition on the target rather than the
host, so `--target aarch64-apple-darwin` satisfies it and `cargo check` needs no
Apple SDK. The script has done exactly that since the arm rotted to 11 unnoticed
errors under the old theory.

The README kept the old theory. Measured here on Linux, `cargo check -p
reims-vgpu --target aarch64-apple-darwin` finishes clean in about ten seconds
warm for `backend-metal`, `backend-metal,host-window`, and
`backend-metal,backend-vulkan,host-window` — every Apple configuration the
pathway table ships, including the both-rails row.

That matters more than a documentation slip usually does. A session read this
note, concluded the Metal arm could not be verified from this host, and recorded
it in its handoff as a standing constraint on what could be changed — which
would have held the last cutover group back on a false premise, since it needs
`Backend` trait signatures to change and those are only checked on the arm this
note said was unreachable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 13:57:14 +03:00
Anees Iqbal f801db172d gate: rustdoc over the replacement crates, so their links cannot go dead again
The previous commit fixed twenty-three broken or ambiguous intra-doc links
that had accumulated because nothing looked. Nothing still looks: rustdoc's
broken-link and private-link lints are warnings, `cargo doc` is not part of
any build, and `cargo check` and clippy are both silent on them. So the
same twenty-three would come back.

`feature-matrix` already carries formatting for exactly that reason — a
tree-wide question no arm asks and no other tool answers — so rustdoc joins
it as cell 0c, next to the two formatting cells and before any arm.
`RUSTDOCFLAGS=-D warnings` is the whole gate: without it the check is green
while the links are dead.

Nine crates, none of which has a backend feature, so there is nothing for
their docs to differ on per arm. `reims-vgpu` is deliberately not in the
list and the script says why: it carries the legacy device model, it has
294 of these today, and a cell nobody can keep green is a cell everybody
learns to ignore. It joins when the model it documents does.

Verified by breaking a link in `reims-vgpu-vulkan` and watching the cell go
FAIL, then restoring it.
2026-09-02 05:21:57 +03:00
Anees Iqbal 73703ba58c vulkan: the rail becomes a crate, starting with the layer that places memory
`reims-vgpu-vulkan` exists. The architecture names one layer as the sole
executor of the semantic model and the only place host capabilities become
placement and transfer policy, and "only place" is a claim a module boundary
cannot hold — a placement decision one `use` away from device state will
eventually read some. So it is a crate whose dependency list says what it may
see: `ash`, `reims-vgpu-core`, the refusal vocabulary, and the operator
switches. No QEMU, no device model, no guest-RAM ownership, no decode.

Its first content is `backend/vulkan/caps/memory_topology.rs`, moved whole and
unchanged apart from `crate::observe::fail` becoming `reims_vgpu_observe::fail`.
That module *is* "host capabilities become placement policy": it classifies
unified against discrete from two structural signals, never a device name, and
selects a memory type by preference with the required flags always as the
fallback — so a misclassification is a performance bug and never a correctness
one. It brings its own seventeen tests and the synthetic device shapes they run
against.

The rest of `caps/` cannot follow yet and the reason is worth recording:
`device_features.rs` reads `backend::vulkan::translate::pixel` in production
code, and `translate/` in turn reaches `runtime::census`, `runtime::decode`,
`runtime::spirv_vertex_input` and `engine`. The legacy backend is woven into the
runtime by 284 references across 25 modules; extracting it piecemeal produces a
`caps` split across two crates, which is worse than either end state. It leaves
at the cutover, and what grows here before then is the replacement executor.

`fixtures` is `pub` rather than behind a `testing` feature: the consumer that
needs it is in another crate, and a feature would either pull this rail into a
Metal-only test build or fork the fixtures — a second answer to what an AMD
APU's memory looks like.

Counts: the vulkan arm 2209 -> 2192 and the replacement crates 532 -> 552, which
is the same seventeen tests on the other side of a crate boundary. The
replacement-crates matrix cell now names the testkit and the rail too, so
neither can empty quietly.
2026-09-01 11:37:19 +03:00
Anees Iqbal 63a93c79fd protocol: one vocabulary, one crate — reims-vgpu-contract is absorbed
The last four modules cross — `pixel_format`, `mipmap`, `iosurface_pages`, and
the `checked` glob — and with nothing left in it, `reims-vgpu-contract` is
deleted rather than left as a shim.

Two crates had the same job under two names: "backend-neutral vocabulary" and
"the layer that assigns meaning to a wire tag" are one description. Two crates
for it means two places to look for a rule and two places for it to drift, and
the device was already writing both spellings — `crate::contract::pixel_format`
next to `reims_vgpu_protocol::extent` — for facts at the same altitude. There is
one spelling now: `crate::protocol::`, across 88 files, tests and conformance
included.

The moved modules take `alloc` imports because protocol is `no_std`, and
protocol takes a dev-dependency on observe with `std` on, because their tests
assert what a refusal *renders* as and rendering is the sink's half. Resolver 2
keeps that feature out of builds that do not compile tests — but `--all-targets`
does compile them, so the existing matrix cell would let a `std::` into the
library unnoticed. A `protocol / no_std library` cell at `--lib` scope is what
notices.

Counts: support crates lib 351 -> 270, replacement crates 425 -> 508, and
`reims-vgpu` itself unchanged at 2138 lib tests.

AGENTS.md's ownership list is updated for both new crates, including
`reims-vgpu-core`, which it had never named.
2026-09-01 11:15:27 +03:00
Anees Iqbal 4bedffbb64 observe: the words a refusal is named in do not need the file it is logged to
`reims-vgpu-protocol` is `no_std` and is meant to absorb `reims-vgpu-contract`.
That has been blocked on one thing: contract names its refusals through
`observe::Decline` and `observe::Refusal`, and observe was std-only — it writes
`/tmp/reims-vgpu-fail.log`, reads a clock, and starts a watcher thread.

But none of that is the vocabulary. `Decline`, `Refusal` and the `Display` they
render through are `core` plus `alloc`; only the sink needs `std`. So the sink
is a feature and the vocabulary is not.

They stay one crate deliberately. The claim this whole layer rests on is "no two
checks share a slug", and a claim about a registry does not survive being split
across two registries — moving the traits into a fourth crate would have bought
the layering by giving up the invariant. A feature buys it for free.

`std` is on by default, so every existing consumer is unchanged and the
`reims-vgpu-config` dependency it needs is now optional. With it off, a layer
below the device can name its own refusals in the same words the device logs
them in.

The feature matrix gains a cell for the configuration, because nothing else
builds it and a `std::` creeping back into the vocabulary compiles fine
everywhere else.
2026-09-01 11:04:12 +03:00
Anees Iqbal 4ffb7401dc gate: the crates under construction are checked, or the gate reports green on a tree that does not build
`reims-vgpu-core` is deliberately not a dependency of `reims-vgpu` — the
replacement stays reachable only from model tests until production ingress
switches — so no arm in the feature matrix links it, and neither it nor
`reims-vgpu-protocol` was compiled by the gate at all. Their clippy and tests
were being run by hand, which is exactly the arrangement that let the Metal arm
rot to eleven errors.

They get their own cell now: checked with --all-targets so their test code
compiles, and counted so a cfg change or a module move cannot empty them
quietly. Reads lib=378 all_targets=381.
2026-09-01 10:56:24 +03:00
Anees IqbalandClaude Opus 5 20140505cf memory: the guest-RAM bound becomes a crate, so the bound is structural
`runtime/guest_ram.rs` moves to `reims-vgpu-memory` and is re-exported under
the path every caller already writes, so no call site moved.

The module's claim has always been that nothing above it can name a byte of
guest RAM except through an import that is alive and a slice that has been
bounds-checked against it. Inside one crate that was a discipline; as a crate it
is a compiler's answer. `reims-vgpu-memory` depends on the contract, the paging
runs and the observe channel and on nothing else — it cannot see a resource
table, a Vulkan handle, a QEMU structure or the device model, so there is no
second way to answer "how big is this" and nowhere for a raw pointer and an
offset to escape together.

Four `#[cfg(feature = "backend-vulkan")]` gates go with it. They were dead-code
suppression for the Metal-only build, not a statement about a rail, and in a
library crate a `pub` item is never dead — so the footprint's allocation
identity, page membership, span and release store are simply public now. That is
one fewer place where a `cfg` looks like it is answering "which rail is
running".

20 tests move with the module: reims-vgpu 2158 -> 2138, reims-vgpu-memory 20.
Feature matrix all arms warnings=0 with the new crate in the support-crate cell;
clippy and rustfmt clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 10:32:37 +03:00
Anees IqbalandClaude Opus 5 b4429dd022 config: the environment is how a switch arrives, not what a switch is
`reims-vgpu-env` becomes `reims-vgpu-config`, re-exported as `crate::config`,
and every call site moves with it.

The rename is the point. What the crate owns is a declaration, a total type for
each value, membership in `ALL`, and the rule that an override may only *narrow*
what this device does and may never widen it. None of that is a fact about
environment variables — the environment is the delivery mechanism, and naming
the crate after it invites a second mechanism to arrive as a second place the
set is written down. A second reader in front of the same declarations is the
shape that stays correct.

Nothing about the parse, the switches or the narrowing rule changes. 161 call
sites, the observe crate's draw-log read, the feature matrix's crate list and
the QEMU build script's comment all move together, and the workspace still
builds on every arm.

reims-vgpu-config 15 tests, reims-vgpu 2158 — both unchanged. Feature matrix all
arms warnings=0; clippy and rustfmt clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 10:29:35 +03:00
Anees Iqbal 4ceee35665 probes: the driver scripts resolve the live pathway instead of naming one
Three probes — sustained-animation, gpu-load, spotlight — spelled one checkout's
absolute path (`/home/aneesiqbal/...`) as `REPO`, so they could not run on any
other machine. Twelve more, those three included, spelled
`vm/disks/run/qmp.sock` as the QMP socket, which is the x86 pathway's; an arm64
boot puts its socket under `vm/guest/run/`.

Between them that is the whole driven-boot harness pinned to the x86 host, and
the arm64 host is the only one the Metal rail exists on — so the probes that
rank this device's per-draw costs could not be pointed at the rail whose costs
are least known.

`qmp.py` already resolves whichever pathway is live and has since it was
written; the shell scripts were overriding that resolution with a constant.
`qmp.py sock` prints what it resolved, so there is one resolver and the drivers
ask it rather than each carrying a copy of half the answer. It answers without
connecting, because the question is which socket to use and that is worth
asking before a boot as well as during one.

`REPO` is derived from `BASH_SOURCE` in all three, which is what every other
script in `scripts/` already did.
2026-09-01 00:15:02 +03:00
Anees Iqbal bfe2037c79 objects: the object-list tags carry Apple's names, not their numbers
The codebase called the guest's object-list tags `type-4`, `type-5`, `type-11`
and `TYPE7` in about 1400 places, which is what you write while the contract is
still being recovered. It is recovered, so this names them.

Static RE settles it. The tag is Apple's `APVObjectType`, from the mangled
symbol of the one writer, `AppleParavirtResourceHeap::addObject(APVObjectType,
unsigned int, unsigned int, void const*)`. Every constant reaching that call
was read out of the guest's own driver — extracted from the provisioned
13.6 image this project boots — and cross-checked against the tag the device
side dispatches on in `PGResourceManager::createObject`, on both 13.6 and the
current host. So: 1 buffer, 2 and 3 texture, 4 backing, 5 ref texture,
6 function, 7 serializer object, 8 texture view, 11 mapper-ref texture.

Two findings the names now carry:

The rails use disjoint halves of one tag space, because the guests load
different drivers — an x86 guest `AppleParavirtGPU`, an arm64 guest
`AppleParavirtGPUIOGPUFamily`. That is why 4 and 5 never appear on arm and 11
never on x86, and why neither absence is a decode gap. The old comments called
this "the x86 type-4 present path" without saying why it was x86's.

Tag 3 is not a "variant" of 2. Both are one `APVObjectTexture` landing on
`PGSinglePlaneTextureResource`; the host sets that resource's
`_generateMipmaps` exactly when the tag is 3, and then reads one 36-byte level
record instead of the count the descriptor's leading 14-bit field states. A 3
is a texture whose base level the guest describes and whose chain the host
generates — identical in Ventura and on the current host.

`OBJECT_TYPE_TEXTURE_VARIANT` becomes `OBJECT_TYPE_TEXTURE_GENERATE_MIPMAPS`,
`OBJECT_TYPE_TYPE7` becomes `OBJECT_TYPE_SERIALIZER_OBJECT`, and the tag table
plus its provenance lands in the owner, `runtime::decode::resource`. The
serializer-object subtypes get the same treatment: the host requires tag 7 and
then dispatches on the descriptor's first dword, which confirms the sampler,
depth-stencil and pipeline values this crate already had and names the two it
has no reader for.

Identifiers, observability slugs, doc comments and test names all move
together; slugs renamed here are renamed in the probe scripts that grep them.
Pure rename: no decode, no dispatch and no wire constant changed.

Verified: fmt, clippy and `cargo doc` clean of new findings on the workspace;
1333 lib tests, and the full `--all-targets` suite serially on both the default
Metal rail and `backend-vulkan` (2181 + integration, 0 failed); the
`backend-metal,backend-vulkan` both-rails configuration still checks. No VM or
conformance run: nothing here can change guest-visible behaviour.

Claude-Session: https://claude.ai/code/session_01HsCsfsNbdFAS11TaiPpkik
2026-08-31 22:43:30 +03:00
Anees Iqbal 2de1663909 metal: the rail presents into the host window, and QEMU's display is no longer the arm64 screen
The Metal rail was the last thing on this device still drawing through QEMU's
Cocoa display. That made the one measurement a `--backend both` binary exists for
— the same guest stream through native Metal and through MoltenVK, with one
variable changed — a comparison across two different display stacks: two
compositors, two present cadences, two input paths, and a frame that differed
between the rails with no way to say which layer changed it.

So the Metal rail gets a presenter of its own. `backend/metal/window.rs` is a
`CAMetalLayer` on the window's own `NSView` and a one-triangle render pass that
fits the published frame into the next drawable; it is reached through the six
`Backend::window_*` methods the previous commit introduced, so the window itself
learns nothing about which rail it is talking to. Both rails now fill one window,
one event loop, one viewport and one input path.

Three decisions worth naming:

* **CPU bytes, always.** This rail retains no texture past the encode that
  produced it, so there is no resident for a present to name and
  `WindowResident` still carries no Metal variant. That is not a step down: the
  Cocoa path read the same frame back through host memory before this window
  existed, so nothing here adds a copy.

* **A render pass, not a blit encoder.** The frame has to be aspect-fitted and
  `MTLBlitCommandEncoder` cannot scale. The viewport is `aspect_fit` — the same
  function the pointer path maps through, so presentation and input stay one
  unit — and the pass's clear colour is the letterbox.

* **A sublayer, not the view's layer.** `setLayer:` makes a view layer-hosted,
  and winit's view is already layer-backed; handing AppKit's own layer over puts
  two owners on one object. Hosting underneath is also what MoltenVK does for a
  `VkSurfaceKHR` here, so the two rails end up presenting through the same kind
  of layer. `addSublayer:` retains, so the presenter removes itself on drop —
  without that, detaching leaves the last frame frozen on a live layer.

`host-window` no longer implies `backend-vulkan`; it names the windowing stack
and nothing else, and each rail's surface half travels with that rail's feature.
The meson `metal` arm builds it, and `vm/boot-arm64.sh` now chooses
`-display none` for the device rather than for one of its rails.

Four raw-Metal calls this needed are added checked, in the module that exists
for exactly that: `newLibraryWithSource:` (metal-0.33 asserts on a nil library,
inside a frame the event loop calls, where a panic aborts the process),
`newFunctionWithName:`, `newRenderPipelineStateWithDescriptor:`. The NSError
text walk the first two need was already written twice and is now written once.

Verified live, arm64/macos-13/reims-vgpu-mmio, `REIMS_VGPU_RAIL=metal` on a
`--backend both` build: `display=reims-host-window backend_rail=metal`, the
window opens at 1920x1080, 144 frames published across the boot with
`dropped=0`, and no `metal_window_*` refusal in the whole run. The guest settles
to `draws=0` at an idle desktop and a QMP pointer move brings it straight back
(`draws=42`) with the window publishing fresh frames — so the quiet is an idle
guest, not a wedged one.

The picture itself is checked by rendering, not by looking: this host's display
was asleep and every screen capture came back black, so the two new tests run the
presenter's real encode into a readable texture. A 2x2 source into a 2x2 target
lands every destination pixel centre on a source texel centre, so orientation is
an exact comparison rather than a tolerance; a 2x1 into a 2x2 proves the fit and
that the bars are the clear. Both would have caught a flipped `uv` or a viewport
that quietly covered the whole target — neither of which any counter reports.

Also: feature matrix green on all five cells, `cargo test` green on metal,
vulkan+host-window and both+host-window (1381 / 2179 / 2260 lib tests).
2026-08-31 20:42:36 +03:00
Anees Iqbal 56e04b7630 build: --backend both, so the two rails can be compared without a rebuild
The Rust side has carried both rails since the selection commit; nothing could
produce a QEMU that used it. `scripts/qemu-build/qemu-build.sh --backend both`
now does, passing `-Dreims_vgpu_backend=both` to the submodule's meson (its own
commit).

Apple only, checked before meson runs so the message names the build choice
rather than arriving as a rustc error inside a custom target: `both` carries
`backend-metal`, which the crate rejects off macOS because there is no
host-stub Metal arm. The pre-existing metal-only check becomes a `case` over the
two backends that share that requirement.

`AGENTS.md` gains the fourth pathway row and the rule this whole branch is the
consequence of: **a `cfg` may answer only "what did this build compile", never
"which rail is running".** On the fourth row those are different questions and
the compiler cannot tell them apart — a `not(feature = "backend-vulkan")` block
meaning "the Metal arm" disappears silently when both features are on, which is
what `emit_object_cache_levels`, `mipmap` and `exec`'s preflight each did before
`Backend` took those decisions over. The row is documented as a measurement
configuration, not a shipping one.

Verified: `--backend both --target aarch64` configures, compiles and links
`qemu-system-aarch64` on this Apple host, and the linked binary carries both
rails — `compute_mtl_pipeline_ref_zero` *and* `compute_vk_pipeline_ref_zero`,
`MTLCreateSystemDefaultDevice` *and* `vkCreateInstance` — plus `rail_selected` /
`rail_refused` and `REIMS_VGPU_RAIL`. The `--backend vulkan` build was then
rebuilt to leave `vendor/qemu/build` configured as it was found.

Not verified: no guest boot on the both-rails binary. The three shipping
pathways are unaffected — `resolve_rail` returns a single-rail build's only rail
for every input — but the comparison this configuration exists for has not been
run against a guest yet.
2026-08-31 19:41:39 +03:00
Anees Iqbal 76db0dec46 backend: one binary carries both rails, and the running one is chosen at run time
This is what the branch was for. An Apple host reaches its GPU natively through
Metal and through MoltenVK, and those two paths translate the guest's command
stream by completely different means — so when a frame is wrong, "is this a
metal2vulkan defect or a defect in this device" is the first question, and it
was unanswerable without a rebuild that changes the binary, the caches and the
boot. It is now one binary, one guest stream, and one variable.

`lib.rs` no longer rejects `backend-metal,backend-vulkan`. The remaining rule is
"at least one".

`backend::resolve_rail` is the decision, and it is a **pure total function** —
`(Compiled, metal_available, RailRequest) -> RailChoice` — compiled on every arm
so its table is tested on every arm. Needing two live GPUs present to check a
narrowing rule would have put its tests on no arm at all, which is exactly how
the `not(backend-vulkan)` gates this seam replaced went stale unnoticed.
`Compiled` is an enum, not two bools, because "neither rail" is not a build
`lib.rs` permits and a bool pair would make that state representable in the very
table that decides what executes guest work.

The rules, in order of authority:

* What the build carries. One rail compiled is chosen even with no device
  behind it — there is nothing to fall back to, and refusing here would replace
  "the draw found no Metal device", which names the missing device where it was
  needed, with a failure at device create.
* What the host was measured able to run. Metal's probe is one
  `MTLCreateSystemDefaultDevice`. Vulkan has no equivalent by design: its
  context is created lazily at the first encode so protocol tests need no ICD,
  and asking whether an ICD exists *is* that creation. So Vulkan is the fallback
  rather than the preference, and that asymmetry is stated rather than implied.
* What the operator asked, through the new `REIMS_VGPU_RAIL`. **It narrows and
  never widens.** `rail=metal` on a host with no `MTLDevice` is refused, not
  obeyed — obeying it would put every draw in front of an absent device. Naming
  an uncompiled rail, naming an unavailable one, and misspelling one are three
  refusals and not one, because they are three operator mistakes with three
  different fixes.

`env::choice` is the third parse kind beside `switch` and `count`, with its own
registry so `report_line` prints `rail=metal` rather than
`rail=unrecognized(metal)`. `Rail::name` is the single spelling: the env value,
the boot line, every refusal and `Backend::name` all read it.

`REIMS_VGPU_RAIL` is deliberately *not* the build-time `REIMS_VGPU_BACKEND` that
`scripts/qemu-build` and `vm/` read. Two owners, two lifetimes; one name would
make "I set it and nothing changed" ambiguous between "this build has no such
rail" and "the device declined the ask".

Six tests keyed an expectation or a stimulus on `cfg` where they meant the
running rail, and eight more reached `backend::selected()` where they meant a
specific one. Each now says which: `VulkanBackend`/`MetalBackend` by name where
the test is about a rail, `selected().rail()` where the answer legitimately
differs. The mapper's alias test split in two — the rail hands an alias back
once, the heartbeat unmaps what it is handed — because those are two contracts
with two owners and testing them together only worked while a build had one
rail.

`scripts/feature-matrix` gains a fourth cell. It is not a fourth flavour of the
other three: it is the only cell where "which rail did this build compile" and
"which rail is running" differ, so it is what catches a `cfg` that conflates
them — the class that `emit_object_cache_levels`, `mipmap` and `exec`'s
preflight each fell into.

Verified: feature matrix (all four arms, both workspaces rustfmt-clean), clippy
`-D warnings` on metal / vulkan / both, and the full suite serially on metal
(1332), vulkan (2274), both-default (2353), both with `REIMS_VGPU_RAIL=vulkan`
(2353) and with `=metal` (2353). The forced-rail runs are the ones that matter:
the same binary executes the same 2353 tests through either GPU API.

Not verified: no VM boot. Nothing here changes what a single-rail build does —
`resolve_rail` returns that build's only rail for every input — so the shipping
pathways are unaffected, but the both-rails binary has not been run against a
guest and the QEMU build plumbing does not yet offer it.
2026-08-31 19:09:15 +03:00
Anees Iqbal 1bf7f90ce5 contract: the protocol vocabulary cannot name a backend, and now the compiler says so
Component: crates/reims-vgpu (contract, runtime/compute_exec) plus the new
crates/reims-vgpu-contract. Pathway: all three. Structural; no guest-visible
behavior and no rail-specific term.

Contract: the catalogue's F0 item asks for a backend-neutral semantic vocabulary
— decoded enums, descriptors, geometry, pixel formats, pass actions, page
arithmetic, exact refusal values — with Vulkan handles, SPIR-V, memory
placement, descriptors, queue families, image layouts and host capability policy
kept out of it. `contract/`'s own doc already said "pure data and pure functions
only — no guest state, no GPU, no QEMU", and every module in one crate could
reach every other, so the rule held only while someone was reading.

Owner: the crate graph. Behaviour changed: none at runtime. `src/contract/`
becomes `reims-vgpu-contract`, depending on the wire views, the paging walk, and
the decline vocabulary — nothing else is in scope, so a contract check cannot
name an `ash` type, a Metal object, a QEMU type or this device's state by
accident. It is re-exported as `crate::contract`, so no call site moves.

The move produced one thing the doc could not. `Extent3` is shared between this
decoder and the backend it dispatches through, and `compute_exec` carried an
inherent `impl Extent3` whose two constructors refuse with `ComputeStatus` and
read a decoded `Size3` — device vocabulary the contract crate cannot name. The
orphan rule rejected it. They are now `extent_from_wire` and
`extent_from_indirect` free functions in the decoder that owns those types, with
the same arithmetic and the same refusals; the extent type stays shared and only
the narrowing that produces it from this device's wire moved.

`iosurface_pages`' fixtures took the arm64e page size from `model`, which
re-exports the shift from `contract::gva` and widens it locally for its own
address arithmetic. The test now derives the same `u64` from the same shift on
this side of the boundary, so the two still cannot disagree in value.

Test: no new behaviour, so no new regression test; the counts are the claim.
2274 tests in `reims-vgpu` before, 2165 plus 109 in `reims-vgpu-contract` after
— the same 2274, none dropped or silently cfg'd out. The feature matrix's
support-crates cell counts the new crate too.

Verified: `cargo test -p reims-vgpu --no-default-features
--features backend-vulkan,host-window -- --test-threads=1` (2165 + 97, 0
failed); `cargo test -p reims-vgpu-contract -p reims-vgpu-env -p
reims-vgpu-observe -p reims-vgpu-paging -- --test-threads=1` (109 + 13 + 45 +
36, 0 failed); all three main clippy arms plus `-p reims-vgpu-contract`, all
with `-D warnings`; `scripts/feature-matrix/feature-matrix.sh` all cells PASS;
`cargo fmt --all` and `--check`; the rustdoc link pass, whose unresolved-link
multiset is byte-identical to the parent's; a release staticlib build carrying
no test log path.

Not verified: no VM boot and no conformance battery were run.
`reims-vgpu-wire`'s twelve oracle-fixture failures remain inherited debt,
unchanged and untouched.
2026-08-31 14:42:41 +03:00
Anees Iqbal 4fdd3d6efc observe, env: make the layering below the device a fact the compiler checks
Component: crates/reims-vgpu (observe, env, contract, runtime) plus the new
crates/reims-vgpu-env and crates/reims-vgpu-observe. Pathway: all three.
Structural; no guest-visible behavior and no rail-specific term.

Contract: the catalogue's F0 item asks for a backend-neutral vocabulary — a
protocol layer that can name a refusal without naming a backend, with
observability and configuration extracted as behaviour-free support beneath it.
`observe`'s own module doc already made the claim in prose ("the sink must sit
somewhere `translate/` and `caps/` can name their reason type without depending
on `runtime/`"), and nothing checked it: every module in one crate can reach
every other, so the direction held only as a habit.

Owner: the crate graph. Behaviour changed: none at runtime. `env.rs` becomes
`reims-vgpu-env`, and `observe`'s sink, decline vocabulary, `Emit` builder, slug
registry, driver watch, footprint and phase clock become `reims-vgpu-observe`.
Both are re-exported under the paths callers already write — `crate::env::…`,
`crate::observe::fail(…)`, `crate::observe::Decline` — so no call site moves. A
layering change that also rewrote three hundred call sites would be two changes
reviewed as one.

`ladder` and `panic` stay in `reims-vgpu`: both name `runtime` types, which is
precisely the dependency the split is drawing a line under.

The split immediately produced one thing prose could not. `contract::gva_resolve`
carried `impl Refusal for ResolveStatus`, with both the trait and the type now
foreign to `reims-vgpu` — an orphan-rule error, and an honest statement that
`reims-vgpu-paging`'s walk status and `reims-vgpu-observe`'s vocabulary meet in
neither crate. It is now `walk_refusal(&ResolveStatus) -> Option<&'static str>`
with the same twelve slugs, and `MemError::slug` delegates to it exactly as it
delegated to the impl.

Test-only surface: `FailCapture`, `fail_log_path`, `forget_all_latches` and the
slug-collision panic are used by tests compiled separately from the crate that
defines them, so they are gated on `any(test, feature = "testing")` and
`reims-vgpu` turns the feature on from `[dev-dependencies]`. Verified that the
shipping artifact does not: `cargo tree -e features` shows `testing` only under
dev-dependencies, and the release staticlib contains `/tmp/reims-vgpu-fail.log`
once and no per-pid test path, so the background writer and the flood detector
are the ones that ship. The writer's flood machinery is `cfg`'d to the
configurations that use it rather than given an `allow(dead_code)`.

Test: no new behaviour, so no new regression test. The existing suite is the
evidence, and the counts are the claim: 2332 tests before the move, 2274 in
`reims-vgpu` plus 45 in `reims-vgpu-observe` plus 13 in `reims-vgpu-env` after —
the same 2332, none dropped or silently cfg'd out. `scripts/feature-matrix`
gains a support-crates cell so a future module move does not read as the
emptied-arm loss its own warning is about.

Verified: `cargo test -p reims-vgpu --no-default-features
--features backend-vulkan,host-window -- --test-threads=1` (2274 + 97, 0
failed); `cargo test -p reims-vgpu-env -p reims-vgpu-observe -p
reims-vgpu-paging -- --test-threads=1` (13 + 45 + 36, 0 failed); all three main
clippy arms plus `-p reims-vgpu-observe --features testing` and the bare arm,
all with `-D warnings`; `scripts/feature-matrix/feature-matrix.sh` all cells
PASS; `cargo fmt --all` and `--check`; the rustdoc link pass, which loses nine
pre-existing unresolved links and adds none; a release staticlib build.

Not verified: no VM boot and no conformance battery were run.
`reims-vgpu-wire`'s oracle-fixture tests fail 12 cases when the gitignored
fixtures are present. That is inherited debt, not this change: the same 12 fail
identically on the parent, run from a separate worktree with
`REIMS_WIRE_FIXTURES_DIR` pointed at the same fixtures. Nothing here touches
that crate.
2026-08-31 14:37:26 +03:00
Anees Iqbal bde2342fd9 Merge pull request #58 from steelbrain-bot/steelbrain/v6-backport
Backports from v6 branch + metal2vulkan upgrade + fixes
2026-08-31 14:01:14 +03:00
Jiajun Liang 2835b6c032 Enable the x86 macOS / host-Vulkan pathway on Windows hosts
Platform-gated port of the Vulkan backend and its build to Windows:

- lib.rs: allow backend-vulkan on target_os = windows (the gate comment says
  a new port is a deliberate edit to this list; Windows hosts use native
  ICDs, so this is that edit).
- backend/vulkan/engine/context.rs: add the VK_KHR_win32_surface platform
  arm next to the macOS/Linux arms.
- host_window/present.rs: Windows refuses a non-main-thread winit event loop
  unless the application opts in; add the EventLoopBuilderExtWindows::
  with_any_thread opt-in, mirroring the existing X11/Wayland arms.
- scripts/qemu-build/qemu-build.sh: the ninja target and QEMU_BIN path carry
  a .exe suffix on MINGW/MSYS hosts.
- vm/boot-windows.sh (new): Windows boot script — WHPX/TCG selection, the
  standard pcibridge + GOP romfile attach, QMP over tcp (no unix sockets on
  Windows), SSH forward 2222.
- vendor/qemu: bump to the Windows-build shim commit (PR
  steelbrain/qemu-reims-vgpu#2).

Verified on Windows 11 (WHPX + TCG): MSYS2 build of qemu-system-x86_64.exe
with the Vulkan backend; the device initializes on a native NVIDIA ICD
(vk_caps: api=1.4, host_pointer_import=supported), the host window presents
its first frame, the guest firmware installs the reims EFI GOP and the boot
loader proceeds to kernel handoff. Linux: cargo check for
backend-vulkan,host-window passes unchanged; the WSL/KVM pathway is
unaffected.
2026-08-31 09:16:20 +08:00
Anees IqbalandClaude Opus 5 ca66596b83 repro: the aim called a fully open menu "mid-animation" because two settles disagreed by 300ms
Component: menu-close probe (scripts only). Pathway: x86 macOS / Linux Vulkan,
rail macos-15. No product code and no guest-visible behaviour changes.

RETRACTION: `mab-r1-ctl` reported `VERDICT=CLEAN` on the control binary. That
verdict is void, and so is the A/B run it opened. Both self-tests passed, the
metric was sound, and the run still measured nothing.

The settled-open reference waited 1.2 s after the right-click. Every timed trial
waited 0.9 s. The menu is still animating open at 0.9 s, so a fully open menu
photographed by a trial measured 199.697 against a 193.06 reference -- a 6.6 gap
with nothing closing. The aim looks for a frame matching neither settled state,
and 6.6 clears the 4.00 tolerance, so it accepted that static open menu as the
close animation at its very first offset. Every trial then photographed the same
static menu, scored zero new black, and the run reported CLEAN.

The `ANIMATION_NOT_SAMPLED` guard added one commit earlier did not catch it,
because the guard asks the same classifier the same question and gets the same
wrong answer. A guard that shares the defective predicate is not a second
opinion. What was missing is upstream of both: one definition of "the menu is
open". `OPEN_SETTLE` is now that definition and both sites use it -- the same
repair as `grab_at`, which made the aim and the measurement share one dismiss
schedule, applied one stage earlier to the open schedule.

Two further corrections to the calibration, both from this boot's numbers:

The noise floor was measured from two captures 0.5 s apart of one standing menu,
which measures the capture path rather than the trial-to-trial variation that
matters -- each trial opens its own menu. It read exactly 0.000 twice over,
flattering the calibration while missing the 6.6 the trials saw. Each state is
now captured twice through a full open-or-dismiss cycle.

`crop_mean` now measures colour only. The captures are `srgba` and
`%[fx:mean]` averages all four channels, so a constant opaque alpha contributed a
fixed 255 to every reading: this rail's closed desktop and open menu separate by
134 on colour and by 100 with alpha folded in. It also makes this reading and the
scoring metric describe the same channels, which matters more than the
sensitivity -- the metric's previous defect was exactly a disagreement about
which channels were being read.

Verified: bash -n; the alpha contribution measured on this boot's real captures
(closed 92.6 -> 38.5, open 193.1 -> 172.4).

Not verified: no boot has run this version. No menu-close verdict on either
binary means anything yet, and the A/B remains unrun.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 00:05:02 +03:00
Anees IqbalandClaude Opus 5 08b3c2dbe0 repro: the scoring metric was disabled by an alpha channel, and its self-test could not have four channels
Component: menu-close probe (scripts only). Pathway: x86 macOS / Linux Vulkan,
rail macos-15. No product code and no guest-visible behaviour changes.

RETRACTION FIRST: `smoke-ctl` reported `VERDICT=BLACK_RECTANGLE` on the control
binary with `new_black_frac=0.917071` on all six trials. That verdict is void.
Re-scored with the metric below, all six of its frames score exactly 0, and all
six are photographs of a fully open menu. Nothing about the black-rectangle
defect was measured.

Two independent defects produced it.

1. The score was the mask's own mean, not an intersection. The host captures are
   `srgba` -- four channels -- and `-negate` negates every channel, alpha with
   the rest. The thresholded frame came out fully transparent, so compositing it
   over the mask left the mask untouched and `%[fx:mean]` read back the mask:
   0.917071, the same number for every frame of every trial, and large enough to
   trip the 0.10 threshold. The third constant this probe has reported as a
   measurement.

   The metric now flattens with `-alpha off -colorspace Gray` before thresholding
   and intersects with `-evaluate-sequence min`. Darken *is* min, but as a
   composite it is an alpha-aware blend of a source onto a destination, which is
   not the operation wanted; as a sequence operator it cannot be turned into a
   no-op by an alpha channel arriving from a different capture helper. Both
   changes are needed and each fixes the case alone.

   The self-test could not have caught this: it built its images with `xc:` and
   no alpha, so the one channel that broke the metric was the one channel the
   test did not have. It now builds `PNG32:` four-channel images, and it darkens
   the reference's top half against the frame's left half so the answer is the
   0.25 quadrant while *both* operands measure 0.50. The old half-black case
   expected 0.50, which is also what returning either operand untouched produces
   -- the expected value coincided with the failure. On the new images the old
   pipeline scores 0.75 and this one scores 0.25.

2. The aim's tolerance was a flat 3 and the desktop is noisier than that. The
   open menu measured 193.06 at calibration and 199.697 seconds later with no
   input in between. Every later capture of a static open menu therefore read as
   "neither settled state", the aim declared the animation found at its very
   first offset, and all six trials photographed that static menu.

   Each settled state is now captured twice, 0.5 s apart with no input, and the
   tolerance is 2x the larger drift plus 3. A run whose two states are not
   separated by three times that noise floor ends METRIC_BLIND rather than
   scoring the noise. Against this boot's measured values the drifted open menu
   classifies as not-MID, which is what lets the aim keep scanning to the
   offsets where the grab lands after the dismiss.

Verified: bash -n; both metric transitions demonstrated on four-channel images
(0.75 -> 0.25) and on this boot's real frames (0.917071 -> 0); the tolerance
transition checked against this boot's measured settled means.

Not verified: still no boot has produced a menu-close verdict that means
anything, on either binary. The A/B remains unrun.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 23:56:47 +03:00
Anees IqbalandClaude Opus 5 b1c7b531fe repro: the menu probe aimed at a window of offsets the capture's grab never fell in
Component: menu-close probe (scripts only). Pathway: x86 macOS / Linux Vulkan,
rail macos-15. No product code and no guest-visible behaviour changes.

The probe reached its aim stage on a live boot for the first time and refused:
five dismiss delays returned `mean=199.697` to six digits, the same fully-open
menu five times, against `no_menu=92.6` and `menu_open=193.1`. The menu opened
and the metric worked; the frames were simply all taken before the menu closed.

The quantity that decides whether a frame lands in the fade is the offset
between the dismiss click and the moment the capture grabs, and the probe
controls neither directly -- it controls when it starts the capture, and the
grab happens an unknown latency L later inside the helper. The old sweep always
started the capture first and dismissed 0.34-0.50 s afterwards, so it covered
offsets in [-0.50, -0.34]: a 0.16 s window, entirely on the far side of the
grab. No value in it could have sampled the animation.

The aim is now over a signed offset O = (capture start) - (dismiss), so the
grab lands at O + L and a range wider than L + fade crosses the fade without
anything having to know L. A coarse scan over [-0.40, +0.45] brackets it, and
when two neighbouring offsets read open and closed the transition is between
them and four bisections find it. `grab_at` owns that timeline and both the aim
and the measurement call it, because two spellings of one schedule is how they
come to disagree about what the chosen offset means.

The classifier is distance from each settled state, not betweenness. Betweenness
was the obvious spelling and it is blind to this probe's own defect: a black
rectangle where the menu was reads near 0 against a 92.6 closed desktop and a
193 open menu, so it is below *both* settled states rather than between them. A
betweenness test files it as "closed", the aim never finds the animation on a
defective boot, and the one boot carrying the defect is the one the probe
refuses to score. Demonstrated, not reasoned: on this boot's measured means an
all-black frame classifies not-MID under the old test and MID under the new one.

Two guards keep a blind run from reading as a clean one. `classify 0` must
return MID against the means this boot actually measured, or the run ends
`VERDICT=METRIC_BLIND` -- the same shape as the existing scoring self-test, and
run after BASE and OPEN are known because the answer depends on them. And a run
whose trials all drifted onto the settled closed frame ends
`VERDICT=ANIMATION_NOT_SAMPLED` rather than CLEAN, because a settled frame is
uniformly not-new-black and scores zero for a reason that has nothing to do with
the defect.

Verified: bash -n; the classifier transition checked both ways against this
boot's measured means. Not verified: no boot has yet run the repaired aim, so no
menu-close verdict exists on either binary. The prior A/B produced none.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 23:49:54 +03:00
Anees Iqbal 80a0e4043a Unify host screenshot capture
Replace the separate KDE and macOS helpers with one capture-app based path. Capture at native resolution, validate the PNG, and cap output at 720p or optional 1440p while preserving strict window selection and black-frame refusal.

Update probes and documentation to use the unified helper.

Validated with bash syntax checks, Python parsing, diff checks, and a live KDE capture at 3840x2290 downsampled to 1207x720.
2026-08-30 23:38:42 +03:00
Anees IqbalandClaude Opus 5 c9c425fe69 repro: the menu probe's verdict was computed from a quantity that did not depend on the frame
Component: host-driven repro harness (scripts/menu-close-probe). Pathway: x86
macOS / Linux Vulkan, rail macos-15. No product code and no guest-visible
behaviour changes.

This probe could not see a black rectangle. It reported CLEAN because CLEAN is
what a blind metric reports.

How it surfaced: a control binary (with 6277c55d's product change reverse-
applied) and a candidate binary were both run through it, and every trial of
every boot of both arms returned the identical `new_black_frac=0.0829293` --
seven digits, four boots, two different binaries -- while the per-frame `mean`
varied from 141 to 180. A number that does not move when the frames move is not
measuring the frames. 0.0829293 is the mean of `basemask.png`: the wallpaper
crop's own dark fraction.

The cause is one operator. `basemask` was built with `-threshold 6% -negate`,
making it "white where the no-menu frame **is** near-black". The scoring
composite is `Darken`, which is `min`, so the metric computed `near-black now
AND near-black before` -- the intersection. The comment two lines above it
states the intended quantity as "near-black in the frame AND **not** near-black
with no menu on screen", the difference. Over a static wallpaper crop the
intersection is a constant.

Demonstrated, not argued: a synthetic frame with half the box painted black
scores 0 under the old pipeline and 0.50 under the corrected one.

Consequences to record plainly: every menu-close verdict this probe has ever
produced is void, including three CLEAN results on the candidate and one on the
control gathered earlier today. Symptom 3 remains undriven by a working
instrument.

Two changes:

1. The `-negate` is removed from the mask, so `Darken` intersects "dark now"
   with "was not dark before" and measures the difference the probe is named
   for.

2. A `self_test` runs on every invocation and abandons the run with
   `VERDICT=METRIC_BLIND` unless the metric scores a synthetic half-black frame
   at ~0.50. This probe has now shipped two scoring metrics that measured
   nothing -- the first used `%[fx:mean(lightness)<0.06]`, which is not a magick
   expression, so the column was empty on every frame -- and both failed
   silently, and both reported CLEAN, which is the defect's own answer. A CLEAN
   verdict is only worth reading from an instrument that would have said
   BLACK_RECTANGLE if the rectangle were there.

The self-test and the real measurement now call the same `base_mask` and
`new_black_frac`, rather than the self-test building its own mask. That is the
part that makes the guard mean something: with a private copy, a self-test would
pass while the measured path stayed blind, which is precisely the failure being
guarded. Verified by regression: reintroducing the `-negate` inside the shared
`base_mask` drops the self-test to 0 and the run is abandoned.

Verified: shell syntax (bash -n); the corrected pipeline scores a synthetic
half-black frame at exactly 0.50 and the old one at 0; the self-test passes on
the corrected polarity and fails on the reintroduced one.

Not verified: no boot has run the corrected probe. Both arms have to be re-run,
and no statement about symptom 3 survives this commit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 20:43:24 +03:00
Anees IqbalandClaude Opus 5 819ccdf946 repro: the web-content probe needed an interpreter the guest is not obliged to have
Component: host-driven repro harness (scripts/web-content-probe). Pathway: x86
macOS / Linux Vulkan, rail macos-15. No product code and no guest-visible
behaviour changes.

Observation: two boots of this rail ran the probe and both exited `rc2` with
"the page never declared a layout". That message reads as a rendering failure
and is not one -- no page was ever served.

The probe's server runs inside the guest and is a `python3` script. macOS ships
`/usr/bin/python3` as a **stub**: it satisfies `command -v python3`, and running
it without the Command Line Tools installed opens a GUI dialog and exits. On a
rail image without them the server never starts, nothing is served, the page
declares no layout, and the only evidence of any of this is a log file inside a
guest that is reverted moments later. Both boots produced the identical message
and no diagnosis, because every fact that would explain it died with the guest.

`--serve host` serves the same page from this machine and points the browser at
the slirp gateway `10.0.2.2`, which removes the guest-side interpreter from the
probe entirely. `probe_server.py` needs no change: QEMU user networking
translates a guest connection to `10.0.2.2` into a host-side connection to
loopback, so its existing `127.0.0.1` bind is reachable and it does not have to
be widened to `0.0.0.0` to be reached. The layout JSON then lands on the host,
so reading a result no longer requires an ssh into a guest that is about to
disappear.

`--serve guest` remains the default. Host serving is very likely better on every
rail, but the rails this probe already measures were measured through the guest
arm and changing their transport underneath them is a claim this change has no
evidence for.

The guest-arm failure message now names the stub and points at `--serve host`,
so the next person meets the diagnosis rather than the symptom.

Verified: shell syntax (bash -n); the host server started and served the probe
page over HTTP (200, 14972 bytes) in a local smoke test with no guest involved.

Not verified: no guest has loaded the page over the gateway yet, so the
end-to-end host-served path is unproven -- the arm that will exercise it is
queued behind the symptom-3 control arm. The guest arm is untouched and
unretested by this change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 20:40:11 +03:00
Anees IqbalandClaude Opus 5 0a585b3884 repro: the menu probe's two anchors were guesses about a desktop it never looked at, and both were wrong
Component: host-driven repro harness (scripts/menu-close-probe). Pathway: x86
macOS / Linux Vulkan, rail macos-15. No product code and no guest-visible
behaviour changes.

Observation: five consecutive graded boots ran this probe and all five exited
`rc2` with "the menu box did not change when the menu opened". That reads as a
menu that failed to appear. Differencing the probe's own two captures on the
boot that did not panic shows 38 % of the screen changing over a bounding box
of the whole display, with the mean moving 106 -> 148. No context menu was
created on any of the five. The right-click raised an application window; the
dismiss click put it behind Finder.

Both of the probe's anchors were positional guesses:

- `ICON_X,ICON_Y = 333,1033`, documented as "the Finder icon, leftmost in the
  dock". On this rail's current snapshot that coordinate is not Finder.
- `AWAY_X,AWAY_Y = 1700,400`, documented as "somewhere with no window and no
  menu". The snapshot boots with an application window open and frontmost, so
  it was beside that window rather than on bare desktop.

Dock layout is precisely what moves between snapshots, guest versions and
running-application sets, so re-measuring the dock would buy one snapshot's
worth of correctness and fail the same way at the next.

The probe now opens the **desktop** context menu instead. macOS places it with
its corner at the cursor, so the rectangle follows from the coordinate this
script itself clicked rather than from a dock it cannot see in advance. The
crop is derived from `MENU_X,MENU_Y` and inset well inside the smallest menu
the desktop produces, because a crop overhanging the menu scores desktop that
never had a menu over it.

What that gives up is stated in the file rather than papered over: the reported
interaction names a dock icon's menu, and this is one step removed from it. The
defect is a property of the menu layer's close-in animation rather than of
which menu it is, but if it turns out to be dock-specific this probe will read
CLEAN and be wrong, and the dock variant will have to be aimed by survey.

Second change, from the same arm: a right-click on this rail has been observed
killing the guest about four seconds later. A dead guest yields frozen,
identical captures, and identical captures score as no new black at all --
which reads as CLEAN. That is the one wrong answer this probe must not give,
because it would report the defect repaired by a boot that died before it could
show it. `guest_gone` marks the serial log's length before the first input and
is consulted at the opening captures, inside the trial loop, and before the
verdict; a run with no trial against a live guest reports GUEST_GONE and scores
nothing.

Verified: shell syntax only (bash -n). Not verified: no boot has run the
re-aimed probe yet, so neither the menu coordinate nor the crop has been
confirmed against a live desktop. The probe's own precondition -- the box must
change by more than 8 mean when the menu opens -- is what will catch it if the
coordinate is still wrong, and it fails loudly rather than scoring.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 20:11:53 +03:00
Anees IqbalandClaude Opus 5 98d66f5387 repro: three inputs arrived inside one eight-second window and no log could say which killed the guest
Component: host-driven repro harness (scripts/input-lever). Pathway: x86 macOS
/ Linux Vulkan, rail macos-15. No product code and no guest-visible behaviour
changes.

Observation this exists for: an arm of five graded boots on this rail killed
its guest three times out of three, each within ~2 s of the menu-close probe's
right-click on a dock icon. Converting each panic's uptime through the rail's
consistent ~11 s firmware-to-kernel offset lands on the probe's own right-click
capture in all three boots -- 140.5 against 140, 142.1 against 142, 136.0
against 136 -- so the association is tight enough to act on and too tight to
have come from an unrelated background event.

It is not, however, an attribution. That probe issues a desktop-wide pointer
sweep, a left-click dismiss, and the right-click inside one eight-second
window. Its logs cannot say which of the three is the lever, and a guest that
dies 2 s after an input is indistinguishable in them from one that dies 60 s
after nothing.

This probe issues exactly one named input onto an identically settled guest and
then stops touching it. The hold afterwards is the measurement rather than a
courtesy: nothing is issued during it, so a panic inside it belongs to the one
preceding input or to nothing at all. The latency is polled rather than slept
through, because "2 s after the input" and "60 s later while idle" are
different defects and a single sleep to the end of the hold reports neither.

The serial log's length is marked before the input, so a panic that was already
present is excluded by construction instead of by reading timestamps -- and a
guest already gone before the input exits non-committally rather than scoring.

`move` is offered but is not the arm's subject: every boot of this harness
already issues five dock-strip pointer moves as its repair sweep, and roughly
ninety historical boots did so without panicking, so pointer motion alone is
already controlled for. The arm that matters is rclick against click against
none.

Verified: shell syntax only (bash -n). No boot has run this probe yet; the arm
that will is queued behind the arm that produced the observation.

Not verified: nothing about attribution to a commit. No control binary has run
this workload, and until one has, none of the above names a cause.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 19:55:08 +03:00
Anees IqbalandClaude Opus 5 69602dd5b5 tooling: the menu-close animation had no witness that could sample it
Component: scripts/menu-close-probe, scripts/qmp.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.
Test tooling only: no product code, no guest-visible behavior, so no
conformance battery applies.

The reported defect -- right-click a dock icon, left-click to dismiss, and a
black rectangle is left behind for the duration of the close animation --
had a probe that had never produced a valid reading. Three things were wrong
with it and each alone was fatal:

  1. It captured repeatedly *after* the dismiss click and reported the
     darkest frame. The host capture costs 1 427 ms on this rig (six timed
     captures, 8 562 ms) and the animation is ~250 ms, so every frame landed
     after it was over. That is why every trial of every run reported the
     identical mean -- the number was the settled desktop, not the
     animation.
  2. Its verdict column was `dark=%[fx:mean(lightness)<0.06]`. `mean(...)`
     is not a magick fx operator, so magick errored on every frame and the
     column was empty on every frame. The probe's actual verdict never
     computed.
  3. Its menu rectangle was a hardcoded guess.

What replaces it: aim the capture rather than chase the animation. The
capture's 1 427 ms is nearly all setup and the frame is grabbed late, about
500 ms in -- measurable by starting a capture and opening the menu 150 ms
later, which puts the menu in the resulting frame. So starting the capture,
waiting, and *then* dismissing lands the grab inside the fade. The delay is
scanned per run rather than assumed, because it is a property of the host
compositor and not of the guest, and the scan produces the fade as a ramp:
88.4 / 92.7 / 106.9 / 131.7 / 147.4 against a menu-open 147.4 and a no-menu
96.0.

The rectangle is anchored to the icon that opens the menu, not differenced
out of two captures. Differencing was tried: the captures are over a second
apart on a desktop repainting damage rectangles continuously, so the
changed-pixel bounding box came back 1279x704 -- the whole screen -- and on
a boot with the blank-desktop defect the field is itself churning between
the frames. The anchored box is then validated against the two settled
states, so a right-click that opened no menu is reported as such.

The score subtracts the settled no-menu frame: it is the fraction of the box
that is near-black in the animation frame and was *not* near-black without
the menu. Dark foliage in the wallpaper reads near-black honestly, and
without the subtraction the probe reports the desktop as the defect.

Exit 2 is a first-class outcome and is why this probe can be trusted: a run
that did not land inside the fade says so instead of reporting a verdict on
frames that never contained the animation.

scripts/qmp/qmp.py gains `rclick X Y` and a `button` parameter on
send_pointer/send_button. The right button is not a convenience here -- a
dock context menu is only reachable with it, so a driver that speaks only
`left` cannot drive this interaction at all. This replaces an ad-hoc
right-click script that lived outside the tree.

Verification run. Driven against a live macos-15 guest (qemu pid 513878,
HEAD 27a0dc1d): `rclick` opens the Finder dock menu, confirmed by the menu
box reading 147.4 against a no-menu 96.0. Two probe runs of 4 and 8 trials
each calibrated to delay 0.46 and reported worst new-black fractions of
0.031086 and 0.031086, stable to under 0.001 across trials, VERDICT=CLEAN.

Not verified. CLEAN here is one boot. The defect is reported as intermittent
across boots, so this run does not establish a rate and does not show the
probe catching a real black rectangle -- only that it samples the animation
and scores it stably. The probe has not been run on any other rail.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 13:54:30 +03:00
Anees Iqbal 4cbaa00c1d repo: gate formatting in the feature matrix, where nothing else can see it
Component: scripts/feature-matrix/feature-matrix.sh. Tooling only; no product
code, no device behavior, no pathway or rail involvement.

Contract. Formatting is a property of the whole tree under the rustfmt.toml at
the repo root, not of any one backend arm, and nothing else in the toolchain
observes it -- rustc and clippy are both silent on formatting. AGENTS.md
already mandates `cargo fmt --all` followed by `--check` as a required Rust
gate; until now nothing executed that mandate, so the only thing standing
between the tree and unbounded drift was each worker remembering.

Behavior changed. Two cells run before every arm, one per workspace (the root
workspace and crates/reims-vgpu-efi), each running `cargo fmt --all -- --check`
and failing the run on a diff. They run first because they are the cheapest,
need no target installed, and a formatting diff is the one failure nobody
should have to read a compile log to find. The final messages now distinguish
"an arm does not compile" from "the tree is unformatted".

Owning invariant: a missing rustfmt is a FAIL, never a SKIP. A gate that
quietly stands down on the machine lacking its tool is indistinguishable from a
gate that passed, which is the failure mode that lets an arm rot unnoticed.

The v6 original also rewrote AGENTS.md's formatting section. Not carried: this
tree already mandates `cargo fmt`, in stricter terms than that rewrite ("Running
only `--check` does not satisfy it: run `cargo fmt` itself first"). Only the
executable half was missing here, so only the executable half is ported.

Verification actually run. `bash -n` on the script passes. Red witness probed
by hand: appending a deliberately misformatted function to
crates/reims-vgpu-efi/src/main.rs makes the run print
`FAIL rustfmt / reims-vgpu-efi   run: cargo fmt --all` and exit non-zero, with
the diff echoed under its own heading and attributed to the correct workspace,
while the root-workspace cell still reports PASS. The probe was removed by
restoring the file from a copy and verified byte-identical to HEAD with `cmp`;
no git checkout/restore was used. A full `--no-counts` run on the restored tree
then reports all five cells PASS and exits 0: both rustfmt cells clean, metal /
aarch64-apple-darwin, vulkan,host-window / x86_64-unknown-linux-gnu, and
option-rom / x86_64-unknown-uefi.

Not verified. This host is Linux, so the Metal and Vulkan arms are `cargo
check` cross-compiles and no Metal test was run. No VM boot was performed and
none is owed: this commit cannot affect guest-visible behavior. The `--counts`
half of the matrix was not exercised.
2026-08-30 04:47:44 +03:00
Anees IqbalandClaude Opus 5 f0e2d8ab6c scripts: preserve Maps windowed correctness evidence
Backported from steelbrain/stability-fixes-v6 (ca2a6279).

Capture the windowed Maps state and the guest status-item process and preference state before entering full screen, keeping setup prompts and menu-bar defects distinguishable from the scored animation window.

Component: scripts/maps-probe. Pathway: x86 macOS / Linux Vulkan. Rail:
macos-13. No device code changes: host-side shell probe only.

Verified: `bash -n` parses the script. The capture and the guest status-item
query both sit before full-screen entry and before the measurement mark, so
neither enters the scored window.

Not verified: the probe was not driven end-to-end for this commit; it is read
by the next Maps interaction.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 23:58:38 +03:00
Anees IqbalandClaude Opus 5 1481ec6249 scripts: measure Maps after first-run setup
Backported from steelbrain/stability-fixes-v6 (6a02d928).

Dismiss both first-run sheets using their keyboard focus order, preserve immediate and settled captures, and score only the probe's exact interaction window. Keep crash-report freshness and performance counters fail-closed when their identifying context is unavailable.

Component: scripts/ probe harness. Pathway: x86 macOS / Linux Vulkan. Rail:
macos-13. No device code changes: this commit touches only host-side shell
probes, so no guest-visible behavior can move.

Verified: the three scripts parse under `bash -n`. The reverted snapshot's
first-run sheets are the observation this encodes, and the change keeps their
dismissal out of the scored window.

Not verified: the probes themselves were not driven end-to-end for this commit.
Their behavior is exercised when a Maps interaction is next run, which is the
gate that will actually read them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 23:58:28 +03:00
Anees IqbalandClaude Opus 5 36c27f681e vgpu: an integer render target reaches its own format, and a retired ref is retired by its own namespace
Review of this branch. Three defects lost guest work, and the first two share a
cause: a capability mask narrowed below the question its reader asks does not
decline, it answers wrongly.

Component: crates/reims-vgpu contract pixel tables, the Vulkan capability
snapshot and its device probe, the sampled upload rail, and runtime::objects
resolution. x86 macOS / Linux Vulkan pathway, except the object-list half, which
is transport-independent.

## An integer colour attachment had no capability bit, so it was never renderable

`91de82c8` split the two per-layout masks into their own vocabularies and sized
the render-target one by *blendable* layouts. Vulkan mandates no
`COLOR_ATTACHMENT_BLEND` for an integer format, so `Rg16Uint` was in neither
mask, `DeviceCapabilitySnapshot::render_target_layout_supported` had no bit to
read and returned `false`, and `gva_resident_format` built every `RG16Uint`
resident at `RESIDENT_RGBA_FORMAT`. Both Store arms then refused the frame: the
GPU-direct one on `ResidentFormatMismatch` (`held` eight-bit against `want`
`R16G16_UINT`), and the copying one inside `convert_rgba8_to_row`, which has no
integer arm by design and must not gain one.

So `33908f96` admitted the format at `render_target_bpp` and the loss moved one
rung later under a different name. Its boot evidence — `rt_linear_format`,
`clear_dropped` and `mrt_slot_unresolved` all 27/27/108 to zero — measured the
rung that stopped refusing, not the frame.

Three parts, and the probe is one of them because a bit nobody can set is not a
fix:

- the vocabulary is now `TexelLayout::is_render_target_layout` — exactly the set
  the reader asks about. `is_blendable_attachment` is deleted rather than kept
  beside it, so the two spellings that could drift are one function;
- `caps::device_features`'s per-layout probe (`color_attachment_blend` ->
  `color_attachment`) demands `COLOR_ATTACHMENT_BLEND` only of layouts that can
  blend. The old conjunction could only ever answer `false` for an integer one;
- `sampled_layout_linear_filter_if_published`'s "no bit" arm returned
  `Some(true)`, written for the block-compressed layouts alone, so this device
  claimed a `VK_FILTER_LINEAR` on an integer format that no driver advertises
  and that the unpublished arm answers `false` for. The arm splits.

The `bool` that selected between the two masks is a `CapabilityMask` enum, so a
third mask fails the build in a `match` instead of silently widening one arm of
an `if`. Bit budget after: 32 + 8 render-target + 1 + 15 filter + 1 published
+ 1 BC = 57, six spare.

## A sampled integer texture fell into a converter with no arm for it

`linear_native_upload_format` gained an `Rgba32Float` arm and not an `Rg16Uint`
one, so a linear sampled `RG16Uint` returned `None`, took the CPU rung, and
refused as `linear_load_row_convert_unsupported`. The sampled half of that
commit's claim was unreachable; the tests exercised the translate tables and not
the production loader.

The arm is ungated, like `Rgba8Unorm` and unlike everything between them:
Vulkan mandates `SAMPLED_IMAGE` for `R16G16_UINT`, and the capability the other
native layouts are gated on is not this layout's question. Linear filtering of
an integer format is undefined in Vulkan and forbidden in Metal, so the guest's
own validation has already made the sampler nearest before the texture arrives —
the same relationship a draw's primitive type has with its pipeline's declared
topology class.

That whole rule lives in one engine door, `supports_sampled_layout_bind`. The
call site asked the filter query directly, which is why making that query
truthful would otherwise have made the layout unbindable.

## `CmdDeleteObject` retired object-list entries with a ref from another namespace

`47f610c6` wired `retired_entry::retire_ref` to `apply_delete_object`, whose own
`## Separate reference spaces stay separate` section — written directly above the
call — records that this ref is in the serializer's per-kind space, that the
object table is keyed by the kernel object-list ref, and that equal integers
across those spaces are unrelated. The measurement is in that doc: 1 988 deletes
in a 25 s driven boot, not one naming a live object-table ref, 22 colliding with
one under a different task.

So the call could only evict an entry that happened to share the integer, which
drops exactly the packets the store exists to keep — and object-list refs were
never retired on delete at all. It is gone; `retire_ref` with it. Retirement is
by namespace, which is the task's object list.

Three more on the same store:

- **Task teardown retires it.** `define_task` and `delete_task` retire every
  other per-task ledger — objects, resources, sampler and pipeline states,
  `map_audit`, `node_guard`, linear residents, GVA views — and did not retire
  this one. A task deleted and never reused held its entries for the life of the
  `DeviceState`, unbounded in a map whose whole design is "no capacity, no
  eviction"; a redefined id could be answered from the previous generation
  between the redefine and its first `CmdSetObjectList`.
- **The instruments run first.** `note_slot_empty_claimants` and
  `slot_recheck::note_slot_empty` were skipped whenever the recall answered, so
  the two instruments built to measure this miss class read zero exactly when
  the population was largest. `slot_recheck` is the only thing that can still
  contradict the freed reading the recall rests on, so it has to keep sampling
  the slots the recall serves.
- **The census reads the device it is given.** `LIVE` was a process-wide
  `AtomicU64` over a per-`DeviceState` map, so with two devices it reported
  neither while `served`/`unknown` summed across both. `note_drain_tranche`
  takes `&DeviceState`; the per-resolve `store(map.len())` is gone with it.

`ListMiss::SlotEmpty` and `retired_entry` asserted opposite readings of a zero
slot — "not written yet" against "freed". They now agree, on the measurement
that settled it (`slot_recheck` landed zero of 147 verdicts on a slot that later
filled; half the misses were on refs that had already resolved in the same
task), and both name the residual this does not fix: a slot freed, reallocated
and read before the guest's twelve-byte entry lands is zero for a ref that
already names something new. The fix for that is a generation captured at
submission time, which the wire does not carry.

## Docs that no longer described the code

- `render_target_bpp` carried a section headed "`RG16_UINT` is measured, wanted,
  and still not here" arguing the format is refused and naming `rt_linear_format`
  as the live refusal, while `is_render_target_format` immediately below listed
  it. Rewritten as the record of why it is admitted and what the native rail
  discharges.
- `draw::render_target`'s call site said `render_target_bpp` "refuses a format
  with no known bytes-per-texel", which is the width/capability conflation that
  function's own doc identifies as the bug.
- `note_load_action_dont_care` said "nothing is changed here, deliberately" about
  plumbing the ordinal to the pass key — the change `8b50fac5` made — and still
  claimed DontCare and Clear reach `caches.rs` as one key. It is also a latched
  line, not a counter, so the new call sites' "counts the cases" comments were
  wrong about their own instrument.
- Three items were spliced into a neighbour's doc block, leaving the neighbour
  undocumented: `is_integer` into `is_block_compressed`'s, `readback_vk_format`
  into `readback_bytes_per_texel`'s (so the readback-slot safety argument no
  longer sat with the `unwrap_or` it warns about), and `retired_entry::census`
  between `slot_recheck`'s comment and `slot_recheck`. `tight_row_bytes` lost its
  doc outright, including the rule that it answers in blocks for a compressed
  layout.

## Instruments and dead code

- `Phase::PrepSeed` had no `enter()` after `09e491a3` removed the CLEAR-seed
  loop, so `prep_seed_us` was permanently zero — a bar that looks measured and
  measures nothing. Retired with its rail; the span it held is charged to
  `Prep`, and the following ordinals renumber.
- The widened DontCare seed path had no instrument at all: it now walks the LOAD
  doors (a provenance seed clone, or `resolve_type11_load_seed` reading the
  surface out of guest memory) on every pass, and `note_load_seed_outcome` stays
  LOAD-only. `dontcare_seed_served`/`dontcare_seed_empty` are the counters, so a
  boot can say how often the widening pays.
- `EVERY_GATE_OPEN` was a field-for-field copy of `NativeUploads::ALL` with
  nothing comparing them; a fifth gate set in one and missed in the other makes
  `native_bind_is_host_gated` compare two equal answers and skip asking the host,
  reproducing the `RGBA32Float` defect it exists to have fixed. `ALL` widens to
  `any(test, backend-vulkan)` and is used. Its doc also corrects "every gate
  shut": the shut arm is `BGRA8`, because `bgra8` is not a host gate.
- `solid_bgra8` lost its only non-test caller with the seed loop and is `pub` in
  `contract`, so nothing warned. Deleted with its test.
- `write_gva_frame_within` allocated the tight scratch row on the
  `FrameRows::Native` arm, which never reads it.

## Behaviour narrowed without a test

`clear_publish_target` stopped retargeting a clear when the store action is
`STORE` and `resolve_texture_ref` is non-zero — the old code keyed the retarget
on the resolve texture's presence alone. That is the more correct reading and it
stays, but it was uncovered; the case is asserted now.

## The screenshot helper's fallback restored the defect it fixed

`55de1305` narrowed the default selector to an exact caption and then fell back
to the substring match, warning on stderr. The case that reaches the fallback is
the guest window being *absent* — a VM that died, or a boot that lost the
hostfwd race — which is exactly when a larger unrelated window mentioning this
device wins the area ranking, and the capture reports FOUND and exits 0. Failing
is the safe default: a missing guest display is a real result and a picture of
something else is not. The fallback is `--inexact` now.

## Verification

`cargo test -p reims-vgpu --no-default-features --features
backend-vulkan,host-window -- --test-threads=1`: 2225 lib green plus 8
integration binaries, 0 failed, 4 ignored (the gitignored wire fixtures and
three doc tests). Net +1 test: -1 for the deleted `solid_bgra8` case, +2 new.

clippy `-D warnings` exit 0 on all three arms — native vulkan,host-window,
`--target aarch64-apple-darwin` backend-metal, `--target
x86_64-unknown-linux-gnu`. `scripts/feature-matrix`: all arms PASS, warnings=0,
lib=2225 all_targets=2322, no dropped count. `cargo doc` intra-doc link pass:
178 warnings, every one in the pre-existing cosmetic classes, none naming a
symbol this touches.

Two new tests gate the halves that fail silently.
`an_integer_colour_attachment_is_renderable_and_never_filterable` sets the
sampled-filter array for the integer layout deliberately and requires the
snapshot not to read it, so it pins both directions.
`a_deleted_or_redefined_task_keeps_no_remembered_entries` asserts through the
map rather than through a resolve, because a torn-down task misses with
`TaskInactive` long before the recall runs — the leak is invisible to
`lookup_list_entry` by construction, which is why it survived. Verified by
ablation: stubbing the retirement fails it on "the object list these refs index
went away with the task".

## Not verified

No live boot. Every defect above is a rung no counter in this tree reports
today: the RG16Uint Store loss reads as `ResidentFormatMismatch` and a
row-converter refusal rather than `rt_linear_format`, and the sampled one as
`linear_load_row_convert_unsupported`. Confirming any of it needs a driven
macos-15 x86/Vulkan boot read at those slugs, plus the
`REIMS_VGPU_GUEST_IMPORT=off` pair compared on pixels — the copying Store arm is
where two of these fixes land and a host with the import never takes it.

The reused-slot window is designed around, not closed; `slot_recheck` is left
sampling as the instrument that would report it firing, and a non-zero fill rate
there is the signal to retire the recall.

`--inexact` passes `bash -n`; the KWin fallback path itself is untested live, as
it was before.

The `backend-metal` test functions do not run on a Linux host, so the Metal arm
is compile-only for all of this — which covers the `CapabilityMask` const
assertions, since rustc evaluates them on the cross-compiled arm.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015FVCj11zRrQQgLSws6k6zu
2026-08-29 12:59:21 +03:00
Anees IqbalandClaude Opus 5 ce25f8a1bc scripts: a drag reports the pointer rate it achieved, not the one it asked for
`scripts/qmp/qmp.py` — host-side input helper, used by every probe that drives
a guest through QMP.

`drag()` returned nothing and the CLI printed `ok`, so the rate the guest
actually received was never on the record. It is not a diagnostic: an app that
pans by tracking the pointer redraws per motion event and cannot produce more
distinct views than it was sent, so that rate is a ceiling on any frame rate
measured across a drag. A caller reporting frames without it is quoting
whichever of the two is smaller and cannot say which.

`drag()` now returns `(moves, seconds)` for the held glide — the press, its
settle and the release stay outside the timed window — and the CLI prints
`moves=`, `secs=` and `moves_s=`.

The rule is not new here. `window-drag-probe.sh` already computes `posted_hz`
and warns "the counters below are bounded by the drag, not by this device", and
`drag.c`'s header says reporting the device as slow for an under-driven probe
"would be measuring this program". `maps-probe.sh` was written later, drives
through this helper, and sends its stdout to /dev/null.

Two facts the new output established immediately, both recorded in the
docstring because both had been assumed:

- The QMP round-trip is **0.7-0.9 ms** on x86/PCI macos-15 with the device
  idle, so the default `hold_s=0.012` dominates and a drag achieves ~77
  moves/s in-glide. A session had reasoned from an assumed ~20 ms round-trip to
  the conclusion that a 28 fps app was bounded by this loop; the first arm
  refuted it.
- The returned rate is **in-glide**, and a caller spawning one `qmp.py` per
  circuit does not achieve it: ~0.14 s of process spawn between circuits took a
  measured 77/s in-glide down to 54/s sustained, and 1490/s down to 151/s.

Verification: offline against a stubbed transport, `drag()` reports 24 timed
moves per 4-segment circuit and recovers an injected round-trip to within
0.6 ms across three (hold, rtt) pairs. Live on macos-15 x86/PCI, two banded
bare-desktop arms produced the numbers above. No Rust changed, so no clippy or
test arm is affected.

Not verified: the round-trip was measured with the device idle. Whether it
holds while the device is drawing is a separate arm, in flight.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 12:08:54 +03:00
Anees IqbalandClaude Opus 5 55de1305eb scripts: the guest display is selected by an exact caption, not a mention
x86/Vulkan verification tooling. With no selector, the screenshot helper chose
the window to capture with a *substring* test over caption and resourceClass,
then ranked the survivors by area. Any window whose title merely contains
"Reims vGPU" therefore passed the selector, and a maximized one beat the
1920x1080 guest display precisely because it was bigger.

That is not hypothetical and it is not rare: this host has a browser window
captioned "Discord | #general | Reims vGPU - Google Chrome", so a probe that
took the default selector photographed the operator's screen instead of the
VM it had just driven. It reported FOUND and exited 0, so the capture read as
a successful measurement. `scripts/maps-probe` takes exactly that path, and its
before/after pair for a Maps drag was two pictures of a chat client.

Two costs, and the second is the one that made this worth a commit rather than
a `--pid` in one caller:

- a screenshot verdict taken from it is simply wrong, and nothing says so;
- whatever is on the host's screen is written into the probe's outdir, which
  for an unattended sweep means it lands in artifacts nobody reviewed.

The host-owned window's caption is the exact string `Reims vGPU`
(`host_window/present.rs` and `device/window_publish.rs` build the WindowConfig
with it), so equality identifies it and a mention cannot spoof it. The default
branch now filters on caption equality. A caption that has gained a suffix is
still findable — the substring match remains as a fallback — but that selection
is ambiguous by construction, so it emits `:INEXACT` and the shell surfaces it
on stderr with the two selectors that disambiguate. `--window`, `--pid` and
`--match` are unchanged; only the no-selector default is narrowed, so no caller
that already passes a selector is affected.

Verified live on macos-15 with the decoy window present: with a VM up, the
default selector and `--pid <qemu>` now return the same window —
`size=1921x1079 -> 1280x719, mean=87.1741, colors=320981` from both, which is
the guest display's signature. (The two PNGs are not byte-identical and cannot
be: the guest wallpaper animates between the two captures a second apart, so
the size/mean/colour triple is the comparison, not `cmp`.) Before the change
the same invocation selected the Chrome window; its candidate line is what
identified the bug.

Not verified: the `:INEXACT` fallback path, which needs a build whose window
caption differs from this constant to reach. It is a warn-and-continue arm of
behaviour that was previously the unconditional default, so it cannot be worse
than what it replaces. No Rust changed, so the Rust suites and clippy arms are
untouched by this commit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 12:08:54 +03:00
Anees IqbalandClaude 4210c0f07f scripts: score a boot on both halves, joined by the timestamp the censuses carry
Component: scripts/boot-score, a new log reader. Reads a fail log and prints one
line per boot; it reads a log and never this repository's source, which is the
whole licence for it to exist under `AGENTS.md`'s ban on source-scanning gates.

It exists because the two mistakes it avoids were both made on real boots.

**Joining by line ordinal drifts.** `drain_duty`, `gpu_span`, `window_publish`
and `store_routes` are emitted from different places and skip different windows —
an idle second costs `gpu_span` nothing and `drain_duty` a line — so pairing them
by position slides within a boot and pulls idle-desktop publishes into a driven
band. The ad-hoc harness that had been scoring driven Maps boots did exactly this
and reported ~31 fps; the same nine logs joined on `t` read **47-52**.

**Ranking on `us/draw` ranks half the change.** On the x86/Vulkan iGPU pathway
`gpu_span busy_us` per draw is the *larger* half — 10-12 µs against 9 µs of drain
CPU — and `(cpu + gpu) x draws/s` accounts for 95-100 % of every busy second
across nine boots of three builds, so the device is saturated, the halves barely
overlap and frames track their sum.

Hence the `occ` column, which is that product: near 1.0 says both halves are the
bottleneck and a microsecond off either converts; well under says something else
paces the guest. And hence `d/frame`, printed because frames are not comparable
across boots without it — `fps = 1e6 / (sum x d/frame)` and the second term is
what the guest chose to draw, which drifts between boots of one binary.

Verified against the boots the numbers above come from, including the
`REIMS_VGPU_PASS_CHURN=on` arm, where it reports the sevenfold GPU move
(9.25 -> 67.64 µs a draw) that made the render-pass boundary the ranking cost in
this device.

No Rust touched, so no clippy or test arm applies.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-16 01:09:48 +03:00
Anees IqbalandClaude 43ac3d177b scripts: bound the Maps probe's zoom drift, which does not cancel
Component: host-side driving only.

The first driven run of this probe disproved a claim its own comment made. The
comment said the four-phase circuit was closed on the zoom axis because phase 1
zooms in by as many wheel ticks as phase 3 zooms out. It is not: Maps clamps at
the world view long before it clamps at street level, so from the regional view
a boot starts at, the out-ticks reach the clamp and are discarded while the
in-ticks all land, and each circuit nets a little further in.

Measured on one driven macos-13 boot: nine circuits at 40 ticks walked the
scale bar from `0 12,5 25 37,5 km` to `0 5 10 m`, which is the far clamp -- so
the back half of that window measured a map that could not zoom any further,
which is precisely the failure the deleted comment claimed to prevent.

Drops the excursion to 12 ticks, which keeps a window of this length inside
both clamps, and replaces the false claim with the asymmetry and the reading
that showed it. The tick count is named as fixed rather than tunable, because
two boots with different phase mixes are not two measurements of one workload.
A much longer run would still need a mid-zoom start; that is stated rather than
implemented, since nothing needs it yet.

Changed now rather than later because no result has yet been scored against
this probe's phase mix, so this is the cheapest moment to re-baseline it.

Verified: `bash -n`. The drive itself was confirmed working on that boot -- the
scale bar and window title both moved, so pan and zoom reach the guest.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-15 17:22:33 +03:00
Anees IqbalandClaude 64a1ee4538 scripts: a sustained Maps pan-and-zoom probe
Adds `scripts/maps-probe/maps-probe.sh`, carrying the same (outdir, seconds)
interface as the sustained-animation and window-drag probes so it drops into
`perf-ab.sh` via `--probe`.

Component: host-side driving only; no device or QEMU code is touched.

Why. The two existing sustained instruments measure a Safari canvas repainting
itself and the window server translating an opaque rectangle. Maps is neither:
it is a full-screen client drawing a tiled vector scene through its own Metal
pipelines, and pan and zoom are the two interactions that redraw the entire
scanout per frame instead of damaging a corner of it. `AGENTS.md` requires a
number to name the probe it came from because two probes rank this device's
costs in a different order; Maps is a third such population and nothing in the
tree could measure it. The `sustained-animation-probe.sh` header has referred
to a `maps.sh` for some time -- no such file was ever in the tree.

Behavior. Opens Maps over ssh, full-screens it with the system Enter Full
Screen binding, parks the pointer, marks the fail log, then drives four phases
back to back for the whole window: a closed rectangular pan circuit, a 40-tick
wheel zoom in, a zigzag pan, and a 40-tick wheel zoom out. The circuit is
closed on both the position and the zoom axis so every round starts from the
same scale; without the closing zoom-out the probe walks to a zoom limit and
the back half of a long window measures a clamped map. The drive loop never
sleeps, because a probe built from discrete interactions spends its wall clock
inside guest animations at zero draws and ranks the device's phases wrongly.

Each pan is a single `qmp.py drag` over a multi-point path, so a phase is one
process and one QMP connection for seconds of continuous motion rather than a
process spawn between every pair of points. Zoom uses `qmp.py wheel`, whose
ticks go over one connection dt apart, for the same reason.

Maps needs Apple's tile servers, which the rails reach only through user-net
NAT, so the probe records a tile-server reachability verdict in the outdir
rather than failing on it: a tileless Maps still exercises the same client
pipelines and is a valid perf population, but a correctness reading from one
would be wrong and the outdir has to say which was measured. Host screenshots
are taken before and after the scored window, outside it.

Verified: `bash -n` only. Not yet run against a booted guest -- no live-VM
result is claimed here, and the phase mix is deliberately fixed so that the
first boot to use it is comparable with later ones.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-15 17:14:21 +03:00
Anees IqbalandClaude 3ac2754b21 scripts: resolve the QMP socket per pathway, and pin one QEMU per perf-ab run
Two harness defects, both of which make a measurement silently not happen.

qmp.py resolved only the arm64 socket
-------------------------------------
`SOCK` defaulted to `vm/guest/run/qmp.sock`, which is boot-arm64.sh's run
directory. boot-x86.sh publishes the same stable symlink in `vm/disks/run/`, so
on the x86 pathway every unqualified `qmp.py` call died with a bare
`FileNotFoundError` on a path belonging to the other host.

That matters more than a wrong default usually would, because AGENTS.md makes
QMP the *preferred* way to drive a guest — it is the one route that works on all
six rails with no guest tooling, no Apple Events consent and no ssh, and the
rails with open defects are exactly the ones where the guest-side alternatives
do not build. A driver script that reaches for it on x86 got a traceback, and a
harness that ran the probe anyway recorded a boot that was never driven.

Now resolved from the two known run directories, whichever is live. A boot
removes its own symlink on the way out, so at most one exists during a boot and
"whichever is there" is unambiguous; the ordering only makes the both-present
case deterministic, and that case is a stale symlink outliving its boot, where
connecting to a dead socket raises rather than driving the wrong VM. `QMP_SOCK`
still overrides. `sustained-animation-probe.sh` already set `QMP_SOCK`
explicitly and is unaffected.

perf-ab did not pin its QEMU
----------------------------
It rebuilt on every boot, so a `--rounds 3 --arms "a b"` run was six builds off
whatever the Rust tree said at each moment. Nothing forced the arms to be the
same tree, and an edit landing mid-run split the sweep into two arms nobody
declared — invisibly, since the results table has no column that could show it.
The last session's journal recorded the same defect in `sweep-rails.sh` as owed.

Builds once up front and exports `QEMU_BIN` for the whole run. Two constraints
are written into the comment because both have already cost a boot here: the pin
must live in the build tree, because QEMU resolves its BIOS datadir relative to
its own path and a copy in /tmp dies on `kvmvapic.bin` before the guest starts;
and it must cross as an exported variable rather than argv, because any command
line naming `qemu-system-x86_64-...` is matched by the
`pkill -f 'qemu-system-x86_6[4].*reims-vgpu'` the next boot issues, which kills
the runner instead of the previous VM. An explicit `QEMU_BIN` in the environment
still wins, so an existing pin can be handed in.

Verified: `bash -n` on perf-ab.sh; qmp.py parses and resolves to the x86 socket
path on this host. NOT verified: no A/B run has completed on this change yet —
the pin path is exercised by the next perf-ab invocation, not by a test.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-15 17:10:54 +03:00
Anees IqbalandClaude dbea1625bd 🔍 The trail named what the wedging draw sampled and not what it sampled it through, and a snapshot's four-day-old crash reports were being read as this boot's
Two instruments and one harness repair. No behaviour change on any rail.

## The sampler was the one hypothesis nothing could observe

`kb/the-sampled-image-is-defined-everywhere-except-the-gathered-vouch.md`
leaves three live: the resolved texture is wrong, the format is wrong, the
sampler is wrong. `SampledNote` answered the first two. The third is not a
property of any texture — all four of the uber shader's unbounded loops sample
through **one** sampler (m2v set 0 binding 67 = guest fragment sampler index 3,
which this device's bands put at 160 + 3 + 288 = 451) — and a `LINEAR` filter
on a texture whose texels are the next UV returns a blend of two cells that is
in neither, so the walk leaves the graph the guest built and never reaches the
terminating zero cell.

`SamplerNote` records the filters, the mip mode, both address modes, the
unnormalized flag, and — the field it exists for — **provenance**. This device
has two routes to a `SamplerResource::normalized_default`, which is
`Linear`/`Linear` and which no guest asked for: a bind whose `sampler_ref` is
`0`, and a binding the residual SPIR-V scan provisions for. A translated guest
sampler that happens to be `Linear`/`Linear` and one this device invented are
the same value afterwards, so provenance has to be recorded where the choice is
made — `g` guest object, `c` AIR constexpr from reflection, `d` this device's
default, `?` a route that did not record one. Printed as
`smpl=N[s451:gNNnee,…]`.

## And the 1x1 texel nobody had ever read

`SampledNote` gains `texel0`, the first four bytes of a CPU-bytes source. For a
**1x1** image that is the entire content, which is the point: the wedging draw
binds one at fragment index 7, one of the two the loops walk, and a 1x1 texture
returns the same texel at every coordinate — so `while sample(uv).x > 0` either
exits at once or never, decided by that one red channel with no undefined
memory anywhere in the story. `kb`'s open question 3, answerable now without a
dedicated boot. Only the bytes rail is read; the gather rail's texels are in
guest RAM and the target rail's are on the GPU, and reading either to write a
log line is not a trade this makes.

## A third silent narrowing site, reported rather than fixed

The type-5 view path folds every format its native table does not name through
`convert_row_to_rgba8`, and said nothing when that quantized. It is the third
CPU convert found doing so. `type5_view_narrowed` is added; the native
half-float arm is **not**, deliberately — this is the video-plane rail, nothing
has measured a type-5 view arriving in a half-float format, and the census is
what should decide. Measure before fixing, in that order.

## The crash-report gate was reading snapshot baggage as evidence

`wait-for-desktop.sh` refuses to log in when the guest holds a crash report,
because a login restarts the session over it. It was treating the **whole
directory** as evidence. These rails boot from snapshots, so a report captured
into an image is in every boot of it forever: macos-12's carries fourteen
`bluetoothd` reports from 2026-08-08, nothing to do with graphics, four days
older than any boot that finds them, and it counted the AppleDouble `._`
sidecars beside them for a tally of 42.

Nothing was lost to it yet — macos-12 reached the desktop this sweep and took
the success path, where the finding is only printed — but the login-window
branch shares the same test and that one exits 3 and skips the rail. On one of
the two rails carrying the standing GPU hang, a gate that always fires is worse
than one that never does, because an always-firing one reads as a finding.

`crashes_since_boot` narrows it to reports newer than the guest's own
`kern.boottime`, taken over the same ssh so no clock comparison crosses the
host boundary, via a reference file (portable where `find -newermt` is not).
Older reports are still collected and still printed — they cost nothing — but
they no longer decide. An unreadable `kern.boottime` treats everything as fresh,
so the failure mode stays "refuse to log in".

Checked against the 42 files macos-12 actually produced: 21 after the sidecar
exclusion, **0** fresh for a boot today, 21 for an earlier cutoff, 21 when
boottime is unreadable.

## Verification

`cargo test … -- --test-threads=1`: 1971 passed / 0 failed, engine parity 52 /
0. Clippy clean with `-D warnings` on all three arms including the
cross-compiled `aarch64-apple-darwin` one.

**Four-rail sweep on `9a57611b`** (one pinned binary, `sweep-rails.sh`,
Safari / Maps / App Store / Contacts / Reminders / Safari-torture /
Launchpad→Screenshot):

| rail | legs | panic |
|---|---|---|
| macos-11 | **7/7 ok** | no |
| macos-12 | **7/7 ok** | no |
| macos-13 | 7/7 ok | no |
| macos-14 | 7/7 ok | no |

The baseline this session inherited was macos-11 **Maps FREEZE** with the
later legs `NO-FRAMES` behind the lost device, and macos-12
**Launchpad→Screenshot FREEZE**. Both freeze rails are clean, and
`sampled_texture_narrowed` — one line on every previous macos-11 boot — is
**absent** from the whole sweep.

## Not verified, and this is the part that matters

**This is n=1 per rail and is NOT reported as a fix.** This repository's own
rule is that a FREEZE eliminates an arm while an `ok` confirms nothing, that a
passing arm needs n>=3, and that macos-11's Maps has produced a fluke pass
before (1 in 15). Repeats on both freeze rails are the next step and no claim is
made until they are in. The instruments above are landed precisely because the
repeats may still freeze.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-12 19:07:13 +03:00
Anees IqbalandClaude f7acdf7556 ✨ A login window is a WindowServer crash report waiting to be collected, and this harness used to type over it
`scripts/app-sweep-probe/wait-for-desktop.sh`, `sweep-rails.sh`, and the rule in
`AGENTS.md`. No device code.

## What was being thrown away

Every harness here treated the guest's login window as a state to get past.
`wait-for-desktop.sh` typed the password and carried on, and its own doc already
recorded the tell it was walking past: `stat -f%Su /dev/console` answering
`_windowserver` rather than `root` means the guest's **WindowServer aborted**,
measured live on a macos-11 boot.

When it aborts the guest writes a `.ips` report naming the failure — the most
direct evidence this project can get about a graphics failure *inside* the
guest, as opposed to a fence this device gave up on. Logging in starts a fresh
session over the top of it and the next boot's snapshot revert discards the
overlay, so those reports have never once been read here.

It is not a rare state. The `REIMS_VGPU_SAMPLED_IDENTITY=off` boot run today hit
`_windowserver` before its probe had started, and the harness logged in and went
on to report a Maps freeze — attributing to a GPU wedge a boot whose window
server had already died.

## What it does now

The login window is a collection point, not an obstacle:

- `collect_reports` tars `/Library/Logs/DiagnosticReports` and the user's own
  copy off the guest into `--reports DIR`, in one round trip, **before** a
  character is typed. Read without `sudo` on purpose — this file already records
  a guest `sudo` wedging with its timestamp lock held, which queues every later
  `sudo` forever, and a report this account cannot read is worth less than a
  boot.
- A login window with any report behind it **exits 3 without logging in**.
  `--login-after-crash` overrides that and an unattended sweep must not pass it.
- A login window with *no* reports is the benign case this script already
  documented — a guest that never logged in — and it logs in as before.
- The success path collects too. Autologin can restart a session over an early
  abort, so a WindowServer that crashed can have a Dock by the time anything
  looks; the console check cannot see that class and the report can.

`sweep-rails.sh` maps exit 3 to a `WINDOWSERVER-CRASH` row per rail and keeps
the reports under `$OUT/$rail-reports`, because a rail that crashes its window
server is not a rail whose app verdicts mean anything.

## Verified

`bash -n` on both scripts and `--help` renders. **Not verified by a boot**: no
guest has yet been made to produce a crash report through this path, so the tar
pipe and the two directory names are unexercised. The next macos-11 boot is what
tests it.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-12 17:43:07 +03:00
Anees Iqbal f90784e8a6 ✨ The thing worth pricing on this host is not one of this crate's switches, and the A/B could only express this crate's switches
`scripts/perf-ab/perf-ab.sh`. x86/Vulkan tooling; no crate code changed.

An arm was comma-joined `NAME=value` pairs, every one exported as
`REIMS_VGPU_NAME=value`. That cannot express a driver arm, and a driver arm is
what this host now needs priced: the macos-11/12 GPU hang is Mesa's SIMD16/32
shader codegen — `INTEL_DEBUG=no16,no32` turns the Maps freeze into `ok` with
zero device recreates — so "what would working around it cost" is a question
about a Mesa variable and nothing this device spells.

Running that as two blocks instead would break the script's own first rule. A
macos-13 boot latches one of two compositing regimes for its life and the rate
at which it picks the slow one drifts across a day, so two blocks are two base
rates and the comparison is against the drift as much as the arm. Interleaving
is the only ordering that cancels it, and interleaving requires both arms to be
expressible in one run.

A pair whose name begins with `INTEL_` is now exported verbatim; everything else
keeps the `REIMS_VGPU_` prefix. Values use `+` where the variable wants a comma,
since the arm string is already comma-separated —
`INTEL_DEBUG=no16+no32` exports `INTEL_DEBUG=no16,no32`.

The stale-variable sweep between arms now clears `INTEL_*` as well as
`REIMS_VGPU_*`. Without that a driver arm would leak into every later round and
turn the whole interleaved run into one arm while still printing two — the
failure mode that reads as a result.

Verified: `bash -n` clean, and the arm parser exercised directly on
`INTEL_DEBUG=no16+no32,LAYOUT_CHURN=off`, which expands to
`INTEL_DEBUG=no16,no32` and `REIMS_VGPU_LAYOUT_CHURN=off`.

Not verified: no A/B has been run through the changed path yet — the machine is
booting the SIMD narrowing arms. The `shipping` arm is untouched, so an existing
invocation behaves exactly as before.
2026-08-12 15:31:43 +03:00
Anees Iqbal e807c176f2 🐛 A four-rail sweep was four builds, and the rails are the populations it compares
`sweep-rails.sh` prints one verdict table across `macos-11 … macos-14` and that
table is read as four rails of one device. It was not: `boot-x86.sh` rebuilds
in-tree QEMU on every boot unless `QEMU_BIN` names something else, and the sweep
set nothing, so each rail booted whatever the tree held when its turn came.

Nothing forced those four to agree, and the way they stop agreeing is not
exotic. A sweep takes the better part of an hour. Anyone editing Rust during it —
which is the obvious thing to do with an hour of waiting, and which this session
deliberately did *not* do only because the trap was noticed — splits the run in
two, and the output is a well-formed table that looks exactly like one binary's.
The rails are the populations the table compares; they have to be one build or
the comparison is not one.

So the sweep now builds once, copies the result to a per-run pin, and exports
`QEMU_BIN` for every rail. Three details are load-bearing and each is a rule this
repository already paid for:

- **Exported, never argv.** `pkill -f 'qemu-system-x86_6[4].*reims-vgpu'` matches
  whole command lines, so a pin named on one would match the shell that named it
  and the shell would kill itself. An environment variable never appears in
  `/proc/pid/cmdline`.
- **The pin lives in `vendor/qemu/build`.** QEMU finds `pc-bios` relative to its
  own path, so a copy in `/tmp` dies on `kvmvapic.bin`.
- **A trap removes it.** Otherwise every sweep leaves ~110 MB behind. That is not
  hypothetical: this working tree currently holds 58 such pins from earlier
  sessions, 6.3 GB, none of them cleaned up by the harness that made them.

An operator who sets `QEMU_BIN` themselves keeps it, and the script says which of
the two happened on its own stdout, so a table can be attributed to a build after
the fact.

Component: `scripts/app-sweep-probe/sweep-rails.sh` (x86/Vulkan verification
harness only; no crate code touched, so no Rust test or clippy arm is affected).

Verified: `bash -n` clean. The four-rail sweep that motivated this ran to
completion immediately before it, on one tree, and reported macos-11 1/7,
macos-12 6/7, macos-13 7/7, macos-14 7/7 with **no guest kernel panic on any
rail** — checked by grepping each boot's own stdout, which outranks `probe
exit=0`.

Not verified: the pinned path has not itself been exercised by a full four-rail
run yet — the run above predates this change. The next sweep is that test, and
its first line will say `pinned …` if it took.
2026-08-12 12:57:24 +03:00
Anees Iqbal 490b11f700 🐛 The arm this script calls the first question worth asking is longer than a file name may be
`hang-bisect.sh` names every artifact of a boot after the arm that produced it,
and its own header says a comma-joined arm carrying every narrowing switch at
once is "the first question worth asking: if the hang survives every
optimization being switched off, no optimization causes it and there is nothing
to bisect". That arm is 319 characters. `NAME_MAX` is 255.

So the one arm the script most wants to run was the one arm it could not: the
boot log redirect failed with `File name too long`, and because the script runs
under `set -uo pipefail` rather than `-e`, it carried on and booted anyway. What
it produced was a results row with `stalls=`, `lost=` and `freezes=` all empty
and `probe_exit=1` — which reads as an arm that reached a desktop and drove
nothing, not as an arm whose file names were rejected.

Past 48 characters the tag is now the arm's position within the round, and
`arms.tsv` maps every tag to its full arm string. Short arms are unaffected and
keep naming their own files, so `r1-shipping-fail.log` still reads the way every
existing note about this script says it does.

Component: `scripts/app-sweep-probe/hang-bisect.sh` (x86/Vulkan verification
harness only; no crate code touched).

Verified: `bash -n` clean; the all-switches-off arm now runs to a driven macos-11
desktop and reports `host_pointer_import=disabled_by_env`, so the arm takes and
the boot is scoreable. Not verified: nothing else in the harness changed, and no
Rust was touched, so the Rust test suites and clippy arms are unaffected.
2026-08-12 12:16:30 +03:00