Commit Graph

125 Commits

Author SHA1 Message Date
43af833d19 Merge remote-tracking branch 'origin/main' into carry/hwrt-2972
# Conflicts:
#	d3d12/docs/switches.md
2026-12-02 07:40:14 +01:00
daf7242f2e Merge remote-tracking branch 'origin/main' into carry/hwrt-2972
# Conflicts:
#	d3d12/scripts/play-nvidia.ps1
#	scripts/play-d3d12.ps1
2026-12-02 06:57:33 +01:00
5b005f8bb9 d3d12/docs/switches.md: list LEONIDA_FSR_MAX_SCALED
The merge queue's tests found the page out of date once this branch met main.
Regenerated with tools/d3d12_switches.py after merging main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 06:31:19 +01:00
4ccf3fed82 Merge pull request #2811 from thiefyzheng/docs/benchmark-4060-laptop-8gb
PORT-BR-DOC-4060-LAPTOP: port 8 GB laptop benchmark note
2026-12-02 00:48:02 +00:00
5a8e1db178 Merge remote-tracking branch 'origin/main' into d3d12-hardware-ray-tracing
# Conflicts:
#	d3d12/crates/leonida-gpu/src/descriptor/host.rs
#	d3d12/docs/switches.md
2026-12-02 01:20:51 +01:00
3a38a050d8 d3d12 hwrt: review addendum (one capability gate, AABB strides, TLAS layout, copy modes)
- One gate for both halves: supported() also asks for shader model 6.6, and the translator is
  told inline ray tracing runs (set_host_inline_rt) only once the DXR manager is made.
- AABB geometries take stride 0 (packed 24-byte boxes) and multiples of 8 of 24 or more, as
  DXR does; others are refused.
- A TLAS of instances by pointer (ARRAY_OF_POINTERS) is not built: the remap reads 64-byte
  instances in a row.
- Structure copies other than clone and compact are not done (said once).
- A TLAS clone points the heap slots that view the destination at the shared structure.
- The points not fixed here are listed in fork-ray-tracing.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 00:40:30 +01:00
9cedb84c93 d3d12 hwrt: review fixes (transform opcodes, no hardware path without DXR 1.1, cleanup)
- rq_op: 187 is CandidateWorldToObject3x4 and 188 CommittedObjectToWorld3x4 (they were
  swapped; checked against dxc 10.0.26100). the_ray_query_opcodes_are_dxils pins all 35.
