Commit Graph
2438 Commits
Author SHA1 Message Date
Anees IqbalandClaude Opus 5 95ecbb0f95 observe: the store's destination and the presented plane's pages were both known and never emitted beside each other
Component: reims-vgpu Vulkan engine (outstanding-write ledger) and the scanout
present witness. Pathway: x86 macOS / Linux Vulkan, rail macos-15. Observation
only; no guest-visible behaviour changes and no execution path altered.

Session 10b established, at n=3, that the flat-white desktop field is neither of
the two readings six sessions were spent choosing between: the guest composites
into the presented plane at 14-195 draws per heartbeat for the entire white
interval, and 409 stores publish into it, while its guest pages stay uniform
0xff. What it asked for next was one comparison -- the guest-physical pages the
Store wrote against the pages the present sampled. Both numbers were already
inside this device and neither was emitted beside the other.

`present_field_witness` gains `write_reach=` and the presented mapping's page
count, first and last page. The witness reads guest pages without settling, and
that is deliberate: settling there would make the instrument cause the
visibility it is trying to observe. But it also means a uniform field has been
three findings wearing one number.

  Overlap   a writeback is in flight into these very pages, so the bytes read
            are pre-write bytes and the field says nothing about what the guest
            composited. The question moves to whether whatever presents this
            plane settles before reading it.
  Disjoint  nothing outstanding lands here, so the stores this boot records are
            landing in another page set entirely, and publish and present
            disagree about which pages the plane is.
  Unnamed   the ledger overflowed or raced and cannot say -- counted apart so it
            cannot be read as Disjoint.

Three different repairs, and no record separated them.

`store_destination` is the other half, emitted from
`record_guest_write_footprint_debt` -- the function that arms the ledger -- so
the destination named and the destination armed cannot drift. It reports on a
change of allocation identity rather than per store: this rail records hundreds
of stores a second into a handful of surfaces, so a per-store line would be a
flood repeating one fact, and the destination is what the question is about.

Identity is `same_allocation` (Arc pointer equality), which is the key the
ledger already deduplicates on, not the page values. A recycled page list
describes a later allocation, so equal addresses would suppress a real
destination change -- the one thing this record must not do. `runs` and
`page_size` travel with it because a scattered destination and a contiguous one
of the same length are not the same footprint.

Test: a_recycled_page_list_is_a_new_destination_and_a_retained_one_is_not pins
all four arms -- a retained clone is the same destination, an identical page list
rebuilt is not, a different page set is not, and the first store of a process has
nothing to be the same as. The suppression rule is split into
`store_destination_changed` so it is stated as a test rather than inferred from
the shape of a log.

Verified: cargo fmt --all and --check; all three clippy arms with -D warnings
(aarch64-apple-darwin/backend-metal, host Vulkan, x86_64-unknown-linux-gnu
Vulkan); full backend-vulkan,host-window suite serially, 2407 passing, 0 failures.

Not verified: no boot carries either record yet, so no white-interval reach and
no store destination has been measured. Metal tests were not run; this host is
not Apple. No conformance battery was run -- the change emits OFF records and
alters no execution path.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 23:58:48 +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 ad5c5aac74 observe: a store's content summary could not tell a white surface from a painted one
Component: reims-vgpu observe sink and the Vulkan store emitters. Pathway: x86
macOS / Linux Vulkan, rail macos-15. Observation only; no guest-visible
behaviour changes.

The blank-field defect on this rail is a full-screen plane that comes up
uniform white. `m2v_store_gva` and `linux_m2v_store` already carry a content
summary for every store, which is the right place to ask whether the content
being published is white -- and it could not answer, because the summary is
`rgb_nz`, a count of pixels with `max(R,G,B) > 0`. Live desktop and flat `0xff`
both saturate it: a 1920x1080 store of either reports about 2 073 600.

Measured, not assumed. Ten labelled boots were scored on `rgb_nz` for
nearly-blank full-screen stores and the two populations overlapped completely
-- WHITE 5/1/3/3/2 against PAINTED 2/5/2/0/1, with the corpus maximum belonging
to a painted boot. A split that looked clean over the first three boots was
sampling noise. So the one distinction this record had to make was the one it
structurally could not.

`rgba_rgb_stats` now returns `RgbaRgbStats` and adds `mean_rgb`, the mean of
the same per-pixel `max(R,G,B)` the other fields are computed from, in the same
pass, so the fields cannot describe different pixels. Flat white is 255 and this
rail's painted desktop measures near 100, so the comparison needs no threshold
chosen in advance. The accumulator is `u64` because a 4K surface has more
pixels than `u32` can sum at 255 each, and a saturating `u32` would report the
brightest surfaces as darker than they are -- silently, and only for the
largest ones.

The tuple became a named struct rather than growing a fourth member: at the
call sites the third and fourth would both have been plausible in either
position.

`mean_rgb` is emitted on all five store lines, including the three
`linux_m2v_store mid=` ones, which are the mapping-store path -- the plane
store, and the one the blank-field question is actually about.

Tests: a_flat_white_surface_is_distinguishable_from_a_painted_one_only_by_the_mean
asserts the two buffers report the *same* `rgb_nz` (the reason the field exists)
while their means sit at 255 and below 130; the painted buffer is varied rather
than flat grey so it cannot pass for the wrong reason.
an_empty_buffer_reports_a_zero_mean_beside_a_zero_count pins that no brightness
is invented for a buffer with no pixels.

Verified: cargo fmt --all and --check; all three clippy arms with -D warnings
(aarch64-apple-darwin/backend-metal, host Vulkan, x86_64-unknown-linux-gnu
Vulkan); full backend-vulkan,host-window suite serially, 2310 passing, 0
failures.

Not verified: no boot carries this yet, so no white-versus-painted store mean
has been measured. Metal tests were not run; this host is not Apple. No
conformance battery was run -- the change alters no execution path.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 20:32:56 +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 fc2af28e36 observe: a plane that stops changing stopped saying whether the guest was still drawing into it
Component: reims-vgpu runtime (scanout present witness, Vulkan draw encode).
Pathway: x86 macOS / Linux Vulkan, rail macos-15. Observation only; no
guest-visible behaviour changes.

The contract this serves is not a wire term but the obligation to make a
dropped store distinguishable from work the guest never sent. Two live
readings of the flat-white desktop field have opposite repairs -- the guest
stopped compositing into the plane, or this device did not publish what it
composited -- and no record separated them. The present witness drained its
per-plane draw ring only when the sampled field changed, so a plane that went
uniform white and stayed that way produced no further drain for the whole
interval in which the defect is resident: exactly the interval to be measured.

The ring is drained on the heartbeat as well, and it now carries the arrival
count beside the remembered tail. The count is what answers the question: the
ring saturates at PLANE_DRAW_RING_DEPTH, so its length reads a busy plane and a
plane receiving exactly that many draws as the same number. `draws=0` on a
heartbeat means the guest sent nothing into this plane since the previous
drain; a non-zero count against an unchanged uniform field means it kept
drawing and this device did not publish it.

PLANE_DRAW_RING's value becomes PlaneDrawWindow (arrivals + tail) and the drain
returns PlaneDrawDrain, whose Display always prints the count and marks the
tail as truncated when it is one. Count and tail travel as one value because
either read alone is misleading.

Test: a_planes_drain_counts_every_arrival_even_past_the_ring_it_remembers
(runtime/draw/tests.rs) sends PLANE_DRAW_RING_DEPTH + 7 draws into one plane and
requires the drain to report all of them, to mark the tail truncated, and to
reset to zero so the next window can say the guest went quiet. The invariant
did not exist before this change: the drain returned a bare String with no
count.

Verified: cargo fmt --all and --check; all three clippy arms with -D warnings
(aarch64-apple-darwin/backend-metal, host Vulkan, x86_64-unknown-linux-gnu
Vulkan); full backend-vulkan,host-window suite serially, 2308 + 96 passing,
0 failures.

Not verified: no VM boot carries this instrument yet, and no conformance
battery was run -- the change emits an OFF record and alters no execution path.
Metal tests were not run; this host is not Apple.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 19:50:28 +03:00
Anees IqbalandClaude Opus 5 f5b967b6a5 compute: a multisample texture has no bytes to stage, and refusing for want of them cost the guest its dispatch
Component: Vulkan compute execution and its bind resolution. Pathway: x86 macOS /
Linux Vulkan. Rail: macos-15.

## The API contract

A Metal kernel may declare `texture2d_ms<T, access::read>` and call
`read(coord, sample)`. The only thing that can supply such an image is a retained
multisample target: this repository already states the rule, at
`engine::types::SampledResource::multisampled` -- "linear bytes cannot be uploaded
into one with a buffer-to-image copy" -- and the render rail already enforces the
matching invariant in `engine::exec::validate_sampled_resident`, declining a
sample-count mismatch by name.

The render rail therefore had the whole path. The compute rail refused.

## What was wrong, and why the premise did not apply

`spirv_bind::reflected_compute_texture` folded a multisampled 2D sampled binding
into `UnstageableShape { axis: "multisampled" }`, beside 1D, 3D, cube, buffer and
arrayed. For those five the premise holds: the compute rail stages one flat plane
window or one linear GVA level per binding and produces a single-layer 2D image,
so binding it to another declared shape is a descriptor-type mismatch. For this
one the premise is about bytes that were never wanted. There is nothing to stage
and nothing needs staging -- the samples are already in the resident the render
pass wrote.

The cost was the whole dispatch, every time, under a reason naming the missing
bytes rather than the missing resident.

## The owning invariant

`ReflectedComputeTexture` gains a third classification beside `Plain2d` and
`UnstageableShape`. A multisampled *read* binding is neither staged nor refused;
it has a different source. A multisampled *write* binding keeps its refusal under
its own axis name, `multisampled_storage`, so the two classes cannot be admitted
together by accident.

`ComputeSampledSource` replaces `bytes: Vec<u8>` sitting beside
`resident_bind: Option<..>`. Those were an enum's tag and payload stored apart,
and the third source cannot be spelled in them at all, because it has no bytes --
not valid ones, not placeholder ones. The `ResidentCopy` variant no longer carries
a zero-filled placeholder either: its byte weight is derived from the binding's own
geometry, which is what the request validation already checked it against.

`PreparedSampledImage` becomes an enum whose `MultisampleTarget` arm acquires no
transient, uploads nothing and copies nothing. It binds the registry's own view,
places the resident with one barrier, and records the access it left it in.

Two engine declines carry the hazard the staging path used to: `MultisampleSampleAbsent`
(with `prior`, separating a reclaimed resident from one never created) and
`MultisampleSampleUnusable` (not ready / wrong extent / single-sample).

## Which identity door the bind takes, and why that is a property of the shape

`gva_resident_if_current` is the currency test every rail that substitutes a
resident for guest pages shares: it names the resident and then asks whether the
guest's own copy of those pixels still agrees with it. A single-sample GVA target
has such a copy, so that question is the right one for it.

A multisample target does not. No rail of this device writes a multisample
target's guest pages -- the last unguarded one was closed by a65348ed -- and this
device is the only reader of them. With nothing to compare, the witness cannot
answer; it reports no observed write, and `is_quiet()` is false for "cannot
answer". Measured on the first attempt at this change: `gvaw_quiet=0`,
`gvaw_guest_no_stamp=8`, `gvaw_no_entry=9`, and every `texture2d_ms` dispatch
refused as `resident_pages_written` -- a refusal for want of an answer, protecting
nothing.

So the identity half is split out as `gva_span_identity` and the multisample bind
calls that. It is an extraction rather than a second spelling: `gva_resident_if_current`
now calls it too, so the two doors share one derivation of the registry key by
construction, and the difference between them is exactly the witness-and-readiness
gate. `GvaTargetKey::of` also replaces the hand-written key beside it, for the same
reason its own comment already gave.

The absent-or-unready hazard the currency test stands in for on other rails is
carried here by the engine's `MultisampleSample*` declines at bind time.

## Tests

Owner level:

- `a_multisampled_sampled_texture_is_served_from_a_resident_not_refused`
  (`runtime/spirv_bind.rs`) requires the read class to classify as servable while
  the write class keeps a distinct named refusal. It did not compile on the parent,
  because `ReflectedComputeTexture::Multisample2d` did not exist -- the strongest
  red a classification change can have.
- `a_span_can_be_named_without_asking_whether_its_guest_pages_are_current`
  (`runtime/draw/tests.rs`) requires the identity door to answer for a span the
  currency door refuses, and requires `None` from the first to mean exactly
  `NoGeneration` from the second. That is the gate this change removes, pinned so it
  cannot be quietly re-plumbed through the witness again.

Conformance: `msaa4_color_store_host_sample_count`, added in 8449a303 for this
purpose. Native oracle PASS; guest FAIL on the identified control, three batteries
deep; guest PASS on the candidate, three batteries deep. Its expectation entry is
pruned here, which is the improvement the ratchet records.

## Verification

Rust: `cargo fmt --all` then `--check` clean. All three clippy arms `-D warnings`
clean. 2307 tests passed / 0 failed / 1 ignored, serially. Feature matrix PASS.

Conformance, rail macos-15, full battery, control `84452de4` x3 against candidate
`5488cbf3` x3, scored with all six device logs:

  preserved 263, unchanged debt 19, unchanged applicability 11,
  improvements 1, changed detail 1, control-unstable 0, REGRESSIONS 0

  IMPROVEMENT   msaa4_color_store_host_sample_count  FAIL -> PASS
  CHANGED-DETAIL msaa4_color_store_no_resolve

294 cases in every run of both arms, no NOT-RUN, no kernel panic, no probe timeout.

The changed detail is the same case moving from the driver rung to the translator
rung. It reads its samples back through `get_num_samples()`, which the pinned
translator folds to the constant 1 for every operand, so the loop runs once and
samples 1..3 keep the readback buffer's fill. That defect is packaged at
`bugs/compute-multisample-query-reports-one/` and is present in published upstream
as well as the pin, so it is not a stale-pin problem. `translation-errors.txt`
already recorded, in advance, that the case was driver-owned only while this device
refused before translation could execute; that condition no longer holds, so the
case moves to the translator inventory it was pre-classified for. Its raw result
is preserved and no native expectation changed.

Device-reason envelope: `compute_linux` 5->3, `compute_record` 5->3,
`draw_encode_fail` 8->7, all fewer, all the repair. `clear_dropped` 3->4 emitted
lines is not an extra loss -- `note_clear_dropped` dedupes on
`(reason, texture_ref)`, and the candidate holds the first multisample target's
resident alive through a readback dispatch the control refused outright, so the
guest cannot recycle that object slot as early and the second case's texture gets a
fresh ref. `render_multisample_contract`, keyed the same way, shows the identical
3-vs-4 split. Three other reasons moved on one candidate run only, matching all
three controls on the other: run-to-run noise.

## Not verified

The arm64 pathways. Metal is cfg-disabled on this host; the aarch64 clippy arm
cross-compiles that code but runs none of its tests.

The user-visible symptom this belongs to -- Safari images arriving half-rendered --
is not proved fixed by this commit. The mechanism it closes is the one established
for that symptom (a rendered tile becoming a flat clear because the device promotes
an attachment to a sample count its own readback then refuses), and this removes the
compute-side reader from that loop. Whether the remaining
`draw_partial_preserving_unseeded_lost_texels` population also contributes is open.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 19:40:08 +03:00
Anees IqbalandClaude Opus 5 8449a30394 conformance: one result line could not say whether the bind was refused or the sample count was one
Component: conformance suite. Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.
Test-only; no product behavior changes.

## The contract, and why one case could not witness it

A Metal kernel may declare `texture2d_ms<T, access::read>` and call
`read(coord, sample)`. Two independent obligations stand behind that: the device
must serve the multisample sampled bind from the retained target that holds the
samples, and the texture's own `get_num_samples()` must report that target's
sample count.

`msaa4_color_store_no_resolve` reads all four samples back through a kernel that
loops over `min(samples, tex.get_num_samples())`, so its result depends on both.
And the two failures are indistinguishable in it: a refused bind writes nothing,
and a served bind whose query folds to 1 writes only sample 0 — in both cases
samples 1..3 keep the readback buffer's 0xEE fill. The case cannot be the red
witness for either half, which is exactly what it was being asked to be.

## What this adds

`read_ms_texels_host_count` is `read_ms_texels` with the sample count taken from
the host constant the caller already has, never from the texture. It is a
separate kernel rather than a flag inside the first because the difference is
the whole point of the pair: the shared one would have to keep both spellings
anyway, and a reader has to be able to see that one of them does not query.

`readBackMultisample` gains `countFromTexture:` and selects between the two
pipelines. `msaa4_color_store_host_sample_count` runs the same render, the same
four unequal samples and the same comparison through it, so a difference between
the two cases is the query and nothing else.

## Results

Native oracle `scaleway-m4-macos15` (Apple M4, macOS 15.6.1), full battery:
294 cases, 0 failures, 0 skipped. Both multisample cases PASS. The tracked
baseline gains exactly one line and its SUMMARY count; no existing native
expectation moved.

Guest, rail macos-15, identified control `84452de4` (= a65348ed), full battery,
294 cases, no NOT-RUN, no panic:

  CASE msaa4_color_store_host_sample_count FAIL the readback dispatch produced
       nothing — the device refused it, or refused a bind in it

with the owning rung named on the device's own channel, the same one the sibling
case refuses at:

  compute_linux texture_shape fail reason=unstageable_multisampled pipe=164 ref=152 bind=32
  compute_record reason=texture_shape_unstageable class=unsupported kind=DispatchThreadgroups

So the new case is recorded as classified driver debt beside its sibling. It is a
coverage-and-isolation case on this build, not a repair witness: both cases refuse
at the same rung today, and the new one is the one that can move first once the
bind is served.

## Not verified

Two further control batteries of the three-run repetition were still running when
this was committed; the first is the evidence above. Because HEAD moved, their
manifests will record a different `harness_tracked_diff_sha256` than the first —
the suite, expectation and guest-binary content hashes in the same manifests are
the identity that matters and are unchanged.

No candidate boot exists for this change: it changes no product behavior, so
there is nothing to score a candidate transition against.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 19:29:52 +03:00
Anees Iqbal a65348ed34 clear: a multisample attachment's guest span is not a place to write one sample
Component: crates/reims-vgpu, the clear fallback in runtime/exec.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.

API contract. A colour attachment whose texture declares more than one sample has
no single-sample linear publication. The guest sizes and strides the allocation
for all of its samples: measured on this rail, `bytesPerRow = sampleCount * width
* bytesPerTexel` exactly, on three targets in two geometries --

  clear_dropped ... tex_ref=930  samples=4 300x300 bpr=4800   (4 * 300 * 4)
  clear_dropped ... tex_ref=1003 samples=4 300x300 bpr=4800
  clear_dropped ... tex_ref=152  samples=4 8x8     bpr=128    (4 *   8 * 4)

against `bpr=1216` on the single-sample 300x300 surfaces beside them. So a
single-sample image written into that span is not a partial answer; it is the
wrong content, in a sample layout this device has never established. This
repository already states the rule, in the sibling arm of the same function:
"treating the source as a linear image would write only one sample".

Owning invariant: `apply_clear` publishes only where a single sample is what the
destination holds.

Behavior changed. `apply_clear` refuses, fail-visibly, when the resolved target
declares more than one sample, and leaves the guest's bytes as it found them.
`clear_publish_target` above it is unchanged -- it decides from the store action,
and the store action does not name a sample count; the sample count arrives with
the resolved target, which is where the new gate sits. A resolve destination is
single-sample by construction and still publishes, so `ClearPublish::Resolved` is
untouched. Nothing changes for a target whose descriptor established no sample
count: `ResolvedRenderTarget::sample_count` is 1 there and always was.

