Commit Graph

20 Commits

Author SHA1 Message Date
5ef76aa9aa docs/running.md: say cgroup memory for the measured 19-20 GB
The runs report the cgroup's peak, as the RUN blocks do; the VRAM
spilled to host memory is a different figure.

AI-assisted.
2026-12-01 07:35:25 +01:00
6b6f75abbb docs/running.md: source the Linux + Wine + NVIDIA details and index the profile
- separate the 22.2 GB run that drew the city night street from the
  22.3 GB default-arena run, as the reports do;
- say the 1.7 GB journal was warm from three earlier runs, not filled by
  these runs;
- replace the unsourced scene names and the submissions-per-frame count
  with the reports' words, and give the 47 s STRAY_RO_HEAL observation
  its provenance;
- say that 724 is the maintainers' count and 723 is this pack's, that
  the skip list takes name fragments and is the ray-tracing programs;
- give the full run_game_wine.sh invocation and name the local trace-off
  change;
- index the profile in docs/README.md and point linux_proton.md at it.

AI-assisted.
2026-12-01 07:11:10 +01:00
8b89520b13 docs/running.md: a Linux + Wine + NVIDIA profile that draws world frames (DOCS-RUNNING-LINUX-WINE-NVIDIA)
The page has Linux RADV, a Proton NVIDIA report and Windows sections, but no Linux + Wine + NVIDIA
profile. This one is a desktop RTX 3060 12 GB with Wine 11.22: it draws the first-run UI at 30 frames/s,
loads the story and draws the opening sequence's prison yard, city street and carnival scenes at 1-3
frames per 10-16 s, with host memory at 19-20 GB and up to 23.6 GB.

The section carries the build, shader pack, environment (including LEONIDA_STRAY_RO_HEAL=1, without which
a run ends at 47 s here) and what to expect, and names the two ends of the carnival scene as known
problems: a console value wait held for 101 minutes with the list values on, and a device loss with
LEONIDA_LIST_VALUES=0. Every value comes from the RUN blocks posted on #2464, which the section links;
no game data is added.

AI-assisted.
2026-12-01 06:47:56 +01:00
db6c0d0afd Merge pull request #2623 from hardly-relevant/feat/d3d12-stall-trace
d3d12: save a rolling timeline after a frame stalls (D3D12-STALL-TRACE)
2026-11-30 16:58:12 +01:00
012b79a678 Merge pull request #2566 from aslan2142/integration/perf-cpu-gpu-r6
[integration] PageMirror, GPU detile, async queue & RDNA2->SPIR-V performance stack (INTEGRATION-PERF-CPU-GPU-R6)
2026-11-30 11:24:25 +01:00
a4300e3eb0 Merge pull request #2594 from owenjbendon-creator/tools-d3d12-run-fps
tools: frame rate of a D3D12-runtime run by draws a frame, and two runs side by side (TOOLS-D3D12-RUN-FPS)
2026-11-30 11:04:31 +01:00
37d2d73dcd d3d12: save a rolling timeline after a frame stalls 2026-11-29 20:47:19 +02:00
a58d22fe2e Merge upstream ProjectLeonida/mandy main (ddfe24fba) into fix/rendering-correctness 2026-11-29 09:37:37 -05:00
d22e725cb6 Merge pull request #2502 from Tyrannys/docs/running-dstorage-history-regen
docs/running.md: regenerate the DirectStorage predictor profile after 2a491668a (DOCS-RUNNING-DSTORAGE-HISTORY-REGEN)
2026-11-29 15:09:27 +01:00
9f7587e193 tools: frame rate of a D3D12-runtime run by draws a frame, and two runs side by side (TOOLS-D3D12-RUN-FPS)
tools/d3d12_run_fps.py reads the frame line the D3D12 runtime logs every few
seconds (fps, ms a frame, preparing, copies, waiting on the GPU, copying back,
draws a frame) and prints numbers only: the samples in the world (the first
bucket's lower bound, 1000 draws a frame by default, leaves out menus and
loading screens), the frame rate (median, slowest tenth, fastest tenth), the
medians of where a frame goes, and the median frame rate per bucket of draws
a frame. --compare puts a second run beside the first bucket by bucket and
gives the change only where both runs have enough samples.

Why: two runs of the game never show the same scenes for the same time, so
their plain medians do not compare. Measured here on two real runs of one
save (numbers only): plain medians 15.6 and 16.2 fps, but by bucket the second
was 51%, 29%, 5% and 21% faster at 3-5k, 5-7k, 7-9k and 9k+ draws a frame: it
had spent its time in busier scenes (median 7,676 draws against 5,132).