- Hardware ray tracing runs only where it can: hwrt::active() (asked for, and a DXR 1.1
  manager made) gates the HLE module, the left-out passes, the copy-back rule and the counters;
  the translator lifts loops only when the host says it runs inline ray tracing
  (set_host_inline_rt, in host_settings and so in the shader cache's key). Elsewhere the title
  keeps its own XboxBvhBuilder.dll and the software walk.
- No env write: builder_allowed() is LEONIDA_BVH_BUILDER=1 and not hwrt::active().
- dxr.rs removed (nothing bound its wrappers); TLAS views are kept out of the list views only
  with the path on; the off16 diagnostics and the xmem log lines are gone.
- as_sizes split out of alloc_or_reuse_as, with a test; the known gaps are in
  fork-ray-tracing.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 00:01:01 +01:00
7c69bc8b19 d3d12: the threads of a frame share its pipeline wait budget and none is left with nothing (D3D12-COLD-START-SKIPS)
The shared frame budget was a reservation: the first recording thread to
wait in a frame took all that was left of it, and every other thread of
that frame (and any thread still on an older frame) got nothing, so its
draw went out without a wait and was dropped as not made. On first starts
(no pipeline book) 400 to 3,600 draws, dispatches and indirect executions
a frame were dropped at the arrival in the world, and the character's
head, drawn by a pass the title runs once, stayed missing for the run.

- The frame's waits are counted once over the threads that wait at the
  same time: what passed while at least one thread waited. A thread that
  begins to wait while others do is left what is left at that count, so
  waits that overlap still cost the frame its budget once; the time a
  thread records between two waits is not counted; a thread on an older
  frame joins the current frame's waits and opens no budget of its own
  (#2601). On by default; LEONIDA_PIPELINE_WAIT_DEADLINE=0 reserves the
  frame's budget as before (no effect with LEONIDA_PIPELINE_WAIT_SHARED=0);
  LEONIDA_AB can turn it while the title runs.
- A pipeline's own budget (LEONIDA_PIPELINE_WAIT_ONCE) is charged the same
  way, the real time once, not the threads' times added up, whatever the
  sharing of the frame's budget (LEONIDA_PIPELINE_WAIT_ONCE=0 turns that
  budget off).
- The queue a wait moves its pipeline forward in and the budget a
  pipeline's waits count against are passed in, so that tests cover them;
  one line tells the rules in use at the first wait.

AI-assisted: Claude Code (Claude Opus 5.5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 23:10:50 +01:00
3fdfbaa46f d3d12: hardware ray tracing on DXR 1.1 (LEONIDA_HW_RT, off: a trial)
In place of -RayTracing (the title's structure builder and software traversal as translated
shaders): the title's XboxBvhBuilder calls become host DXR 1.1 bottom and top levels, and the
traversal loops of its trace programs become inline ray queries.

Ported from trustno1-coder/VIctory-NVIDIA (its #3706; from Leslie-d-a/VIctory-NVIDIA-HWRT 61e389e0
and 5f55bca8, original by dakisback2 ecc49d5b and 72f8316a), GPL-3.0, and fitted to this tree:

- leonida-shader: emit/rayquery.rs wired into lower.rs (the plan, the handles, TLAS root SRVs
  t230..t241, the analyses that leave the lifted loops out). A program in the paired form is not
  lifted. With LEONIDA_HW_RT=1 the node test of a loop left unlifted misses every node
  (emit/intersect.rs bvh_miss): the console structures are never written then.
- leonida-gpu: hwrt.rs (and dxr.rs for its records); list::external with a LEONIDA_THIN op for the
  structure work at its place in a title list; the TLAS views in the descriptor heaps;
  Deferred::held; the ray queries in the shader cache's entries; counters in the frame log.
- leonida-hle: modules/xboxbvh.rs replaces the exports of the title's XboxBvhBuilder.dll when on.
- With it on the light stand-in stands aside and the passes left out without structures run.
  Shader writes are not all copied back as VIctory-NVIDIA does (LEONIDA_HW_RT_COPY_BACK=1 asks for
  it): here that stretched and flickered textures and cost 30 to 45 ms a frame.
- F1: HARDWARE RAY TRACING (TRIAL); play scripts: -HardwareRT (frame generation left off with it,
  as with -RayTracing); launcher: a checkbox. Docs: fork-ray-tracing.md, README.md, switches.md.

One PC (RTX 4070 12 GB, driver 621.40, Series X profile, no frame generation): 22 to 25 frames a
second against 6 with -RayTracing; the run ended after six minutes with the card's memory full.

Co-authored-by: dakisback2 <90546900+dakisback2@users.noreply.github.com>
Co-authored-by: Leslie-d-a <70692092+Leslie-d-a@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 23:04:12 +01:00
597e2d9226 Merge remote-tracking branch 'origin/main' into reaper-bounded-queue
d3d12/docs/switches.md regenerated with tools/d3d12_switches.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 18:30:24 +01:00
7be7711c8e Merge remote-tracking branch 'origin/main' into reaper-bounded-queue
d3d12/docs/switches.md regenerated with tools/d3d12_switches.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 18:12:31 +01:00
fe612066ac gpu: drop neon green and blue garbage from the probe resolve on request
The light pass already drops magenta from what the title's probe resolve
left (LEONIDA_AMBIENT_MAGENTA, on). LEONIDA_AMBIENT_GREEN=1 drops a green
far above red and blue, LEONIDA_AMBIENT_BLUE=1 a blue far above green and
above red, with the thresholds of lobomfz/VIctory-xmem 5a60834 (from
coastingVI via dfmbrollins/victory-linux-nvidia, GPL-3.0).

Both are off by default: the garbage was seen on Linux with RADV, not yet
on a Windows driver, and a strongly green or blue light that is real would
be dropped too. A new test compiles the part with every drop on and off;
it fails when a define the shader reads is missing.

On an RX 6800 (Windows 11, driver 32.0.21030.2001) with both on, a
save loaded into the world: the light passes were made with the drops
compiled in, and the picture showed nothing wrong over about 4 minutes.
No frame was compared with them off.
2026-12-01 12:02:15 -05:00
2d769e5f46 hle: skip the title's Bink movies on request (LEONIDA_SKIP_BINK)
LEONIDA_SKIP_BINK=1 skips the movies that play once (logos, the intro);
=all skips the looping ones too (menu backgrounds, which then stay dark).
Unset, nothing changes and no import is bound anew.

The title's Bink DLL still opens every movie. The exports a player loop
calls on an open movie (BinkWait, BinkDoFrame*, BinkNextFrame, BinkGoto,
BinkShouldSkip, BinkClose) are bound to wrappers that put a skipped movie
on its last frame and keep it from reaching the DLL, so the title's own
end-of-movie check closes it. The executable's imports and those of DLLs
the title loads later go through the wrapper; GetProcAddress does not.

The technique is from fxceless/victory-fork (pull request 613, by
C-GDev), as carried by trustno1-coder/VIctory-NVIDIA and
lobomfz/VIctory-xmem 0a4aadf (GPL-3.0); written anew for this loader.

Checked on an RX 6800 (Windows 11, driver 32.0.21030.2001): with =1 all
eight wrapped exports the executable imports from Bink2Scarlett.dll are
bound to the wrappers. Booting with no save and pressing Enter, the first
movie (3840x2160, 450 frames, not looping) was skipped and the title went
on to its setup screen. The unit test fails when the wrappers are not
bound.
2026-12-01 11:48:05 -05:00
c648ec4bdf Merge remote-tracking branch 'origin/main' into fix/ahead-split-kept-thread
# Conflicts:
#	d3d12/docs/switches.md
2026-12-01 17:03:17 +01:00
49ef42d706 Merge remote-tracking branch 'origin/main' into reaper-bounded-queue
d3d12/docs/switches.md regenerated with tools/d3d12_switches.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 16:30:27 +01:00
d096ddc728 switches.md regenerated: LEONIDA_WINDOWS_BAR_LINE, LEONIDA_WC_SUBRANGE_NO_BACK on by default
AI-assisted (Claude).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 10:23:56 -05:00
51fbf718ba The write-combined part of a mixed copy is left out of the copy-back by default (LEONIDA_WC_SUBRANGE_NO_BACK on): the card and the submitting thread 1 ms a frame lighter each
- shadow.rs: wc_subrange_no_back (f85d1790a, by hardly-relevant) is on
  unless LEONIDA_WC_SUBRANGE_NO_BACK=0. The copy the compares behind
  submissions go over most, 147 MB of the 32-bit graphics heap four times a
  frame, spans its 47 MB write-combined part (0x2404) and its 100 MB cached
  one; the whole-copy rule (LEONIDA_WC_NO_BACK) never took it.
- findings.md: the measurements.

Standing at the waterside save, Series X, 1,080 to 1,440 lines, no
generated frames, by turns of 4 s (run d317, 55 phases): the card busy
-0.99 +-0.40 ms a frame, the submitting thread -0.99 +-0.40, the frame's
median -0.68 +-0.61, means -0.48 +-0.68. Recorded tour (d318, 581 frames):
49 frames with one-frame cells, 79 cells, all where the camera swings, as in
the tours before; nothing torn.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: the runs
above; cargo check with diagnostics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 10:23:47 -05:00
ecaa291d5b Title memory windows' line in card memory the CPU maps can be set (LEONIDA_WINDOWS_BAR_LINE, 80 by default); notes on windows up to 6 GB and the paired form for the heaviest passes
- shadow.rs: window_mapped_for stopped making windows in card memory the
  CPU maps at 80 hundredths of the card's budget, a fixed line. On this PC,
  where other programs held 4.4 GB of the 16 GB card, the line kept 1.7 GB of
  windows in the PC's memory with a 6 GB cap (run d314).
  LEONIDA_WINDOWS_BAR_LINE sets it (50 to 97), to measure what those windows
  cost read over the bus. Nothing changes without it.
- findings.md: windows up to 6 GB (d314: 39 more windows there, the line
  stopped the rest; PCIe 3.9 GB/s received and 5.1 sent at the median), and
  the paired form for 16 of the heaviest single compute passes (d312 against
  d316: no clear gain, not taken).

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: the runs
named; cargo check with and without diagnostics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 10:22:40 -05:00
955e7d9cf2 Indirect batches stay open past programs that only read through views picked from the heap, by default: 928 clamp passes a frame become about 180, the card 3.7 ms a frame lighter
- draw.rs: LEONIDA_BATCH_HEAP_READS is on unless set to 0. stores_bound
  already says no of every store through a picked view, so the extra rule
  only kept batches from staying open past programs that read through
  picked views: the 934 CS_RaytracingResolve dispatches a frame (and the
  meshlet culling passes, which store their records through views their
  binds declare and now end a batch for those records alone).
- findings.md: the measurements; switches.md regenerated (with the
  switches of the main commits merged before).

Standing at the waterside save, Series X, 1,080 to 1,440 lines, no
generated frames: 175 to 186 batch passes a frame against 928 (run d311
against d275, LEONIDA_BATCH_WHY), 8 of them ended for stores not declared
(793 before). By turns of 4 s (run d310, 53 phases): the frame's median
-2.11 +-0.69 ms, means -1.86 +-0.86, the card busy -3.67 +-0.43, the
submitting thread +0.48 +-0.73. Timing run (d312): the card's timed work
60.5 ms a frame against 63.2. Recorded tour (d313, 520 frames): 37 frames
with one-frame cells, 67 cells, all in fast turns, at the low end of the
tours before; terrain, foliage, the house and the player drawn.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: the runs
above; the batched clamp's WARP tests; cargo check with and without
diagnostics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:49:17 -05:00
a6f835ef0f Merge remote-tracking branch 'origin/main' into reaper-bounded-queue
d3d12/docs/switches.md regenerated with tools/d3d12_switches.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:23:20 +01:00
dd4829ecfc Merge remote-tracking branch 'origin/main' into push/main-1130
# Conflicts:
#	d3d12/docs/switches.md
2026-12-01 07:52:21 -05:00
e12f7f9f9a Notes: NVIDIA's float forms timed, the light stand-in's near-surface switch, the clamp passes' wait; switch list
findings.md: LEONIDA_HOST_FLOAT in timing runs (d294 51.82, d306 51.81 ms of the card's timed work a frame; the
first run after compiling its pipelines, d303, 54.51, the driver's background compiles), left on; LEONIDA_AMBIENT_NEAR
not shown to be needed here (runs d304, d305), left off; the clamp pass waiting only for its record buffers (run
d302) no quicker. switches.md regenerated (LEONIDA_HOST_FLOAT, LEONIDA_AMBIENT_NEAR).

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: runs d302 to d306 (Series X profile, 1440p
output, dynamic resolution from 1080 lines, frame generation off).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 07:51:34 -05:00
96d3ad2082 d3d12: switches.md lists LEONIDA_LIST_LOCK_FAST
Refs #2707
AI-assisted: yes
2026-12-01 02:57:12 -08:00
10d8223336 Notes: join parts 8 against 4, and legacy multiplies as plain products, measured
findings.md: 8 parts of submissions joined against 4 by turns (run d296, 112 phases; ImTaneax/VIctory-RTX3050-4gb
2b3030f joins at most 4 there): the frame the same, the submitting thread 3.18 +-0.32 ms less with 8, so 8 stays.
LEONIDA_LEGACY_PLAIN=1 in timing runs with every pipeline from the library (d294, d297): 51.82 -> 51.25 ms of the
card's timed work, within what two runs of one build differ; left off.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: runs d294, d296, d297 (Series X profile, 1440p
output, dynamic resolution from 1080 lines, frame generation off).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 03:18:03 -05:00
adb8ea4741 Notes: the precompile's notes per executable name, measured
findings.md: library loads as each name (43 s, then 16 s, as leonida_sm.exe; 28 s as leonida.exe for the
same 400), the storm of run d291 with notes by translation alone, and run d293 after the change (4,875
loaded through the library in 61 s; the world at 74 to 110 ms a frame, none loading after two and a half
minutes).

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: runs d291 and d293 (Series X profile,
1440p output, dynamic resolution from 1080 lines, frame generation off).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 02:11:13 -05:00
aefb250844 Merge remote-tracking branch 'origin/main' into push/main-1130 2026-12-01 01:28:25 -05:00
b024e59403 Notes: why the game compiled the precompile's pipelines again, and what was done; the switch list regenerated
findings.md, under the static samplers: the two causes (the precompile's processes had no sampler
places; the driver's cache on disk does not keep what the precompile compiles, about 30 % lost), the
measurements (the card test, 116 of 400 compiled again, run d287's 1,700 in the world, run d289's 3,540
loaded and 74 made after the store), and that forced stops of test runs write neither cache.
switches.md: LEONIDA_WARM_LIBRARY, LEONIDA_NO_WATCHDOG's default, and main's
LEONIDA_CARD_ROOM_FOR_TARGETS_SETTLE_MS.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: runs d287, d288, d289 (Series X
profile, 1440p output, frame generation on).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 01:28:22 -05:00
640b0d0df8 Merge pull request #2802 from bobcatchris/perf/d3d12-gpu-texture-digest-aes
D3D12-GPU-TEXTURE-DIGEST-AES: hash a texture's memory with AES rounds (23.6 -> 108-139 GB/s in cache, 2.9x from memory)
2026-12-01 06:34:39 +01:00
095af0c96e Legacy multiplies can be plain products on any host where the zero rule cannot apply (LEONIDA_LEGACY_PLAIN, off)
The title's programs multiply with v_mul_legacy_f32 (0 x anything = 0): 5,968,915 of them in the 25,734
programs, 13.2 % with a constant against a vector register and 1.1 % against a scalar one. Off the RDNA host every one
became a product, two compares, their or and a select. With the switch, what of the RDNA host's forms holds for any
host's floats goes everywhere: a plain product of two factors known to be finite or with a finite constant that is not
0, and only the finite factor's zero asked where one of two is known finite. A product of a finite factor and a zero
keeps the sign the product gives, as on the RDNA host, instead of +0. Off until measured.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: a new test runs each form on the card and on WARP
over zeros of both signs, ones, tiny and huge values, infinities and no number, against the spelled-out form (the
same but for a zero's sign), and checks that the forms by a constant and of a saturated value are shorter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 23:27:55 -05:00
247e27d912 Merge remote-tracking branch 'origin/main' into reaper-bounded-queue
d3d12/docs/switches.md regenerated with tools/d3d12_switches.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 05:15:46 +01:00
169c990609 Merge remote-tracking branch 'origin/main' into fix/ahead-split-kept-thread
# Conflicts:
#	d3d12/docs/switches.md
2026-12-01 05:00:53 +01:00
a59fe07402 gpu: the split list ahead's textures half runs on one thread kept for the run (LEONIDA_AHEAD_KEPT_THREAD, on)
With LEONIDA_AHEAD_SPLIT, record_ahead_split made a new OS thread with an
8 MiB stack every frame for the textures' half of the list ahead, chose the
fast cores for it and logged a line, all on the path of the line's thread,
which waits for that half (14,271 such lines in about 2.5 minutes of play on
an RTX 4070 Laptop / Core Ultra 7 155H).

One thread is now kept for it (queue::beside::Kept, made at the first split,
pinned once); each frame's half is handed to it and waited for, with the same
panic and fallback behaviour. LEONIDA_AHEAD_KEPT_THREAD=0 brings back the
per-frame thread, and LEONIDA_AB can switch it. Measured with LEONIDA_AB
every 10 s on that machine (18 steady phases a side): the line's thread stood
2.5 ms a frame for the list ahead with it, 5.2 ms without; the frame median
moved 55.6 -> 54.4 ms, within its spread.

switches.md regenerated (it also picks up two rows main had stale).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 04:56:34 +01:00
9d231d373c Lists' scratch in the card's memory with the budget-sized pool measured: the frame 1.87 ms shorter here
By turns of 4 s standing (run d282, RTX 4060 Ti 16 GB, 96 phases): card scratch on against off with the spare chunks
kept to the card's budget, the frame's median -1.87 +-0.30 ms, means -1.61 +-0.40, the card -1.94 +-0.24 (with the
old pool in d281: -1.15 +-0.36, -0.84 +-0.38, -1.72 +-0.30). Chunks made in the card's memory 19.5 a second against
48, residency waited for 1.0 ms a frame against 3.7; the churn guard never tripped. The switch's notes and the
findings say so.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: runs d281 and d282.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 22:54:27 -05:00
e22a5ea7a9 Lists' scratch in the card's memory keeps spares to the card's budget, guards against churn, and is on again for big cards
TheGeogeo turned LEONIDA_SCRATCH_CARD off by default (f8ad7e245, #2819) "until the card's spare chunks are kept by
size": the card's pool kept 256 MiB of spare chunks in all, in the order they came, and let go of every chunk given
back past it, so the lists' resets freed chunks the recording threads made again (1,158 a second and 35 ms a frame
of MakeResident on an RTX 3090). Now:
- the card's spare chunks are kept up to a sixteenth of its budget, between 256 MiB and 1 GiB
  (LEONIDA_SPARE_CARD_MB=<MB> says it), and when the pool is full those kept longest go, not the one given back
  (Spare::give_evicting); LEONIDA_SPARE_CARD_GROW=0 keeps the old pool, LEONIDA_AB can name it;
- a guard sends new chunks to the PC's memory for the rest of the run if more than 1,000 are made in the card's
  within 10 s (100 a second; this PC's worst was 48 with the old pool), said once;
- with both, card scratch is on again where the card's budget is 9 GiB or more, as before #2819.
Measured before the change (run d281, RTX 4060 Ti 16 GB, by turns of 4 s standing, the old pool): card scratch on
against off, the frame's median -1.15 +-0.36 ms, the card -1.72 +-0.30, with 48 chunks a second made in the card's
memory and 3.7 ms a frame waited for their residency.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: cargo check with and without diagnostics, the
two new tests (the default by card and switch, the pool letting the oldest go); in-game A/B to follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 22:39:44 -05:00
200a55e29f leonida-gpu: bound the reaper's line (LEONIDA_REAPER_LIMIT)
The reaper thread's channel had no bound and nothing slowed its senders.
On an RTX 3090 its line grew to hundreds of thousands of things in most
runs; the landed host lists waiting there kept their scratch chunks, and
the runs that were not stopped ended in a device loss as private memory
neared Windows' commit limit, while LEONIDA_REAPER=0 kept memory flat. The lists' scratch was in card
memory; it is in PC memory by default since #2819, where the line should
stay short. This bound is the safety net for LEONIDA_SCRATCH_CARD=1 and
any other cause of a backlog.

Once the line (REAPING) holds LEONIDA_REAPER_LIMIT things (4096 by
default; 0: no bound, as before; LEONIDA_AB can turn it on and off), what
the host is done with is let go of by the thread done with it, as
LEONIDA_REAPER=0 does. land(), bury() and fronts_let_go() go through one
helper (reap), which counts each batch as the reaper thread takes it off;
the check and the count are one atomic step (hand_over),
so the line holds fewer than the bound and one batch however many threads
send. A batch comes off the line also if letting it go panics. The first
time the bound takes hold is logged once; the census memory line counts
what was let go in place (REAPED_IN_PLACE) and says the bound.

Diagnostics only: host lists and preludes made per frame by the title's
threads, the submitting thread and the others, with their time; a SPLIT
slot for preludes made and recorded; HostList::reset split into what the
list held let go and the allocator and list resets.

Claim: D3D12-REAPER-BOUNDED-QUEUE

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 04:33:11 +01:00
023043bfe1 Merge remote-tracking branch 'origin/main' into push/main-1130
# Conflicts:
#	d3d12/crates/leonida-gpu/src/host.rs
2026-11-30 22:22:07 -05:00
a69ec496d1 Findings: the title told at its first signal, and three frames ahead, do nothing here
Both after ImTaneax's VIctory-RTX3050-4gb, by turns of 4 s in one run standing (d280, 112 phases, RTX 4060 Ti):
LEONIDA_RELAY_EACH the frame's median +0.73 +-0.46 ms, LEONIDA_SUBMIT_FRAMES=3 against 1 +0.60 +-0.46. The card is
the wall here, so the title learning sooner or running further ahead wins nothing. Both stay off.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: run d280.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 22:20:34 -05:00
23767aff86 The relay can land up to the title's first signal and tell it at once (LEONIDA_RELAY_EACH, off)
The thread that lands what flights wrote took every flight the card had run before it told the title anything:
the title's fence was signalled only after the flights behind its signal had landed too. With the switch it lands up
to and with the first signal of the title's among them. After ImTaneax's VIctory-RTX3050-4gb bd79bb1
(VICTORY_RELAY_EACH, GPL-3.0), where the title polled 32 to 81 ms a frame for the card on a walk and two A/B walks on
a 4 GB laptop card had 5 of 6 comparable pairs faster, -8 ms on average. Off until measured here; LEONIDA_AB can
name it.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: cargo check with and without diagnostics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 21:58:24 -05:00
caceb1727c The amplification stage measured slower in the game: LEONIDA_MESH_AMPLIFY stays off, findings for it and the driver cache
By turns of 4 s standing (run d279, RTX 4060 Ti) the stage made the frame's median +4.42 +-0.40 ms and the card
+7.64 +-0.68 ms a frame. The batches' clamp passes it was to take away open for the title's indirect dispatches and
vertex draws; the mesh executions only read from batches those had opened (860 opened a frame with the stage, 871
without), so no pass went and each mesh draw paid for the stage. The switch stays, off, with nothing of it made
without it. Also written down: the joined parts measured again (8 against 1, 16 against 8), and the full driver cache
file that made every start compile some 600 pipelines in the game.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: runs d273 to d279 (A/B by turns, recorded tours).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 21:58:22 -05:00
d87ada3917 Mesh executions of one record can be launched by an amplification stage that reads the record itself (LEONIDA_MESH_AMPLIFY, off)
The title's mesh draws are indirect executions of one record each, which its culling passes write:
8,600 a frame standing at the waterside, clamped by 955 batch passes (run d275). A pass is a compute
dispatch of ours between the draws and a wait for it. With the switch, and the stage's code in the file
LEONIDA_MESH_AMPLIFY_DXIL names (DXC's as_6_6 of indirect/amplify.hlsl; the translator's own DXIL writer
does not make it yet), mesh pipelines are made a second time with the stage in front, reading the record
through a root view appended to their root signature, and such executions are DispatchMesh(1, 1, 1) of
that form: X alone, Y and Z as 1, nothing past 65,535 groups, as the batched clamp bounds a mesh record.
Where a batch would have opened for the record, a wait for every earlier shader write is recorded alone.
Mesh shaders declare the stage's 4-byte payload with the switch set (D3D12 refuses the stage in front of
a mesh shader without it; one with it runs without the stage), so with it unset the translations stay.

A benchmark of 9,000 mesh draws on the card (RTX 4060 Ti, driver 616.64; not committed): records clamped
every 9 draws 23.9 ms against 10.8 read as they are, through the stage 10.7 to 11.5. The stage writes
nothing: one that only declared a writable view (for the list's budget) made a wait every 9 draws cost
4.4 ms against 1.1, so the list's budget is not charged for these records (the largest record in 55 runs
asked for 2,828 groups).

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: cargo check with and without
diagnostics, the batch and mesh unit tests, a new test that the payload validates in dxil.dll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 20:55:24 -05:00
f8ad7e2455 d3d12: lists' scratch stays in the PC's memory by default for now (D3D12-SCRATCH-CARD-OFF-BY-DEFAULT)
Part of enlighted's D3D12-REAPER-BOUNDED-QUEUE, agreed with them. Card scratch, on by default where the
card's budget is 9 GiB or more and it has a GPU upload heap, churns chunks: SPARE_CARD keeps 256 MiB in all
and gives back an exact size only, so chunks of other sizes are let go in the list resets on the reaper and
made again on the recording threads. The reaper falls behind and the memory it holds piles up. Measured on
an RTX 3090 with a resizable BAR (23 pairs): frame median 64.6 ms with card scratch against 33.3 ms without.
It is off by default until the card's spare chunks are kept by size; LEONIDA_SCRATCH_CARD=1 still puts it
there and LEONIDA_AB still switches it. A card that used to get it says once that it is off now.
switches.md is regenerated for that row.
2026-12-01 02:40:18 +01:00
d920d850d0 Pages written since they were taken go up by the 4 KiB that changed, on by default
LEONIDA_TAKE_BLOCKS is on (0 turns it off; LEONIDA_AB can name it). By
turns of 4 s standing at 1080 to 1440 lines, no generated frames (run d271,
106 phases): the frame's median -1.69 +-0.38 ms, means -1.87 +-0.39, p90
-2.48 +-0.68, the card -1.84 +-0.32, the submitting thread -1.87 +-0.31;
10 MB sent up a frame against 27 to 28, the sends with their hash passes
1.3 to 1.8 ms of the card against 2.8 to 3.7.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: cargo
check of leonida-gpu with and without diagnostics; the shadow test
only_the_blocks_the_title_changed_go_up; run d271.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 19:44:10 -05:00
3a780e4bfc docs: port RTX 4060 Laptop benchmark note 2026-12-01 00:33:07 +00:00
ace8a41a4b Findings: the submitting thread sampled again; copies at their place back to common
Run d267: the submitting thread waits 45 % of its samples; the rest is
spread (refreshes on the wide threads 15 %, the write watch 7.3 %, the
merge under flights' writes 6.4 %, the driver 6.6 %, the planes' presents
5.9 %, the crossings' search 1.2 %). Run d268 with the place fix: no
device error, our lists as before.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: the runs
named.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 19:11:37 -05:00
4959d6b630 d3d12: hash a texture's memory with AES rounds, 2.9-5.9x faster (D3D12-GPU-TEXTURE-DIGEST-AES)
texture::digest, which tells whether a guarded texture's memory changed (at every check that is not skipped, and over all of it the first time), was a fold of 64x64-bit multiplications that ran at 23.5 GB/s at every size from 16 KiB to 256 MiB: the multiplications were its limit, not the memory. With AES-NI it is now eight 128-bit lanes of `aesenc` over 128 bytes at a time, each lane through two more rounds on its own before the lanes meet: 139, 121, 108, 114 and 70 GB/s on 16 KiB, 256 KiB, 2 MiB, 32 MiB and 256 MiB (Ryzen 7 7800X3D, best of five, `digest_speeds`). The folded one stays as the fallback. The digests are only compared with each other inside one run and none is written out, so the value may change; which version is used cannot change during a run.

A first version, whose lanes met by one round, had pairs of one-bit changes with the same digest (1,328 in a million with four lanes). `no_two_changes_cancel_in_the_aes_digest` tries pairs of one-bit changes over 520 bytes and 4 KiB of noise and of zeros: none for the real digest and for the folded one, 83 for the eight-lane version met by one round (its negative control).

AI-assisted: Claude Sonnet 5.5
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-30 18:02:27 -06:00
de69f6d376 Findings: what our own lists take of the card; only changed dwords sent up do not pay
Run d263 (LEONIDA_OWN_STAMPS=1): the sends with their hash passes 3.1-3.9
ms a frame, the compares behind submissions 3.4-4.7, the copies between
copies 0.02-0.04. LEONIDA_SEND_CHANGED (runs d264, d266): the card -1.95
+-0.16 ms a frame, the submitting thread +5.08 +-0.36, the frame's median
+0.77 +-0.33 ms; a recorded tour with it (d265) had no fault. Off.
switches.md regenerated.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: the runs
named.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 18:39:58 -05:00
b597f759ec Findings: the older values sent up are not the fetch check's to mend
With the up-copy check on the game's own path for landed pages (run d259)
whole-page sends still put older values over some 66,000 card words a
second, in the same buffers as before; with LEONIDA_FETCH_CHECK=1 (run
d260: 13 to 17 fetched pieces a frame caught while a later flight was at
them) 61,000. What else puts card bytes there that never come back is not
found yet.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: runs
d259 and d260.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 17:40:14 -05:00
2c4f423ee5 Findings: the up-copy check under the merge, crossings mended on the card, the driver cache the launcher missed
What run d254's up-copy check showed (the merge's own conflicts few; some
280 refreshes a second crossing a flight's writes through another copy;
whole-page sends over the card's words), what the crossing copies cost
(runs d255, d257, d258: none in the frame, 1.56 ms of the submitting
thread), and the full driver cache that the launcher did not tell once it
was moved aside (run d256). switches.md regenerated.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: the runs
named.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 17:10:53 -05:00
d8ca182407 Merge remote-tracking branch 'origin/main' into push/main-1130 2026-11-30 15:21:40 -05:00
3b33420c65 Findings: settling copies in the card's memory costs this PC 53 ms a frame; the DLSS output's readers
AI-assisted (Claude). Tested on an RTX 4060 Ti (driver 616.64), Ryzen 5 7600X: runs d252, d253.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 15:21:38 -05:00