Why. On rail macos-15 the guest runs four-sample 300x300 passes with
`storeAction=Store` and no resolve texture. The device promotes the attachment to
four samples faithfully (7540d6ec establishes the texture really declares four),
its readback then correctly refuses to linearize a multisample resident
(`read_target_multisample_image`), nothing is stored -- and then the clear
fallback wrote a flat 300x300 beige or near-black image into a span the guest had
strided for four samples, twice a boot, over whatever those pages held.

Every other rail that can write a render target's guest pages already refused
this shape through `resident_read_snapshot`: the host readback Store, the
GPU-direct copy, the deferred writeback (whose bytes come from that readback),
and the shared-backing synchronize -- which cannot even arise, because
`registry_ensure` imports guest memory only at `sample_count == 1`. `apply_clear`
was the last unguarded writer, and it is the one that ran.

What this does NOT repair, deliberately. The guest's pages now keep their prior
bytes instead of receiving a colour the contract does not put there. That is a
refusal, not a landing: the four-sample content stays in the engine resident and
this device still has no rail that can express it in guest memory. The next step
is `msaa4_color_store_no_resolve`, whose blocker is a different one --
`spirv_bind::reflected_compute_texture` refuses a reflection-declared multisample
texture as `UnstageableShape`, so the guest's own `texture2d_ms` readback never
dispatches.

Focused test. `a_multisample_linear_target_keeps_its_guest_bytes_instead_of_a_one_sample_clear`
(runtime/exec/tests.rs) drives `finish_stream` twice over the same 4x2 linear
BGRA8 texture in real guest pages, differing only in the sample count its
descriptor's trailer declares. The single-sample arm must still publish and must
actually write; the four-sample arm must leave every byte at its 0xcc fill and
say `clear_multisample_source_not_linear` on the fail channel. It fails on the
parent at the four-sample assertion.

Conformance gate: PASS. Rail macos-15, three control and three candidate
batteries interleaved against pinned binaries (control 01b1e949 = parent
7540d6ec, candidate 84452de4). 293 cases on all six, no NOT-RUN, no missing name,
no duplicate, no panic, and no timeout. Scored against both controls:

  cnd-1  preserved 263, unchanged debt 19, unchanged applicability 11, regressions 0
  cnd-2  same, regressions 0
  cnd-3  same, regressions 0

Device-reason transitions, read against the three-control envelope:

  clear_dropped               1 -> 4       this repair's own witness: three
                                           four-sample targets a boot, and exactly
                                           4 on all three candidates
  stamp_wait_timeout          3 -> 2       fewer (cnd-1, cnd-3)
  sampled_resident_reclaimed  1..2 -> 0    inside the control envelope on cnd-1 and
                                           cnd-3; fewer on cnd-2
  present_order_hold          0..1 -> 3    cnd-2 only. A timing counter, and the
                                           same one the parent's gate recorded
                                           moving inside each arm.

Reader decisions recorded rather than hidden:

- Every one of the six runs, control and candidate alike, reports
  `catastrophic=1`. `run-guest.sh` raises it on the presence of
  `stamp_wait_timeout` in the device log, and that condition is standing on this
  rail: the three prior `dc` batteries read it too, controls included (ctl 2, ctl
  2, cnd 4). It is inherited debt that both identified controls reproduce, not a
  candidate failure, and the candidate reports fewer of them than the control.

Verification actually run: cargo fmt --all and --check; clippy -D warnings on all
three main arms (aarch64-apple-darwin backend-metal, host
backend-vulkan,host-window, x86_64-unknown-linux-gnu backend-vulkan,host-window);
the full reims-vgpu suite serially, 2305 passed / 0 failed / 1 ignored.

Not verified:
- No live desktop boot ran this candidate and no visual interaction was
  re-photographed. The 300x300 tiles it stops overwriting were never isolated as
  a photographed symptom; the evidence is the device log and the guest's own
  stride.
- What the guest's four-sample span is supposed to contain is still unknown, and
  is deliberately not guessed here. This commit stops writing the one thing that
  is certainly not it.
- Metal arm cross-compiles only; its tests did not run. No other pathway or rail.
2026-08-30 18:52:02 +03:00
Anees Iqbal 7540d6ecf9 render target: a linear texture's sample count comes from its descriptor, not from a provisional
Component: crates/reims-vgpu, render-target resolution for type-2/3 linear textures.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.

API contract. A type-2/3 linear texture descriptor declares its own sample count
(recovered in the parent commit: raw u16 at TEXTURE_DESC_PIXEL_FORMAT + 16).
Metal requires a render pipeline's raster sample count and its colour
attachment's texture to agree, so the texture's declaration is what the
attachment must be built to.

Owning invariant: `ResolvedRenderTarget::sample_count` states what the target
itself declares, and is not a stand-in for a field nobody read.

Behavior changed. The type-2/3 linear path takes `tex.sample_count` instead of a
hardcoded `1`. The two paths whose target is a *mapping* rather than a texture --
type-11 and type-4 surfaces -- keep `1`, because they carry no creation
descriptor: there `1` is the display contract's own default rather than a
provisional. A descriptor that established no sample count still yields `1`, so
a texture this decoder could not corroborate keeps exactly the behaviour it had.

Why, measured. Rail macos-15, arm `m`, two boots at the parent commit:

  texture_desc_samples_1=3367   texture_desc_samples_4=4   trailer_corroborated=3371
  texture_desc_samples_1=4705   texture_desc_samples_4=4   trailer_corroborated=4709
  texture_desc_trailer_disagrees=0

  OFF texture_desc_multisample samples=4 300x300 shift=0

Exactly four textures a boot declare four samples and every one is 300x300 --
the same geometry, to the pixel, that the promotion record names:

  attachment_sample_count_override pipe=1014 tex_ref=1002 resolve_ref=0
    pipeline_samples=4 target_samples=1 resolved_samples=4 300x300 mid=0

So the guest's texture really is four-sample, `pipeline_samples=4` was right, and
`target_samples=1` was the provisional. The device was not inventing a
multisample attachment; it was reporting a disagreement with its own placeholder.
Zero descriptors out of 3371 and 4709 failed the trailer's self-corroboration, so
the recovered layout holds on every descriptor these boots decoded, not only on
the ones that looked plausible.

The witness, control against candidate, three batteries each:

  attach_samples_multisample_no_resolve   3  ->  0     (ctl-1/ctl-2 vs cnd-1/cnd-2)
  texture_desc_samples_4                  6  ->  6     unchanged
  texture_desc_trailer_disagrees          0  ->  0

The disagreement is gone because there is no longer a disagreement: both sides
now read four. `note_attachment_sample_count_override` returns early when they
agree, so that counter going to zero is exactly the claim.

What this does NOT repair, deliberately. `chain_resident_land_fail` is 3 on both
arms, unchanged. The attachment is still multisampled -- correctly -- and
`resident_read_snapshot` still refuses to read a multisampled resident
(`TargetReadDecline::MultisampleImage`), so nothing is stored and
`runtime::exec::finish_stream` still applies the pass's clear, and the rendered
300x300 tile is still lost. That is the next commit's work, and it is now
unblocked: this one establishes that the multisample-ness is the guest's and not
this device's, which is the fact that decides whether to resolve or to stop
promoting.

Conformance gate: PASS. Rail macos-15, three control and three candidate
batteries interleaved against pinned binaries (control 221ba048 = parent,
candidate 01b1e949). 293 cases run and 292 scored on all six, no NOT-RUN, no
missing name, no duplicate, no panic. Case-level transitions:

  cnd-1  preserved 262, unchanged debt 19, unchanged applicability 11,
         changed detail 1, control-unstable 1, regressions 0
  cnd-2  same, regressions 0
  cnd-3  same, regressions 0

One reader decision, recorded rather than hidden: scoring with device logs also
flags `device_lock_busy -- control 0 candidate 1`, from a single line in cnd-1,
`reason=gfx_read_deferred offset=0x122c size=4`. That is an MMIO read arriving
while the host device lock is held -- host-side contention, no guest-visible
branch, and this session was running builds alongside the batteries. Its
companion `present_order_hold` moves the same way inside each arm (control
0/0/1, candidate 0/1/3), which is what a timing counter looks like. Not scored as
a regression. The control-unstable case is
`srt_blit_iosurface_source_1920x1080_x4`, failing in 1 of these 3 controls, known.

Verification actually run: cargo fmt --all and --check; clippy -D warnings on all
three main arms (aarch64-apple-darwin backend-metal, host
backend-vulkan,host-window, x86_64-unknown-linux-gnu backend-vulkan,host-window);
the full reims-vgpu suite serially, 2304 passed / 0 failed / 1 ignored.

Not verified:
- No live desktop boot ran this, and no visual interaction was re-photographed.
  The defect it moves toward is a lost 300x300 tile inside Safari-class content;
  symptom 2 still has no working end-to-end witness (`web-content-probe` exits 2
  on its own setup gate).
- The guest's texture type was not read. `MTLTextureType` is a 4-bit field at
  TEXTURE_DESC_PIXEL_FORMAT - 2 and would corroborate `2DMultisample`
  independently of the sample count; it is not decoded here.
- Metal arm cross-compiles only; its tests did not run. No other pathway or rail.
2026-08-30 18:23:24 +03:00
Anees Iqbal eb406d87b5 decode: the texture descriptor's sample count is recovered, and it is read only from a trailer that corroborates itself
Component: crates/reims-vgpu, type-2/3 linear texture descriptor decode.
Pathway: x86 macOS / Linux Vulkan. Rails: verified statically against 12.7, 14.8,
15.7 and 26.6; not verified on 11.7.

No guest-visible behavior changes. The decoded value is not yet consumed by any
render-target decision -- `ResolvedRenderTarget::sample_count` keeps its
provisional. This commit recovers the contract term and makes it measurable; a
later one may act on it, once measured.

API contract recovered.

  In a type-2/3 linear texture descriptor, the texture's sample count is a
  little-endian u16 at TEXTURE_DESC_PIXEL_FORMAT + 16, i.e. byte offset 102 in
  the 116-byte single-mip body, shifted by (levels-1)*36 in a multi-mip body --
  the same shift the pixel-format read already applies. It is the raw
  MTLTextureDescriptor.sampleCount (1, 2, 4, 8), not a log2 and not an index.
  The producer narrows an NSUInteger to 16 bits at this field and refuses a
  value that would not survive the narrowing, so every value a guest can legally
  send round-trips exactly.

  The same trailer repeats the texture's width and height, as u32, at
  TEXTURE_DESC_PIXEL_FORMAT + 2 and + 6. They are an independent statement of
  the extent the level-0 record already gives.

The three new offsets are written as distances from the pixel-format anchor
rather than as 102 / 88 / 92. They live in one packed trailer and move together;
a layout change that moved one and not the others is not a thing that can
happen, and three literal constants would let this file claim it had.

Why the read is guarded. A sample count cannot be sanity-checked by looking at
it: 1, 2, 4 and 8 are all plausible, and so is a misread. The anchor this decode
hangs from is measured-correct on the rails in use, but a second and wider
trailer form exists under which *every* field including the pixel format shifts.
A rail using that form would not announce itself by failing -- it would hand
back a number read from between two other fields.

What can be checked is the redundancy: the extent is stated twice, in two
independently written places. `decode_trailer_sample_count` reads both and
returns the sample count only when they agree. When they disagree it emits a
typed `texture_desc_trailer_disagrees` and returns `None`.

`None` is not one. `TextureDescriptor::sample_count` is `Option<u32>` precisely
so a caller cannot confuse "this descriptor did not establish a sample count"
with "this texture is single-sample". The provisional it will eventually replace
is a hardcoded `1`, and a hardcoded `1` is exactly what a softened `None` would
be indistinguishable from.

Why this was recovered now. On rail macos-15 a rendered 300x300 tile becomes a
flat clear, three times a battery, on every battery of both arms:

  attachment_sample_count_override pipe=1014 tex_ref=1002 resolve_ref=0
    pipeline_samples=4 target_samples=1 resolved_samples=4 load=0x2 store=0x1
    300x300 mid=0 gva=0x326e000

The device promotes the attachment to four samples, its own
`resident_read_snapshot` then refuses to read a multisampled resident
(`TargetReadDecline::MultisampleImage`), nothing is stored, and the pass's clear
is applied instead -- a closed loop it inflicts on itself. The repair depends
entirely on which side of `4 != 1` is true, and it could not be decided, because
`pipeline_samples` is decoded while `target_samples` is that provisional. This
supplies the missing term.

Census added so the question can be answered from a boot:
`texture_desc_samples_{0,1,2,4,8,other}`, plus a first-sight
`texture_desc_multisample` record naming the geometry. If no texture on this rail
declares more than one sample, the promotion is this device's own invention; if
the 300x300 one declares four, the promotion is right and the readback is the
gap.

Verification actually run: cargo fmt --all and --check; clippy -D warnings on all
three main arms (aarch64-apple-darwin backend-metal, host
backend-vulkan,host-window, x86_64-unknown-linux-gnu backend-vulkan,host-window);
the full reims-vgpu suite serially, 2304 passed / 0 failed / 1 ignored, including
two new tests: one requiring the sample count to be read for 1/2/4/8 from a
corroborated trailer and withheld from a contradicted one, and one asserting the
three offsets stay derived from the single anchor.

Not verified:
- No boot has run this. The census it adds has taken no measurement yet.
- Not verified on rail 11.7; that bundle uses an older method-list encoding and
  the walker used here found no match.
- A wider trailer variant exists behind a capability whose trigger was not
  identified. On it, pixelFormat itself would move, so the existing
  measured-correct pixel format is evidence the rails in use are not on it -- but
  that is inference, and the corroboration check is what actually defends it.
- A stencil-bearing format class appears to emit two consecutive dimension
  regions, which would shift the trailer by a further 24 + 36*levels. Not
  observed on the wire, not modelled, and the corroboration check would withhold
  rather than misread it. Flagged as a decode hazard, not an established defect.
- The field at offset 108 is undecoded and unnamed.
2026-08-30 18:00:09 +03:00
Anees Iqbal 255ee070d1 observe: nothing said whether the wallpaper draw's Store ever published for the plane it drew into
Component: crates/reims-vgpu, plane draw census. Observation only.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.

No guest-visible behavior changes. This adds two `store_routes` counters and the
per-plane state that joins them.

What could not be measured before. On rail macos-15 the desktop background comes
up flat white on about two boots in three. Every boot-total differential run
against that separates nothing -- across 24 boots that share one proven-identical
binary, a white boot and a painted one have the same typed reasons at the same
frequencies, the same `present_route` / `present_page_identity` /
`type11_store_route` payloads, the same five or six `Composite` mids and the same
page geometry. An exhaustive normalised diff of the guest's own logs, stack
samples, `procs`, `ioreg` and `system_profiler` output separates them either.

What is established: the guest issues the wallpaper draw on a white boot --
`plane_draw_multi_quad` 963 on a white boot against 734 on a painted one, more
and not fewer -- the presented plane's own guest pages hold uniform `0xff`, and
no door reports losing a seed (`load_seed_lost` 0, `present_unbacked` 0).

And, measured this session on three of three boots where it could be asked:
rebuilding the guest's wallpaper layer repairs the screen, while damaging the
desktop with pointer motion never does. That is the expected shape -- macOS
composites the background once and relies on it persisting -- and it says the
loss is of one draw's result, not of a texture and not of a damage notification.

  boot    zero-input      pointer/dock     desktop hover    wallpaper rebuild
  lb-w1   WHITE  211.40   AMBIG   196.90   AMBIG   196.83   PAINTED 115.68
  lb-w3   WHITE  228.50   WHITE   214.00   WHITE   213.93   PAINTED 115.68
  lb-w4   WHITE  233.48   WHITE   222.69   WHITE   222.61   PAINTED 122.26

So the remaining question is a join no record could make: **did the multi-quad
draw's Store publish for the plane it drew into?** A boot total cannot answer it,
because the same plane also takes hundreds of six-vertex draws that publish
normally, so the join has to be per plane and per draw shape.

What this adds. `PLANE_MULTIQUAD_PENDING` holds one bit per plane -- "the last
draw into it was the multi-quad one and nothing has published since". A
multi-quad draw into a full-screen mapped plane arms it;
`publish_surface_store`, which is the one place a Store becomes visible in a
plane's guest pages, disarms it and counts `plane_multiquad_published`. A plane
armed twice with no publish between counts `plane_multiquad_redrawn_unpublished`
once, because two lost draws are the same observation as one until something
publishes.

Bounded by the number of live planes, which is the guest's swap chain (five or
six); entries are removed on publish, so nothing accumulates.

Reading it: compare `plane_multiquad_published` against `plane_draw_multi_quad`
on a white boot and a painted one. Both are per-window `store_routes` values and
must be summed across the boot, never read as a maximum.

Cost: one extra uncontended mutex acquisition per draw into a mapped plane of at
least 1024x1024, alongside the ring lock that path already takes. It does not run
for ordinary draws.

Verification actually run: cargo fmt --all and --check; clippy -D warnings on all
three main arms (aarch64-apple-darwin backend-metal, host
backend-vulkan,host-window, x86_64-unknown-linux-gnu backend-vulkan,host-window);
the full reims-vgpu suite serially, 2302 passed / 0 failed / 1 ignored.

Not verified: no boot has yet been run with these counters, so the measurement
they exist for has not been taken. No conformance battery -- this changes no
guest-visible behavior and adds no branch a guest can reach.
2026-08-30 17:47:18 +03:00
Anees Iqbal 6277c55d1b pass: the guest's three load actions stop collapsing onto one bit, and an unseeded preserving pass stops inventing a colour
Component: crates/reims-vgpu, Vulkan render-pass key and engine draw request.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.

API contract. `contract::pass_action::LoadAction::preserves_prior_contents` is
true for both `MTLLoadActionLoad` and `MTLLoadActionDontCare`: DontCare declares
the prior contents *undefined*, and undefined permits any contents, including
the ones already there. `backend::metal::render` hands the same wire word to
Metal, which preserves, and the guest relies on that — it declares DontCare and
then redraws only its damage rectangle. Nothing in the contract supplies a
colour for the texels such a pass does not cover.

Owning invariant: a pass may write the whole colour attachment at its start
only when the guest asked for a clear.

Behavior changed. `PassKey.load_seed: bool` becomes
`PassKey.color0_load: Color0Load`, a three-valued type resolved at one site:

  Preserve  -> AttachmentLoadOp::LOAD,      the attachment's resting layout
  Clear     -> AttachmentLoadOp::CLEAR,     ImageLayout::UNDEFINED
  Undefined -> AttachmentLoadOp::DONT_CARE, ImageLayout::UNDEFINED

Before, two different requests spelled `false` — a pass that asked to clear to
the guest's own colour, and a pass that promised to keep its contents and
arrived with none of them — and `caches.rs` resolved `false` to `CLEAR`. The
value it cleared to was `target_clear`, which is assigned only on the `Clear`
arm and is otherwise its `Default`: transparent black `[0.0; 4]`, a colour this
device invented. That is the black rectangle left behind by a closing dock
context menu.

`DrawRequest` gains `color0_declared: Option<LoadAction>`. The engine's existing
fields say what this device *can* offer; none of them said what the guest *asked
for*, so the engine could not tell the two `false` cases apart and had to invent
a colour for both. `None` means the caller did not state one and keeps the
historical clearing answer, so an unfilled request cannot silently acquire a
preserving reading it was never given evidence for.