It never prints a log line, a program name, an address or the path of a log;
the log stays on the machine that made it. Standard library only. Reads UTF-8
and UTF-16 logs (a PowerShell redirection writes UTF-16) and strips terminal
colour codes; a truncated last line is skipped. The pattern takes only what
the runtime's format string writes (bounded lengths, nothing in front of the
first number), so no other text in a log reads as a frame line.

Test: python -I tests/test_d3d12_run_fps.py (16 tests on synthetic lines in
the shape of the runtime's format string; no game files, no GPU). On main it
fails at import: the tool does not exist there.

Checked: python -I tests/test_d3d12_run_fps.py; python -I
tests/test_text_write_line_endings.py; python -I scripts/check_no_game_data.py
on the three files; eight deliberate breakages of the tool each fail a test.
A second, fresh session reviewed the first version; its findings are fixed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 22:50:37 +00:00
660872215a Merge branch 'main' of https://github.com/ProjectLeonida/mandy into test/round10
# Conflicts:
#	make_game.py
#	runtime/README.md
#	tools/shader_meta.py
2026-11-28 16:35:38 -05:00
e890d0a101 docs: fix inaccurate doc paths/flags/env vars and add recommended variables to running.md
- docs/running.md: add Recommended variables (all platforms) table covering async submit/compile, compile-pool sizing, warm-up throttling, heap sizing, input, and telemetry/fault variables on main; update RX 7900 XTX RADV recipe and Reporting section
- runtime/README.md: document LEONIDA_CLWB_PATCH (runtime/src/cpu_emulation.h)
- AGENTS.md: add port_ctl.py (scripts/port_ctl.py) to numpy/Pillow exception list
- d3d12/docs/replay.md: fix nonexistent --looks flag reference to --flow
- docs/port_plan.md, docs/port_status.md, docs/ultrawide.md, docs/victory_gap_gpu.md, docs/victory_gap_media.md: fix typos (chad_dsp.cpp -> chad.cpp, VIctory tests/fidelityfx.rs -> crates/victory-hle/tests/fidelityfx.rs) and clearly mark unmerged-branch paths (runtime/ ultrawide, frame_step.h, media_foundation.cpp, gameinput_xinput.cpp, d3d12_xs_exports_test.cpp, pipeline_queue.h -> pipeline_wait.h)
- tests/test_docs_cli_flags.py: scan .rs sources and clap #[arg(long)] struct fields for d3d12/docs/*.md flags, treat cargo/git-filter-repo flags as foreign, and add docs/port_plan.md to OTHER_PROJECTS

AI-assisted: Antigravity (Gemini 4 Neon). Verified: 13/13 tests/test_docs_*.py pass and scripts/check_no_game_data.py clean.
2026-11-28 09:09:23 -05:00
de8604c3dc Merge ProjectLeonida/mandy main (431ceba4f) into test/round2
Preserves all Round 1/2/2.1 CPU/GPU runtime optimizations alongside upstream
mandy/main changes, resolves all 10 conflicted files, and fixes arena_window
accounting on retired/dropped title windows.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-27 19:57:44 -05:00
f390e9b1b1 docs/running.md: regenerate the DirectStorage predictor profile after 2a491668a
A runtime built without make_game.py's runtime stage keeps an older
history.bcph, so 2a491668a's fix for the missing-endpoint BC7 tail requests
(#2019, #2396) does not apply until tools/build_dstorage_history.py runs
again. Add it to "Settings every platform needs" with the command, the
load line to check and a profile M report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 13:36:49 -06:00
d42c37335b d3d12: LEONIDA_ASYNC_MIN_BYTES_GRAPHICS, a separate async threshold for graphics (RT-ASYNC-MIN-BYTES-GRAPHICS)
With LEONIDA_ASYNC_PIPELINES=1, graphics and mesh pipelines (all their stages) now take
LEONIDA_ASYNC_MIN_BYTES_GRAPHICS when it is set, and LEONIDA_ASYNC_MIN_BYTES otherwise, so
nothing changes while it is unset. Compute keeps LEONIDA_ASYNC_MIN_BYTES. 0 makes every graphics
pipeline asynchronous. One startup line states both thresholds; text that is not a number is
ignored with a log line.

Thread dumps from a retail run showed the draw thread building lazy graphics variants under the
1 MiB threshold in place, 2.5-11 s each, back to back, with no present for about 100 s. A skipped
draw costs one draw. The image needs the small lighting and post compute programs, and those
are still built in place.

Tests: async_pipeline_size_test covers the per-kind decision and the unset fallback;
d3d12_pipeline_workers_test --async-graphics-zero / --async-graphics-unset (new ctests) hold
the compile worker with compute over its threshold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:24:29 +01:00
76099a22f6 d3d12: LEONIDA_ASYNC_MIN_BYTES, only large pipelines asynchronous (RT-ASYNC-LARGE-ONLY)
With LEONIDA_ASYNC_PIPELINES=1 every pipeline not built yet has its draws
and dispatches skipped, the small lighting and post programs too, so the
world phase stays black while anything compiles; with it off a submission
waits minutes for each large ray-tracing compute program.

LEONIDA_ASYNC_MIN_BYTES=<n> (with async on): a pipeline under n bytes of
SPIR-V (compute: its module; graphics: all its stages) takes the path of
async off: no record-time request, PipelineCompiles builds it at prepare,
and a compile-helper build waits for its file. One of n bytes or more stays
asynchronous. Decided once per pipeline at create (async_build). Unset, 0
or not a number: every pipeline asynchronous, as before.

Tests: async_pipeline_size_test (parsing and decision);
d3d12_m4_compute --async-small-waits (both pipelines under the threshold,
compile worker held: no job reaches it and every word matches).
Docs: runtime/README.md row, docs/d3d12_vulkan.md, docs/running.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 09:03:28 +01:00
9da604f3f5 d3d12: the GPU address arena binds its memory in 2 MiB blocks as allocations need it (RT-MEMORY-BREAKDOWN-AND-SPARSE-ARENA)
The arena was one allocation of its whole size, made at start: with LEONIDA_ARENA_MB=4095 a world run used about
0.8 GB of it (peak end about 1 GB) and held 4 GiB of Resizable BAR memory. Where the device can, the arena is now a
sparse buffer: LEONIDA_ARENA_MB bounds the address range, and memory is bound as it is used.

- src/arena_backing.h (new): the backing units. A unit is one VkDeviceMemory, mapped once, bound over whole 2 MiB
  blocks. An allocation no larger than a block stays inside one block; a larger one takes whole blocks of its own
  (the free-block map's keep-out, footprint and alignment). A unit is bound before the first allocation in it is
  handed out, and when its last allocation is released it is pending with the release's retire ticket; it is unbound
  and freed only once completed_retire_ticket() has reached that ticket. An allocation in a pending block revives it.
- The CPU reaches the arena through one accessor, DeviceState::arena_host(offset, bytes): one table read, null with a
  rate-limited line for a range without memory. Callers that name an offset they do not hold (write_arena_value,
  read_arena, the fsdraw probe) use ArenaBacking::with_host under its shared lock; copy_destination and
  known_view_heap use offset_of. arena.mapped is gone, so every former `arena.mapped + offset` was converted.
- Binds go to a queue nothing else uses (pick_arena_bind_queue: RADV's sparse-only family, or a sparse family with
  a queue to spare) and are waited for there, so a bind never sits behind a submission that waits for a fence the
  CPU signals later. The device asks for that queue at creation.
- Unbinding is safe because: arena_release records submitted_retire_ticket() + 1 (as defer_destroy), so the
  submission being recorded is covered too; reclaim_arena() runs at the start of ExecuteCommandLists, reads
  completed_retire_ticket() before taking the arena lock, and unbinds only units whose ticket has completed; the
  table entries are cleared under the exclusive lock before the memory is freed. An unbound range reads as zero
  (residencyNonResidentStrict is required), never a fault.
- A D3D12 heap in the arena lends its unit's memory (at the heap's place in the unit) to reserved resources' tiles;
  Heap::offset() keeps the arena VA.
- Without sparse buffers, strict residency, a sparse address space as large as the arena, or a queue to spare
  (llvmpipe), one allocation backs the whole arena as before, through the same accessors. No new setting.
- The arena line at release gains `GPU address arena: bound N MiB now (peak P, U units of 2 MiB blocks, sparse)`;
  the mem-probe breakdown's arena `bound` is the bound bytes.

Tests: arena_backing_test (CPU, fake driver): placement never crosses a unit, binds shared per block, unbinding
waits for the ticket, revival, a random workload whose bound bytes equal the blocks live allocations touch, bind
failure, the one-allocation arena, the bind queue choice. arena_sparse_gpu_test (a real device, 77 without sparse
binding): a 256 MiB arena with 40 MiB allocated has 44 MiB bound; CPU writes are what the GPU reads; released blocks
stay bound while a submission that reads them is in flight and are unbound (reading zero) once it completes; a bind
made while the work queue is blocked completes. Both are new (fail to build on main).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 16:44:41 -05:00
84db5cd027 d3d12: console heap slots record what their V#s resolved to; a release re-fixes only the slots naming it (RT-VSHARP-SLOT-RECORDS)
After any arena release, title-window or geometry block destroyed, or alias change, the next submission walked
every live V# slot of the console heap (about 580,000 in world runs), reading each from the copy in ReBAR VRAM:
1.1-1.5 s a walk whatever the scene, about 2.9 s of a 4.6 s frame. It existed only because nothing recorded
which slot resolved into which backing.

Each V# half of a console resource heap's copy now has a record in host RAM (src/console_heap_slot_records.h):
the title's base and span, the device address its copy names, and whether it resolved or waits. Two indexes
(by base, by target; per power-of-two span class and 64 KiB-or-larger granule) find the halves near a range.
fix_console_slot, the only writer of a slot's copy, writes them; a zeroed range, a deferred slot and a
rewritten slot drop theirs; a destroyed heap takes them with it.

Releases (backing(), title_block_gone), alias ranges removed or replaced (TitleVaAliases tells its listeners
as it happens, forget_copy included) and additions (backings, alias ranges, title memory) go on an unbounded
per-device list. refresh_console_heaps takes it whole; every heap re-fixes exactly the slots it touches: a
release or removal every half naming the range, an addition the waiting halves over it. A new heap log line
gives the changes, slots looked at, slots fixed again and ms per submission.

Removed: the live_vsharps walk and its bitset (console_heap_vsharp_slots.h and its test), the release
generation checks (released_backings, TitleVaAliases::invalidations), LEONIDA_CONSOLE_RELEASE_FILTER, the
4,096-entry DescriptorRangeChanges ring with its full-sweep overflow and changed_ranges(), the empty-slot probe
and retry_unmapped_slots (unreachable: nothing set its flag). LEONIDA_CONSOLE_GPU_FILTER now defaults to unset
instead of the removed variable's value. The T# retries (retry_console_slots) stay.

Tests: console_heap_slot_records_test (portable): releasing a buffer 10 of 60,010 slots name looks at 10
entries and fixes 10 slots; an alias moved, removed and added back; overwritten and zeroed slots; partial
overlap; two slots on one backing; a buffer back; a refused alias copy backed later; a large span; a destroyed
heap; and 400 random rounds compared with a full re-resolution of every slot. d3d12_unmapped_vsharp_test now
expects all 128 waiting slots restored at the first submission after their alias comes (was: 16 by the probe in
64 submissions), none after it goes, and the slots naming a released buffer null. title_va_alias_test and
geometry_views_test check the listener in place of the ring.

Linux ctest 113/113; Windows suite under Wine (clang-cl, iGPU, RADV) equal to main 2d43417d4 test by test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 14:47:29 -05:00
76109561f4 d3d12: --precompile-pipelines builds the skip-listed programs unless --skip-listed
LEONIDA_SKIP_COMPUTE is a play-time setting: the game drops the listed programs' dispatches. The precompile also
refused to build them, one "not built (LEONIDA_SKIP_COMPUTE)" line each and no override. Players run it with the
game's environment (docs/running.md), so their skip list kept those programs out of the journal for good, and a later
run without the list compiled them in the game.

- precompile_compute_pipelines builds every compute entry; with the list set it says how many entries it names.
  --skip-listed leaves them out on purpose, one line each.
- The last line counts the whole run: built (compiled, from a cache), journaled already, being built by another
  process, failed; left out: of those the list names, not buildable, filtered out (--filter, the size bounds and now
  --limit too).
- BuildHost::unbuildable no longer checks the list. The compile server checks it itself, as before: the game that
  starts it drops those dispatches.

Docs: running.md, linux_proton.md and d3d12_vulkan.md no longer give compile time as the reason for the skip list.
The 89-167 s per program came from wave64-emulated packs; with a native wave64 pack on an RX 7900 XTX (RADV, Mesa
26.3.1, Wine) all 721 library programs of 2 MiB or more built, 360 of them in 170 s on 32 threads, 2.5-32 s each, the
largest (13 MiB) in 28.5 s alone, at a peak of 14 GiB of RAM. Two world runs on that card with all of them journaled
and no skip list took them all from the journal and got no further than runs with the list (a stop with the GPU
idle at 404 s; an idle-queue device loss at about 214 s, which also happens with the list set). Their output is
not checked, so the docs keep the skip list and LEONIDA_RT_AS=off as the setting of our longest runs.

Test: precompile_skip_list (test/check_precompile_skip_list.cmake) precompiles two synthetic compute modules, one of
them listed, three times: with the list set both are built; with --skip-listed only the other one is, and the listed
one is named; a second run into the first journal finds both journaled. It fails on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 12:40:56 -05:00
96d8ce0802 docs/running.md: running the game per platform and GPU
One section per platform and GPU (Linux/Wine with the RX 7900 XTX and
with the RDNA2 iGPU, Linux/Proton with NVIDIA, Windows with NVIDIA and
with AMD, Intel, macOS), each with the same fields: build, shaders,
pipeline pre-compile, driver and OS settings, environment with a reason
per setting, command, what to expect and known problems. Every value is
marked as measured by us, reported by others (linked) or TBD. The title
watchdog's KICK values are measured by each person and never committed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 09:22:29 -05:00