`decode::render::Command` carried `has_blend_color`, `has_cull_mode`,
`has_front_facing`, `has_depth_bias` and `has_stencil_ref`. Each was set `true`
in exactly one place, read in exactly one place, and the two are the same record:
the decoder assigns `out.kind = Kind::SetCullMode` and `out.has_cull_mode = true`
in the same block, and that kind has one producer. So
`RenderKind::SetCullMode if cmd.has_cull_mode` was true whenever the arm was
reached and the guard could not fail.
Not free, for two reasons. `handle_render_record`'s match ends in a bare
`_ => {}`, so the shape claims a guest could set a cull mode this device then
discards without a word — a claim `scripts/silent-arms` exists to find, and which
it had to suppress five times per run as presence-guards to stay quiet. And a
reader checking whether the absent case is handled finds a flag rather than the
fact that there is no absent case: a record too short to hold the field never
reaches the accumulator, because the wire view refuses it and `decode` returns
`ErrShort` before a kind is assigned.
Deleted: five `pub` fields, five assignments, five guards. The one comment that
replaces them says why there is no guard, which is the part that was not written
down anywhere.
`has_attribute_stride` and `has_sampler_lod` are deliberately kept and are not the
same shape — each distinguishes two *different* opcodes that decode to one kind
(plain vs stride-form `SetBuffer`, plain vs LOD-form `SetSampler`), so they carry
information the kind does not.
Two decoder tests asserted `c.has_blend_color` / `c.has_cull_mode`, which was
asserting that the decoder had set a flag it sets unconditionally beside the kind.
They now assert the kind, which is what the flag stood in for.
`scripts/silent-arms/README.md` gains the sub-class: a presence guard whose flag
is assigned in the same block as its kind cannot fail, and wants deleting rather
than suppressing, because a suppressed hit is still re-triaged every run.
Verified: `cargo test -p reims-vgpu --no-default-features
--features backend-vulkan,host-window -- --test-threads=1` 1355 passed, all
integration binaries green. Clippy `-D warnings` clean on the Vulkan/host-window
arm and on `aarch64-apple-darwin --features backend-metal`.
`scripts/silent-arms` reports the suppressed count down 30 to 25 and the
value-guard count unchanged at 8. Not verified by boot: no behavior changes —
every arm that ran before runs now, on the same condition.
silent-arms
Reports match arms carrying an if guard, inside a match whose catch-all is
_ => {} or _ => ().
scripts/silent-arms/silent-arms.sh # both crates' src trees
scripts/silent-arms/silent-arms.sh <dir> ...
What it is looking for
An arm written as
RenderKind::ExecuteCommands if cmd.indirect_command_buffer_ref != 0 => { … }
…
_ => {}
decodes a guest record, tests something the guest said, and — when the test
fails — hands it to a catch-all that does nothing and says nothing. The record
was understood well enough to be classified and is then dropped with no line in
/tmp/reims-vgpu-fail.log, which is the failure mode AGENTS.md's "Never Fail
Silently" exists to prevent. Nothing else finds this shape: the arm compiles,
the match is exhaustive, no counter moves, and a driven boot looks identical.
It is also invisible to a reader, because the guard and the catch-all are usually hundreds of lines apart.
The triage rule
Most hits are not findings. The question to ask is what the guard is testing:
- A guard on decoder presence is not a finding.
if x.is_some(),if word_count >= 3— these ask whether the decoder saw the field at all, or whether the record was long enough to hold it. The arm not running means the guest did not send the thing, so there is nothing to lose. The script counts these and suppresses them. - A presence guard that cannot fail is worth deleting, not suppressing. Check
where the flag is set. If the decoder assigns it in the same block that
assigns the kind the arm matches, and that kind has one producer, the guard is
true whenever the arm is reached. It still costs something: the reader — and
this script — sees a shape that says the device may discard a state the guest
set, so it has to be re-triaged every run. The five
has_blend_color/has_cull_mode/has_front_facing/has_depth_bias/has_stencil_refguards inruntime/exec.rswere this, along with the fiveCommandfields behind them; the suppressed count went 30 to 25 when they went. - A guard on a decoded value is a candidate.
if cmd.scissor_w > 0,if cmd.indirect_command_buffer_ref != 0— the guest sent a record and said something specific in it. Falling through means the device read the guest's statement and discarded it. - A candidate is still not automatically a finding. The catch-all may be a
real no-op state. Apply the test
AGENTS.mdgives for a never-firing branch, inverted: name what the guest is asking for, and say what happens to it. If the answer is "nothing should happen", the arm is right and wants a comment, not a counter.
An adjudication that was wrong, and how
The SetPipeline if cmd.pipeline_ref != 0 arm was on this list as legitimate,
reasoned as "a zero ref is an intentional unbind, which AGENTS.md names as
expected control flow". The premise was right and the conclusion did not follow.
A zero ref is an intentional unbind — but the arm did not perform one. Falling
through to _ => {} left the previous pipeline latched, so the following
draws were encoded against a pipeline the guest had stopped asking for, and
dropped_unbound read zero because they were executed rather than dropped.
The trap is that "expected control flow" answers a question about the guest ("is the guest allowed to send this?") and the arm is a statement about the device ("what does this device then do?"). Reading the first as settling the second is what put it on the list.
So the rule for this list: an entry is only adjudicated once it names what the device does instead, not just why the guest's record is unremarkable. Every entry below does. Fixed in the commit that added this section.
Already adjudicated — do not re-report these
Eight candidates on the current tree, all read and all legitimate:
runtime/metal_draw/mod.rs×4 andmetal_draw/vulkan.rs×3 — thePASS_LOAD_ACTION_*ladders. The catch-all isDONT_CARE, whose whole meaning is "do nothing to this attachment", and the value is bounded upstream byload_action <= PASS_LOAD_ACTION_CLEARso it cannot be an unknown action.runtime/spirv_bind.rs:531— the taint scan's_ if …any(is_derived). The catch-all is an instruction that touches no derived value, which is the scan's normal case rather than a drop.
Re-check them when the surrounding code changes; do not spend a second session rediscovering that they are fine.
Validation
Run against the tree before f18608a, which fixed two bugs of exactly this
shape, and the script reports both:
mkdir -p /tmp/pre/runtime
git show f18608a^:crates/reims-vgpu/src/runtime/exec.rs > /tmp/pre/runtime/exec.rs
scripts/silent-arms/silent-arms.sh /tmp/pre
Three candidates, five presence-guards suppressed. All three were real losses.
Two were fixed by f18608a: an empty SetScissor that left the previous
rectangle clipping later draws, and an ExecuteCommands with ref == 0 that
dropped a whole ICB batch. The third was the SetPipeline arm, which is the same
shape as the SetScissor one — a guard that reads as a drop and is really a
carry-forward of the last value — and which this list initially cleared. It is
fixed now.
Known weakness
It matches an arm head by taking the text before the arm's first =>. That is
right because ==, >= and != contain no =>, but a guard containing a
closure with its own => before the arm separator would be misread. There is no
such arm in this crate today. An earlier version excluded = from the head
entirely and so matched no x if x == FOO => arm at all — it reported one hit
and looked clean, which is the failure worth knowing about: a quiet report
from this script should be checked against the validation above before it is
believed.