Measured population this removes, rail macos-15, boot s5:
`draw_partial_preserving_unseeded` 461, `_unseeded_lost_texels` 2 107 399 in one
boot, over live guest content. On boot s3 `draw_partial_preserving_unseeded`
equals `draw_partial_dontcare` exactly in every window (65/109/288) — not one
DontCare partial draw in a boot found its prior contents through any door, while
LOAD preserved 14 882 times.

Why DONT_CARE and not a seed. Two earlier variants were built and withdrawn:
widening the ordinal test in `draw/mod.rs` to `preserves_prior_contents()` (adds
~15 full-frame CPU seed reads per battery) and preserving from the resident.
Both hung at `srt_blit_after_render_1920x1080`. That hang is now attributed to
the completion-rail abandonment defect repaired in the parent commit, so it was
never evidence against either variant — but this change needs neither: it writes
*less* than the clear it replaces, adding no read and removing a full-surface
write.

Why ImageLayout::UNDEFINED on that arm. Images are created with
`initial_layout(UNDEFINED)`, and this arm is reachable on the first pass into a
freshly allocated attachment — which is exactly what a DontCare into a new plane
is. Naming the resting layout there would tell Vulkan the image is in a layout
it has never been transitioned into. The cost is that UNDEFINED licenses an
implementation to discard, so this removes the invented colour without
*promising* the prior contents. The promise needs the resident LOAD arm, which
is not in this change; its witness stays red and says so.

Census. `passbegin_load` / `passbegin_clear` become three buckets, with
`passbegin_undefined` naming the new population, because folding it into either
existing counter would move counts between two populations already being read.

Focused tests, in `caches::color0_load_tests`:
- a_preserving_pass_with_no_prior_contents_does_not_write_the_attachment
- only_a_declared_clear_may_invent_a_colour  (sweeps the ordinal space, so a
  fourth ordinal from the wire cannot acquire the clearing reading)
- the_three_slot0_loads_are_three_pass_keys  (the collapse must not reappear one
  layer down, as two answers sharing a cached render pass)
- each_slot0_load_keeps_its_own_answer

Verification actually run: cargo fmt --all and --check; clippy -D warnings on
all three main arms (aarch64-apple-darwin backend-metal, host
backend-vulkan,host-window, x86_64-unknown-linux-gnu backend-vulkan,host-window);
the full reims-vgpu suite serially, 2302 passed / 0 failed / 1 ignored.

