Files
reims-vgpu/crates
Anees Iqbal de37dc579b 🐛 The census line named its fields by hand and had fallen thirty-five counters behind the vocabulary
`crates/reims-vgpu`, Vulkan pathway, observability only — no product behaviour
changes and no guest-visible path is touched.

## What was wrong

`engine_counters!` generates the atomic struct, the snapshot, the reset and the
delta from one list of names, precisely so a counter cannot half-exist. The
line that *prints* them was not generated: `census::emit_engine_delta` carried a
hand-written format string naming 58 fields, against a vocabulary of 102.

So 44 counters were incremented correctly by product code and printed nowhere.
Nine of those are legitimately absent — they are absolute high-waters that
`registry_pressure` prints beside the prose explaining each — leaving **35 rate
counters that no boot could be asked for**. A counter in that state reads
exactly like a code path that never runs, which is this module's own documented
trap for a missing `delta_since` arm, one step further along.

That cost real work: a twelve-boot interleaved A/B was running to read the four
`dynstate_*_held` counters and could not have answered its own question, because
all four were among the 35. It was stopped rather than finished.

## What changed

- `engine_counters!` gains a fourth group, `pool_levels`, holding the nine
  high-waters and instantaneous levels. It is merged from `ResourcePools` like
  `pool_sourced`, but `delta_since` now **carries these through unchanged**
  rather than subtracting: a high-water minus an earlier high-water is not a
  high-water, and it reads as a plausible zero once the true maximum is behind
  the window.
- The macro generates `CounterSnapshot::delta_fields`, one `(name, value)` per
  rate counter in declaration order, `pool_levels` excluded.
- `emit_engine_delta` walks that instead of naming anything. The line now
  carries every rate counter, 94 fields, and cannot drift from the vocabulary
  again — this is "derive, don't duplicate and compare" from `AGENTS.md`, with
  the second spelling deleted rather than checked.

Putting a level in the wrong group is now the only way to get it onto the
per-interval line, and that is a visible edit rather than an omission. Field
names and `name=value` spelling are unchanged, so any parser keyed on those is
unaffected; the field *count* per line rises from 58 to 94.

## What this measured

One driven macos-13 boot (rail macos-13, sustained-animation probe, 35 s, host
quiesced, `rm`'d fail log, `vk_caps` confirms exactly one boot in the log, no
`guest kernel panic` in the boot's stdout). 88 census windows, 1 019 548 chains,
1 016 068 batched draws at 14.8 draws/CB.

The question the stopped run existed to answer, now answerable:

| counter | share of `chain_phase chains` |
|---|---|
| `dynstate_pipeline_held` | 75.9 % |
| `dynstate_viewport_held` | 75.9 % |
| `dynstate_scissor_held`  | 71.2 % |

So `pools::CbGraphicsState` (5fb5414f) is **not inert**: three draws in four
join a command buffer already carrying their pipeline and viewport, and skip
both. `viewport_held` equals `pipeline_held` exactly in every one of the 88
windows, which is the cache's own construction — a pipeline change clears the
viewport — rather than a coincidence.

Note this refines 5fb5414f's "nineteen draws in twenty": that figure was the
per-draw map, and 75.9 % is the share reused *across draws of one command
buffer*, which is the narrower and more honest denominator.

`dynstate_stencil_held` is 0 in all 88 windows. It is out of *stencil* draws,
and this workload issues none, so that is a null denominator and not a defect —
it is not evidence about the stencil arm either way.

## Population, and what was not verified

This was a **paced 60 Hz boot** (`present_hz` 60.0-60.3 tracking `offered_hz`
exactly, `busy_fence=0`), i.e. the slow population. The hold shares are ratios
of counts and counts survive that, but no per-draw timing is quoted from it and
none should be. No A/B was run: this commit changes what is printed, not what
is done, so there is nothing to score.

Not verified: the arm64/Metal pathway (no Apple host — the change is in
`backend-vulkan`-gated code and the Metal arm compiles), and the copying rails
under `REIMS_VGPU_GUEST_IMPORT=off` (untouched by this change).

## Checks

- `cargo test -p reims-vgpu --no-default-features --features
  backend-vulkan,host-window -- --test-threads=1`: 1989 passed, 0 failed. The
  2 ignored are the gitignored wire fixtures on a non-Apple checkout.
- clippy `-D warnings` clean on all three arms: `backend-metal` via
  `--target aarch64-apple-darwin`, and `backend-vulkan,host-window` both
  default-target and via `--target x86_64-unknown-linux-gnu`.
2026-08-12 03:28:34 +03:00
..