Testers could not use the gate daily without memory figures, and a memory pile-up took a 3090's Windows
down twice. The parser now reads the runtime's memory line and video memory line (every 5 s in builds with
diagnostics) and writes a memory block: the private bytes at their most and when, the most of them in
physical memory, the least the PC had left to commit and when, the card's video memory in use at its most
and when with the budget then, the seconds over that budget, and the most shared memory in use. The video
memory is what the system counts for the process, so it works on any card. The five runtime strings it reads
join the contract test.
Under Windows PowerShell 5.1 the gate failed in about 2 s without starting the game and without saying
why (reported by a tester). A #Requires -Version 7.0 line makes 5.1 refuse it with a message before
anything runs; docs/game_gate.md says so, and a test keeps the line.
A fuzzed sNaN through v_fmamk_f32 into v_cmp_class_f32 flipped a result
bit on both Vulkan GPUs against the reference model. The model returns a
canonical quiet NaN for v_fmamk_f32, but on gfx1036 under the game's MODE
the hardware mostly returns the NaN source's word and only sometimes
quiets a signalling one (f32_hw_s5.log), so whether the result tests as
signalling or quiet is not something the model can know. Track registers
holding such a computed NaN (st["nanf"], set by v_fmamk_f32 with a
signalling or already-fuzzy NaN operand and propagated through the
pass-through ops and register moves) and raise Uncertain when
v_cmp_class_f32 reads one, instead of reporting a mismatch that is a
model gap, not a translator bug.
Co-Authored-By: Devin <noreply@cognition.ai>
Check offset zero and width 16 on the product and the value stored by the signed sum. Ignore unrelated extracts in the fragment.
AI-assisted with OpenAI Codex (GPT-6).
NVIDIA's shader compiler (RTX 4070 SUPER, wave32) corrupts the preserved
high half of a 16-bit VOP3 result when OpBitwiseAnd & 0xFFFF consumes a
value that passed through %int ops and the result merges with
(old & 0xFFFF0000): v_add_nc_i16 v14, v3, v12 op_sel:[1,1,0] clamp wrote
0x1113AAA8 for 0x0002AAA8. BitFieldUExtract reads the same low 16 bits
and dodges the peephole; SClamp on %int and select-based clamps do not.
AMD (gfx1036, Vulkan and hw_oracle) and the CPU interpreter are
unaffected.
Co-Authored-By: Devin <noreply@cognition.ai>
VK_FUZZ_SKIP_CRASH treats every vk_compute_test exit outside 0/1/2/77 as a
driver crash skip, including the negative return codes Python uses for signal
deaths on POSIX. Spell that out in the module contract and cover it beside the
Windows access-violation case so exits 1/2 staying fatal is unambiguous.
Co-Authored-By: Devin <noreply@cognition.ai>
Translate with rdna2spirv.py --pc-tail-ubo when LEONIDA_PC_TAIL_UBO asks for it
(the 1/true/yes/on convention image_fuzz, lds_fuzz and valu_fuzz already use), so
the modules fit a device's 128-byte push-constant range; the variable also
reaches vk_compute_test through the inherited environment.
VK_FUZZ_SKIP_CRASH=1 records a vk_compute_test crash (the AMD Windows shader
compiler's access violation and the like) as a per-program skip instead of
aborting the batch; exit 1 (CHECK failures) and 2 (usage errors) stay fatal,
as does every non-zero exit without the variable.
Co-Authored-By: Devin <noreply@cognition.ai>
A lane mask in an SGPR, EXEC or VCC is one wave-wide word on hardware.
The EXEC-coverage gate added earlier in this pull request could not prove
the independent-SGPR restore idioms crosslane_fuzz uses, so it fell back
to this lane's 0 / ~0 bit for exactly the programs the read is meant to
fix. It also encoded the wrong control-flow model: EXEC narrowing is a
per-lane value here, not a SPIR-V edge. Mask-data readers are already
kept out of lane-local `if (active)` runs, and the eager wave-mask store
keeps lowering from moving the subgroup gather into an EXEC-selected
arm, so lanes EXEC has off still contribute their mask bits.
Remove the gate and the CFG EXEC provenance analysis it needed, gather
the mask word for every lane-mask data read, and cover narrowed SGPR and
VCC reads, an independent all-ones SGPR EXEC restore, and the composed
vector-bitwise mask words. The vector-bitwise expectations now check the
uniform mask words and the resulting per-lane cndmask bits and popcounts
rather than the old fallback artifact.
Co-Authored-By: SWE-2.1 Max <noreply@google.com>
Review follow-up on the mask-word gather gate (#1397): `s_mov_b32 s4,
exec_lo` under an unknown EXEC narrowing recorded nothing for s4, so the
later `s_mov_b32 exec_lo, s4` restore minted a fresh ("n", id) tag in
_exec_src_ex. mask_exec_sigs coverage then failed and the read kept this
lane's 0 / ~0 bit, while the equivalent literal `s_mov_b32 exec_lo, -1`
resolved to a constant half-state and gathered — register and literal
restores of the same runtime value disagreed.
_mov_sgpr_vals now returns an ("al", halves) alias for an EXEC source
whose half-state is an unknown narrowing, the same scheme saveexec uses:
exec_lo gives (state, None), exec_hi (None, state), exec gives each half
in its own register for b64 moves. _exec_src_ex already resolves those
aliases, so the restore reproduces the original tag and the gather stays
exact; untracked SGPR sources still mint a fresh narrowing and stay
conservative.
Tests: two semantic cases (wave32 and wave64) assert the register
round-trip gathers OpGroupNonUniformBitwiseOr identically to the literal
-1 restore; cs_exec_copy.asm (+ fixture, check.py/run_gpu_tests.py dump
entries) stores the mask word, exec_lo's own word and the literal-restore
word side by side on real hardware — PASS on RTX 4070 and Radeon
(64-wide), wave64 exec filters 9/9 on AMD.
Co-Authored-By: Devin <noreply@cognition.ai>
Review fixes for the mask-as-data change:
- The wave-mask gather is a group op over the lanes EXEC leaves active,
and drivers differ on whether lanes EXEC has off still vote: NVIDIA,
AMD and KosmicKrisp return the whole subgroup's bits, MoltenVK's
ballot/reduce saw only the lanes a narrowed EXEC left on and produced
the EXEC value instead of the frozen mask word (cs_mask_vgpr_exec).
mask_word_read_ok now gathers only when a CFG must-analysis
(mark_exec_state) proves every lane that can hold a set bit of the
mask is EXEC-active at the read: each EXEC half is tracked as clean,
a constant mask, or an unknown narrowing (s_mov/s_cselect resolve
constants, saved-EXEC aliases and unchanged EXEC, so the common
restore idioms still gather), and mask_exec_sigs records every EXEC
state seen while each mask register held a mask. Unproven reads keep
this lane's 0 / ~0 bit, the pre-change answer.
- Scalar number ops read a lane mask operand as data too
(MASK_NUMBER_READERS, #1043's NUMBER_READERS): s_add_u32 s20, s10, K
after v_cmp wrote s10 yields the wave's mask word, while mask moves
and mask logic ops keep this lane's bit for the saveexec idioms.
- wave64_emulate_opt treats ins["mask_words"] (a mask read that will
gather) as a cross-lane exchange for the lane-local fold planner and
barrier scheduler, covering the scalar readers as well.
- test_slot67_operand_forms' expectedFailure comes off: the packed
vcc_hi word now reaches the data read.
Co-Authored-By: Devin <noreply@cognition.ai>
A lane mask (EXEC/VCC or a mask-tracked SGPR) that a VALU op reads as a
32-bit value — v_mov_b32 of it into a plain VGPR, or any VALU source
where the mask is data rather than a mask operand — materialized each
lane's own 0 / ~0 bit. Hardware holds the whole wave's mask word there
(tools/crosslane_fuzz.py's op_maskdata model: the uniform word written
to the active lanes), so every lane gets the word, the same in each.
- src_u materializes the wave mask word (lane_mask_word) for SGPR and
EXEC/VCC operands when the instruction's VGPR destination makes the
read a data read (mask_read_is_data); SGPR/EXEC/VCC destinations keep
this lane's bit, which mask_src readers rely on. Mask-holding VGPRs
already store the word, so their reads are plain loads.
- mask_src extracts this lane's bit back out of a mask-holding VGPR
(_vgpr_mask_lane_bit), half-aware in wave64 via mask_half.
- mask_data_src keeps instructions that materialize the word out of
EXEC-gated active runs (a subgroup op can't sit inside if (active)).
- v_readfirstlane_b32 of a mask VGPR broadcasts the first active lane's
copy — the only lane guaranteed fresh after an EXEC-gated v_mov_b32 —
as the word itself into a VGPR destination (VGPR writes are never
mask-tracked), or this lane's bit for a mask-tracked SGPR/special
one; fixes cs_wavemask lanes 48-63.
Found by tools/crosslane_fuzz.py (#293). docs/design.md's whole-wave
mask contract updated.
Co-Authored-By: Devin <noreply@cognition.ai>
"B faster" or "B slower" needs the interval to leave 0 out and all pairs but at most one to agree
in sign. No test caught removing the sign part (the verification of #2783 found it): the odd-run
test's interval already held 0. Eight pairs, two against the rest, now give no verdict, and one
against the rest still does.
install_runtime() removed every .runtime-staging-* folder before it
started, including the folder an IncompleteRollback kept as the only
copies of the previous runtime. If the retry also failed, those copies
were already gone. Clean the stale folders only after a successful
publish, so a failed retry leaves the recovery folder in place.
RT-INSTALL-KEEP-RECOVERY.
run.json's dirty leaves untracked files out; a new untracked count says how many there are. The first
second under 2 frames counted from the world's first second, so the arrival's streaming dip was the
run's; it now counts from 60 s in the world, like the median. The longest gap with no frame stays
from the world on: a freeze on pipeline compiles comes right after arrival. The docs say both, and
that world_at_s counts from the gate's start, the precompile included.
Green is current main with the pull request merged. Red is current main plus only the pull request's
tests: its test files, and the hunks of other Rust files that change only #[cfg(test)] items,
committed on the merge base and cherry-picked with a 3-way merge. It runs the touched D3D12 crates'
cargo test and the changed tests/**/test*.py on both sides, in one worktree and one target dir under
the git common dir, and prints per test: red then green, pass on red and fail on green, fail on both,
on one side only, with a verdict and an exit code. docs/testing.md has it next to the fork-CI recipe.
docs/measuring_fps.md tells how to read an A/B (neighbouring pairs, the
effect with its standard error, ABBA after a throwaway run), but the
scripts it named were never in the repository, and testers' two-run
verdicts turned out to be noise.
`abba` takes runs in the order they ran (folders of scripts/game-gate.ps1
or logs), one value a run (its world median frame time: frames within a
run are not independent), pairs neighbouring runs and gives the mean
difference with its standard error and a 95 % t interval, the median of the
differences and how many agree in sign. It needs at least 4 pairs, as many
with A first as with B first, so a linear drift cancels; with 3 runs a side
it fits the side and a linear trend instead. It says "B faster" or "B
slower" only when the interval leaves 0 out and all pairs but one agree.
Gate runs that did not PASS are left out with their pair.
`phases` does the same inside one LEONIDA_AB run, per switch, for the
median frame time and the `A/B counters` line, leaving out pairs of blocks
whose draws a frame differ by more than a tenth. `plan` prints a balanced
order. Numbers only, never log text.
Testers ran in-game gates and A/Bs by hand on five machines, each with
their own launcher wrapper and log parsers, and lost runs to consoles and
key files. scripts/game-gate.ps1 runs leonida.exe through the checkout's
play-d3d12.ps1 and writes one folder per run: run.json, launch.ps1, the
-DryRun settings, the F1 settings file, the launcher's output (the
precompile lines nobody kept), the runtime's log, events.jsonl and a copy
of the tester's data template (their own saves are never touched). It
stops the game with WM_SYSCOMMAND/SC_CLOSE (the runtime's own end: suspend,
pipeline cache saved) once -WorldSeconds were spent in the world, on a
STOP file or after -MaxMinutes, and kills it only 60 s later; it keeps the
game's exit code. `start` runs the same detached (created through CIM, so
an agent's or console's end does not end it); `stop` asks a run to end.
tools/game_gate.py (standard library) reads the folder into
summary.json (leonida-gate-summary/1): build, card, settings (the run's
settings line, no paths), precompile counts, time to the world (two frame
lines with 500 draws or more, cutscenes included), when the pipeline
cache went warm (60 s with nothing being made), fps from the presents
(median, p5, frame p95, end median, the first second under 2 frames, the
longest gap with no frame), crashes by kind (device lost, panic, fault by
module kind), exit, stop and a verdict: PASS needs 300 s in the world,
no device loss, panic or fault, no gap over 10 s, alive at the stop. The
testers' answers to a draft on the bridge are folded in. Its tests use
synthetic logs and check that the runtime still writes what it reads.
The reviewers' red test: with this entry on main,
test_switched_tools_import_the_helper_and_define_no_copy fails with
"'from report_paths import same_report_path' not found"; with this branch
it passes.
merzleckeier measured it on CachyOS: --skip-existing --jobs 1 left 0 of 3
existing outputs alone, --skip-existing --jobs 2 rewrote 3 of 3. The submit call
passed export_bank four arguments where the serial call passed five, so the
flag never crossed into the pool. The unit test above it calls export_bank
directly - the function, not the CLI - which is why the plumbing was not
covered; the new test runs the tool as a subprocess for --jobs 1 and 2, freezes
an output, and carries its own control (the same command without the flag must
rewrite the frozen file).
merzleckeier forced the schedule on Windows (#2759): with ThreadingHTTPServer's
daemon handler threads, server_close() returned while the handler still held
art.jpg, so ignore_cleanup_errors only hid it and left the file behind. With
daemon_threads = False, server_close() joins the handlers, which close their
files first; the folder's removal is strict again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FetchTests made their temporary folders with 'with', so they were removed when
the test body ended, before the cleanups stopped the test's HTTP server; on
Windows the handler thread could still hold art.jpg open and the removal failed
with PermissionError [WinError 32] (seen on #2724, #2734 and #2754). The folders
are now made with enterContext before the server, so the server stops first, and
with ignore_cleanup_errors=True.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Applied from merzleckeier's follow-up (f9456e020), unchanged: the two render()
calls use the parent's numpy and Pillow, and the three CLI validation checks
finish before the child needs numpy, so all five should run rather than skip.
The two PNG preview subprocesses need Pillow in the child, which the isolated
probe now checks.
Written with an AI assistant.
test_each_sibling_importing_tool_starts skipped a NUMERIC list when numpy was
missing, but it asked find_spec in this process while the tools run with -I, so
the skip never fired here; and a list of names cannot cover calibrated_texture
and tex_export, which are not numeric themselves and import one that is.
The probe now matches how the tools run, and a child that fails with
"No module named 'numpy'" is skipped rather than failing the startup check.
Measured on main b8bd37111, Windows 11, Python 3.13: 2 failed, 2 passed,
218 subtests before; 2 passed, 214 subtests after (the four are the two
numpy-dependent subtests, skipped). With numpy visible to -I nothing changes.
Written with an AI assistant.