Conformance gate: PASS. Rail macos-15, complete battery, three control and
three candidate batteries run interleaved against pinned binaries (control
sha 8a2351f6 = this commit's parent, candidate sha ab21b37c), scored with
`conformance/ratchet.py`, every candidate against all three controls:

  cnd-1  preserved 262, unchanged debt 19, unchanged applicability 11,
         improvements 2, changed detail 2, control-unstable 1, regressions 0
  cnd-2  identical
  cnd-3  preserved 262, ... improvements 0, changed detail 6, regressions 0

293 cases run and 292 scored on every one of the six, no NOT-RUN, no missing
name, no duplicate, no panic. The one control-unstable case is
`srt_blit_iosurface_source_1920x1080_x4`, which failed in 1 of these 3 controls
and is already known unstable at about that rate.

`srt_blit_after_render_1920x1080` did not hang on any of the three candidate
batteries. Both previously withdrawn DontCare variants hung there, so this is
the specific thing that had to be checked and it is checked three times.

The repair's own witness in the always-on log, dc-ctl-1 against dc-cnd-1:

  passbegin_clear      700  ->  864
  passbegin_load      1300  -> 1535
  passbegin_undefined  absent ->  64

64 passes a battery that used to begin by clearing the whole attachment to an
invented colour now begin by writing none of it. `draw_partial_preserving_
unseeded` is unchanged in kind (66 control, 52 candidate — run-to-run) because
it counts the passes that promise prior contents and have none, which is the
population, not the destruction. Its `_lost_texels` companion should now be read
as texels left undefined rather than texels overwritten with black; the name
predates this change.

Live interaction, rail macos-15, candidate binary ab21b37c, one held boot:
`scripts/menu-close-probe` ran **30 trials** across two invocations, aimed at
delay=0.46 inside the fade both times (calibration ramp 0.34 -> 0.50 reproduced:
84.2, 92.4, 111.0, 125.7, 145.6). Every trial `VERDICT=CLEAN`, worst new-black
fraction 0.031086, and the fraction is stable to under 0.001 across all 30.

Read that as the interaction passing, **not** as the repair being demonstrated.
0.031 is the same constant background the probe recorded on boot `h1` before
this change; the black rectangle is intermittent across boots and it did not
occur on this boot, on this binary. A run that does not see the defect is not
evidence that it is gone, which the probe's own README says. The repair rests on
the contract and on the census, not on this run.

Also on that boot, with host-driven QMP input only: the desktop came up white
(host mean 231.25) and a five-point pointer sweep across the dock strip repainted
it (115.14) -- the reported symptom-1 loop, reproduced and repaired on this
binary. Unrelated to this change and not repaired by it.

Not verified:
- The guaranteed-preservation obligation is untouched.
  `a_preserving_gva_attachment_reaches_the_encoder_able_to_preserve` remains
  `#[ignore]` and remains red, deliberately.
- Metal arm cross-compiles only; its tests did not run. No other pathway or rail
  was exercised.
- A guest kernel panic occurred on this rail during this session, on the PARENT
  binary and not this change (journal/panic-2026-08-30-cwl-w5). It is inherited,
  unattributed debt; nothing here addresses it.
2026-08-30 17:30:43 +03:00
Anees Iqbal d6e181490a completion: a fence deadline reports how far behind the queue is, and stops discarding the word
Component: crates/reims-vgpu, Vulkan completion rail (stamp_completion.rs).
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.

Message amended after the fact to record the conformance gate, which had not
run when this was first written. The tree is byte-identical to what was scored:
the manifests identify the candidate arm by `tracked_diff_sha256=61f431e4...`,
which is `git diff 44905c60 <this tree>`, so the amend does not touch the
artifact identity the scoring rests on.

API contract. `IOGPUEventMachine::waitForStamp(index, target)` reads the stamp
word out of the page this device writes, compares `target - current <= 0`
signed, and when the target has not been reached sleeps on the word's own
address with a one-second deadline, re-reading the word on every wake. The
interrupt is the wakeup, not the notification, so the word is the entire
delivery and the guest's deadline is a re-read timer rather than a give-up.

Owning invariant: the completion word for a FIFO submission becomes guest
visible when that submission completes -- never before it, and never dropped
because it was late.

Behavior changed. `await_completion` replaces the single `vkWaitSemaphores`
call in the completion thread. A `TIMEOUT` is now reported and the wait
*resumes*; only the point arriving, a non-`TIMEOUT` device result, or shutdown
ends it. Publication is unchanged: the word is still stored only after the
point completes, so nothing is published early and the
late-write-after-release shape the old code was guarding against is still
impossible. What is removed is the *abandonment* -- the old TIMEOUT arm
withheld the word (right) and then popped the entry (wrong), so a submission
completing a moment later had nothing left that could store its word.

Why, measured. Boot `ins-1`, rail macos-15, control binary at 44905c60:

  stamp_wait_timeout index=1 value=1594 counter=1592 reserved=1595 queued=1595
                     class=stamp_timeout_queued_not_run

Every occurrence is `queued_not_run` with `queued >= value`, and the timeline
counter is two or three points behind -- a queue slightly behind a heavy pass,
not a wedged one, and not a reservation that was never submitted. The device
was discarding a word for work that was about to finish.

The cost of that, from preserved logs. Five healthy conformance runs do device
work until the battery ends (t=111.7k, 113.3k, 112.8k, 111.7k, 112.7k). The
hung run `conf-v2-1` does its last work at t=55073 and then idles 575 s with
packets=0, ring_reads=0, draws=0 and no typed failure -- the guest stops
sending entirely. Its last three records are three consecutive 5 s deadlines.
`conformance/suite/cases/Blit.swift::blitAfterRenderCase` names the guest call:
256 heavy whole-target draws committed without waiting, then a blit committed
and `waitUntilCompleted()`, i.e. a thread parked on exactly one word with
nothing of its own left to submit. The survivable form is in the control arm
too: `ins-1` reached cases=293 but ran to t=322802 against ~110k for the other
five, losing ~210 s until a later stamp covered the abandoned one.

Focused test, red then green.
`a_fence_deadline_reports_and_resumes_instead_of_abandoning_the_word`. With the
pre-repair rule spelled back in (`return false` at the first deadline) it fails
and every other test in the module still passes; with the repair it passes.
`await_completion` takes its wait, its shutdown test and its two reports as
arguments precisely so this rule is checked rather than asserted in a comment.
Two companions cover the paths that still end the wait:
`shutdown_ends_the_wait_at_the_first_deadline` and
`a_device_error_ends_the_wait`.

Considered consequence: `wait_for_fifo_idle` and the per-FIFO pending ring now
hold an entry until the work really completes, rather than for at most one 5 s
deadline. That is the correct semantics and is bounded by real completion; the
old bound did not rescue anything, it converted a device-side wait into a
permanent guest-side one.

Verification actually run: cargo fmt --all and --check; clippy -D warnings on
all three main arms (aarch64-apple-darwin backend-metal, host
backend-vulkan,host-window, x86_64-unknown-linux-gnu backend-vulkan,host-window);
the full reims-vgpu suite serially, 2394 passed / 0 failed.

Conformance gate: PASS. Rail macos-15, complete battery, `conformance/ratchet.py`
with control = the two runs whose manifests carry an empty tracked diff at
44905c60, candidate = each of the four complete runs whose tracked diff is this
change. All four score identically:

  preserved 262, unchanged debt 19, unchanged applicability 11,
  improvements 0, changed detail 1, control-unstable 1, regressions 0

292 cases on both arms, no missing name, no duplicate. The one control-unstable
case is `srt_blit_iosurface_source_1920x1080_x4`, known. With both control
device logs supplied, every moved typed-reason count collapses into run-to-run
variance except `sampled_resident_reclaimed` 1 -> 2, a count of one.

The repair's own effect, measured on those runs: `stamp_wait_timeout` still
fires 3-4 times per battery on BOTH arms -- the GPU really is a couple of points
behind that pass, and that was never the thing to fix -- while
`stamp_word_abandoned` goes 4 and 3 on control to 0 on all four candidates. The
~210 s stall present in one of the two control runs does not recur in four.

Not verified, and required before this is relied on:
- Four candidate runs is not a rate for a 1-in-7 event. The claim is that the
  repair removed the abandonment it targeted and cost nothing on the ratchet,
  not that the stall is proved gone.
- No live desktop boot ran this change. Only the conformance rail did.
- Symptoms 1, 2 and 3 are untouched by any measurement here; the hypothesis
  linking symptom 1 to an abandoned word is written up in the journal and is
  NOT established.
- Metal arm cross-compiles only; its tests did not run. No other pathway or
  rail was exercised.
2026-08-30 16:28:57 +03:00
Anees Iqbal 44905c6021 observe: a timed-out stamp is dropped, and nothing said which of two losses it was
Component: crates/reims-vgpu, Vulkan completion rail.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.

API contract. `IOGPUEventMachine::waitForStamp(index, target)` reads the stamp
word out of the page this device writes, compares `target - current <= 0`
signed, and when the target has not been reached sleeps on the word's own
address with a one-second deadline, re-reading the word on every wake. The
interrupt is the wakeup, not the notification. So the word is the whole
delivery: a wakeup that arrives without one is not a partial delivery, it is
none, and the guest's deadline is a re-read timer rather than a give-up.

Owning invariant: the completion word for a FIFO submission becomes guest
visible when that submission completes, and a device that has advertised a
timeline point owes its word to whatever is asleep on it.

Behavior changed: none. This is observation only.

Why. A candidate battery hung, and comparing preserved device logs by their
last non-OFF record showed what that means. Five healthy runs do device work
until the battery ends (t=111.7k, 113.3k, 112.8k, 111.7k, 112.7k). The hung run
does its last work at t=55073 and then idles 575 s further with packets=0,
ring_reads=0, draws=0, duty=0.002 and no typed failure: the guest stops sending
entirely. Its final three records are three consecutive 5 s fence deadlines
covering ~39.3 s to 55 s, during which the timeline never reached 919.

Reading the completion thread against that: the TIMEOUT arm withholds the word,
which is right on its own terms, because publishing a stamp for work that has
not executed tells the guest its results are ready and its inputs are free. But
it also pops the entry, so a submission that completes a millisecond later has
nothing left that could store its word. That is survivable whenever more work
follows, since the wait is `>=` and stamps are monotonic, so a later stamp
covers an abandoned one -- which is why control runs carry two of these records
each and finish. It is unsurvivable for the last stamp, and a guest asleep in
waitForStamp is exactly a guest that has stopped producing the later work.

A second candidate for the same wedge: `latest_queued` advances at enqueue
rather than at submit, so a point that was reserved and never handed to the
queue owner is named as the newest queue point and nothing will ever signal it.

Nothing preserved says which of the two happened, and they have opposite
repairs, so this records the discriminator instead of guessing. Per timeout it
now reports the semaphore's actual counter against the reserved and queued
high-water marks and classifies `stamp_timeout_queued_not_run` (handed over,
GPU has not run it) against `stamp_timeout_never_submitted` (reserved, never
handed over). `stamp_word_abandoned` sizes the population of words the guest can
never be told about. Both are summable store_routes counters; the per-occurrence
line stays always-on.

Verification actually run: cargo fmt --all and --check; clippy -D warnings on
all three main arms (aarch64-apple-darwin backend-metal, host
backend-vulkan,host-window, x86_64-unknown-linux-gnu backend-vulkan,host-window);
the full reims-vgpu suite serially, 2391 passed / 0 failed. Six control
conformance batteries were started against the pinned control binary; three
completed clean before the loop was killed by process-group cleanup (293/293
cases, 19/19 driver, 0 unexplained, 2 stamp_wait_timeout each, none hung).

Not verified: no boot has yet run this instrument, so neither class has been
observed. The hang is not reproduced here and its mechanism is not established
-- only that the two candidates are distinguishable and were not distinguished
before. Metal arm cross-compiles only; its tests did not run. No other pathway
or rail was exercised.
2026-08-30 16:02:31 +03:00
Anees IqbalandClaude Opus 5 289efa8efe observe: the cost-negative DontCare repair hung in the same place, which
retires the latency explanation

Component: crates/reims-vgpu, runtime/draw/mod.rs.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.
Documentation only: no product behavior changes, so no conformance battery
applies to this commit.

The previous commit recorded that widening the GVA arm's ordinal test to
LoadAction::preserves_prior_contents() removes the DontCare defect entirely
and regresses the conformance ratchet, and attributed the regression to
cost: ~15 extra full-frame seed_color_load CPU reads per battery, enough to
flip the deliberately racy 1920x1080 blit cases.

A cost-negative variant was then built to test that attribution. Preserving
from the engine resident instead of from a CPU seed costs strictly less than
the branch it replaces -- the price of preserving is the seed upload, and
there is nothing to upload when the pixels are already resident, so the arm
removes a full-surface clear write and adds no read. It is lawful for
DontCare specifically, because undefined permits any contents, so a resident
stale against a guest CPU write needs none of the currency reconciliation a
LOAD would; it is the same rule the secondary-attachment path already spells
as `LoadAction::DontCare => resident_content_ready(&identity)`.

It worked: one battery measured dontcare_resident_preserved 47,
dontcare_resident_absent 12, and draw_partial_preserving_unseeded down from
~78 to 5.

And it hung in exactly the same place: srt_blit_after_render_1920x1080,
rc=124 after the 600 s probe timeout, immediately after
srt_blit_after_render_1024x768 passed -- the identical signature the seed
variant produced.

That retires the latency explanation. Two variants with opposite cost
profiles -- one adding full-frame CPU reads, one removing full-surface clear
writes -- hang at the same case. So either routing a DontCare GVA pass to
preserve by any door disturbs that case, or the case is flaky and both
candidates were unlucky. The counts do not separate those: 3 anomalies
across 8 candidate batteries against 0 across 4 control batteries.

Both variants are therefore reverted and neither product behavior change is
in the tree. What lands is the measurement and the reading, beside the arm
they are about, so the next attempt starts from them instead of rebuilding
either variant.

The named next step is to bound the control: run the control battery enough
times to give srt_blit_after_render_1920x1080 a fair chance to hang on its
own. A control hang settles it as inherited raciness in a case whose own
source says its repeated whole-target draws exist "so the GPU is still
working when the copy behind them is decoded". Absent that, the mechanism
has to be understood first, starting from the hung run's device log where
the device is idle (drain_duty duty=0.002, no submissions, no typed failure)
behind a stamp_wait_timeout on a 2.6 s gpu_span busy_max_us -- and where a
control run reached the same escalated stamp pattern without hanging.

Verification run. cargo fmt --all and --check clean. All three clippy arms at
-D warnings, each invoked separately: aarch64-apple-darwin/backend-metal,
host backend-vulkan,host-window, and x86_64-unknown-linux-gnu
backend-vulkan,host-window. Serial suite 2391 passed, 0 failed, 1 ignored
(a_preserving_gva_attachment_reaches_the_encoder_able_to_preserve, the
unmet contract obligation recorded in the previous commit).

Not verified. The cost-negative variant was measured on one battery only;
runs 2 and 3 of its planned three had not completed. The remaining untried
shape -- a three-valued PassKey load op -- is described and not built.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 15:49:46 +03:00
Anees IqbalandClaude Opus 5 06142c6ed5 observe: write down the DontCare GVA obligation, and the measurement that
rejects its obvious repair

Component: crates/reims-vgpu, runtime/draw/{mod.rs,tests.rs}.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.
No guest-visible behavior change: the product edit is documentation, and the
new test is #[ignore].

The defect, established. runtime/draw/mod.rs's colour-attachment loop reaches
the GVA seed and resident-elision rail only when the declared load action is
exactly MTLLoadActionLoad. MTLLoadActionDontCare also promises the prior
contents -- undefined permits them, backend::metal::render hands the same
wire word to Metal which preserves them, and the guest declares DontCare and
then redraws only its damage rectangle.
contract::pass_action::LoadAction::preserves_prior_contents states that term
and answers true for both ordinals. The seed block in draw::vulkan was
widened to it and the secondary-attachment path spells it directly as
`LoadAction::DontCare => resident_content_ready(&identity)`; this arm was
never widened.

So a DontCare GVA attachment falls past that arm with no seed and
gva_load_from_resident false, every downstream door is shut to it,
PassKey::single reads "no seed", caches.rs resolves that to
vk::AttachmentLoadOp::CLEAR, and every texel outside the draw's scissor
becomes target_clear -- untouched at [0.0; 4], transparent black, because
that variable is assigned only in the Clear arm. Boot s5: 461 partial draws
and 2 107 399 texels a boot, over live guest content.

Why this commit does not repair it. The one-line widening to
preserves_prior_contents() was built, tested and measured against the
compatibility ratchet, and it must not land as written.

It does remove the defect completely. Across three candidate conformance
batteries on rail macos-15, dontcare_seed_empty,
draw_partial_preserving_unseeded and its lost-texel total were all zero,
against 211 012 and 298 602 lost texels on two control batteries, with
dontcare_seed_served rising 16 -> 31.

It also regresses the ratchet. Five candidate batteries against four control
batteries, both arms pinned and differing only by that change (control
f1fe0f02 at f0933a82, candidate 7c76ae86):

  candidate  one run hung 600 s at srt_blit_after_render_1920x1080, leaving
             6 cases NOT-RUN, one of them a previously classified driver
             failure -- PASS -> not-run and known-owned-FAIL -> not-run are
             both regressions
  candidate  one run srt_blit_iosurface_source_1920x1080_x4 REGRESSION,
             stale_frames=2/4, 576 wrong texels of 2 073 600
  control    four runs clean: 293/293 cases, 19/19 driver, 0 unexplained

Both failures are in the deliberately racy heavy 1920x1080 blit family,
whose own source says its repeated whole-target draws exist "so the GPU is
still working when the copy behind them is decoded". The mechanism is cost,
not staleness: gvaseed_chained is unchanged between the arms (195-347
control against 176-308 candidate), so the widening elects no additional
resident elisions -- it pays ~15 extra full-frame seed_color_load CPU reads
per battery, and that latency is enough to flip cases built to race.

The repair therefore has to be cost-negative, and the shape that is sits one
layer down: PassKey.load_seed is a bool and the contract it represents has
three values. Preserve, clear-to-the-guest's-colour and undefined collapse
two-into-one and caches.rs resolves the collapsed value to CLEAR. Spelling a
seedless DontCare vk::AttachmentLoadOp::DONT_CARE is lawful, writes none of
the attachment, and is cheaper than the full-surface clear it replaces.

What lands here. The measurement and the reasoning, beside the arm they are
about, so the next attempt does not re-derive them or repeat the rejected
repair. And the invariant as an executable, currently-red test:
a_preserving_gva_attachment_reaches_the_encoder_able_to_preserve drives
mrt_draw_request over a real guest-page GVA texture and asserts colour 0
arrives able to preserve -- a CPU seed carrying the attachment's own texels,
or gva_load_from_resident. It compares the seed's contents rather than its
presence, because a Clear on this path also arrives with a seed
(solid_rgba8 of the guest's clear colour) and "has a seed" would pass for
the wrong reason; the rig writes [7,5,3,255] into the guest pages so the two
cannot be confused. Clear is asserted both ways: it keeps its solid seed, and
it must not carry the attachment's prior texels.

It is #[ignore] rather than deleted or inverted, because it is the red
witness the repair has to turn green and inverting it would pin the defect as
if it were the contract. Verified red under --ignored and skipped by default.

Verification run. cargo fmt --all and --check clean. All three clippy arms at
-D warnings, each invoked separately. Serial suite 2391 passed, 0 failed, 1
ignored. Conformance batteries as tabulated above; the rc=1 "CATASTROPHIC
device timeout or loss" verdict appears identically on every control run,
from 2 stamp_wait_timeout records, and is unchanged pre-existing debt.

Not verified. The cost-negative repair is described, not implemented or
measured. The hung battery's mechanism is not fully explained: the device was
idle through it (drain_duty duty=0.002, no submissions, no typed failure) and
a control run reached the same escalated stamp_wait_timeout pattern without
hanging, so raciness inherited by that case is plausible but not established.
Preserved in journal/conf-cand-hang-2026-08-30/.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 15:33:01 +03:00
Anees IqbalandClaude Opus 5 f0933a82cc observe: size the safe half of the lost-texel population, and correct what the
sample-count record claims

Component: crates/reims-vgpu, runtime/draw/{mod.rs,vulkan.rs}.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.
Observation only: no guest-visible behavior changes, so no conformance
battery applies.

Boot s4 (HEAD 8aee8882, tree clean, host WHITE/233.478, dock-sweep repair
PAINTED/123.342) read the two censuses added above:

  draw_partial_preserving_from_target          32 423
  draw_partial_preserving_seeded                   69
  draw_partial_preserving_unseeded                575
  draw_partial_preserving_unseeded_lost_texels  2 884 701
  attach_samples_multisample_no_resolve             2

2.9 million texels a boot are overwritten with [0.0; 4] on attachments whose
declared load action promised to keep them. That is the dominant loss by
three orders of magnitude over the multisample thread beside it.

Correction, and it retires a claim this session made two commits ago.
`ResolvedRenderTarget::sample_count` is a hardcoded provisional `1` at every
one of its construction sites -- a linear texture resource's dimensions do
not retain the creation descriptor's sample count, and the field's own
documentation says the Vulkan encode is expected to replace it with the
pipeline's. So `pipeline != target` was never evidence that the guest's
texture is single-sample, and "did this device invent the multisample?" was
not a question that record could answer. It cannot see the texture's
declaration at all.

What boot s4 does establish about that thread: exactly two such passes in a
whole boot, both `pipeline_samples=4 resolve_ref=0 store=0x1` on 300x300
linear GVA targets, and they are the same two the corrected skipped-draw
tail reports as engine_drew_store_lost_it. Two out of a boot's several
hundred pipelines is also what says raster_sample_count is decoded correctly
rather than misread -- it comes from a TLV tag, and a misread tag would not
be that rare. So the guest really does run a 4x pass, and the open question
is now what it expects to find in those guest pages afterwards: Metal writes
nothing to a linear buffer for a multisample MTLStoreActionStore, and this
device writes the pass's clear colour there. Nothing establishes which the
guest reads, so no repair there is supportable yet. The route names are
corrected accordingly -- `attach_samples_multisample_no_resolve` and
`attach_samples_below_provisional` replace the "promoted"/"demoted" pair,
which asserted a comparison that was not being made.

Behavior changed. None. The lost-texel population is split by whether the
target has guest-visible backing, because that is the line between a repair
that is safe and one that is not:

  draw_partial_preserving_unseeded_guest_backed   a type-11 mapping or task GVA
  draw_partial_preserving_unseeded_resident_only  neither

The prior contents these passes needed are on the engine resident. Loading
them back is only unambiguous when nothing outside this device can have
changed the surface since the resident was published, and the one writer
this device cannot see is the guest's own CPU writing the surface's pages.
A target with guest backing has such pages, and reusing its resident without
the currency query is the documented fixpoint where "renders correctly for a
few frames then stays corrupted" comes from. A target with neither has no
guest pages, hence no guest-side writer, and its resident is the only place
its prior contents exist -- authoritative by construction, with nothing to
reconcile. Sizing that subset is the precondition for repairing it.

Focused tests. a_dontcare_partial_draw_is_priced_by_the_area_it_destroyed
now also asserts the two halves are counted apart.
an_attachment_sample_count_taken_from_the_pipeline_names_where_the_samples_go
is updated to the corrected reading and still holds its arms apart.

Verification run. cargo fmt --all and --check clean. All three clippy arms at
-D warnings, each invoked separately: aarch64-apple-darwin/backend-metal,
host backend-vulkan,host-window, and x86_64-unknown-linux-gnu
backend-vulkan,host-window. Serial suite 2391 passed, 0 failed.

Not verified. No boot has read the guest-backed/resident-only split, so the
size of the safe subset is still unknown -- that is what this commit exists
to ask. Boot s4's menu-close probe ran and reported CLEAN; the web-content
probe again exited 2 on its own setup gate, so symptom 2 still has no
witness. No boot since h1 has panicked, but that is two boots and does not
speak to the panic's rate.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 14:15:16 +03:00
Anees IqbalandClaude Opus 5 8aee8882ee observe: an attachment's sample count comes from the pipeline, and nothing said
when that disagreed with the texture

Component: crates/reims-vgpu, runtime/draw/mod.rs.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.
Observation only: no guest-visible behavior changes, so no conformance
battery applies.

Established first, on two live boots (s3 and h1, HEAD 27a0dc1d and
e273bd4f, rail macos-15). With the skipped-draw tail corrected, the whole
population that reaches it reads:

  chain_resident_land_fail reason=read_target
    target=Gva { gva: 54280192, width: 300, height: 300, generation: 227,
                 format: B8G8R8A8_UNORM }
    err=vk_engine_target_read: reason=read_target_multisample_image
  linux_clear_store draws_skipped refused_by=engine_drew_store_lost_it
    pipe=1129 vtx=6 mid=0 gva=0x33c4000 300x300
    load=0x2 store=0x1 clear=[0.947,0.913,0.847,1.000]

The guest declares a 300x300 GVA target, MTLLoadActionClear with a warm
off-white clear and MTLStoreActionStore. The engine draws it successfully.
resident_read_snapshot then refuses the readback because the resident's
sample_count is not 1, nothing is stored, runtime::exec::finish_stream
applies the pass's clear, and a rendered tile reaches the guest as a flat
colour. Twice per boot, on every boot measured, the second instance at
clear=[0.024,0.026,0.028,1.000].

API contract. MTLRenderPipelineDescriptor.rasterSampleCount must equal the
sample count of every colour attachment the pipeline renders into. Reading
the count off the pipeline is therefore normally a restatement of what the
destination texture already says.

The seam. runtime/draw/mod.rs takes the attachment's sample count from the
bound pipeline and lets it *override* the destination texture's own:

  let attachment_sample_count = pipeline_sample_count.unwrap_or(target_sample_count);

When the two agree that is a restatement. When they disagree it is not: the
destination is single-sample and this device has promoted it to a
multisample attachment on the pipeline's word, with no record that it did.
The engine then creates the resident at the promoted count and the readback
refusal above follows -- so the promotion's cost is paid three layers away
from the promotion, and nothing connected them.

Behavior changed. None. The disagreement is now named, split by whether the
samples have anywhere to go, because the halves have different owners:

  attach_samples_from_pipeline_with_resolve  a resolve texture is declared
  attach_samples_promoted_no_resolve         promoted with nowhere to resolve
  attach_samples_demoted                     the opposite disagreement

plus a per-(pipeline, texture) latched line carrying both counts, the
resolve ref, the load and store actions, the geometry and the destination.
Agreement, and a pipeline that could not be resolved, stay silent -- a
census firing on every attachment of every draw would cost a store route per
attachment per draw and could not be read.

This exists to answer exactly one question before any repair is designed:
did the guest declare the multisample, or did this device invent it? A
record with target 1, pipeline greater, and no resolve_texture_ref is the
second -- a promotion with nowhere for the samples to go, which is not a
shape Metal can express and which this device should refuse rather than
silently lose.

Focused test.
an_attachment_sample_count_taken_from_the_pipeline_names_where_the_samples_go
asserts silence on agreement and on an unresolvable pipeline, and holds the
three disagreement arms apart from each other. Delta form, because the
census map is process-global.

Verification run. cargo fmt --all and --check clean. All three clippy arms at
-D warnings, each invoked separately: aarch64-apple-darwin/backend-metal,
host backend-vulkan,host-window, and x86_64-unknown-linux-gnu
backend-vulkan,host-window. Serial suite 2391 passed, 0 failed.

Not verified. No boot has read these counters, so which of the three arms the
300x300 case falls in is still unknown -- that is the question this commit
exists to ask, not one it answers. No repair is proposed here.

Also recorded, and unresolved: boot h1 ended in a guest kernel panic --
"corrupt list around element ... at _pmap_enter_options", in
UserNotificationCenter under vm_fault_enter, a memory-corruption signature.
Preserved in journal/panic-2026-08-30-h1/. HEAD was 27a0dc1d with a clean
tree and every commit at that point was observation-only, so no
guest-visible behavior change was active; the device log shows duty=0.001
with no submissions and no typed failure near it. Causality is unknown and
is not claimed either way. It has not been reproduced and no baseline was
run against it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 14:00:00 +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 IqbalandClaude Opus 5 27a0dc1daa observe: 288 partial draws a boot destroy texels, priced by the area they lost
Component: crates/reims-vgpu, runtime/draw/vulkan.rs.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.
Observation only: no guest-visible behavior changes, so no conformance
battery applies.

What the prior commit's census read, on boot s3 (HEAD e273bd4f, tree clean,
rail macos-15, zero-input host capture WHITE, dock-sweep repair PAINTED):

  draw_partial_preserving_from_target   14 882
  draw_partial_preserving_seeded            78
  draw_partial_preserving_unseeded         288
  draw_partial_dontcare                    288

Two readings. First, 288 partial draws a boot destroy texels that
MTLLoadActionDontCare promised to keep -- a population the ordinal census
reported as draw_partial_load_unseeded = 0 under the sentence "no partial
draw on this pathway destroys what it did not cover", which was true of one
ordinal and false of the contract term.

Second, and stronger: draw_partial_preserving_unseeded equals
draw_partial_dontcare exactly, in every sampling window. Not one DontCare
partial draw in the boot found its prior contents through any door, while
the LOAD population preserved 14 882 times. The two seed doors that were
widened to admit DontCare have never once answered for it.

The colour that lands. `target_clear` is initialised [0.0f64; 4] and is
assigned only in the LoadAction::Clear arm, so a preserving action with no
seed keys "no seed", caches.rs resolves that to vk::AttachmentLoadOp::CLEAR,
and the value cleared to is the untouched default: transparent black. The
texels outside the scissor do not become undefined -- they become (0,0,0,0),
a colour this device chose for an attachment whose clear colour the guest
never set, because the guest did not ask for a clear.

Behavior changed. None. The population is now priced in the only unit its
cost is proportional to: draw_partial_preserving_unseeded_lost_texels
accumulates the attachment area minus the rectangle the draw covered, for
the unseeded arm only. A record count cannot rank this -- a boot's small
scratch targets outnumber its full-screen compositor layers by orders of
magnitude -- and pricing the preserved arms would report the rail working as
if it were the loss, which is the mistake that once produced a 519 715-strong
"defect" out of the LOAD population.

Focused test. a_dontcare_partial_draw_is_priced_by_the_area_it_destroyed
asserts the loss of a 10x10 draw on a 100x100 DontCare target is 9 900, and
that the same draw prices nothing when its prior contents were on the
resident, when a seed resolved, and when the guest asked for a Clear. Delta
form, because the census map is process-global.

Verification run. cargo fmt --all and --check clean. All three clippy arms at
-D warnings, each invoked separately: aarch64-apple-darwin/backend-metal,
host backend-vulkan,host-window, and x86_64-unknown-linux-gnu
backend-vulkan,host-window. Serial suite 2390 passed, 0 failed.

Not verified. The lost-texel total has not itself been read on a boot; this
commit reports the record counts above, not an area. The link from this
population to the reported half-rendered-image and black-rectangle symptoms
remains a hypothesis: both witnesses failed on boot s3 for setup reasons --
menu-close-probe's dark= column used a non-existent magick fx operator and
its captures never changed across trials, and web-content-probe exited 2 on
its own "the page never declared a layout" gate. Neither result says
anything about the device. Symptom 1 is separately not explained by this:
the clear that lands is transparent black, the white field is uniform 0xff,
and the white passes declare MTLLoadActionLoad, whose seed is never lost.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 13:41:51 +03:00
Anees IqbalandClaude Opus 5 e273bd4fc0 observe: a draw the engine made and one it refused printed the same sentence
Component: crates/reims-vgpu, runtime/draw/vulkan.rs.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.
Observation only: no guest-visible behavior changes, so no conformance
battery applies.

The invariant. The skipped-draw tail -- `linux_clear_store draws_skipped` --
is the only record that says why a record with vertices ended up storing
nothing, and its `refused_by=` field is the whole of that answer. Histories
with different owners and different repairs must not share one name there.

What was wrong. `refused_by=` read one `Option<&'static str>` that was
assigned in the engine draw's `Err` arm and in no other arm, and the tail
spelled the `None` case `engine_draw_not_attempted`. Three histories
therefore printed that one sentence and two of them were false:

  - the engine drew, and the Store below dropped the result;
  - the engine answered with no colour-0 geometry;
  - the engine draw genuinely never ran -- no pipeline, or no vertices.

Only the third is "not attempted". The first is the costly one to
mislabel: `runtime::exec::finish_stream` then applies the pass's clear over
pixels that were successfully rendered, so the loss is in the Store rail,
while the line sends the reader into the translator looking for a refusal
that never happened. That misdirection cost a prior session an hour on the
multisample-readback thread, where the engine draw succeeds and
`resident_read_snapshot` refuses the readback.

Behavior changed. None. `EngineDrawOutcome` carries the four histories with
four distinct names, and `EngineDrawOutcome::of` reads it off the engine's
own `Result` rather than from an assignment inside a match arm -- so an arm
can no longer forget to record itself, because no arm records anything.
This is the first preference in the workflow: the invalid state is now
unrepresentable rather than guarded.

  NotAttempted     engine_draw_not_attempted    (unchanged, and now exact)
  Refused(slug)    the decline's own slug       (unchanged)
  Drew             engine_drew_store_lost_it    (new; was mislabelled)
  NoColorGeometry  engine_draw_no_color0_geom   (new; was mislabelled)

Focused test.
the_skipped_draw_tail_tells_a_refused_draw_from_one_the_store_lost asserts
over the engine's own `Result`, holds the four slugs pairwise distinct
rather than spot-checking them -- the defect was exactly two of them
collapsing onto a third's name -- and checks that a refusal still reports
the decline's slug rather than a generic one. It cannot compile against the
prior shape, which is the expected form for a type-level repair.

The pre-existing tail test,
a_draw_skipped_after_an_engine_refusal_is_counted_with_the_vertices_it_cost,
still passes unchanged and its expectation was not weakened: its request
carries `pipeline_ref` 0, so its draw genuinely was not attempted and
`engine_draw_not_attempted` was always the correct answer for it. It never
covered the mislabelled cases, which is why the defect survived it.

Verification run. cargo fmt --all and --check clean. All three clippy arms
at -D warnings, each invoked separately: aarch64-apple-darwin/backend-metal,
host backend-vulkan,host-window, and x86_64-unknown-linux-gnu
backend-vulkan,host-window. Serial suite 2389 passed, 0 failed.

Not verified. No boot has read the new slugs, so the size of the
`engine_drew_store_lost_it` population on this rail is unknown and this
commit claims nothing about it. Nothing here repairs the multisample
readback refusal itself; it only stops that refusal from being reported as
an engine refusal.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 13:24:08 +03:00
Anees IqbalandClaude Opus 5 081693e5b5 observe: the partial-draw census called half of one contract term benign
Component: crates/reims-vgpu, runtime/draw/vulkan.rs.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.
Observation only: no guest-visible behavior changes, so no conformance
battery applies.

API contract. MTLLoadActionDontCare declares the attachment's prior
contents undefined, and undefined permits the prior contents. The direct
Metal arm hands the same wire word to Metal, which preserves them, and the
guest relies on that: it declares DontCare and then redraws only its damage
rectangle. contract::pass_action::LoadAction::preserves_prior_contents is
where this device states that term, and it answers true for both Load and
DontCare.

The invariant. A partial draw is lawful exactly when the attachment already
holds the rest of the picture. So the population that matters is "the
declared action promised the prior contents, and this pass has none of
them" — and that population is defined by the contract term, not by an
ordinal.

What was wrong. note_draw_coverage split by ordinal. MTLLoadActionLoad with
no seed and no resident chain routed to draw_partial_load_unseeded,
documented as "the one arm that is a defect". MTLLoadActionDontCare routed
to draw_partial_dontcare whatever its seed state, under the sentence
"undefined outside the scissor by declaration" — the reading this device
has rejected everywhere else, and the one its own seed block contradicts by
walking DontCare through the same doors as a Load. An ordinal outside the
declared set, which from_declared folds to DontCare and which must
therefore preserve, routed to draw_partial_load_unknown.

By the time caches::get_or_create_pass reads the pass key, all three are
one thing: no seed, resolved to vk::AttachmentLoadOp::CLEAR. A partial draw
on any of them destroys every texel outside its scissor. The census's
headline — draw_partial_load_unseeded = 0, "no partial draw on this pathway
destroys what it did not cover" — was therefore scoped to one ordinal and
did not speak for the term.

Behavior changed. None. preserving_partial_route derives the bucket from
preserves_prior_contents and note_draw_coverage emits it as a second route
beside the existing ordinal split; every prior counter keeps its name, its
meaning and its history, so no coverage is lost or moved:

  draw_partial_preserving_from_target   the engine resident carries them
  draw_partial_preserving_seeded        a CPU seed resolved
  draw_partial_preserving_unseeded      none; CLEAR; texels destroyed

draw_partial_preserving_unseeded is the number to read. It is the union of
the old draw_partial_load_unseeded, the unseeded and unchained part of
draw_partial_dontcare, and the preserving part of draw_partial_load_unknown.

Focused test.
every_preserving_load_action_with_no_prior_contents_shares_one_bucket
sweeps the ordinal space rather than listing the three names, so an ordinal
added to the declared set or arriving from the wire cannot leave the
population silently. It also holds the two preserved rails apart from the
defect bucket and from each other, so a rail going dark reads as its own
count falling rather than as the defect count staying flat.

Verification run. cargo fmt --all and --check clean. All three clippy arms
at -D warnings, each invoked separately: aarch64-apple-darwin/backend-metal,
host backend-vulkan,host-window, and x86_64-unknown-linux-gnu
backend-vulkan,host-window. Serial suite 2388 passed, 0 failed.

Not verified. No boot has yet read the new counter, so the size of
draw_partial_preserving_unseeded on this rail is unknown and this commit
claims nothing about it. The link to the reported half-rendered-image and
black-rectangle symptoms is a hypothesis this instrument exists to test, not
an established one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 13:17:51 +03:00
Anees Iqbal e57fb418c1 observe: count the wallpaper's draw, because the white field is the guest's own transient
Component: reims-vgpu runtime (Vulkan draw encode). Pathway: x86 macOS / Linux
Vulkan. Rail: macos-15.

Printing the plane ring on every field change caught the transition the
uniform-only rule was hiding, and it overturns this investigation's premise:

  seq=55 mid=5 [white x4]     passes=[p30/v6 x22, p117/v24, p30/v6]
  seq=56 mid=2 [white x4]     passes=[p30/v6 x24]
  seq=57 mid=5 [painted …]    passes=[p30/v84/s-none/l0x1/t11.27  p117/v42/t32]
  seq=58, 59  painted, and painted to the end of the boot

Pipeline 30 paints both states. Repeated six-vertex unscissored quads give the
uniform white field; one eighty-four-vertex draw -- fourteen quads -- gives the
wallpaper. So the white field is the login transition's own fill, and on a
healthy boot the multi-quad wallpaper draw replaces it a few presents later.

The defect is not that something writes white. There is no writer of white to
find, and the earlier readings in this investigation -- a lost LOAD seed, a
dropped draw leaving its clear behind, a device-side presentation defect -- were
all looking for one. The defect is that on about half of boots the wallpaper
draw never replaces the transient.

That also explains the two graded classes and the dock-hover repair without a
presentation bug: the guest recomposites the wallpaper when something damages
the screen, and `screencapture` re-composites from window backing stores, so it
reads painted whether or not the scanout plane ever received the wallpaper.

Contract: none changed. Observation only.

Behavior: draws into a full-screen plane are counted, always-on and summable,
split on vertex count -- `plane_draw_single_quad` against
`plane_draw_multi_quad`. The ring cannot answer the remaining question because
it prints only on a field change, and a plane that goes white and stays white
produces no later change to print at. A white boot with a non-zero multi-quad
count means the wallpaper draw arrived and this device lost it; a zero means it
never came. Those are opposite defects with opposite owners.

These are `store_routes` counters and therefore per-window: sum the samples, do
not take a maximum.

Verified: cargo fmt --all and --check; clippy clean on all three main arms, each
-D warnings and each invoked separately; the serial Rust suite, 2387 passed, 0
failed; live macos-15 boots on the x86/PCI rail producing the transition
sequence quoted above.

Not verified: the counters have not yet been compared between a white boot and a
painted one -- that batch is running -- so which of the two owners holds is
still open. No arm64 pathway, no Metal backend tests (Linux host), no
conformance battery; no guest-visible behavior changed.
2026-08-30 13:03:49 +03:00
Anees Iqbal 0fbc2f3f56 observe: the plane ring skipped the one transition that identifies the wallpaper's pass
Component: reims-vgpu runtime (scanout present boundary). Pathway: x86 macOS /
Linux Vulkan. Rail: macos-15.

The ring was printed only when a plane's field newly read uniform on every
patch, to keep the ordinary black-to-wallpaper transition from draining it. That
protection discarded half the measurement. The question the ring exists to
answer is whether the pass that paints the wallpaper and the pass that paints
the flat field are the same pass, and the wallpaper transition is the only place
the first one can be observed.

It matters because of what the ring has already established: pipeline 30, the
full-screen unscissored quad that fills the plane with one flat colour, binds
fragment textures (`t11.27`, `t35.27`). It is a textured pass, not a
solid-colour one -- so the flat field is this device resolving a textured
full-screen composite to a single value, not the guest asking for a fill. And
`shader_resource_declared_unbound` does not fire for that pipeline, so its
textures are bound; the neutral-substitute rung is not involved.

Contract: none changed. Observation only.

Behavior: the ring is printed on every change of a plane's field pattern.
Draining is not a loss -- it refills from the next frame's draws.

Verified: cargo fmt --all and --check; clippy clean on all three main arms, each
-D warnings and each invoked separately; the serial Rust suite, 2387 passed, 0
failed; live macos-15 boots on the x86/PCI rail showing the ring carrying
pipeline, vertex count, scissor, load action, clear colour and texture refs.

Not verified: the wallpaper transition's ring has not been captured yet -- that
batch is running -- so whether pipeline 30 is also the wallpaper's pass is still
open. No arm64 pathway, no Metal backend tests (Linux host), no conformance
battery; no guest-visible behavior changed.
2026-08-30 13:00:23 +03:00
Anees Iqbal bf8fb29329 observe: the plane's flat-fill writer has a name, and the ring now says what it samples
Component: reims-vgpu runtime (Vulkan draw encode). Pathway: x86 macOS / Linux
Vulkan. Rail: macos-15.

With the ring recording every draw into a full-screen plane, the macos-15 white
field names its writer. Two presents before the field turns white it reads a
uniform grey 41 -- the macOS desktop grey -- and both states are produced by the
same pass:

  seq=51  [flat:41/0  x4]  passes=[p30/v6/s-none/l0x1 x24]
  seq=53  [white:255/0 x4] passes=[p30/v6/s-none/l0x1]
  seq=54  [white:255/0 x4] passes=[p30 x22, p66/v24/l0x1, p30]

Pipeline 30 is a six-vertex quad with no scissor and a LOAD load action, run
many times a frame, and it fills the whole plane with one flat colour. Every
plane in the swap chain takes it in turn, which is why the symptom propagates
across planes and never recovers. Its CLEAR colour on a fresh plane is
[0,0,0,1], so the flat white is written by the draw and is not a clear.

`compositor_plane_pass` never reports pipeline 30 at all: that census sits at
the colour-seed site and this pipeline's seed is elided every time. The ring is
the only record of it.

Contract: none changed. Observation only.

Behavior: the ring entry now carries the pass's CLEAR colour when it declares
CLEAR, and the fragment stage's bound texture refs. That is the measurement that
splits the two remaining accounts of a flat full-screen fill, which want
opposite repairs: a solid-colour pass means the guest intends the fill and this
device is losing a later pass that should draw over it, while a textured pass
whose texture resolved to one value means this device is turning the guest's
wallpaper into a flat fill. Refs only -- the ring is a breadcrumb, and a ref's
identity is recoverable from the records that already name it.

The clear colour is recorded only for a CLEAR pass, because that is the one case
where it is what the attachment holds wherever the draw does not reach, and the
full-screen CLEAR passes are exactly the ones the latched census cannot see.

Verified: cargo fmt --all and --check; clippy clean on all three main arms, each
-D warnings and each invoked separately; the serial Rust suite, 2387 passed, 0
failed; live macos-15 boots on the x86/PCI rail showing the ring dump at a white
transition and the recorded CLEAR colour.

Not verified: no dump with the texture refs has been captured at a white
transition yet -- that batch is running. No arm64 pathway, no Metal backend
tests (Linux host), no conformance battery; no guest-visible behavior changed.
2026-08-30 12:55:47 +03:00
Anees Iqbal 109537f09c observe: the plane ring sat where 95% of passes never go
Component: reims-vgpu runtime (Vulkan draw encode). Pathway: x86 macOS / Linux
Vulkan. Rail: macos-15.

The per-plane draw ring added in the previous commit was filled from the
colour-seed site in `encode_draw`. That site is skipped whenever the type-11
LOAD seed is elided, and elision is the overwhelming majority: a boot reads
about 1 000 `type11_seed_elided` against 50 `type11_seed_provided`. So the ring
recorded roughly one pass in twenty, and its first live dump at a white
transition carried a single entry -- `passes=[p13/v6/s-none/l0x0/seed]` -- where
it was meant to carry the frame's worth of passes that bracket the moment.

Contract: none changed. Observation only.

Behavior: recording moves to `record_plane_draw`, called from the draw encode's
own entry, which every draw with a pipeline and geometry reaches. The latched
`compositor_plane_pass` census stays where it is, because what it reports is the
seed outcome, which only exists at that site. The ring entry drops the seed
field for the same reason and keeps pipeline, vertex count, first scissor and
load action.

Live on this rail the ring now carries the passes it should: the first dump of a
boot reads `passes=[p13/v6/s-none/l0x0 p30/v6/s-none/l0x2]` -- two full-screen
six-vertex quads, one DontCare and one Clear -- against the single entry the old
site produced.

Verified: cargo fmt --all and --check; clippy clean on all three main arms, each
-D warnings and each invoked separately; the serial Rust suite, 2387 passed, 0
failed; and a live macos-15 boot on the x86/PCI rail showing the ring dump
carrying multiple passes.

Not verified: no dump has yet been captured at a *white* transition with this
site -- the batch that would show it is still running, and the single-entry dump
quoted above came from the previous, undersampled site. No arm64 pathway, no
Metal backend tests (Linux host), no conformance battery; no guest-visible
behavior changed.
2026-08-30 12:50:07 +03:00
Anees Iqbal 3d28b44d6b observe: name the passes that rendered into a plane whose field just went uniform
Component: reims-vgpu runtime (Vulkan draw encode, scanout present boundary).
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.

With the witness reporting on change, the macos-15 blank desktop turns out not
to be a field the guest never painted. On boot `y-1` the plane's four background
patches read [painted 176/27, painted 36/12, black 26/9, black 24/5] at t=38171
-- the same four a fully painted boot ends on -- and at t=38914 all four read
[white 255/0] at once, then the same on the next plane at t=39013 and the next
at t=39146. The wallpaper composites correctly and is then overwritten.

Nothing could say by what. `pass_target` and `compositor_plane_pass` are both
latched, because a compositor re-runs the same pipelines every frame, so neither
can report which pass ran at a particular moment.

Contract: none changed. Observation only.

Behavior: passes that render into a full-screen plane are kept in a bounded
per-plane ring (24 deep: pipeline, vertex count, first scissor, load action,
seed outcome), and the witness prints and drains that ring exactly when a
plane's field newly reads uniform on every patch. Not on every change -- that
would drain it on the ordinary black-to-wallpaper transition and leave the one
that matters empty. Kept per mapping id for the same reason the field pattern
is: two planes of one swap chain hold different frames.

The census, its ring, and `PlaneDrawShape` are gated on `backend-vulkan`, which
is where the only caller lives.

Correction: the previous commit (b7326489) states clippy was clean on all three
main arms. That is wrong. `note_compositor_plane_pass` was reachable only from
the Vulkan draw encode and so was dead code under `backend-metal`, and the
aarch64-apple-darwin arm fails at that commit with `function
note_compositor_plane_pass is never used` -- verified just now by building it in
an isolated worktree rather than inferring it. The arm was not run for that
commit and the message should not have claimed it. The cfg gate in this commit
is the repair; both commits are clean on all three arms as of here.

Verified: cargo fmt --all and --check; clippy clean on all three main arms, each
-D warnings, each invoked separately (an earlier attempt passed the whole arm as
one shell word, which cargo rejects as an unknown argument and which greps as an
error line -- that was argument parsing, not clippy); the serial Rust suite,
2387 passed, 0 failed.

Not verified: the ring has not yet printed on a live white transition -- the
batch that would show it is still running. No arm64 pathway, no Metal backend
tests (Linux host), no conformance battery; no guest-visible behavior changed.
2026-08-30 12:46:22 +03:00
Anees Iqbal b7326489db observe: the field witness bracketed the defect by 7000 presents, and the pass state it needed was unrecorded
Component: reims-vgpu runtime (scanout present boundary, Vulkan draw encode).
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.

The blank desktop field is a transition, not a state: a plane's field reads
black for the whole early boot, then one composite makes it wallpaper or makes
it a uniform 0xff field, and it never moves again. The heartbeat witness could
only bracket that moment by its own spacing, and the spacing that keeps a
heartbeat cheap is what makes the bracket useless -- the first sighting of the
white field sat about 7 000 presents after the last sighting of the black one.

Contract: none changed. Both records are observations; neither alters a
guest-visible decision.

Behavior:

- `note_present_field_witness` now samples every present and reports when the
  answer changes, keeping the heartbeat beside it so a field that never changes
  still says so and a reader can tell "nothing changed" from "nothing looked".
  The four patch verdicts are folded into one word so the comparison is a
  compare and not a string diff, and the last pattern is kept per mapping id --
  two planes of one swap chain hold different frames, and a shared slot would
  report every alternation between them as a change. Cost is unchanged at 256
  texel reads a present; only the emission rule moved.

- `compositor_plane_pass` records what a pass declares for a full-screen plane:
  load action, clear colour, whether a seed was served and through which door.
  A flat field is what a CLEAR leaves behind and `exec::finish_stream` applies a
  pass's clear whenever the pass will not draw, but nothing said what colour any
  of these passes clears to, so "the field is this pass's clear" and "the field
  is something else" could not be told apart. Latched per (mapping, pipeline,
  load action, seed outcome); full-screen planes only, since a scratch offscreen
  answers a different question and there are thousands of them.

  It is placed where the load action is resolved rather than where it is
  decoded: this rail's requests do not pass through the MRT builder, and a first
  placement there produced no output on a live boot.

