Commit Graph

18350 Commits

Author SHA1 Message Date
b1ef6eac3a Copies in the card's memory may be settled instead of merged under the flights' writes (LEONIDA_MERGE_CARD_COPIES)
After voidopcode/vilocity ccb27fd (GPL-3.0): in its night walks with every frame looked at, the merge of the
title's bytes into copies in the card's memory under the flights' writes was what tore moving cars, trailers and
people into big flat triangles for single frames (3 of 1,322 frames merged, 0 of 1,032 settled; 0 of 2,331 in a
longer walk); the same merge into copies in the PC's memory was not; and the merge made a frame 16 ms shorter there.
LEONIDA_MERGE_CARD_COPIES=0 (and LEONIDA_MERGE_PC_COPIES=0; both A/B-able, on by default) settles that kind of
copy in Shadow::merge_under_writes, with its own reason in the stale-reason log.

AI-assisted (Claude). Tested on an RTX 4060 Ti (driver 616.64): builds with and without diagnostics; its cost and
the tears to be measured in game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 15:06:00 -05:00
923dc26741 mods: gate_driver takes a run from the menus into the world (D3D12-GATE-DRIVER-MOD)
A Lua mod for in-game gates and A/Bs: it presses Enter through the title's menus only once frames
have moved on since the last press, shows control by holding W (the player must walk 1 to 30 m in
3 s; more is the title placing the player, which it waits out without a press), then stands still
(idle) or walks a fixed loop (roam). It logs GATE PRESS/PROBE/CONTROL/MARK/SHOT/FAIL lines with
distances only, never a position. It ships disabled; a run enables a copy with LEONIDA_MODS and
needs LEONIDA_GAME_ACTIONS=1 for the player's position.

The logic is in driver.lua and takes the calls it uses as an argument, so leonida-lua's tests run
it on a stub with a simulated clock: menus, control, roam, no position, no control, a jump.
2026-11-30 21:02:29 +01:00
c05f43403a docs: measuring_fps names no file of another pull request
test_docs_repo_paths failed: docs/measuring_fps.md named scripts/game-gate.ps1, which only #2782 adds.
Name the game gate's run folders instead, here and in the tool's docstring.
2026-11-30 20:57:07 +01:00
22e096e479 docs: the gate's command example names no play-script switch as its own (review)
test_docs_cli_flags read the -SeriesS -NoFrameGen inside -PlayArgs '...'
in the fenced command as flags of game-gate.ps1. The block now shows a
placeholder, and the text gives the example.
2026-11-30 20:52:03 +01:00
bd5abe5f32 Diagnostics: a view placed in the memory of a texture the card wrote is reported whatever copy-back says
LEONIDA_COPY_BACK brings back only textures the title fills; a texture the card renders to or an upscale writes
(the black world of DLSS on Series X) is not copied back, so the lead of a placed view in its memory, filled from
title memory the card never wrote, is looked for in every run now.

AI-assisted (Claude). Tested on an RTX 4060 Ti (driver 616.64): builds with diagnostics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:47:39 -05:00
0f86bd594f Merge remote-tracking branch 'origin/main' into push/main-1130 2026-11-30 14:46:52 -05:00
87dea59b63 Findings: three list threads against eight on a six-core processor; where DLSS's output goes on Series X
AI-assisted (Claude). Tested on an RTX 4060 Ti (driver 616.64), Ryzen 5 7600X: runs d246 to d251.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:46:50 -05:00
76b543a097 tools: d3d12_ab_compare reads an A/B of the D3D12 runtime (D3D12-AB-COMPARE)
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.
2026-11-30 20:44:09 +01:00
b535fb0dc3 d3d12: an in-game gate: one command, one run folder, one summary.json (D3D12-GAME-GATE)
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.
2026-11-30 20:39:48 +01:00
d99ba5c095 Merge main: drop the macos job as main does, keep this PR's runtime.yml path filters
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 20:24:47 +01:00
51dbc5b58e Merge pull request #2674 from bobcatchris/fix/d3d12-pipeline-cache-concurrent-publish
D3D12-PIPELINE-CACHE-CONCURRENT-PUBLISH: tolerate Windows AccessDenied on concurrent cache publish
2026-11-30 20:20:00 +01:00
968aa17539 Diagnostics: every present's time with LEONIDA_FRAME_TIMES=<file>
The frame-rate line averages five seconds, and what a player feels as a stutter is single long frames. With
LEONIDA_FRAME_TIMES=<file> each present's number and time (microseconds since 1970) is appended as a line
"<frame> <us>", a second's worth at a time, without recording any picture.

