Component: crates/reims-vgpu, runtime writeback rails (mapper, mapping_write,
gva_view, metal_draw) and the drain census.
Deletes `runtime/land_redundancy.rs` (986 lines, 16 tests) and its five hooks.
What it did: on one landing in 64, before each writeback stored its bytes, it
read the destination back and compared it to the source at two granularities —
4 KiB guest pages and 256-byte tiles — then bucketed the whole walk by how
redundant it was and emitted a `land_redundancy leg=… same_pages=… same_fine=…`
line once a second.
Why it goes: it has its answer. The redundancy is 70-99% at tile granularity,
and that finding is banked in the code that acts on it — the GPU tile-difference
pass in `backend/vulkan/engine/diff_pass.rs`, whose module doc carries the
measured percentages. Applying the test `runtime/census/mod.rs` states for
exactly this case — "name the reading the next window could produce that the
last thousand did not" — there isn't one. It had also already refuted the
CPU-side compare it was built to justify (744 µs/landing without it against 802
with it), and that refutation is likewise recorded where the decision lives.
What the hooks cost: each was an `unsafe { walk.note_write(...) }` inside the
innermost row loop of a writeback, reading the destination bytes the copy was
about to overwrite. Removing them takes a read of the destination out of four
hot copy loops on the sampled path.
Incidental simplifications the removal unlocked:
- `RunCopy::write_src()` existed only to feed the audit; it is gone.
- Two `let spans: Vec<(u64,u64)> = selected_within(..).collect()` bindings in
`mapper::copy_mapping_runs` were collected into a `Vec` solely because "the
audit and the copy both borrow `copy`". `selected_within` borrows neither, so
both are now direct iteration and two per-walk allocations are gone.
- `emit_land_redundancy()` and its 26-line doc leave `drain/`.
Also updated the two consumers outside the crate: `window-drag-probe.sh` parsed
the log line that is no longer emitted, and `constant-fields/README.md` used its
`under_50=0` field as the worked example of a constant that is itself a
measurement. The README example is rewritten to state the class without naming a
field that no longer exists, and to note the opposite reading — that a
measurement with an answer is a probe.
Behaviour is unchanged: every copying `unsafe` block is untouched, and the bytes
written, their order, and the surrounding footprint and write-phase accounting
are identical. Four doc references in `spirv_emit.rs` and `diff_pass.rs` were
rewritten to state the 256-byte tile size directly rather than name the deleted
module.
Test count: down 16. All 16 tested the instrument itself — its bucket
boundaries, its stride, its own comparison — so no other behaviour lost cover.
Verified: `cargo build` and `cargo clippy --all-targets -- -D warnings`, both
`--no-default-features --features backend-vulkan,host-window`, clean.
Not verified: not run on an Apple host, so the `backend-metal` arm is unbuilt
here; the hooks removed from `metal_draw/mod.rs` are outside any `cfg` so the
arm is affected identically. No live-VM boot.
Co-Authored-By: Claude <noreply@anthropic.com>
74 lines
3.7 KiB
Markdown
74 lines
3.7 KiB
Markdown
# constant-fields
|
|
|
|
Reports always-on log fields that only ever take **one** value.
|
|
|
|
```sh
|
|
scripts/constant-fields/constant-fields.sh [logfile] [min-samples]
|
|
# defaults: /tmp/reims-vgpu-fail.log, 200
|
|
```
|
|
|
|
## Why this finds things reading the source cannot
|
|
|
|
`observe/` is large and almost every counter looks live in the source. What the
|
|
source does not show is whether a branch that would move a field is ever taken.
|
|
A field printed 12 000 times with the same value is not a measurement — it is
|
|
either **structurally impossible** or **vestigial**, and both are removable.
|
|
|
|
The sweep's own control is that it re-finds `gva_write gpa_match=0`, the write-gate
|
|
probe deleted in `d128fc1` for exactly this reason. If a run stops reporting that
|
|
on a pre-`d128fc1` log, the parser has drifted.
|
|
|
|
Two towers it found on first use:
|
|
|
|
- `type4 id_hits=0`, 12 172 samples. The page loop returns on the first
|
|
untranslatable page, so any page that advances the counter also exits before
|
|
the census line. Its sibling route `type4_identity_pages` turned out to have a
|
|
distribution identical to `type4_translate_refused` — a duplicate counter — and
|
|
the whole thing measured the counterfactual of an identity guess deleted in
|
|
`6a3d878`.
|
|
- `guest_write_footprint war_licensed/superseded/unstated/unattributed=0`, 6 655
|
|
samples. The licence tally only increments on the mapping rail, and
|
|
`war_mapping` is *also* always zero, so the four buckets split a population
|
|
that has never had a member. The `WriteLicence` parameter was threaded through
|
|
the per-write, per-frame `mark()` hot path to fill them.
|
|
|
|
That second one is the shape worth internalising: **a bucket downstream of
|
|
another bucket that is itself always zero.** Four zeros looked like four quiet
|
|
measurements until the fifth zero showed they were unreachable.
|
|
|
|
## Bucketing by line family is load-bearing
|
|
|
|
Field names repeat across unrelated families. A `reason=` that is constant on one
|
|
line family and varied on another cancels out if you group by field name alone,
|
|
and the constant one is never reported. The script keys on `(family, field)`,
|
|
taking the family from the second whitespace field — the token after the
|
|
`OFF`/verbose marker.
|
|
|
|
## What a constant field can legitimately be
|
|
|
|
Do not cut on the report alone. Read the emitting code. These are all fine:
|
|
|
|
- **A standing alarm reading zero.** It is doing its job. `host_cache_levels
|
|
gva_cap_wanted=0` is the GVA cap's harm reading, deliberately kept by `d16dd43`
|
|
after the opposite claim turned out to be wrong.
|
|
- **A capability or geometry constant** for this host: `frame_shift=12`,
|
|
`gva_cap_bytes=134217728`, a probed device feature.
|
|
- **An arm the workload never reached.** The type-11 ladder's own doc records
|
|
that an undriven boot reported 12/5/8/0 where a driven one reported
|
|
31 916/1 694/705/150 — "quiet enough to talk someone into deleting it". Drive
|
|
the guest before believing a zero, and prefer the whole accumulated log over
|
|
one boot.
|
|
- **A support-matrix cell** selected by a host *capability* rather than by the
|
|
workload, per `AGENTS.md`.
|
|
- **One cell of a partition, where the constant value is the measurement.** A
|
|
bucket reading zero on every driven second can be the finding rather than a
|
|
dead counter: if the buckets partition the whole range, the empty one says the
|
|
population never reaches it, and deleting the field deletes the result. This
|
|
class is the hardest of the five to spot, because the field looks exactly like
|
|
a vestigial counter and the value it holds is the one a vestigial counter
|
|
holds. Weigh it against the opposite reading — once such a measurement has an
|
|
answer and the answer is recorded where it is acted on, the instrument is a
|
|
probe that outlived its investigation and should go.
|
|
|
|
The report points at code; it does not convict it.
|