What it already establishes, and it rules a hypothesis out: every full-screen
compositor pass on this rail clears to [0,0,0,1] or [0,0,0,0] and reports
seed=served door=mapping. The uniform 0xff field is therefore not one of these
passes' clears, which is what the record was added to test.

Verified: cargo fmt --all and --check; clippy clean on all three main arms, each
-D warnings; the serial Rust suite, 2387 passed, 0 failed; and live macos-15
boots on the x86/PCI rail confirming both records emit, that the witness fires
on change, and that the plane-pass census reaches this rail's path.

Not verified: no arm64 pathway, no Metal backend tests (Linux host), no
conformance battery -- no guest-visible behavior changed, so there is no
candidate transition to score.
2026-08-30 12:38:25 +03:00
Anees Iqbal 6bab0bd6b6 observe: the white desktop had no witness that could say whose copy was white
Component: reims-vgpu runtime (scanout present boundary, Vulkan draw Store tail).
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.

On this rail a boot's desktop background is sometimes the union of the
compositor's damage rectangles over a uniform field nothing painted. Every
record this device kept described what the device did; none read the guest's own
copy of the plane being presented, which is the only reading that can assign the
field to one side or the other. The presented frame comes from the host surface
cache or the GPU resident and never from guest pages, so the guest's pages are
independent of it.

Contract: none changed. Nothing here alters a guest-visible decision.

Behavior:

- `scanout::note_present_field_witness`, called from `present_named_mapping`,
  samples four 8x8 texel patches of the presented plane's guest pages at fixed
  fractions of the frame and reports each as painted, white, black or flat. It
  reads the page list as it already stands and never revalidates: a revalidate
  can run a resolve, which would be a decision the witness caused rather than
  observed, so an unresolved mapping is left unsampled instead. It settles
  nothing, for the same reason -- landing deferred work into these pages is one
  of the repairs a blank field could need, so an instrument that settled would
  report the frame it had just fixed. Power-of-two spacing plus a fixed stride
  bounds it to roughly one line a second.

- `linux_clear_store draws_skipped` now names its colour target and clear colour.
  The cost of that refusal is not the draw count: `exec::finish_stream` still
  applies the pass's clear, so a record reaching that tail publishes a flat clear
  over whatever the skipped draws would have drawn, and a refusal on a scratch
  offscreen read identically to one on the compositor's own full-screen plane.

What it established, on two graded boots that reached a desktop: before the
first desktop composite both planes read black on every patch; at that composite
one boot's plane takes the wallpaper and the other's takes a uniform 0xff field,
and the second never recovers -- still uniform white 85 s later. So the white is
in the guest's own pages, written at one composite. That also explains why a
guest `screencapture` reads painted on those boots: it re-composites from window
backing stores and never reads the scanout plane.

Not established, and explicitly not claimed: which pass writes the field, or why.
The two `linux_clear_store draws_skipped` events in the white boot land after the
field is already present, and the painted boot has the same two events with the
same shape.

Verified: cargo fmt --all and --check; clippy clean on all three main arms
(aarch64-apple-darwin backend-metal, host backend-vulkan,host-window,
x86_64-unknown-linux-gnu backend-vulkan,host-window), each -D warnings; the
serial Rust suite, 9 suites, 0 failed; and six live macos-15 boots on the
x86/PCI rail confirming the witness emits and discriminates.

Not verified: no arm64 pathway, no Metal backend tests (Linux host), no
conformance battery -- no guest-visible behavior changed, so there is no
candidate transition to score.
2026-08-30 12:26:08 +03:00
Anees IqbalandClaude Opus 5 3238da2de5 conformance: the macos-15 debt ledger was carrying 53 repairs as debt
Component: conformance/expectations/macos-15. Pathway: x86 macOS / Linux Vulkan.
Rail: macos-15. No product behavior changes; this commit touches one text file.

A debt inventory is a ledger, and a ledger that names a case the device now
passes is not conservative — it is wrong in the direction that hides the next
regression. `verdict.py` says so per case (`FIXED-DRIVER`), and on this rail it
was saying it 53 times: the buffer-backed sampled rail, every mip level through
both fetch and blit, `offset_oracle`/`offset_alias`, the stencil clear, and the
A8 replacement had all been repaired by earlier commits and none of the entries
were pruned. The rail scored "unexplained 54-66" as a result, which is exactly
the reading that cannot tell a candidate that broke something from one that
broke nothing.

Every entry removed here is `PASS` in raw guest output in **five** complete
293-case batteries on this rail: two at the parent of the repair that preceded
this commit (`m15-ctl-1`, `m15-ctl-2`) and three after it (`m15-cand4-1/2/3`).
None was repaired by that commit — they pass in the controls too.

Two section headers lost every case they described and went with them, and the
buffer-backed header now names what actually remains: the *storage*-image arm
(`compute_buffer_texture_storage_unsupported`), since the sampled forms of the
same rail execute.

After: `active driver failures 19/19, unexplained 0` on all three candidate
runs, against the tracked native oracle baseline.

Not verified: no other rail's inventory was examined, and no VM boot was made
for this commit beyond the batteries already run for its parent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 10:42:14 +03:00
Anees IqbalandClaude Opus 5 ffcae31d1e vgpu: a guest CPU write into part of a layer took the whole frame the GPU drew
Component: crates/reims-vgpu (runtime writeback, GVA render targets, colour LOAD
seed). Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.