AI-assisted (Claude). Tested on an RTX 4060 Ti (driver 616.64): builds with diagnostics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:12:44 -05:00
40a97ef09f Merge main (both new tests kept)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-30 13:12:17 -06:00
9a6913f4b0 Diagnostics: the upscale's output and the title textures placed in its memory
For the black world of DLSS on Series X: the first three upscales log the output's title memory and every title
texture whose memory overlaps it (resource::textures_overlapping), through which later passes may read what the
upscale wrote into the output's host copy alone.

AI-assisted (Claude). Tested on an RTX 4060 Ti (driver 616.64): builds with and without diagnostics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:01:46 -05:00
2e78c2ab46 Merge main (cross-block loads' tables take the multiply hash too)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-30 12:49:26 -06:00
e9b2529a96 tests: list meshlet_page in SHARED
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.
2026-11-30 19:43:24 +01:00
ef82195675 meshlet_page: ask report_paths for the report-path guard 2026-11-30 19:43:23 +01:00
6c4474cfde Merge main 2026-11-30 12:38:32 -06:00
f48d2db7f9 d3d12: skip the lane-parking scan for programs with no lane save or restore, and walk register sets by word
`unspill` decodes the fields and the effects of every instruction to find scalars
parked in VGPR lanes, though most programs have no `v_writelane_b32` or
`v_readlane_b32`; it now returns at once for those. The scan itself is unchanged
for the rest (`unspill_scan`).

`members` (the register sets `rename` walks for every block) stepped through all
513 registers testing a bit each; it now takes the set bits a word at a time, and
`rename` sizes each block's live-out list once.

Measured on a full-archive `leonida translate` (mimalloc build, 16 threads, four
interleaved pairs against main): CPU 655.2 s -> 645.7 s (-1.5 %, three pairs of
four lower), wall unchanged within noise (median 50.0 s vs 49.9 s). The DXIL of
all 25 689 programs is identical to main's (blake3 of each, five runs).

New test: `unspill` leaves a list with no lane save or restore alone, and finds
the same parks as the scan for lists that have them; it fails if the early-out
skips a list that has one.

AI-assisted: Claude Sonnet 5.5
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-30 12:38:32 -06:00
58db554c7d d3d12: a test runs leonida and finds the settings line in its log (review)
The unit tests of settings_line could only fail on main by not building.
This one runs the built binary on a title that does not exist, with two
LEONIDA_ settings, one a folder, and reads its log: on main there is no
settings line and it fails by assertion; with the change the line names
both settings and shows the folder only by its length.
2026-11-30 19:32:01 +01:00
22d58b8629 Merge upstream main into the PR branch 2026-11-30 18:31:59 +00:00
4c36dba7cb d3d12: LEONIDA_AB tells the frame lines' counters by arm (D3D12-AB-COUNTERS)
LEONIDA_AB compares switch settings by turns in one run, but its phase
lines carried only frame times, the card's idle time and the submitting
thread's work: an A/B could not split by arm the time spent changing memory
protections, refreshing, or waiting. The frame lines' counters (watch's
ASKS and FAULT_ASKS, host's SPLIT) were emptied with swap(0) by the frame
line, which runs on its own thread at its own pace, so a phase could not
read them.

They are now running totals, never reset; no writer changes. The frame
line takes what came since its last take (ab::take, a fetch_max on a
second array, so two takers never count the same amount twice) and prints
the same numbers. Each A/B phase snapshots the totals where it reads the
card's idle time and logs one more line, "A/B counters phase N bits b:",
with each counter that moved, per frame, named next to its array
(nanoseconds as ms). Diagnostics builds only, as before.
2026-11-30 19:29:57 +01:00
8f41d7d019 Merge pull request #2757 from zmasi/fix/d3d12-twin-bias-rdna3
d3d12: guard biased raw twins against sub-dword offsets and 32-bit wrap (D3D12-TWIN-BIAS-RDNA3)
2026-11-30 19:28:27 +01:00
4da7792521 Merge pull request #2685 from bobcatchris/feat/d3d12-shader-1d-wave-base-no-ticket
D3D12-SHADER-1D-WAVE-BASE-NO-TICKET: skip entry ticket barrier and LDS atomic for 1-D groups
2026-11-30 19:28:11 +01:00
8c8ab1783f Merge pull request #2684 from bobcatchris/feat/d3d12-shader-opt-cross-block-loads
D3D12-SHADER-OPT-CROSS-BLOCK-LOADS: propagate LOADS across write-free dominating blocks
2026-11-30 19:27:55 +01:00
aec6998a9d d3d12: the translator's test modules are no part of the shader cache key (D3D12-SHADER-KEY-NO-TESTS)
leonida-shader's build script hashed every .rs file of the crate, its
*_tests.rs modules included, into LEONIDA_SHADER_SOURCE_HASH, and since
0baa9278c that hash is part of the shader cache key
(translation_fingerprint). A pull request that only adds a translator test
made every player and tester translate all shaders again at the next start
and make their early pipelines again, which 69837e53a had ruled out for
leonida-gpu's own fingerprint. The switch-name scan in the same script also
put the switches only tests read (LEONIDA_DIFF_ONLY, LEONIDA_EMIT_DUMP,
LEONIDA_CONSOLE_DXC, LEONIDA_PROBE) into the key.

The build script now leaves *_tests.rs out of both. Each of those modules
is declared under a cfg with test, so none changes what the translator
emits. Three portable tests: the hash recomputed without the test modules
equals the built one; test-only switches are out of the key and the
translator's own are in; every `mod *_tests;` is test-only.
2026-11-30 19:20:58 +01:00
6cdc0a0d13 Merge remote-tracking branch 'origin/main' into push/main-1130 2026-11-30 13:18:51 -05:00
f7857c4d6f Findings: the NaN-exact compares in the game: no new refusals, no pipeline waits after the first start, the card's time the same
AI-assisted (Claude). Tested on an RTX 4060 Ti (driver 616.64), Ryzen 5 7600X: tours d240 to d242 against d233.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 13:18:48 -05:00
4d18c0d3b4 d3d12: a run logs the LEONIDA_ settings it starts with (D3D12-RUN-SETTINGS-LINE)
A tester could not show from a run's log that a switch was on. `leonida
run` now logs one line, under the `settings` target, with every LEONIDA_
variable present, sorted, as NAME=value. A value with any character other
than letters, digits, space and ._,:+=*- (a folder, which names the user,
a file, a command line) shows only its length, so posted logs carry no
path; one longer than 120 characters is cut. Names that came from an older
VICTORY_ name say so. `LEONIDA_LOG=warn,settings=info` keeps the line on
its own.

It says what a run was started with, not that the code read it.
2026-11-30 19:08:50 +01:00
6bbaeed111 D3D12-SHADER-ITE-LOSSY-MEMO: keep the results of Bools::ite in a table that forgets (-12 % of full-archive translate time)
`Bools::ite` kept every result in a hash map. A result depends on its
triple alone, and the nodes made on the way to it stay in the diagram, so
a result that is asked for again after it was dropped finds those nodes and
makes none: the table can forget without the diagram changing. It is now a
set-associative table of four 16-byte entries to a cache line (the newest
of a set first), which doubles, keeping what it holds, while the diagram
has more nodes than it has entries. A lookup touches one line, and nothing
is rehashed as the table grows.

`Bools::mk` also makes a new node with one probe of its table (`entry`)
where it looked the key up and then inserted it.

Measured on a full-archive `leonida translate` (16 threads, mimalloc
build), four interleaved pairs against main: wall 47.1 s -> 41.2 s, CPU
(user + kernel) 654 s -> 574 s. The blake3 of every emitted DXIL (25,689
programs, 15,799 distinct) is the same as main's in all four runs. On the
system heap the same pairs show no change (six pairs, CPU +0.5 %).

Tests: the table keeps the newest of a set and forgets the rest, grows to
its limit and keeps what it holds, and a diagram whose table holds four
entries gives the same nodes, in the same places, as one with room for
all, and every function holds where the one it stands for does.

AI-assisted: Claude Sonnet 5.5

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-30 12:00:55 -06:00
52ed0b51a8 awc_opus: pass skip_existing into the parallel workers
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).
2026-11-30 18:58:49 +01:00
ad36782c6d Merge pull request #2622 from TheGeogeo/d3d12-pipeline-wait-queue
d3d12: a pipeline a frame waits for goes before those asked for earlier (D3D12-PIPELINE-WAIT-QUEUE)
2026-11-30 18:51:24 +01:00
afb511541e Merge pull request #2613 from TheGeogeo/d3d12-frame-time-stats
d3d12: frame-time percentiles and what stalls frames, in the log and on the panel (D3D12-FRAME-TIME-STATS)
2026-11-30 18:39:25 +01:00
a4fcebbf1d Shader translator: float compares and the NaN scrubs tell a NaN by its bits (LEONIDA_NAN_EXACT, on)
The NVIDIA driver compiles DXIL under fast math and may fold a float compare's NaN case away. The title's NaN
guards are such compares (v_cmp_u_f32 x, x; v_cmp_neq_f32 x, x), lowered to fcmp uno / une; a NaN that passes
one reaches the temporal filters, where it spreads as black blocks that grow frame by frame. Every
v_cmp_*_f32 / _f16 but f and tru now tests both operands with the integer check is_nan_f32 already used
(|x| > the bits of infinity): ordered compares are the ordered compare and no NaN, unordered ones the ordered
compare of their sense or a NaN, o and u the NaN test itself, so no unordered fcmp is left. The NaN of
v_cvt_u16_f16 / v_cvt_i16_f16 is found the same way, and so are the NaN and infinity tests of the scrub of
colours and image stores (LEONIDA_NAN_SCRUB), which were unordered compares too. LEONIDA_NAN_EXACT=0: as
before. The shader cache keys on the switch (translation_fingerprint).

Ported from voidopcode/vilocity 598050b (INFIERNOXIII, GPL-3.0-or-later; after the Whiplash-NVIDIA team's
nan_exact), written into Leonida's lower.rs; the scrubs are ours.

Test: float_compares_with_nan_on_the_device (the fourteen compares other than f and tru against quiet,
signalling and negative NaNs, infinities and signed zeros, on the RTX 4060 Ti and WARP; f and tru are left out:
WARP's device is removed at a dispatch of an fcmp false). The existing NaN tests (v_cmp_lg, med3, the 16-bit
conversions, the scrub's integer bits, division fixup) pass with the switch on. docs/switches.md made again.

AI-assisted (Claude). Tested on an RTX 4060 Ti (driver 616.64) and WARP: the named tests above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 12:39:08 -05:00
99167bcaf3 Merge pull request #2737 from OreoFR/carry/pr-2062
reprend #2062: d3d12: say when the driver's pipeline cache stops keeping new pipelines (RT-PIPELINE-CACHE-GROWTH-STALL)
2026-11-30 18:38:24 +01:00
f0143cd5ff Merge pull request #2732 from OreoFR/carry/pr-2173
reprend #2173: d3d12_xs: say so when LEONIDA_D3D12=vulkan is asked of a runtime built without the Vulkan device (RT-VULKAN-REQUESTED-NOT-BUILT)
2026-11-30 18:37:45 +01:00
db9f497bb0 Merge pull request #2725 from OreoFR/carry/pr-279
reprend #279: d3d12: min/max samplers honour filterMinmaxImageComponentMapping (D3D…
2026-11-30 18:37:03 +01:00
12b3740a15 Merge remote-tracking branch 'origin/main' into push/main-1130 2026-11-30 12:32:55 -05:00
8cc104d6ed Findings: the title's compute queue holds about 1.6 ms of the card's work a frame
Each list of a standing frame's operations given the queue it was submitted to, and each operation weighed by its
kind's card time in a timing run: the drawing queues about 50 ms, the compute queue 1.6 ms. Running the compute
queue beside the drawing one, as the console does, could overlap no more than that.

AI-assisted (Claude). Tested on an RTX 4060 Ti (driver 616.64), Ryzen 5 7600X: run d239 against timing run d183.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 12:32:52 -05:00
ad25611b53 Merge pull request #2729 from OreoFR/carry/pr-220
reprend #220: d3d12: validate CreateShaderResourceView descriptors (reopens #5275)
2026-11-30 18:16:12 +01:00
e319e63250 Merge pull request #2758 from OreoFR/test/vk-gpu-profile-paravirtual-no-stamps
vk_gpu_profile_test: skip the per-pipeline checks, and say so, when a paravirtual GPU resolves no timestamp
2026-11-30 18:15:49 +01:00
efe695aa91 Merge pull request #2738 from OreoFR/carry/pr-2031
reprend #2031: runtime: harden submit_phases period parsing and skip Scope overhead when disabled
2026-11-30 18:15:34 +01:00
cee1cb1d31 Merge pull request #2735 from OreoFR/carry/pr-2016
reprend #2016: runtime: guard null and invalid sizes in value_write_sink and add unit tests (RT-VALUE-WRITE-SINK-GUARDS-AND-TESTS)
2026-11-30 18:15:17 +01:00
149e3835f3 Merge pull request #2716 from OreoFR/carry/pr-1050
reprend #1050: runtime: replay the console list's inline records as their vtable calls (BL-3)
2026-11-30 18:15:03 +01:00
1d4949d586 Merge remote-tracking branch 'origin/main' into push/main-1130 2026-11-30 12:03:09 -05:00
bad1aec475 Findings: frame generation costs a rendered frame about 6 ms on this card
By turns of 4 s standing at 1440 lines with no frame limit (run d237, LEONIDA_FG_TURNS): the frame +5.82 +-0.43 ms
by medians, p90 +10.25, the card +6.76, with DLSS 4's generator (nvngx_dlssg 310.9.16).

AI-assisted (Claude). Tested on an RTX 4060 Ti (driver 616.64), Ryzen 5 7600X: runs d236, d237.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 12:03:07 -05:00
e7b9959c55 d3d12: give host sampler heaps every slot the shaders can reach
Shaders clamp a sampler index to 2,047 (leonida-shader emit/shader.rs:
"not the bound heap's own count, which a title heap smaller than 2,048
would need"), but HostHeap::new made a sampler heap with exactly the
title's count. With a title sampler heap of fewer than 2,048 samplers, an
index between its count and 2,047 (a number read from memory the host has
not got yet) read past the end of the host heap.

A host sampler heap now always has 2,048 slots; fill_null already makes
every slot a null point sampler, so the slots past the title's count read
as that. The title's own count is kept (up to 2,048): unlike the sibling
tree's version, slot 2,047 is not taken from a title heap that uses it,
since any clamped index now lands inside the heap anyway.

Test: sampler_heaps_have_every_slot_the_shaders_can_reach (a 16-sampler
title heap gets 2,048 host slots and keeps count 16; a 2,048 one keeps
2,048). On main it fails: the 16-sampler heap has 16 slots.

After ESAT's fix in the sibling VIctory tree (TaynanGT/Vice-Tay dd67ae7,
GPL-3.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 17:56:52 +01:00
d6ad919983 Frame generation by turns: Streamline is started by the setting alone
The start (fg::wanted, read once) went through the A/B pick, so a run whose first phase had LEONIDA_FG_TURNS off
never started Streamline (run d236 measured nothing). The pick now changes only the amount at each present.

AI-assisted (Claude). Tested on an RTX 4060 Ti (driver 616.64): builds with and without diagnostics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 11:50:50 -05:00
7663c34fcf Merge pull request #2739 from OreoFR/carry/pr-2029
reprend #2029: runtime: guard overflow/div-by-zero and remove duplicate passes in d3d12_xs_alloc_size
2026-11-30 17:50:48 +01:00
6dbbe6df5a Merge pull request #2759 from OreoFR/test/launcher-serve-fetch-cleanup
tests/test_launcher_serve: stop the file server before removing its folders (WinError 32 flake)
2026-11-30 17:50:29 +01:00