b1c7b531fe259e34209c5ee0ea5c2ca647c72002
17
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7173ac6924 |
📝 A healthy import-off fail channel opens with thirty records that read like a broken host
Component: `scripts/runtime-dead/README.md`. Documentation only — records what the fail channel of the first `--import-off` boot actually contains, so the next reader does not have to re-derive that none of it is a loss. Ranking that boot's fail channel puts `gpuwb_guest_ref_refused` at the top, 30 times, every one `via=guest_ram_map_no_backend_import`. Read cold that says the host cannot import guest RAM — on a run where the operator turned the import off themselves. `runtime/mapping_write/mod.rs` predicts this line being ranked to the top in the doc comment on the variant, which is why it restates the inner check rather than pointing at `guest_ram_map`'s once-per-boot report; this is that prediction coming true, and it is worth a baseline so it is recognised rather than re-investigated. Nothing in the channel is lost guest work. The other three entries: `sync_exec_lock_hold` 30 times at 313-378 ms against a 250 ms threshold, which on a coverage-instrumented build running every guest window through the copying path is an artifact of the build; `sampled_resident_reclaimed` 12; and `lin_rung_blank_with_host_entry` 8, all carrying `host_blank=1 backing=Same`, which the record's own legend defines as the cache agreeing and nothing lost, over pages the entry still covers. Two counting traps found while reading it, both recorded: - That tag greps 13 times and is 8 records. Five are `OFF store_routes` census lines carrying it as a counter name. Summed per `AGENTS.md` — the samples are per window, not cumulative — the route fired 9 times across 5 windows against 8 deduped fail lines, and the two numbers agree because emitters dedupe and counters do not. - `grep -c 'backing=Same'` returns 16 for 8 records, because each record's explanatory parenthetical contains the string while defining it. The field has to be matched with its neighbour or you are counting the legend. This one bit during the investigation and produced a five-record discrepancy that looked like a second event shape. Not verified: this is one 25-second Safari drag on one x86 Vulkan host with a coverage-instrumented build. The `sync_exec_lock_hold` attribution to the build is reasoning from what that build does, not a measurement against an uninstrumented import-off boot. |
||
|
|
aeb57b3743 |
📝 never-ran.txt counts monomorphizations, and one file supplies 40 lines for two cold functions
Component: `scripts/runtime-dead/README.md`. Documentation only.
Two coverage reports now exist for the same tree — import-on and import-off — so
the intersection is answerable for the first time: 1387 mangled names are cold
in both. Ranking their files produces the closest thing this instrument has to a
candidate list, and the top four entries are all explained by reasons already on
this file's list, which is the expected and reassuring outcome.
One of them is worth naming because it is the largest cluster a reader could
mistake for dead code. `runtime/mapper/mod.rs` contributes 67, and it is the
arm64-only mapper rail — the standing example `AGENTS.md` uses for a rail that
runs on exactly one pathway, with the file stating it at its own resolve rail.
An x86 boot structurally cannot move it. Worth noting alongside: 42 of its 79
functions ran anyway, so even that file is half live here, and "arm64-only"
describes the rail rather than the module.
The finding that changes how the output should be read is `observe/decline.rs`.
It contributes 40 lines to `never-ran.txt`. It contains three functions and
missed two. A `Decline` impl is generic and every instantiation is counted
separately, so the file a reader is invited to act on is a list of
monomorphizations wearing the shape of a list of functions.
Measured rather than asserted:
by-file.txt 3175 functions 1234 missed
never-ran.txt 1413 lines — 1.15x, +179
So the aggregate is roughly honest and the per-file figure is not, because the
15 % is not distributed — it concentrates in whatever file has the most generic
instantiations, at a factor of 20 in this one. The guidance is now to rank by
`by-file.txt`'s missed-function column and treat a `never-ran.txt` line as a
pointer to look rather than a fact about a function. This is the same caution
that retires the 26-versus-70 mangled-name figure in the `--import-off` section,
and it is why that section diffs per file.
Not verified: no claim here is about arm64 or Metal-direct, which this
instrument does not cover. The blit_exec and compute_exec rows attribute their
cold halves to the workload, which follows from a 25-second window drag issuing
no blit or compute opcodes but was not confirmed against the `store_routes`
counter set.
|
||
|
|
63af1ca2be |
📝 The usage block lists the flag it grew
Component: `scripts/runtime-dead/README.md`. `--import-off` landed in `cda0f2ff` with a section explaining it and no entry in "Running it", which is the one part of this file a reader consults before running anything. Adds the invocation and names the second output directory there, with the reason it is separate — the two reports are meant to be diffed. Documentation only. No script or product change. |
||
|
|
a6258c2b01 |
📈 The copying rails measured, and the number that looks like the answer is inflated
Component: `scripts/runtime-dead/README.md`. Documentation only — records the first paired reading from the `--import-off` flag added in `cda0f2ff`, whose commit body said the flag had not been run end to end. It has now. The guard fired correctly on a real boot: `runtime-dead: confirmed host_pointer_import=disabled_by_env`, exit 0, report written. ``` import on 3450 functions 1413 never ran regions 53.65% functions 61.13% import off 3450 functions 1457 never ran regions 52.50% functions 59.72% ``` The first thing the diff produced was a wrong answer that looked like the right one. At mangled-name granularity, 26 functions ran only with the import off and 70 only with it on, and 26 is a satisfying number to report — the copying rails, named, including the whole `MapRefusal` and `GpuWritebackDecline` decline machinery. It is inflated, for the reason this README's own generics note gives: one entry per instantiation. `model/lru_memo.rs` executed 4 of its 10 functions in *both* runs while contributing three mangled names to the "only off" set. Per file, 20 files move at all, and the shape is the opposite of the headline: the import reaches *more* code than the copying path does. `runtime/guest_ram.rs` goes from 19 executed functions to 2, `engine/mod.rs` 84 to 71, `exec.rs` 41 to 37, `guest_window_regions.rs` 2 to 0. The copying rails are about ten functions across six files — `objects/mod.rs` +3, `draw/mod.rs` +3, then one each in `mapping_write`, `storage_flush/land.rs`, `decode/fifo.rs` and `pools/mod.rs`. That does not make them a deletion, and the README says so: the plan this instrument serves is explicit that they are the dGPU rail and the only rail on a host without the extension. What changed is that there is now a driven boot behind that rather than an argument. `guest_ram.rs` collapsing 19 → 2 is also a second confirmation the override took, independent of the `vk_caps` string the guard reads — worth having, because the guard and the reading would otherwise share a single point of failure. Stated as not established, in the README and here: the two runs are two different Safari drags, so a one-function delta on a file unrelated to importing is as likely to be workload variance as a rail. Only the large deltas and the ones whose file is about the import decision are worth trusting. A third run would separate them and was not done. Nothing here touches arm64 or Metal-direct, which this instrument does not cover at all. |
||
|
|
cda0f2ff72 |
✨ runtime-dead can measure the copying rails, which the capable host it runs on never takes
Component: `scripts/runtime-dead`. Script only; no Rust or C changed. This instrument could only ever see one half of the device. Where the host can import guest RAM, every guest window takes the import and the copying rails run zero times — and on a host without the extension those rails are the only ones there are. So they read cold here for a reason that has nothing to do with them being dead, which is the class `f002f205` added to the README as reason 7. `--import-off` exports `REIMS_VGPU_GUEST_IMPORT=off`, which AGENTS.md provides for exactly this, and writes to `/tmp/reims-vgpu-runtime-dead-import-off`. The separate directory is deliberate: the two reports exist to be diffed, and a run that overwrote the other would destroy the comparison it was made for. The guard matters more than the flag. An override that does not take is the worst outcome available here, because the run still *succeeds* — a full report, self-consistent counters, a directory named `-import-off`, and coverage of the import rails it was supposed to exclude. Diffed against the ordinary run it then shows no copying rails at all, which reads as "the copying rails are dead": the exact conclusion the flag exists to prevent. So the run refuses unless `vk_caps` reports `host_pointer_import=disabled_by_env` in the fail log, and prints whichever rung it did see. The script truncates that log before the boot, so a match is this boot's. Verified: `bash -n` clean; the flag's `OUT_DIR` selection exercised in isolation; `REIMS_VGPU_GUEST_IMPORT` matches `env.rs:38` and `disabled_by_env` matches `caps/host_pointer.rs:136`; and the field name in the guard's grep is confirmed against a real fail log, which carries exactly one `host_pointer_import=supported` from the last driven boot. Not verified: **the flag has not been run end to end yet.** The confirmation guard is therefore unproven against a live import-off boot — it is checked against the string the capable rung emits, not the disabled one. That boot is the next thing to do and its reading belongs in the README beside the ordinary baseline. Nothing here touches the arm64 pathway, which this instrument does not cover at all. |
||
|
|
f002f205e3 |
📝 Two of this instrument's zeros have no entry on its list, and one of them reads as a deletion
Component: `scripts/runtime-dead/README.md`. Documentation only; no Rust, C or script behavior changed. The first driven boot since the host-pointer import landed put three files at 0.00% that the README's five "legitimate reasons a function reads zero" do not cover, and the gap is not symmetric — one of them inverts into an argument for deleting live code. Reason 5 said `backend-metal` "is cfg'd out of the build entirely, so it does not appear at all". That stopped being true when `AGENTS.md` started asking for pure logic under `backend/metal/` to be moved out of the gated tree so its tests run on every arm rather than on none. `backend/hash.rs`, `backend/render_pso_key.rs` and `model/content_cache.rs` were each moved for that reason, and each is now compiled into the Vulkan binary and called only from the Metal arm. They read 0.00% here — 2, 9 and 6 functions — and a reader applying reason 5 as written concludes they cannot be Metal-only, and therefore that their zero is a finding. Each of the three states in its own first paragraph why it sits outside `metal`; the README now says to read that. The second is `runtime/spirv_vertex_input.rs`, 0.00% across all 10 functions on a boot that issued thousands of draws a second. It is reached only from `VertexFormatSupport::resolve`, and only on the widening fallback — when a device declines a three-component vertex format and is handed the mandatory four-component sibling, the module answers how many components the translated shader actually reads at that location, so the substitution is refused rather than silently changing a `w`. An RTX 5080 declines no such format. Verified by reading the call graph: `translate/support.rs` and `engine/caches.rs` are its only callers and both sit behind that fallback. That is a class, not a one-off, and it is the same shape as the copying guest-memory rails: a rail that is the *only* rail on a less capable host reads exactly like a dead one here, which is what `REIMS_VGPU_GUEST_IMPORT=off` exists to exercise. Both are now reasons 6 and 7. Not verified: neither new reason was checked on the arm64 / Metal-direct pathway, which this instrument does not cover at all. Reason 6 in particular is an argument about what a Metal boot would execute, and no Metal boot was run — the claim made here is only that a Vulkan boot cannot be evidence against it. |
||
|
|
c4309bbeec |
🐛 runtime-dead could not name its own QEMU, and called a complete profile missing
Component: `scripts/runtime-dead` (x86 / Vulkan / host-window instrument). No
Rust or C changed; the crate and both shims are untouched.
Three consecutive runs refused to write a report at the guard `the boot's own
profile is missing or empty`. The guard was wrong every time. The last of them
left `reims-996479.profraw` on disk — 4 310 352 bytes, `Maximum function count:
225055584`, `Total count: 4331733340` — a complete measurement of the boot it
had just declared unmeasured. The README's whole "known broken" section, which
had the search space narrowed to "the writer ran and did not finish, on the one
process with a live Vulkan device", was chasing a defect that does not exist.
The cause is the pid. The script found QEMU with
ps -eo pid,args | grep '[q]emu-system-x86_64' | awk '{print $1}' | head -1
which matches any process whose argv holds that string, not any process that is
it. Three things in this script's own critical path qualify and all three land
inside the loop's two-second polling window: the boot script re-runs qemu-build,
whose ninja link step spawns `cc ... -o .../qemu-system-x86_64 ...` for a 119 MB
binary; qemu-build then makes four short-lived `-device help` probes; and any
other process mentioning the name matches too — a shell running a command
containing it is what finally exposed this. `head -1` returns one of those, none
of which writes a profile under the pid the script then looks for.
What changed:
- `qemu_pids()` matches `/proc/<pid>/exe` rather than a command line. An argv
match cannot tell a compiler writing that name from a process running it. The
stale-VM guard had the identical flaw and now shares the helper; it also loses
the `set -o pipefail` edge where grep-found-nothing was the pipeline's status.
- The measurement pid is re-sampled once the guest answers SSH, when the build
is finished and the probes are gone, and the run refuses unless exactly one
QEMU is alive. The early loop survives only to notice a boot that never
started and to have something to kill on the refusal paths.
- The guard tests counts, not bytes. A probe's dump is 4 310 352 bytes of
records that are all misses — exactly as large as the measurement — and passed
`-s` on every failed run. `llvm-profdata show`'s `Maximum function count:`
reads 0 for every probe and 225 055 584 for a driven boot.
Verified by running it: `--seconds 25 --app Safari` on `006d2216`, exit 0,
`runtime-dead: measuring QEMU pid 1087125` (the re-sample found exactly one),
drive verdict passed, 8 raws merged, report written.
crates/reims-vgpu/src 3450 functions 1413 never ran (59.0% ran)
regions 53.65% functions 61.13% lines 53.33%
All six files the first baseline adjudicated as 0.00% reappear at 0.00%. The
instrument agreeing with a conclusion reached the expensive way is why it is
worth having.
The reading also answers the plan's §5, which reserved three modules for
measurement before deciding the in-place import had stranded them. It refuses
all three: `gva_view.rs` 80.35% regions / 26 of 28 functions,
`surface_cache/mod.rs` 72.13% / 49 of 62, `m2v_cache.rs` 62.97% / 40 of 65.
None is a deletion.
Not verified: the arm64 / Metal-direct pathway, which this instrument does not
cover at all (`backend-metal` is cfg'd out of the build). The §5 claim that a
UMA host's armed-window count goes to zero is still unmeasured — this host is a
discrete RTX 5080, where `storage_flush/`'s 21-98% coverage is the dGPU rail
working rather than evidence either way. No timing in this run's drive log is
usable: it was taken minutes after a full instrumented rebuild and presents at a
tenth of the first baseline's rate. Coverage is a count and survives that.
|
||
|
|
24a71cc68e |
📝 runtime-dead now stops QEMU the right way, and that was not the bug either
`scripts/runtime-dead/`. The zero-byte profile has an obvious suspect: QEMU leaving through `qemu_system_killed` rather than returning from `main`, so the `atexit` writer never runs. The script now stops it with a QMP `quit` — the shutdown that sets the cause from inside the monitor and lets `main` return — falling back to a signal only if the monitor does not answer. **The `quit` went through, QEMU logged a clean exit, and the profile was still zero bytes.** So the exit path is not the bug. The change stays because `quit` is the correct way to stop it and the fallback costs nothing, but it is recorded as a negative rather than a fix, which is the useful thing to write down. Also ruled out this run: no coredump from any of the three attempts, and `/tmp` is a 47 G tmpfs at 5 % with 1 % of inodes used. That narrows the search space to something worth stating precisely, and the README now does: **the writer ran.** Nothing but the profile runtime creates that file and it opens truncating, so zero length means the handler was entered, the `fopen` succeeded, and the write did not finish. The same binary in the same directory on the same run writes a complete 4 310 352-byte table from the boot script's probe invocations. The only difference is that the failing process ran the device — live Vulkan instance, host-window thread, 30 seconds of guest work. The other untested candidate is the toolchain: the README's baseline predates this host's LLVM 22. Verified: `bash -n` clean; a third live instrumented boot, driven 27 seconds, stopped by QMP quit, which the run log confirms was the path taken. Not verified: §5 of the guest-memory plan is still unmeasured. Three ruled-out hypotheses and a precise statement of what is left is what this buys, not a reading. |
||
|
|
ff8f5915ce |
🐛 runtime-dead drove a guest whose app had no window, and swallowed the failure
`scripts/runtime-dead/`.
Ran this for §5 of the guest-memory plan — measure `m2v_cache`, `surface_cache`
and `gva_view` rather than inspect them — and it failed twice. One of the two
causes is fixed here; the other is recorded with what has been ruled out.
**Fixed: the drive never started.** SSH answering is not the guest being ready.
The boot reverts to a snapshot, so `sshd` listens within seconds while the
window server is still restoring sessions and Safari has no window. The probe
reads that window's frame first, so it exited in about a second with
window-drag-probe: could not read Safari's window frame (pos '' size '')
which is not the probe's "the window never moved" refusal — that refusal is the
whole reason this script trusts the probe — but a failure to start at all.
`|| true` swallowed it, the boot was stopped seconds after reaching the desktop,
and the only thing that reported a problem was the all-zero guard ten minutes
later. The script now waits for the app to present a window before driving, and
makes both that timeout and a probe failure fatal where they happen. Verified:
the rerun drove 29 seconds of real compositing where the first run drove none.
**Not fixed: the boot's own profile is zero bytes.** The end guard refuses the
report, correctly — the run is genuinely unmeasured. Recorded in the README as
known-broken with four things ruled out, so the next attempt does not re-cover
them: the profile runtime *is* linked and working (the boot script's four probe
QEMUs each wrote a full 4 310 352-byte table on the same run); `vm/boot-x86.sh`'s
`SIGTERM`/`sleep 2`/`SIGKILL` fuse never fired, since its own `killing qemu
pid=` line is in neither `boot.log`; the boot was driven; and the probe bug
above was not the cause, because fixing it changed nothing. What is left is
QEMU's `SIGTERM` path reaching exit without running `atexit`, or the toolchain
(this host is LLVM 22; the baseline predates it).
The README already says a zero here is a question and not a verdict. It now also
says that the tool's *silence* is not a reading either — which matters more,
because an unmeasured run and a clean one look the same to someone who only
reads the exit code.
Verified: `bash -n` clean. Two live instrumented boots, the second driven.
Not verified: §5 remains unmeasured. This commit makes the instrument fail
honestly and sooner; it does not make it produce a reading.
|
||
|
|
920f78f502 |
🐛 A fail log nobody truncated made two healthy-zero decoders read as failing 96 000 times
scripts/runtime-dead and AGENTS.md's fail-log reading rules. No product code. `/tmp/reims-vgpu-fail.log` is appended to and never truncated, and `runtime-dead.sh` — unlike the driven-boot recipe in AGENTS.md — never removed it before booting. So the file it leaves behind holds every boot since someone last deleted it, of every build those boots ran. Nothing in a merged log says where one boot ends, and the merge does not read as noise. `first_sight` latches per process, so a refusal seen exactly once per boot arrives as N identical-keyed lines; ranking `reason=` on the accumulated file then reports a decoder failing thousands of times. Ranking one such file put `type7_payload_len_disagrees` at 58 506 and `color_attachment_table_truncated` at 37 562, both of which are documented at their emitters as reading zero on a driven boot, with `declared=` values (9 995 776, 108 459 239, 3 680 631 280) that look exactly like a descriptor being parsed at the wrong offset. A clean driven x86/PCI/Vulkan boot on this tree — log removed first, Safari drag probe, 499 draws/s median, 25/25 seconds compositing — puts both at **zero**, along with `pipeline_descriptor_field_dropped`. The docs were right and the log was history. Whole fail channel for that boot: `translation_deferred` 7, `sampled_resident_reclaimed` 5, `buffer_import_bind_offset_alignment` 3, `llvm_vector_alloc_stride` 1. Two changes, because the trap needs both halves: - `runtime-dead.sh` removes the fail log before booting, like the AGENTS.md recipe already does. That is the omission that produced the file. - AGENTS.md gains "count the boots before ranking anything" — `grep -c vk_caps` is the boot count. This is deliberately *not* folded into the existing "is this a boot's log or the test suite's" check, because it fails the opposite way: the log is a real boot's, it is just also three other boots'. Also verified in the same boot, since the binary carried the preceding commit: the desktop renders (wallpaper, menu bar, dock, Safari window; 126 937 colours), `draw_prepare_secondary_target_unbuildable` and every `mrt_drop_*` read zero, and `mrt_slot_attached` 31 983 against `mrt_draw_single` 96 163 with no `mrt_draw_multi` — so that workload declares one colour attachment per pass and the new refusal is unexercised rather than regressing anything. Not verified: arm64/Metal, and the copying rails (`REIMS_VGPU_DMABUF=off` was not run — this host reports `dma_buf_import=supported`, so the import rail is what booted). Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
847f09adb1 |
🐛 A broken coverage run reported every function in the crate as a kill list
scripts/runtime-dead — the reachable-but-never-runs instrument. No product code, no pathway. A run on this toolchain produced `never-ran.txt` naming all 3360 functions in the crate and `TOTAL 0.00 %`, from a boot that reached the desktop, answered on SSH, and passed the drag probe's did-the-window-move verdict. Nothing in the output says it is broken; it is a deletion list for the whole device in the format a reader is invited to act on. Cause: `$OUT_DIR` has more writers than the boot. The crate's build scripts write a raw each, and the boot script's own short-lived `qemu-system-x86_64` probe invocations each dump the complete function table with every counter at zero. The boot's own QEMU wrote a 0-byte raw, `-size +0c` dropped exactly that one, `merge -sparse` then discarded the all-zero records the probes carried, and the report was built from the six functions a build script had touched. Two guards, both refusing to write rather than warning: - Before the merge, the raw named by the QEMU pid the script itself SIGTERMed must exist and be non-empty. This names the failure exactly. - Before `never-ran.txt` is opened, not every function of ours may read zero (and the export must contain some of ours at all). Backstop for a raw that is present but all misses — reachable if the pid loop races a probe QEMU. Deliberately not gating on `llvm-profdata show`'s `Instrumentation level:`: it reports `Front-end` here even for the genuinely-instrumented 42141-function dumps, so an `IR` check would refuse good runs. Noted in the README. The README's claim that a bad toolchain gives "a silently 0-byte file, which is how you will notice" was falsified by this run and is corrected: the 0-byte file was written, and other non-empty files hid it. Verified: `bash -n` clean; the guard replayed against the retained bad `export.json` refuses and writes nothing, and against the same export with five counts flipped non-zero it writes 3355 rows and exits 0. `note_packet_stamp_- records` — called on every decoded packet — was in the bad list, which is what made the list obviously wrong. Not verified: no new instrumented boot was run, so the underlying reason QEMU's atexit writer produces a 0-byte file on SIGTERM is not diagnosed. The guard turns that into a refusal instead of a false report. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
737aab200b |
♻️ The 6682-line file every draw goes through was half a test module, and twenty comments named it by filename
`crates/reims-vgpu` — `runtime/exec` becomes a directory. Pure motion: the reassembled file is token-identical to its predecessor. The rest of the diff is comments. `exec.rs` was 6682 lines, of which 3277 were one colocated `mod tests`. It joins `compute_exec`, `drain`, `icb`, `metal_draw` and `storage_flush` as a directory: exec/mod.rs 3403 (product) exec/tests.rs 3277 The product half is unchanged, including the two `#[cfg(test)]` *items* at what is now mod.rs:2058 — a `UNIMPL_TEST_LOCK` and a dedup-latch reset. Those are test-only helpers living in the product region and they stay there; they are not a test module and moving them would change what `super::` means for the callers that take the lock. This is the prerequisite for the census extraction, which wants a sibling module in the same directory; doing the motion first means that change can be read as a change. **The measurement that chose this file was nearly wrong.** Sorting the five colocated god-test modules by "lines after the first `#[cfg(test)]`" ranks `decode/resource.rs` top at 5070. Brace-matching instead says it has 1959 test lines in two modules and **4077 lines of production code after the last one** — the exact trap this repo has recorded before. The real ranking is exec 3277, blit_exec 2308, decode/render 2381, decode/resource 1959, objects 1375; and `drain/mod.rs`, which the eye reads as a god-file, has **no** colocated tests at all. Twenty comments across thirteen files referred to this module as `exec.rs`. They now say `exec`, which is what they meant and what survives the next move. Two were deliberately left: `scripts/silent-arms/README.md` line 101 is a `git show <sha>:…/exec.rs` command whose path is historical and must stay wrong-for-today to still work, and line 48 describes a past state in past tense. Verified: - Pure motion proved mechanically: reassembling `mod.rs` + `tests.rs` and comparing token streams against `HEAD:runtime/exec.rs` gives equality (229 625 chars each), so no product line changed. - `cargo fmt --check`; clippy `-D warnings` clean on all three arms, `--all-targets`. It compiled clean on the first attempt — nothing in the test module reached a private item by a path the move broke. - Full serial suite: 1469 passed, 0 failed, 4 ignored — unchanged. - `scripts/feature-matrix/feature-matrix.sh`: all four cells pass, warnings=0, `lib=1385 all_targets=1473` unchanged. Not verified: no boot. A token-identical product region cannot change any pathway's behavior. Metal cross-compiled and linted, not executed. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
a8f61bfadc |
🐛 The instrument for "reachable but never runs" could not run, and said every function was dead when it did
`scripts/runtime-dead`, `scripts/qemu-build`. Four defects, each of which alone made the instrument useless, and none of which it reported. **1. It exited after its first banner line, with status 0.** The stale-VM guard is `stale="$(ps … | grep '[q]emu-system-x86_64' | awk …)"`, and the healthy case is grep finding nothing — exit 1, which under `set -o pipefail` is the whole pipeline's status, which `set -e` turns into an abort. So the script ran past this guard only when the condition it refuses on was already true, and returned success without doing anything every other time. Same shape in the loop that waits for QEMU's pid. Both now end in `|| true`. **2. The guest-wait loop finished in under a second.** It polls `ssh -o ConnectTimeout=4 macos-vm true` 120 times with no delay between attempts. `ConnectTimeout` bounds a connection being *accepted slowly*; QEMU's hostfwd **refuses** instantly until the guest is listening, so all 120 attempts returned immediately and the script declared a guest that had another twenty seconds to go. Added the `sleep 2`. **3. The profile it merged was a build script's, not QEMU's.** `LLVM_PROFILE_FILE` was a single fixed path exported before the build — and `-C instrument-coverage` instruments the crate's build scripts too, which run during that build and write there on exit. That is why the one run that got far enough reported **3010 of 3010 functions never ran** on a boot whose own log says it presented frames. `%p` per process now, the build is run explicitly so its raw files can be swept before the boot, and every remaining raw file is merged. **4. The profile writer was never linked in.** `hw/display/meson.build` reads `REIMS_VGPU_COVERAGE` with `run_command` and turns it into a `--whole-archive` link argument — a **configure-time** decision. `qemu-build.sh` skips configure when `build/build.ninja` exists and its stamp matches, and the stamp carried only target and backend. So a tree configured once without coverage stayed without it forever: the staticlib carried `__llvm_prf_*` counters and nothing that writes them, and QEMU's exit produced no profile at all. The stamp now carries `cov=$REIMS_VGPU_COVERAGE`, so turning coverage on or off reconfigures, in both directions. The path rather than a flag, because a different clang major is a different archive. Verified end to end on this host: after the fixes, a driven run (`--seconds 25 --app Safari`, 22 s of real compositing) merges 5 raw profiles and reports **1203 of 3010 functions never ran**, with plausible per-file coverage (`caps/api_floor.rs` 100 %, `pools/teardown.rs` 30 %, `pools/images_and_registry.rs` 44 %). Before the fixes the same command printed one line and exited. No product code touched; nothing in `crates/` changes and no test count moves. |
||
|
|
f460a7391a |
🐛 runtime-dead would have measured a stale VM instead of its own
scripts/runtime-dead/runtime-dead.sh. The script found QEMU by grepping ps and taking the first match. A qemu-system-x86_64 left over from an earlier boot holds localhost:2222, so the new boot fails its hostfwd rule and exits within a second — and every later step then waits on, drives, and finally SIGTERMs the OLD, uninstrumented VM. The run would produce no profile and no explanation, or worse, a profile from a binary that was not the one under test. This is not hypothetical: it happened while the method was being worked out, and cost a boot to diagnose. Now refused up front, naming the offending PIDs, because there is no way to tell which QEMU is ours from ps alone. Also notes why the guest-never-answered path kills rather than continues. Verified: preflight runs, discovers the profile runtime, and passes the stale check with no VM running; shell syntax checks clean. |
||
|
|
6c1193de86 |
🐛 runtime-dead counted every dependency's functions, not the crate's
scripts/runtime-dead/runtime-dead.sh. The source list passed to `llvm-cov export` restricts the per-file summaries and not the function list, so the walk of data[].functions reported every monomorphization in every dependency: 54 210 "never ran" against the 1 066 the README's baseline records. The script would have contradicted its own documentation on first use. Filtered on the filenames each function actually spans, and the line now reports the denominator too — "1 066 of 2 826" is a reading, "1 066" on its own is not. Verified by extracting the embedded block from the committed script and running it against the export.json from the baseline run: 1 066 of 2 826, matching the README exactly. The script's shell syntax checks clean. Found because the script was assembled from steps that had been run by hand, and the hand version carried the filter while the transcribed one did not. |
||
|
|
779e28d4b7 |
📝 All six zero-coverage files adjudicated; none is a deletion
scripts/runtime-dead/README.md. The first runtime-dead run named six files at 0.00% function coverage. Each has now been traced upward to the decode dispatch arm that reaches it and matched to the guest action that would take it, so the search is not re-run: runtime/icb/mod.rs type-7 tag 0x36, already priced runtime/heap_query.rs child-FIFO config op 0x40 runtime/mipmap.rs blit opcode 0x133 generateMipmaps runtime/plan/event_sync.rs Metal events / encoder fences runtime/fence_exec.rs same backend/vulkan/engine/draw_preparation.rs the decline type itself Two are healthy-zero alarms — a firing is the bug. The other four are real Apple opcodes a 25-second Safari window drag does not issue: no multi-mip texture is created, no heap size query is made on a host with no Metal device, no cross-encoder synchronization is requested. That ratio is the finding. The instrument's yield is a map of the contract, not a list of things to cut, and the README now says so with the evidence attached. |
||
|
|
9698572ad1 |
✨ An instrument for the one reduction lever dead-state cannot see
scripts/runtime-dead: which decoded paths the guest protocol never takes. AGENTS.md has named runtime-dead code as the remaining lever for a while, and named /tmp/reims-vgpu-fail.log as its only ground truth. The log is a bad instrument for it: every decoder in decode/ is silent on success, so the absence of a line proves nothing, and the only usable never-fired signal was the 85-name store_routes set — which has been audited to exhaustion, twice. This measures the whole crate at function granularity from one boot. It builds the staticlib with -C instrument-coverage, boots x86, drives the guest with the drag probe so the reading is of a busy device rather than an idle one, stops QEMU with SIGTERM so the atexit writer runs, and reports every function whose counter stayed at zero. Three things that had to be worked out and are written down so they are not re-derived: the profile runtime is linked by QEMU (rustc bundles it into a final artifact and a staticlib is not one), RUSTFLAGS must be scoped to the host triple (a bare one reaches the UEFI option ROM, which has no profiler_builtins and fails the boot), and QEMU must exit rather than be killed (continuous mode would survive SIGKILL but needs counter relocation this toolchain lacks — it yields a silent 0-byte file). First run, x86/Vulkan/host-window, driven 25 s with Safari at 496 draws/s median and 11 fresh: 1 066 of 2 826 functions never ran. Six files read 0.00%, including runtime/icb/mod.rs — which is the correct reading and is already priced as not a deletion. None of the six were deleted. The README carries the five reasons a zero is legitimate and the test to apply before acting on one: name the guest action that would take the path. Verified: script runs end to end and produced the committed baseline; the default build is unaffected — rebuilt with REIMS_VGPU_COVERAGE clear and confirmed the binary carries no __llvm_prf_cnts section. vendor/qemu at 3538e649ec. NOT verified: arm64. The script is x86-only; the arm64 boot would need its own profile runtime and an Apple host. |