## The contract

A `.shared` MTLTexture's storage is guest RAM, and the guest CPU and the GPU are
both writers of it. Metal's guarantee is per region: `replace(region:)` changes
that region's bytes and nothing else, and a render pass's Store owns every texel
it wrote. A later read sees each writer where it wrote.

The guest's statement of a CPU write carries no region. It is one resource-wide
dirty bit, test-and-cleared once per submission, and this device records it whole
-object in `buffer_write_gen`. "The guest wrote this resource" is therefore not,
and cannot be, "the guest wrote every byte of it".

## What the device did

`pay_gva` had two answers to that statement and both destroy a writer: land the
whole frame and the guest's bytes are gone, or release the debt and everything
the GPU rendered is gone. It released. The third answer needs the hypervisor's
per-page report, which `HostOps::guest_written_pages` exists to give and which
the type-11 surface rail already uses (`merge_guest_writes_into_pages`).

Measured on the macos-15 battery: five cases green on the native oracle failed in
raw guest output with the CPU's half intact and **100 %** of the GPU's half gone,
against `gvadebt_abandoned_guest_wrote` = 7 in the same run.

## What changed, and why the merge is not the whole repair

The merge is implemented — `store_gva_frame` takes a skip list, threaded to a new
`write_gva_frame_within_skipping` that walks each row through the same range
subtraction `write_bgra8_skipping` uses, so the two rails cannot disagree about
which bytes are excluded — but on its own it fired zero times. Split counters
said why: the hypervisor's tracked set holds its generation at 0 until a harvest
has run over it, and every frame the ledger lost was a *first* Store into a fresh
plane, inside that window. So the merge had no extent to work from.

That establishes the writer's rule, which is stricter than the reader's:

  A Store into a guest-visible plane may be deferred only while this device can
  still name what the guest writes to that plane in the meantime.

A reader may give up and re-read; a writer that gives up has already lost the
frame. `arm_gva` now refuses to defer an unwitnessed Store and the caller takes
its existing eager rail. On the battery that is ~250 of ~1 100 Stores, one per
fresh plane.

Moving those Stores onto the eager rail exposed the same clause on the read side.
The eager rail publishes the frame into the GVA surface cache, nothing in that
cache witnesses a guest CPU write — `HostSurface`'s own comment records the gap —
and the next pass's `MTLLoadActionLoad` seed served that copy, losing what the
CPU had written and then Storing the result back over the guest's own pages. So:

  A host-side copy of guest pages is a seed source only while it can be newer
  than those pages. An entry the guest's pages also hold can only be older.

`GvaSeedVerdict::GuestHolds`, narrow on purpose — an entry the guest's pages do
*not* hold is the only copy of those pixels and keeps serving — and it blocks the
texture-ref fallback door for the same address, because both entries are stored
by one call over one frame and the fallback may not be the more permissive of the
two.

## Verification

Owner-level, new: a landed frame leaves the bytes the guest wrote alone; a
partial guest write names the pages it owns; an unwitnessed GVA Store is not
deferred (both unwitnessed shapes — no dirty bitmap, and the arming window); the
plane's own page order decides the offsets and the last page is clamped to the
span; the seed door refuses an entry the guest's own pages hold.

Full Rust suite serially, all arms green. `cargo fmt --all` run and `--check`
clean. All three clippy arms `-D warnings` clean.

Conformance, macos-15, complete battery: two identified controls at the parent
(`m15-ctl-1/2`) and three candidate runs. Against both controls, all three
candidates: **0 regressions**, 293/293 cases reported, and five improvements —
`cpu_write_after_render_64x32` / `_256x64` and `srt_cpu_write_then_sample_60x32`
/ `_256x64` / `_1000x40` — now pruned from the driver inventory.
`srt_blit_iosurface_source_1920x1080_x4` is control-unstable (FAIL in ctl-1, PASS
in ctl-2) and is not a candidate transition.

## Not verified

No live desktop interaction was run for this change; the reported white-desktop,
half-rendered-image and black-menu-rectangle symptoms are the same loss shape but
this commit proves only the conformance relation. arm64 Metal and MoltenVK
pathways are unaffected by measurement here — the GVA debt rail is Vulkan-only —
but were not booted. `REIMS_VGPU_GUEST_IMPORT=off` was not run. Performance of
the added eager Stores was not measured.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 10:40:05 +03:00
Anees IqbalandClaude Opus 5 929ba601f0 vgpu: a render pass owns its depth and stencil clear, and this device let a per-draw state decide it
Component: crates/reims-vgpu, runtime/draw/vulkan. Pathway: x86 macOS / Linux Vulkan.
Rail: macos-13.

API contract. `MTLRenderPassDepthAttachmentDescriptor` and its stencil sibling
are properties of the **render pass**: which texture, which load action, which
clear value, which store action. `MTLDepthStencilState` is **per-draw** state
carrying a compare function and a write enable. Neither implies the other, and
the default state Metal supplies when a draw binds none is a test that always
passes with writes off — a test that changes nothing, over an attachment that is
still cleared and still stored.

The owning invariant: the attachment is assembled from both states, once, and
neither term may be read off the other. That is `depth_state_for`, and the rule
for whether an attachment exists at all is `needs_depth_attachment`, which is a
predicate now because it was the thing that was wrong and there was nothing to
assert against.

Two defects, one shape, the second found because the first exposed it.

First, the attachment was built only inside `if req.depth_stencil_ref != 0 { if
!depth_stencil_descriptor_is_trivial(&ds) {`. A pass that declared a depth or
stencil attachment and bound no state produced no attachment, so its clear and
its store never happened and the next pass tested against values the guest never
wrote. `depth_stencil_descriptor_is_trivial`'s own doc reasons entirely about
occlusion, which is why the omission reads as correct at the call site: dropping
a test that always passes is sound, and dropping the pass's own clear alongside
it is not.

Second, and only visible once the first was repaired: `DepthState::stencil`
answers two questions — whether the image carries a STENCIL aspect, and what the
stencil test does — and it too was derived from the bound state alone. A pass
declaring a stencil attachment with no bound test got a depth-only image, so its
stencil clear had nowhere to land, and the pass that later bound a stencil test
asked for the combined image and found a different resident holding nothing. The
candidate boot for the first repair logged precisely that:
`depth_load reason=depth_load_without_content 8x8 stencil=1`. The aspect now
comes from the pass and the test from the state, with Metal's documented
no-op face (`STENCIL_PASS_THROUGH`) standing in when nothing binds one.

Focused test: five owner-level cases. The red witness is `needs_depth_attachment`
itself — with the control's rule spliced back in, the declared-clear test fails;
restored from a copy and verified byte-identical with `cmp`.

Focused conformance: `stencil_attachment_clear_without_test_state` PASSes on the
named native oracle, FAILs in all six identified control runs, and PASSes on the
candidate in both batteries that carry the complete change.

Broader verification actually run: suite 2381 pass 0 fail serially; clippy on all
three main arms with -D warnings; cargo fmt --all and --check.

Complete conformance battery, macos-13, import off, three candidate runs
(255/27/11 with only the first repair, then 257/25/11 and 254/28/11 with both)
against a six-run control envelope of 255/27/11. Scored per case: one improvement,
and the only other movement is `iosrt_cpu_write_then_sample_256x64`, a member of
the family that flips inside the control's own population across four control
runs. Nothing outside that unstable set moved. No CATASTROPHIC, no device_lost,
one vk_caps per boot.

Not repaired, and not hidden. `depth_attachment_clear_without_test_state` and
`stencil_only_attachment_clear_without_test_state` still fail; both reach this
code and neither is explained yet. `depth_attachment_isolated_across_tasks` is
the same family read the other way — it says a bound depth state must be disabled
when the pass declares no depth attachment, while this device attaches an
anonymous transient and tests against it. Taking that one means re-establishing
the contract behind the anonymous depth path, which exists because a per-record
transient lost inter-record occlusion on a live 3D scene; "may a pass with no
declared depth attachment test depth" and "must a serialized pass share one depth
buffer across its records" are different questions and that path answers the
second by assuming the first.

Also not verified: the import-on arm, arm64, and Metal.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 09:01:10 +03:00
Anees IqbalandClaude Opus 5 ded2082b1b vgpu: the fail log ends eight seconds before the panic, and could not say which of two things that means
Component: crates/reims-vgpu, observe/sink. Pathway: x86 macOS / Linux Vulkan.
Rail: macos-13.

Contract: none changed. The always-on sink decides no guest-visible behavior.

What this is about. Every line in the fail log is stamped at *enqueue*. On the
host-pointer-import rail the log ends at t=29 682 while the QEMU process lives to
38 s and the guest panics at 42 s, and that file has two readings it cannot tell
apart: the device stopped emitting, or the writer thread fell behind and its
backlog died with the process. Those eight seconds are the eight seconds before a
guest kernel panic, so which reading is right decides whether any instrument can
see that defect at all. Both emitter threads — drain and host window — produce
their last line within 50 ms of each other, which is consistent with either.

Behavior changed. The writer now reports on itself. Once per census interval it
writes a `log_writer` row carrying its own clock at write time, how many messages
it wrote in the interval, and the exact queue depth, which the two ends of the
channel now keep between them because mpsc has no depth of its own. The row is
written directly rather than enqueued: a heartbeat that queued behind the backlog
it is measuring would report the backlog's clock. The channel wait became a
timeout so an idle device still beats — a silent writer and a silent device must
not look alike, which is the whole point.

Read it as: beat present and `queued` small, then the file ends, means the device
stopped and the last producer line is where; `queued` climbing means the writer
is behind and everything after the last written line was lost.

Focused test: `writer_beat_due` as a pure function of (last, now) — a second's
worth of drain wake-ups yields one line, and a long silence is still due exactly
once per interval. The gate matters: this is called from a loop that wakes
hundreds of times a second, so without it the beat would flood the file it exists
to make readable.

Broader verification actually run: full vulkan suite serially, 2376 pass 0 fail;
clippy on all three main arms with -D warnings, clean; cargo fmt --all and
--check.

Live, macos-13, import on: 176 beats over a 180 s boot, `queued=0` at every one,
peak depth 320 during a 357 lines/s burst. That boot did not die — it ran the
whole cap with no panic where the recorded controls died at 42/42/47 s — so it is
one green boot on an intermittent defect and settles nothing about the rate. The
question this change exists to answer is therefore still open; what it has
established is that the writer is never more than 320 lines behind, which makes
the lost-tail reading the less likely of the two.

Live, macos-13, import off: complete conformance battery twice, 255 PASS /
27 FAIL / 11 SKIP both times, totals identical to the control envelope. One case
transitioned per run and a different one each time, both members of the
`iosrt_cpu_write_then_sample_*` family that flips inside the control's own
population across four control runs. Nothing outside that unstable set moved. No
device_lost, no stamp_wait_timeout, no CATASTROPHIC, no guest panic.

Not verified: the import-on arm's rate, which needs repeated boots; arm64 and
Metal, untouched and unmeasured here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 08:33:12 +03:00
Anees IqbalandClaude Opus 5 894951dc16 vgpu: the guard on released guest pages could hold 6% of them, and never said what it missed
Component: crates/reims-vgpu, runtime/{host_writes,released_pages}.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-13.

Contract: none changed. REIMS_VGPU_PAGE_GUARDS is observation only, this guard
decides no guest-visible behavior, and no branch a guest can see moves here.

The invariant the guard watches: a page the guest has taken back is a page this
device has been told to stop writing, and it stays that way until some task maps
it again. Its owner is now the per-page cell in HostWrites, which is where every
writer that names its pages already goes.

What changed and why. The guard was a BTreeMap of released pages judged against
the write census once per drain tranche. A sweep costs the watched population
per tranche, so it carried a capacity of 4096 — and the capacity is what decided
what it could see. Every macos-13 boot read `watching=4096 refused=32138`: the
instrument held 6% of its own subject, quietly, while its levels line kept the
shape of a healthy reading. It has never once reported.

Inverted, the release marker lives in the write census's own cell for that page.
Arming, disarming and detection are each one cell access; there is no sweep, so
there is nothing for a cap to pay for and the cap is gone. The armed population
is the guest's own — bounded by its releases, not by a constant, which is what
AGENTS.md requires of state keyed to a guest lifetime. Two readings the old shape
could not give at all are now kept: `dropped`, when findings outrun the drain,
and `unnamed`, for a write that named no pages while something was armed and so
could neither implicate it nor clear it. The levels line reports all three.

Focused test: runtime::released_pages + runtime::host_writes, 26 cases. The red
witness for the cap is the test the old code carried,
`a_full_watch_refuses_and_says_how_often`, which asserted the refusal this
removes; `sixty_thousand_released_pages_are_all_armed_and_all_answer` asserts the
opposite and cannot pass on the control. Both terminals, both page geometries,
the whole-chunk write path, the epoch-0 arm, and the report-queue overflow are
each pinned.

Broader verification actually run: full vulkan suite serially (2278 lib + all
integration, 0 failures); clippy on all three main arms with -D warnings, clean;
cargo fmt --all and --check.

Live, macos-13, REIMS_VGPU_GUEST_IMPORT=off:
  - full 418 s idle boot, no panic, zero findings, zero drops, zero unnamed.
    `armed` high-water 13358 — 3.3x the whole old capacity — and it falls again
    as pages are remapped, so both terminals work on the rail and not only in a
    test.
  - complete conformance battery, boot identity proven through /proc by the
    runner (one vk_caps record): 293 cases, 255 PASS / 27 FAIL / 11 SKIP. Scored
    per case against the control envelope of two runs at the parent commit
    (255 PASS / 26-27 FAIL / 11 SKIP): zero regressions, zero improvements, zero
    missing, zero new. No device_lost, no stamp_wait_timeout, no CATASTROPHIC, no
    guest panic, and no false finding across the whole battery.

Not verified. The REIMS_VGPU_GUEST_IMPORT=on arm is standing debt on this host
and cannot complete a battery: the candidate boot ends at 38 s with the device
log stopping at t=29.7 s, and the recorded control does the same thing at the
same place (log stops t=30.6 s, boot ends 42 s). Same signature, so this is not a
candidate transition — but it also means the guard has not yet been given the
boot it was built for, because that boot dies before the guest starts releasing
pages at all. arm64/Metal and every other rail are untouched and unmeasured here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 08:20:36 +03:00
Anees Iqbal 19a48c084e vgpu: A8Unorm is alpha, and the dispatch rail could not say so
Component: crates/reims-vgpu — the Vulkan format translation and the compute
sampled-image view. Pathway: x86 macOS / Linux Vulkan. Rail: macos-13.

Metal `A8Unorm` presents `(0, 0, 0, a)`. The Vulkan 1.2 baseline has no
single-channel alpha format — `VK_FORMAT_A8_UNORM_KHR` arrives with
`VK_KHR_maintenance5`, above the floor every memory cell must meet — so the byte
rides in `R8_UNORM` and a view component mapping puts it back. That contract was
already recovered in this tree: `translate::pixel::translate` gives the format
the `ALPHA_IN_RED` plan, `sampled_pixels` returns it, `vk_component_mapping`
performs it, and the draw rail has been binding it all along.

The dispatch rail refused the format outright — `sampled_format fail
reason=mtl_format_unsupported fmt=0x1` — and took ten conformance cases with it.
The reason is the one `vk_component_mapping`'s own doc states: the plan is a
property of the *Metal* format, not of the Vulkan one it resolves to, and
`A8Unorm` and `R8Unorm` are the same `VkFormat`. `StorageImageFormat` is the
reduction that loses that distinction, so `sampled_image` had nothing to answer
with and declined rather than sample the byte as red.

The distinction now survives the reduction. `StorageImageFormat::A8Unorm` is its
own member over `R8_UNORM`; `storage_image_components` is the plan its sampled
view binds; `acquire_storage_image` binds it. A storage-image view must carry the
identity mapping, and no format the contract admits to that role has a
non-identity plan — `storage_selector` has no entry for `A8Unorm` — so a storage
key naming one is a contradiction and is refused as
`storage_image_needs_component_mapping` rather than built with the guest's
channels in the wrong places.

Tests. `every_sampled_dispatch_format_binds_the_plan_its_metal_format_states`
sweeps all 65 536 format codes and holds the reduced mapping equal to the one
`translate` states, so the next non-identity format cannot slip through the same
hole. `a8unorm_samples_in_a_dispatch_with_its_byte_in_alpha` pins the named case.
`compute_sampled_a8unorm_arrives_in_alpha` runs it on the real device with `0x80`
— neither `0x00` nor `0xff`, so a dropped channel and a `ONE` fill both fail —
and asserts `rgb == 0`. Red witnesses, probed by hand and restored: dropping
`.components(...)` gives `rgb [0.5019608, 0.0, 0.0]`, the byte sampled as red;
collapsing `A8Unorm` onto `R8Unorm` fails both owner-level tests. The pre-existing
ratchet `a_texture_the_graphics_rail_samples_is_not_refused_by_the_compute_one`
listed `A8Unorm` as a named exception; the entry is removed, which is that test
working as designed.

Verification. 2276 lib tests plus every integration binary, serially, exit 0.
`cargo fmt --all` then `--check` clean. All three clippy arms clean at
`-D warnings`.

Conformance ran in the `REIMS_VGPU_GUEST_IMPORT=off` arm on both sides, because
the import-on arm cannot complete a battery on this host — see below. Control is
`c86adb77` in an isolated worktree with its own QEMU (`e36a8029…`), sharing the
rail disks and the conformance binary by symlink. Four control runs
(237/39/17, 237/39/17, 235/41/17, 237/39/17) and two candidate runs (256/26/11,
255/27/11). Scored per case across all six: **18 improvements, 0 regressions**,
293 names present exactly once. Twelve `FAIL -> PASS` are the `linear_a8Unorm_*`,
`offset_alias_a8Unorm_54x16_x4`, `offset_oracle_*_compute`,
`replace_a8Unorm_compute_first_read` and `incremental_a8Unorm_compute_first_read`
cases; six `SKIP -> PASS` are the lifecycle cases that skip themselves when the
first read refuses. Four cases are unstable in the control itself
(`iosrt_cpu_write_then_sample_{60x32,256x64,1000x40}`,
`srt_blit_after_render_1024x768`); the candidate stays inside their observed sets
and none of them is claimed. A 60 s host-driven Maps pan-and-zoom over 114 phases
rendered correctly with frames inspected as images; all eight silent-loss counter
classes zero; no panic in any of the eight boots in this arm.

Why the arm. On this host the guest-RAM host-pointer import rail corrupts guest
memory. Measured on the identified control `6026f037`, six interleaved idle boots
of the same rail and snapshot: `REIMS_VGPU_GUEST_IMPORT=on` panicked the guest
3/3 times in 42-47 s with three unrelated signatures, `=off` survived the full
six-minute idle 3/3. That is committed code with none of this change present, and
it is recorded as its own finding rather than worked around here.

Not verified. The import-on arm, which cannot boot long enough to be measured on
this host. arm64 Metal-direct and MoltenVK; every rail but macos-13. The Metal
compute rail still refuses `A8Unorm`: `split_staged_textures` asks every staged
texture for a storage selector and this format has none, which is pre-existing
and untouched here. The discrete-GPU memory cell — every boot in this session ran
on the host's Intel integrated GPU under Mesa, because the NVIDIA driver is not
answering.
2026-08-30 08:00:24 +03:00
Anees Iqbal c86adb77ff vgpu: a mip chain the guest declares in full reaches the device as its base alone
Component: crates/reims-vgpu — compute staging and the Vulkan compute engine.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-13.

Metal's `read(coord, lod)` and `sample(_, _, level(lod))` both name a level of
the chain a texture declares. A type-2/3 texture descriptor declares that chain:
`mipmapLevelCount` plus one `TextureLevelLayout` per level, each with its own
offset, row stride and extent, all already decoded and already checked against
`contract::extent::mip_extent` by the mipmap resolver. Measured on this rail, a
seven-level 64x64 RGBA8 texture arrives with all seven records, extents matching
`mip_extent` exactly, tight strides, ascending offsets, and every level resolving
through `level_gva` down to the 1x1 tail.

The compute rail staged one of them. `stage_texture_raw` called
`level_gva(view_level)` once and returned a `StagedTexture` whose
`width`/`height`/`bytes` is a one-level shape; `ComputeSampledImageResource` and
`StorageImageKey` were one-level too, and `acquire_storage_image` hardcoded
`.mip_levels(1)`. So a fetch at any level above the base returned nothing and an
explicit-LOD sample clamped to level 0 — which is indistinguishable from a
texture whose upper levels were never written, and is why both upload routes
(`replace(region:mipmapLevel:)` and a blit from a buffer) failed identically.

The invariant now belongs to the staging owner: a sampled type-2/3 binding stages
the declared pyramid, level by level, each read at its own gva, stride and
extent, packed tightly base-first by `contract::extent::tight_pyramid_spans`.
Producer and consumer both call that one function, so no site computes a level
offset of its own. A storage binding and a level-naming view stay at the base —
a compute write names one level and a levelled view exposes one. A resident
source can only answer for one window at one level, so it is not paired with a
pyramid: the runtime declines the optimisation and the engine refuses the pair by
name. A level the descriptor will not place truncates the chain to the prefix
above it and says so on the fail channel, because that is dropped guest work. The
Metal rail refuses `mip_levels > 1` rather than binding a pyramid flattened to
its base; its ABI carries one level and this pathway is not validated here.

Tests. `a_declared_mip_chain_stages_every_level_and_not_only_its_base` builds a
four-level chain through a real descriptor with padded rows and per-level
markers; red witnesses probed by hand: staging only the base reads 1 level
against 4, and reading every level at the base's stride puts a neighbour's
marker in a level. `compute_sampled_image_serves_every_declared_mip_level` runs
`OpImageFetch ... Lod n` per level on the real device against a pyramid the test
lays out by hand rather than through the shared helper; putting `.mip_levels(1)`
back reproduces the guest's `got=0x00000000` at level 1 exactly.
`compute_sampled_resident_bind_refuses_a_pyramid` pins the refusal.

Verification. 2274 lib tests plus every integration binary, serially, exit 0.
`cargo fmt --all` then `--check` clean. All three clippy arms clean at
`-D warnings`. Conformance on macos-13: three control boots at 6026f037, all
byte-identical at 221 PASS / 55 FAIL / 17 SKIP, against two candidate boots,
byte-identical to each other at 239 / 37 / 17 — 18 FAIL to PASS, zero
regressions, 293 names present exactly once, and every surviving failure keeping
its exact detail string. The 18 are `mip_fetch_level_{1..6}`,
`mip_sample_level_{1..6}` and `mip_blit_level_{1..6}`. No new refusal channel
fired. A 60 s host-driven Maps pan-and-zoom over 116 phases rendered correctly,
frames inspected as images: correct tiles, labels at many sizes, full Dock and
menu bar, no corruption. Silent-loss counters all zero; `web-content` 20/20 and
`wallpaper` 10/10 clean.

Catastrophic result, and why it does not implicate this change. One candidate
visual-gate boot took a guest kernel panic (`tro ... @bsd_kern.c:139`) during
session log-out. The identified control at 6026f037, built in an isolated
worktree with its own QEMU and run through the identical gate, panicked on two
of three boots — and one of its signatures, `Taking non-sleepable RW lock with
preemption enabled @lock_rw.c:1377`, is the same string a candidate boot
produced. Five distinct signatures across seven gate boots, in five guest
processes, four with no GPU frame in the backtrace, one reached while the guest
sat idle before any probe ran. The class is the rail's, demonstrated by the
control. All five conformance boots, which drive far more GPU work, were clean.

Not verified. arm64 Metal-direct and MoltenVK pathways, and every rail but
macos-13. The storage half of a buffer-backed texture, still refused. The
truncation path, which no case reaches. `REIMS_VGPU_GUEST_IMPORT=off`. Every
boot in this session ran on the host's Intel integrated GPU under Mesa — the
unified, host-pointer-import memory cell — because the host's NVIDIA driver is
not answering; the discrete cell is unverified for this change. The visual gate
cannot reach a verdict on this rail on either arm: its modal-button probe logs
the session out for real when its cancelling keystroke loses the race, so every
gate boot ended without a verdict.
2026-08-30 06:31:32 +03:00
Anees Iqbal 6026f037d0 vgpu: the compute rail refused a buffer-backed texture the draw rail executes
Component: crates/reims-vgpu, runtime/compute_exec. Pathway x86 macOS / Linux
Vulkan, rail macos-13.

API contract. `newTextureWithBuffer:descriptor:offset:bytesPerRow:` is a
persistent texture view over a type-1 buffer at an explicit byte offset and row
pitch; the texels *are* the buffer's bytes read through the embedded texture
descriptor. This tree already recovered that contract:
`decode/resource::decode_buffer_texture_descriptor` parses the opcode-9 and
opcode-9-wide records, and `runtime::draw::load_buffer_texture_rgba` executes
them for the draw rail.

`compute_exec::stage_texture_raw` refused the identical record outright with
`compute_buffer_texture_unsupported`. Two execution arms consuming one wire
form and disagreeing about it -- the shape AGENTS.md names directly ("Compare
every execution arm consuming the same wire form; do not read one in
isolation").

Behavior changed. A new `stage_buffer_texture` decodes the record through the
same decoder and stages tight raw texels: `bytes_per_row == 0` means tight rows
(the draw twin's reading of the same field), a pitch shorter than tight is
refused, the writeback debt is paid under the texture ref as the draw twin does
because a debt may be armed under either of the two references over the one
allocation, and rows are de-pitched so row padding never reaches the image.

Two deliberate differences from the draw twin, both stated at the site:
`StagedTexture` carries `pixel_format` beside `bytes`, so the native format
survives rather than being narrowed to RGBA8; and the read span is
`bpr*(h-1) + tight` rather than `bpr*h`, so a texture whose last row ends the
allocation is not refused for want of a trailing pitch.

Scope held to the evidence. A *storage* binding of a buffer-backed texture
still refuses, under its own new name
`compute_buffer_texture_storage_unsupported`. Writing back through the buffer
is a separate destination contract, no case in the battery binds one writable,
and inventing a writeback would widen the repair past what it can show.

Owner-level test.
`a_buffer_backed_texture_stages_its_texels_without_the_row_padding` builds a
4x3 BGRA8 texture at pitch = tight+8 with padding 0xEE and asserts tight
output, no padding byte present, exact per-byte position, native format
preserved, and that a storage binding refuses by its own name.

Red witness probed twice by hand and restored by `cp` each time (no git
checkout/restore): reading rows one byte off fails the per-byte assertion;
striding the destination at `tight` instead of `bpr` fails on "row padding must
not reach the image".

Three `BUF_TEX_DESC_*` offset constants and `BUF_TEX_WIDE_DESC_BODY` widened to
`pub(crate)` so a sibling module's test can construct the wire record. No
behavior attaches to that visibility.

Verification actually run. Full serial Vulkan/host-window suite: 2269 lib unit
tests plus every integration binary, exit 0. `cargo fmt --all` then `--check`
clean. All three clippy arms clean at `-D warnings`.

Complete macos-13 conformance battery, import-on, snapshot base, 293 cases
(journal/runs/buftex-cand-1). Scored against control journal/runs/07ec-control-2,
which is byte-identical to controls -3 and -4 at parent fa1f3214:

  control    187 PASS / 77 FAIL / 29 SKIP
  candidate  221 PASS / 55 FAIL / 17 SKIP

  22 FAIL -> PASS
  12 SKIP -> PASS
   0 regressions -- no case moved out of PASS, none missing or duplicated

The 22 repaired failures are the `linear_<fmt>_<w>x<h>_pitch_*` family across
r8/rg8/rgba8/bgra8, the `incremental_*_compute_first_read` family, and
`offset_alias_rgba8Unorm_32x32_x3`. The 12 SKIPs that now run and pass are the
rest of the `incremental_*` lifecycle (`append_visible`, `rewrite_visible`,
`untouched_stable`), which had been skipping because their first read refused.

`compute_buffer_texture_unsupported` appears 0 times in the candidate device
log, against 43 in the control. No `vk_engine_fence_wedged` and no
`vk_engine_fence_timeout`; `stamp_wait_timeout` at 6, inside the control range
of 6-10.

Not verified. One rail, one pathway, import-on only; the
REIMS_VGPU_GUEST_IMPORT=off cell was not run. One candidate boot, not three --
this is a deterministic decode-and-copy path with no timing component, but the
rate is unmeasured. No visual Maps gate was run on this candidate. Nothing here
is evidence about arm64 / Metal, which was cross-compiled and linted only. The
storage-destination half of the contract remains unimplemented and refuses.
2026-08-30 05:03:03 +03:00
Anees Iqbal 8fa11f267e vgpu: a dedicated-only import is not an alias, and both capability reports said it was
Component: crates/reims-vgpu, backend/vulkan/caps/linear_sampled.rs and
backend/vulkan/caps/linear_target.rs. Pathway x86 macOS / Linux Vulkan,
measured on rail macos-13.

API contract. `VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT` says the
implementation will import a handle of that type only into memory bound to a
dedicated image or buffer. Both of these rails exist to alias guest pages: the
imported host allocation is one the guest's own whole-span buffer already
covers. Memory that must be dedicated to the image cannot simultaneously be
that buffer, so a dedicated-only import refuses the aliasing shape outright.
This is not a narrowing of the design space that a later rail could work
around; it is a "no" for any aliasing design.

The bit is invisible in `IMPORTABLE`, which reads true on exactly such a
device. Both verdicts therefore counted a dedicated-only device in
`alias_possible` and printed the `alias_possible` slug for it.

Why this is a contradiction and not a preference. The execution path already
enforces the rule: `engine/linear_target_import.rs`'s
`external_import_is_shareable` is `IMPORTABLE && !DEDICATED_ONLY`, and it has a
test pinning that. So on a dedicated-only host the capability report would have
announced four aliasable formats while the engine refused every import of them.
Two consumers of one device answer, one contradicting a rule the other states.

Behavior changed. `dedicated_only` joins both verdicts, is read from the same
`vkGetPhysicalDeviceImageFormatProperties2` query that already yields
`IMPORTABLE`, is required to be false by `device_conditions_hold`, and gets its
own `dedicated_only` slug rather than being folded into `not_importable` --
the two decline for different reasons and a report that conflated them would
send the next reader to the wrong question. Owning invariant: the capability
report may not claim a shape the import path will refuse.

Scope. Both modules are reached only through `report()` from
`engine/context.rs`; `device_conditions_hold` has no caller outside its own
module. This changes two `OFF` census lines and no guest-visible behavior, so
no conformance battery is owed and none was run.

Owner-level tests. `a_dedicated_only_import_is_not_an_alias` in both modules:
with every other condition holding and `importable` true the verdict is
`alias_possible`, and setting `dedicated_only` must flip it to false with the
`dedicated_only` slug. `linear_sampled`'s existing
`every_device_condition_is_required` gained a fourth arm so the new condition
is covered by the test that claims to cover all of them, rather than merely
compiling beside it. Plus `tiling_alone_never_claims_dedicated_only`, matching
the existing rule that `from_tiling` invents no query answer.

Red witness probed by hand: deleting `&& !self.dedicated_only` from each
`device_conditions_hold` fails both new tests (linear_sampled.rs:265,
linear_target.rs:181). Restored by `cp` from copies; no git checkout/restore.

Verification actually run. Full serial Vulkan/host-window suite green: 2268 lib
unit tests (three new) plus every integration binary, exit 0. `cargo fmt --all`
then `--check` clean. All three clippy arms clean at `-D warnings`.

Measured on this host, one macos-13 boot, one clean fail log (grep -c vk_caps
= 1), no guest kernel panic: this discrete NVIDIA device does *not* report
DEDICATED_ONLY, and both census lines still read alias_possible=4/4 across
bgra8_unorm, bgra8_srgb, rgba8_unorm and rgba8_srgb. So the reading here is
unchanged and this commit is a no-op on this host's answer. It is a guard
against overstating on a host that does report the bit.

Not carried from the v6 original. That commit also added a `vk::ImageCreateFlags::ALIAS`
flag to the query, on the grounds that the query must describe the image the
rail creates. Neither module creates an image in this tree -- both are
report-only -- so adding ALIAS here would make the query describe a creation
shape nothing performs, which is a design decision this tree has not taken.
It belongs with the rail, not ahead of it.

Not verified. One host, one GPU vendor, one rail. No device that reports
DEDICATED_ONLY was available, so the new arm's effect on a real report line is
argued from the Vulkan contract and pinned by unit tests, not measured. Nothing
here is evidence about arm64 / Metal.
2026-08-30 04:52: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 Iqbal 67a052c102 vgpu: static descriptor use belongs to the shader variant, not to every draw
Component: crates/reims-vgpu, Vulkan engine draw path and the m2v shader
variant cache. Pathway x86 macOS / Linux Vulkan, rail macos-13.

API contract. The set of uniform-constant descriptor bindings a module
statically uses is a property of the immutable executable SPIR-V variant.
Vulkan requires each such binding to appear in the pipeline layout, and this
device enforces that relation before it lets the host compile a pipeline,
because a binding the layout omits can divide by zero inside the driver's
shared layout scoring. The left-hand side of that relation is fixed the moment
the variant exists; it does not depend on the draw that binds it.

Behavior changed. `ShaderVariant::new` derives the used-binding set once, from
the same words it already retains, and `DrawRequest` carries it. The engine's
`used_binding_absent_from_layout` now compares two retained sets instead of
walking both full modules per draw -- `declared_binding_numbers` plus a
`descriptor_static_use` scan per declared binding, twice, on every render draw.

The refusal is unchanged, and provably so. The old form is
`declared.find(|b| absent(b) && used(b))`; the new is
`declared.filter(used).find(absent)`. Same conjunction, and `filter` preserves
the order of `declared_binding_numbers`, so both yield the same first element.
`DrawReason::UsedBindingAbsentFromLayout` therefore fires on exactly the same
draws with the same `(binding, fragment)` payload. Owning invariant: the
variant, not the call site, decides what "statically used" means.

Owner-level test. `m2v_cache::tests::a_variant_retains_only_statically_used_
descriptor_bindings` -- a declared-but-unreferenced binding must stay out of
the retained set and a referenced one must enter it. SPIR-V 1.4 puts every
global in OpEntryPoint's interface list, so a declaration is not a use, and
admitting one would refuse draws the guest is entitled to. Red witness probed
by hand: removing the `descriptor_static_use` filter fails that test on the
`is_empty` assertion. The engine's two guard tests were rewritten to feed the
retained sets directly.

Verification actually run. Full serial Vulkan/host-window suite green (2265
lib unit tests plus integration binaries, exit 0). `cargo fmt --all` then
`--check` clean. All three clippy arms clean at `-D warnings`: native
backend-vulkan,host-window; x86_64-unknown-linux-gnu; aarch64-apple-darwin
backend-metal.

Live results, rail macos-13, import-on, snapshot base, complete battery.
Four control boots at parent fa1f3214 scored 186/78/29, 187/77/29, 187/77/29,
187/77/29 over 293 cases; controls 2-4 are byte-identical and the sole
difference anywhere in the set is srt_blit_iosurface_source_1920x1080_x4,
which flips roughly one boot in four and carries the fence-wedge signature.
Two candidate boots both scored 187/77/29 and are byte-identical to those
controls and to each other: zero new failures, zero fixed, no case missing,
duplicated or skipped differently. Neither candidate recorded
vk_engine_fence_wedged or vk_engine_fence_timeout.

Original interaction replayed on the candidate: 45 s sustained Maps pan and
zoom, 86 phases driven. The windowed capture shows the menu bar with its
status items, the Maps window with sidebar and correctly rendered tiles and
labels, and a full Dock; the settled capture shows a fully populated
full-screen map. All eight silent-loss classes read 0 against budget. No guest
kernel panic; `device_lost=0` throughout on the OFF census.

Not verified. One rail, one pathway, one host GPU, import-on only. Nothing here
is evidence about arm64 / Metal -- that arm was cross-compiled and linted, and
its tests cannot run on this Linux host. The REIMS_VGPU_GUEST_IMPORT=off cell
was not re-run. The pipeline-residue improvement this change is aimed at was
not measured here; only that it costs nothing.
2026-08-30 04:43:48 +03:00
Anees IqbalandClaude Opus 5 fa1f321493 vgpu: stage overlapping texture copies instead of refusing them
Component: crates/reims-vgpu, runtime/blit_exec. Both backends compile it;
measured on x86 macOS / Linux Vulkan, macos-13 rail, PCI attach, page shift 12.

`exec_copy_texture_to_texture` refused a same-allocation copy whose source and
destination texel rectangles intersect, returning `BlitStatus::Overlap` and the
`t2t_overlap` reason to a blit encoder that does not fail on real hardware. The
copy was dropped and the guest went on treating it as complete. It fires on live
traffic: a driven Maps interaction produced five distinct
`(task, src_ref, dst_ref)` across the three recorded boots at the parents of this
chain.

The refusal's own comment called the shape "undefined in Metal". The parent
commit measured that on the named oracle and it is not undefined: an overlapping
`copyFromTexture:toTexture:` produces source-snapshot semantics, the whole source
region read before any destination byte is written. `self_copy_overlap_row_shift_14`
and `self_copy_overlap_column_shift_12` record that, pass natively, and failed on
the identified guest control with the destination still holding its full pre-copy
contents.

The change: where the rectangles intersect, snapshot every source plane into a
host staging buffer before writing any destination plane, then write the
destination from the snapshot. A row-at-a-time loop can otherwise overwrite bytes
a later row or depth plane still has to read, which is exactly what both live
shapes do. The prior refusal and its `T2T_OVERLAP_SEEN` diagnostic side state are
removed; the staging path carries its own typed capacity refusals
(`t2t_overlap_plane_overflow`, `t2t_overlap_total_overflow`, `t2t_overlap_alloc`)
where an extent or a host allocation cannot be served.

Non-overlapping copies are untouched: the intersection test that used to select
the refusal now selects the staging, and everything that did not reach it still
takes the direct row path.

Tests. `t2t_overlapping_self_copy_stages_the_source_region` and
`t2t_vertical_overlap_reads_every_source_row_before_writing` drive the two live
shapes through `execute_blit` and assert every destination row came from the
pre-copy source row. Probe-verified red: restoring the refusal makes both fail
`Overlap` against an expected `Ok`; restored by copying the file back, never via
git. 2356 lib tests pass serially on backend-vulkan,host-window, 0 failed.
Clippy `-D warnings --all-targets` clean on all three arms. cargo fmt --all
applied, --check clean.

Conformance, macos-13, complete battery: three candidates against the parent's
two-run control. Every candidate is identical per case to the control on all 288
other cases, and the two repaired cases move `FAIL` to `PASS` in all three runs.
Counts 187 PASS / 77 FAIL / 29 SKIP against the control's 185/79/29 -- the two
new passes are the whole difference, and 77 is the parent chain's own failure
count, so the control-unstable `srt_blit_iosurface_source_1920x1080_x4` did not
fire in any of the three. No catastrophic run.

Visual, macos-13. Driven Maps, fail log cleared (`grep -c vk_caps` = 1), 85
phases over 45 s of sustained pan and zoom. Windowed before and full-screen after
both render correctly with the type layer intact at two very different zoom
levels. All eight silent-loss classes zero, no device loss, no fence wedge, no
panic. `blit t2t_overlap` did not fire once on this boot, against the five
distinct firings recorded on the boots at this chain's earlier parents: those
copies now land instead of being dropped.

Not verified. The oracle measurement is Apple silicon only; no Intel Mac was
measured and nothing here claims the semantics are architecture independent. The
three capacity refusals are healthy zeros and have not fired. Bytes staged are
not measured. One visual interaction. Only the macos-13 rail and the x86 macOS /
Linux Vulkan pathway were booted; the Metal arm compiles and its tests do not run
on this host. No `REIMS_VGPU_GUEST_IMPORT=off` arm was run for this change: the
staging is a host-side buffer on a path that does not reach the guest-RAM import.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 04:20:28 +03:00
Anees IqbalandClaude Opus 5 596e37c7e3 conformance: an overlapping self-copy is not undefined, and this device drops it
Component: conformance/, test-only. Native oracle: Apple M4, macOS 15.6.1.
Guest: macos-13 rail, x86 macOS / Linux Vulkan pathway.

A driven Maps interaction on this rail issues `copyFromTexture:toTexture:`
naming one texture twice at different origins, several times a boot -- a
horizontal shift inside one row and a one-texel column shifted a dozen rows
down. This device refuses those as `t2t_overlap` and returns an error to a blit
encoder that, on real hardware, does not fail. The copy is dropped and the guest
treats it as complete.

The refusal's own comment called the shape "undefined in Metal", which is the
term this case exists to settle. It is not undefined on the oracle. Measured
there in three identical runs, over both live shapes and on both a buffer-backed
and an ordinary image, `copyFromTexture:toTexture:` with intersecting rectangles
produces source-snapshot semantics: the whole source region is read before any
destination byte is written. Row-at-a-time execution gives a different answer for
both shapes, and a disjoint copy -- where the two readings agree -- separates a
device that mishandles the overlap from one that refuses every self-copy.

Three cases, all `PASS` on the oracle and recorded in the tracked native
baseline:

- `self_copy_overlap_row_shift_14` -- 20 texels of one row copied 14 texels
  right, so the destination overwrites source texels the same row still reads.
- `self_copy_overlap_column_shift_12` -- a one-texel column, 17 rows tall,
  shifted 12 rows down, so a top-down loop overwrites rows 12 through 16 before
  reading them.
- `self_copy_disjoint_control` -- the same call shape, rectangles disjoint.

Raw guest result on the identified control (HEAD, no product change), reproduced
identically in two complete batteries: the control case **passes**, and both
overlap cases **fail** with `still_pre_copy` equal to the full copy extent --
20/20 texels and 17/17 texels still holding exactly what they held before the
copy. That is the signature of a dropped copy rather than a mis-ordered one, and
it is the refusal doing it.

Owner: `exec_copy_texture_to_texture` in `runtime/blit_exec`, which decides the
overlap. Not shader translation and not the guest driver, so neither rail
inventory takes these; they are this device's own defect and the next commit
repairs them.

Counts: 185 PASS / 79 FAIL / 29 SKIP on the guest, against the parent's
184/77/29 -- the disjoint control is a new pass and the two overlap cases are the
two new failures. Every other case is identical to the parent's envelope in both
runs. Native: 293 cases, 0 failures, 0 skipped.

An earlier draft of these cases declared the image over an `MTLBuffer`, and all
three failed on the guest with the readback dispatch refused
(`compute_buffer_texture_unsupported`) rather than on the copy. That would have
made the case a witness for a different gap, so the image is an ordinary one and
the control's pass is what proves the distinction holds. The buffer-backed
readback gap is real, unrelated, and not covered here.

Not verified: one rail and one pathway. The oracle result is Apple silicon only;
no Intel Mac was measured, and nothing here claims the semantics are architecture
independent. No product behavior changes in this commit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 04:08:13 +03:00
Anees IqbalandClaude Opus 5 fb69ad6888 vgpu: a byte copy asks whether the bytes are a host texel, not whether a render target could have declared them
Component: crates/reims-vgpu, guest-page writeback licences on both rails. Both
backends compile it; measured on x86 macOS / Linux Vulkan, macos-13 rail, PCI
attach, page shift 12, discrete host with host_pointer_import supported.

Both guest-page writeback licences -- the GVA plane licence in
`runtime/render_writeback.rs` and the type-11 surface licence in
`runtime/mapping_write/` -- decided whether an image->buffer copy could land the
guest's pages by asking `contract::pixel_format::store_texel_order`. That is the
render Store's table. Its own doc states the membership rule as "a guest render
target can declare it", and the test
`a_byte_copy_destination_is_the_texel_every_other_table_agrees_it_is` holds it to
that by requiring every admitted format to answer `render_target_bpp` and
`sampled_class`.

A compute storage output is neither rendered into nor sampled, so asking that
table was a render-target question about a destination that is not one -- an
abstraction from one rail leaking into a licence that serves two. The answer was
`FormatNeedsConversion`, which on the parent's driven boot was the entire
remaining compute readback traffic.

What changed: `backend::vulkan::translate::pixel::verbatim_texel` answers "the
host texel these bytes already are, and how wide", as the union of the two
tables that already exist -- `store_texel_order` composed with `vk_texel_layout`
for a render target, `storage_selector` composed with `storage_image_from_selector`
for a storage image. Both licences ask it instead. Nothing new is claimed about
any format and no third table is introduced: a format either half admits is a
format that rail creates images at, and a new arm in either reaches both licences
without being added twice.

Widening `store_texel_order` was the other route and was rejected: it would have
obliged this device to declare RGBA32Float and RGBA32Uint renderable and
samplable, which the guest never asked for and the contract does not say, and it
would have needed new `TexelLayout` variants that the CPU `texel_to_rgba8` loader
has no arm for.

Tests. `the_two_verbatim_texel_tables_never_disagree` sweeps the whole u16 space
and requires the two tables to name the same `vk::Format` and the same width
wherever both answer, which is what makes the union a union rather than a
precedence rule dressed as one; it also asserts the overlap is non-empty so it
cannot pass vacuously. `a_thirty_two_bit_per_channel_storage_plane_is_a_byte_copy_destination`
pins the two formats that were the remaining traffic and asserts the render
Store's table still refuses both. Probe-verified red: cutting the storage half
out of `verbatim_texel` makes it fail `None` against
`Some((R32G32B32A32_UINT, 16))`; restored by copying the file back, never via
git. 2356 lib tests pass serially on backend-vulkan,host-window, 0 failed (2354
before). Clippy `-D warnings --all-targets` clean on all three arms. cargo fmt
--all applied, --check clean.

Conformance, macos-13, complete battery: five candidates against the parent's
own five-run envelope. All five are identical per case to a clean control across
the 289 stable cases. The 290th,
`srt_blit_iosurface_source_1920x1080_x4`, is the control-unstable stale-frame
family already on record: it fires in 2 of 5 candidates here, against 2 of 5 and
1 of 5 on the two arms measured at the parent. Unchanged debt, not a transition.
Counts 184/77/29 clean, 183/78/29 when it fires.

Import-off. Two candidates against the parent's two import-off controls. One
candidate is identical per case to a control; the other passes
`srt_blit_after_render_1024x768`, which that control fails -- an improvement in
the other control-unstable family of that cell. Zero regressions.

Visual, macos-13. Driven Maps, fail log cleared (`grep -c vk_caps` = 1), 86
phases over 45 s of sustained pan and zoom, correct at both zoom levels with the
type layer intact. All eight silent-loss classes zero, no device loss, no fence
wedge, no panic.

Every compute destination on that boot landed in the guest's own pages and none
was read back:

  compute_wb_landed                        56
  compute_dst_guest_pages                  56
    linear resident / transient           8 / 13
    type-11 resident                          35
  compute_dst_host_unlicensed                0   (route absent)
  compute_dst_host_type11_unlicensed         0   (route absent)
  compute_dst_host_not_linear                0   (route absent)
  readback_compute_image                     0
  readback_compute_image_bytes               0

8 + 13 + 35 = 56 = `compute_wb_landed`, with no unlicensed route emitted at all.
The parent boot read 5.

Not verified. A single visual boot. Boots run different amounts of compute work,
so the comparable figure is the routing share -- 49/50 at the parent, 56/56 here
-- and not the byte totals; no byte total is measured. The Metal arm compiles
only and nothing on an Apple host has run these tests. No arm64 or MoltenVK
pathway was exercised.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 03:51:33 +03:00
Anees IqbalandClaude Opus 5 8e5739f286 vgpu: the type-11 licence resolved a window its caller already had, and refused every sub-rectangle
Component: crates/reims-vgpu, compute and render guest-surface writeback. Both
backends compile it; measured on x86 macOS / Linux Vulkan, macos-13 rail, PCI
attach, page shift 12.

`licence_type11_surface` resolved its own destination window -- mapping
geometry, then `type11_sample_window` over the mapping's full extent -- and
refused when the frame's extent was not the mapping's latched one. That is a
scanout Store's rule: a Store's destination is the surface, so a frame at
another extent is a frame for a mapping that moved underneath it. It is not a
property of a type-11 destination, and a compute dispatch writing a
sub-rectangle of a surface is ordinary.

On the driven macos-13 boot at the parent that rule was every remaining decline
this arm made: 15 of 15, all `GeometryMoved`, at extents like 44x26 of a 64x64
surface and 128x512 of a 512x512 one.

Behaviour change:

- `Type11SurfaceDestination` is added and the licence takes one, exactly as
  `licence_gva_plane` takes a `GvaPlaneDestination`. The licence keeps what is
  genuinely shared -- mapping liveness, the format rule, the page-list plan, the
  page walk, the guest-RAM references and both write witnesses -- and resolves
  no geometry at all.
- `write_bgra8_from_resident_gpu` keeps its own preamble: `scanout_extent_ok`,
  the geometry-moved check and `type11_sample_window`. Nothing about the render
  rail changes.
- `type11_destination` passes the window `compute_exec` already staged. That
  window is plane-correct where the bind is a type-5 view (it was resolved via
  `type5_sample_window` with the wire's plane index) and is already the
  sub-rectangle the dispatch writes.

Removing the geometry check without moving the window resolution would have
exposed a latent hazard rather than fixing one: `type11_sample_window` takes no
plane index and matches by geometry, so a type-5 bind's frame would have landed
in whichever plane shared its dimensions. `resident_gpu_plane`'s doc already
states that this fails silently -- right surface, wrong plane, symptom is the
next plane's pixels. No boot has shown it, because the geometry rule refused
first.

`TextureWriteback::Type11` now carries the format its window was staged against
instead of a bytes-per-texel it derived from that format. Every byte offset in
the record is arithmetic over that format, so judging the window under a
declaration that has since changed would judge a different window; and with one
answer carried, the two cannot disagree. Bytes per texel is derived at each
consumer, with a typed refusal (`compute_writeback_tex
reason=type11_format_unsized`) where it previously could not be asked. That
refusal is a healthy zero today: staging refuses a bind whose format has no byte
width.

Tests. 2354 lib tests pass serially on backend-vulkan,host-window, 0 failed
(2353 before; the new one is
`a_type11_licence_judges_the_callers_window_and_not_the_surfaces_extent`, which
drives the licence directly and asserts a 44x26 destination over a 64x64 surface
reaches the same decline as a 64x64 one -- the reference gate, downstream of
every rule the licence still owns). Probe-verified red: re-adding the geometry
check to the licence body makes it fail with the exact
`GeometryMoved { 64, 64, 44, 26 }` this change is about; restored by copying the
file back, never via git. `a_licence_and_not_the_destinations_shape_decides_the_direct_arm`
now varies the staged format per case rather than the mapping declaration,
because the staged format is what the licence judges. Clippy `-D warnings
--all-targets` clean on all three arms. cargo fmt --all applied, --check clean.

Conformance, macos-13, complete battery: five controls at 4eb3fcb9 and five
candidates, plus two import-off controls and two import-off candidates. Fourteen
batteries in total counting the parent's.

Every candidate is identical to a clean control across the 289 stable cases.
The 290th, `srt_blit_iosurface_source_1920x1080_x4`, is intermittent on both
arms with the same stale-frame signature -- `stale_frames=n/4` accompanied by
`vk_engine_fence_wedged` -- failing in 2 of 5 controls and 1 of 5 candidates.
That family is already on record as control-unstable rail debt and the candidate
did not worsen it; the scorer drops it rather than charging it here. Counts:
184 PASS / 77 FAIL / 29 SKIP on the clean runs, 183/78/29 when it fires.

Import-off. Two controls and two candidates, all 182 PASS / 79 FAIL / 29 SKIP.
Both candidates are identical per case to the second control. The two cases the
two controls disagree on -- `iosrt_cpu_write_then_sample_1000x40` and
`srt_blit_after_render_1024x768` -- are control-unstable in that cell, which is
the same family already recorded for it.

Visual, macos-13. Driven Maps, fail log cleared (`grep -c vk_caps` = 1), 86
phases over 45 s of sustained pan and zoom. Windowed before and full-screen
after both render correctly with the type layer intact at two very different
zoom levels. All eight silent-loss classes zero, no device loss, no fence wedge,
no panic. The arm took 49 landings, 34 of them type-11 residents against the
parent boot's 20, with exactly one decline left --
`FormatNeedsConversion`, a declaration no copy can express -- and
`readback_compute_image` down from 21 to 5. `GeometryMoved` is gone.

Not verified. The type-5 plane hazard described above is reasoned from
`resident_gpu_plane`'s own contract and the wire's plane index, not demonstrated
by a boot; no workload on this rail has produced a type-5 bind whose sibling
plane shares its dimensions. `type11_format_unsized` is a healthy zero and has
not fired. One visual interaction per arm. Only the macos-13 rail and the x86
macOS / Linux Vulkan pathway were booted; the Metal arm compiles and its tests do
not run on this host.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 03:24:10 +03:00
Anees IqbalandClaude Opus 5 4eb3fcb906 vgpu: a tiled surface mapping is not a linear plane, which never made it unreachable
Component: crates/reims-vgpu, runtime compute rail and mapping_write, x86 macOS
/ Linux Vulkan pathway, macos-13 rail, PCI attach, page shift 12.

`direct_destination` answered `Host` for a type-11 destination on the shape of
the writeback alone, with a `return` before it had looked at the surface. The
sentence justifying it was true -- a tiled surface mapping is not a guest-linear
plane, and `GvaPlaneDestination` cannot describe one -- and it was an argument
about the wrong thing: that the *GVA* licence could not serve these, not that
nothing could. The census landed in the parent priced the difference on this
rail at 32 of 35 windows, so most of the largest remaining readback class was
being read device->host because the code asked which licence it had rather than
which one it needed.

The destination that describes a type-11 surface already existed, inline in the
render rail's `write_bgra8_from_resident_gpu`: resolve the sample window, walk
the mapping's page entries, take the guest-write witnesses, build a
`GuestPageTarget`. That is split out as `licence_type11_surface`, the type-11
counterpart of `render_writeback::licence_gva_plane`, and the render caller is
now three lines over it. Both rails that write a guest surface from the GPU meet
the geometry rule, the format rule, the page walk and the guest-RAM references
in one place, and a third could not spell any of them differently.

Two things the split had to decide rather than move:

- The format check moves into the licence. The render caller left it to
  `copy_target_to_guest_pages`, which compares against the resident image's own
  format -- a real check, still there, and one the compute rail has no
  equivalent of, because its dispatch writes the guest's pages itself and there
  is no second pair downstream. The licence now takes `held` and refuses
  `ResidentFormatMismatch` by name. Whole formats, not channel orders:
  RGBA16_FLOAT and RGBA8_UNORM are both RGBA-ordered and four bytes per texel
  apart, so an order comparison would land a frame of the wrong size.
- The post-copy bookkeeping becomes `note_type11_landed` -- the residency
  window, the mapping's written mark, the surface cache forget. Called by the
  render Store after its copy and by the compute `Landed` arm. Both err early
  rather than late: a cache forgotten early costs a re-read, one forgotten late
  hands out a stale frame.

The engine pin needs no change. `record_guest_write_debt` keys off the
resource's residency and its destination being `GuestPages`, neither of which is
about the writeback's shape, so a type-11 resident takes the same
`ResidentStorage` pin against the same re-key window.

Tests. `a_licence_and_not_the_destinations_shape_decides_the_direct_arm`
(renamed from `only_a_licensed_transient_linear_window_can_take_the_direct_arm`,
which no longer described it) asserts `compute_dst_host_not_linear` does not
move for three type-11 mappings and that all three land on
`compute_dst_host_type11_unlicensed` instead. Confirmed red without the change
by stubbing the arm back to its early return: it fails 3 against an expected 0
on `compute_dst_host_not_linear`; restored by copying the file back, never via
git. 2354 lib tests pass serially with backend-vulkan,host-window, 0 failed.
Clippy `-D warnings --all-targets` clean on all three arms. cargo fmt --all
applied and --check clean.

Conformance, macos-13. Three controls at bc76f9c4 and two candidates, complete
battery each: 184 PASS / 77 FAIL / 29 SKIP in all five, and the per-case result
files are byte-identical across all five runs over 290 cases. Zero transitions,
no missing or duplicate case, no catastrophic run.

The routing moved as the census predicted. Against the control envelope
(`compute_dst_guest_pages` 7, `compute_dst_host_not_linear` 15-17 splitting into
14 agrees and 1-3 differs), the candidate reads `compute_dst_guest_pages` 21 --
the same 7 plus 14 type-11 residents, exactly the agreeing population -- with
`compute_dst_host_type11_unlicensed` 3 and `readback_compute_image` down from
17-19 to 5-7. `compute_wb_landed` 21 matches.

Visual, macos-13. A driven Maps interaction on a fresh boot with the fail log
cleared (`grep -c vk_caps` = 1), 86 phases over 45 s of sustained pan and zoom.
Maps windowed before the drive and full-screen after it both render correctly
with the type layer intact -- Tallinn/Tartu/Parnu/ESTONIA at one zoom, the
Indian Ocean rim with every city label at the other. Wallpaper, menu bar and
Dock correct. All eight silent-loss classes zero, no device loss, no fence
wedge, no panic. Under that workload the arm took 35 landings, 20 of them
type-11 residents, with `readback_compute_image` at 21 against the parent boot's
39. All 15 remaining type-11 declines are `GeometryMoved`.

Import-off. Two `REIMS_VGPU_GUEST_IMPORT=off` controls at bc76f9c4 and two
candidates. Both controls read 182 PASS / 79 FAIL / 29 SKIP and are identical
per case. One candidate is identical to them; the other reads 183 PASS, passing
`srt_blit_after_render_1024x768`, which both controls fail. Zero regressions in
that cell, and the `srt_blit_after_render_*` family remains the control-unstable
one already on record for it.

Not verified. `GeometryMoved` refusing 15 of the 19 remaining compute readbacks
is measured and not repaired here; it is a scanout Store's rule applied to a
destination that is not one, and it wants its own change. Bytes saved are
counted, not measured against a byte total. One visual interaction; two
candidate batteries per cell. Only the macos-13 rail and the x86 macOS / Linux
Vulkan pathway were booted -- the Metal arm compiles and its tests do not run on
this host, and no arm64 or MoltenVK pathway was exercised.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 02:46:58 +03:00