Commit Graph

5744 Commits

Author SHA1 Message Date
2ad32c8fc8 Merge pull request #250 from ProjectLeonida/old-pr/9984
docs(models): remove duplicate material effect section (lines 653-737)
2026-12-01 16:13:46 +01:00
4a305d0666 d3d12/vulkan: bind/map staging before binding VRAM buffer & document LEONIDA_EXTERNAL_WINDOWS_MB 2026-12-01 17:04:33 +02:00
182746f038 Merge pull request #2189 from vinceychu/hw-image-load-pck
image_fuzz: image_load_pck / image_load_pck_sgn on the hardware oracle, measured on RDNA2 (HW-IMAGE-LOAD-PCK)
2026-12-01 15:53:45 +01:00
8ebe7cc2e8 d3d12/vulkan + make_game: ReBAR DMA readback, budgeted staged slabs, test fixes & CLI wiring 2026-12-01 16:40:36 +02:00
098f7ff761 rdna2spirv: guard v_readfirstlane in --mesh-native-wave32 and lower --spirv-opt SSA threshold to 512 KiB
- Exclude v_readfirstlane from --mesh-native-wave32 until per-use uniformity
  analysis proves the source wave-uniform (with ms_native_readfirstlane.asm
  and test_mesh_native_wave32.py regression test + docs/design.md update).
- Lower SPIRV_OPT_LARGE_BYTES from 750 KiB to 512 KiB so library/lib_cs_03245
  and siblings use the safe SSA pass set instead of --scalar-replacement=0
  (avoiding NVIDIA 590.48.01 compiler SIGSEGV during warmup).

AI-assisted.
2026-12-01 16:38:32 +02:00
9d41505a44 d3d12/vulkan: staged VRAM arena, DMA readback batching, parallel shadows, stream-pool fix
On top of PR #2566 (8db8335d2), combines verified runtime performance and
correctness improvements for non-ReBAR Vulkan GPUs (tested on Linux / Wine /
RTX 3090 24 GB, BAR1 = 246 MiB, driver 590.48.01):

- Stage 4 GiB GPU address arena + overflow TitleBufferWindows slabs in
  DEVICE_LOCAL VRAM with HOST_VISIBLE staging mirrors (arena_staging.h,
  arena_staging_test.cpp).
- Fix startup glibc realloc() race by caching max_compute_shared_memory_size,
  sharing mutex-guarded VkPipelineLayouts, and eagerly loading pipeline_cache()
  during single-threaded Device construction.
- Stage 9a-1: batch retired arena + external window host readbacks into a
  single copy_buffers_sync() submission on the dedicated DMA copy queue
  (wb: 27.6 ms -> 2.35 ms/frame).
- Stage 9a-2: parallelize ShadowPages::refresh across 4 persistent threads
  via ShadowRefreshPool (shadows: 26.9 ms -> 10.2 ms/frame).
- Fix resolve_pool_memory() zeroing out root descriptors probed with
  kRootViewBytes (64 KiB) near the end of committed stream-pool blocks
  (stream pool unbacked: 131,072 -> 16-33, root view unbacked: 0).

AI-assisted. Verified with 151/151 portable Linux CTest passing and Windows
MSVC build + retail boots on RTX 3090 (590.48.01).
2026-12-01 16:37:00 +02:00
cf15c2c6ed d3d12: a typed switch wins over the F1 menu, not a value that changed (D3D12-MENU-LAST-CHOICE-WINS)
Review of the first version: a value that differs from the last start's command line was taken for the user's new
choice. That lost an explicit flag on the first start after an upgrade, never let the same flag typed again win, and
dropped a menu value the command line never mentioned when leonida-launch.txt lacked the key. The menu file was also
rewritten before the history, so a failed history write had already lost a saved choice.

Now the rule follows what the user typed:
- A switch typed for this start wins over the menu's saved value of each setting it makes. The menu file drops that
  value, so F1 shows the command line's. scripts\play-d3d12.ps1 passes the switches typed there as -Typed, so its
  Series X default and -Lowest 1080 leave the menu's choice standing. A start by hand counts its own switches, and
  -More wins like a typed switch.
- Every other setting keeps the menu's value.
- The menu's SAVE AND RESTART adds -MenuRestart to the switches it replays (LEONIDA_MENU_ARGS), so there the menu's
  values, saved after those switches, win.

leonida-launch.txt is gone. The menu file is written to a temporary file and moved over the old one, and only when a
value leaves it. If that fails, the start runs with the command line's values and the file stays whole.

Tests: 10 cases, among them the same switch typed again, an untyped default, a setting no switch makes, the restart,
a start by hand, -More and a menu file that cannot be written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:20:54 -03:00
c8eea9466f d3d12: the last choice wins between the command line and the F1 menu (D3D12-MENU-LAST-CHOICE-WINS)
play-nvidia.ps1 applied leonida-settings.txt (what F1 saved) over the command line at every start. An empty value
there removed what the command line set, so a later -Resolution, -Dlss or -SeriesS was lost without a word.

Now leonida-launch.txt (git-ignored) keeps what the last start's command line made:
- A setting this command line makes otherwise than that start's did wins. The menu file drops its value, so F1
  shows and saves the new one.
- A setting it makes as before keeps the menu's value, the newer choice.
- Each start says which values came from the menu and which the command line replaced.
- A dry run writes neither file.

The F1 menu gets the native render scale (1, which -Resolution makes at the output's height) and the dynamic
resolution's lowest scale (LEONIDA_RENDER_SCALE_MIN, from -Lowest).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:16:56 -03:00
b3910e5e3d Merge pull request #2814 from TheGeogeo/test-red-green-compiler-crash
scripts: red_green.py tells a crashed compiler from a build error (TEST-RED-GREEN-COMPILER-CRASH)
2026-12-01 15:06:18 +01:00
9f27ba2e1f Merge pull request #2839 from aznohonza/docs/running-linux-wine-nvidia
docs: a Linux + Wine + NVIDIA profile that draws world frames (DOCS-RUNNING-LINUX-WINE-NVIDIA)
2026-12-01 14:36:15 +01:00
e04721c7f7 Merge pull request #2871 from aslan2142/docs/agent-standards-and-accuracy
docs: update agent/contributor standards, fix stale references, and consolidate docs
2026-12-01 14:17:24 +01:00
7e63341483 Merge pull request #2842 from aznohonza/docs/port-status-list-values-pair
docs/port_status.md: the measured list-values pair past the world load (DOCS-PORT-STATUS-LIST-VALUES-PAIR)
2026-12-01 14:14:29 +01:00
4367afb817 docs: address review findings in descriptor_lookup and docs/README 2026-12-01 08:08:00 -05:00
8246772326 docs: deduplicate AGENTS/CONTRIBUTING and consolidate descriptor_lookup docs 2026-12-01 07:53:33 -05:00
20b0be7107 Merge pull request #2364 from Tauwni/docs/testing-wine-macos
docs/testing.md: the Windows runtime tests under Wine on a Mac (WineHQ build, ROSETTA_ADVERTISE_AVX)
2026-12-01 13:47:46 +01:00
c95183fd8f Merge pull request #2229 from Tauwni/docs/kk-nan-constant-fixtures
docs/testing.md: three more KosmicKrisp failures from its (NAN) constant printing
2026-12-01 13:45:44 +01:00
457735ca8a docs: fix stale repo references and add coding-agent engineering bar 2026-12-01 07:44:31 -05:00
abf475ef65 Merge remote-tracking branch 'origin/main' into tools/cgroup-memory-peak
# Conflicts:
#	tests/test_run_game_wine.py
2026-12-01 12:55:58 +01:00
3fbc120df4 Merge pull request #1397 from whoalin1/mask-regs-data-read
rdna2spirv: a VALU data read of a lane-mask operand yields the wave's mask word
2026-12-01 12:53:35 +01:00
1b83716379 Merge pull request #2455 from MoonEyes/feat/picture-metrics
tools: picture_metrics.py and the PICTURE block, numbers only from a frame on your disk (TOOLS-PICTURE-REPORT)
2026-12-01 12:48:22 +01:00
427aa19b69 Merge pull request #2231 from MoonEyes/tools/chain-check
tools: chain_check.py, one page of counts for the whole shader chain (TOOL-CHAIN-CHECK)
2026-12-01 12:46:48 +01:00
a726736ec2 Merge pull request #1774 from Tauwni/fix/explicit-lod-bias-moltenvk
rdna2spirv: --explicit-lod-bias applies the S# LOD bias where MoltenVK drops the sampler's; ps_ssharp passes on Macs (SHADER-EXPLICIT-LOD-BIAS-MVK)
2026-12-01 12:45:24 +01:00
a63eb958d9 Merge pull request #2843 from aznohonza/docs/boot-which-end
docs/boot.md: which end a late run ended in, read from the [rt] counters (DOCS-BOOT-WHICH-END)
2026-12-01 12:43:31 +01:00
4913ef152e Merge pull request #2436 from kawaii-shakal/wine-run-shader-cache
run_game_wine.sh: keep the drivers' shader cache from run to run (WINE-RUN-SHADER-CACHE)
2026-12-01 12:30:40 +01:00
d9df071e91 Merge pull request #1585 from whoalin1/nc-i16-clamp-nv
rdna2spirv: emit OpBitFieldUExtract for the VOP3 16-bit result mask (NVIDIA And-&-0xFFFF miscompile)
2026-12-01 12:30:35 +01:00
e80995b9a8 Merge pull request #2188 from robot00f/docs/cpu-avx1-baseline-counts
docs(cpu_features): record baseline instruction counts and AVX1/SSE4.2 host delta
2026-12-01 12:02:09 +01:00
c6c8f5f5a3 scripts: build llvm-mc 23.1.5 by default, so the pipeline library translates (#1923)
* scripts, tools: build llvm-mc 23.1.5 by default, so the pipeline library translates

LLVM 21.1.8's gfx1013 decoder cannot decode 840 of the 2,684 compute
programs in the pipeline library of 1.0.2.1: their listings carry 79,490
undecodable words and 8,310 exp invalid_target_N lines, the translator
refuses all of them as "fall-through into undecodable words", and the
shaders stage keeps 1,844 of 2,684. LLVM 21 does translate all 26,503
shaders of shaders.rpf; the library is what it loses.

The same bytes under llvm-mc 23.1.5 have no rejected word in those 840,
and 839 of them translate and pass spirv-val (the last wants s_sethalt,
which the translator does not implement, under either version). The 1,844
that already translated were re-disassembled too: 1,674 listings change
and all 1,674 still translate, the other 170 are byte-identical, so the
stage goes from 1,844/2,684 to 2,683/2,684.

The build helper now builds 23.1.5 by default. The docs that name the
minimum version (README, docs/design.md, docs/testing.md, docs/linux.md)
and the three user-facing messages that still said 21+ (make_game.py's
preflight, shader_disasm.py's probe error, mc_command.py's install hint)
now say 23+, with the tests that assert those texts updated.

AI-assisted (DeepSeek Harness).
Written with an AI assistant.

* docs: LLVM 23 is what the shaders stage needs, and a test pins the script's default
2026-12-01 11:48:54 +01:00
4009a3426d Merge pull request #1659 from whoalin1/snan-fma-cmpclass
fmisc_diff: do not judge the class bits of a NaN whose quiet bit is unmodelled
2026-12-01 11:31:31 +01:00
501b3e6c5c Merge pull request #2805 from TheGeogeo/d3d12-gate-pwsh7
gate: game-gate.ps1 says it needs PowerShell 7 (D3D12-GATE-PWSH7)
2026-12-01 08:50:36 +01:00
d9c470cd30 game_run_summary: record the run cgroup's memory peak 2026-12-01 08:41:52 +01:00
7b06905c87 docs/port_status.md: wrap the device-loss paragraph
AI-assisted.
2026-12-01 07:54:06 +01:00
8e0594344c docs/port_status.md: name the call that first returned device lost
run24's loss came from vkWaitSemaphores; run25's from vkQueueSubmit
before vkWaitSemaphores. The paragraph attributed both to run24.

AI-assisted.
2026-12-01 07:53:14 +01:00
035da4fa9d docs/boot.md: label the made pipeline pair and the counters' preconditions
The pipeline row now cites the made pair for "made", not the live
counts; the table says the mem-probe rows need LEONIDA_MEM_PROBE at the
start, submit frame needs LEONIDA_SUBMIT_FRAME_SECONDS, and the [rt]
lines are the Vulkan layer's stderr. Retitle the section to three stops
and name the device-loss/watchdog lines and the at device loss reason.

AI-assisted.
2026-12-01 07:35:40 +01:00
f589493c5f docs/port_status.md: scope the second machine's list-values runs
Move the runs out of the 2026-11-25 boot section into their own dated
section, name the build and driver, say how many runs each configuration
has, keep "draws further" with run24 only, and report cgroup memory.
Scope the two test-machine statements that said the title stops before
its first frame.

AI-assisted.
2026-12-01 07:35:33 +01:00
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
57d5c000ee docs/boot.md: tell a compile stall, a held value and host memory apart
A run that ends after the first frame now has a short table of the
[rt] lines to compare: mem-probe's made-pipeline count, list values'
oldest held gate, and the cgroup peak, with the measured shapes from
#2464. Links the gate rule in d3d12_xs_console_abi.md instead of
repeating it.

AI-assisted.
2026-12-01 07:16:28 +01:00
c7c82150b1 docs/port_status.md: the measured list-values pair past the world load
The device-loss paragraph now has the measured reproduction on a 12 GB
NVIDIA card: with the list values on, the opening sequence's night scene
waits in one console value for 101 minutes; with LEONIDA_LIST_VALUES=0 it
draws further and ends in the title's device-removed handler, with no
fault address. Links the two #2464 run comments.

AI-assisted.
2026-12-01 07:13:30 +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
f442c3dfba scripts: red_green.py tells a crashed compiler from a build error (TEST-RED-GREEN-COMPILER-CRASH)
A verification's only trial said "red does not build" while rustc had crashed (0xC0000005). A side whose
cargo output shows rustc or a build script ending with a Windows crash status, an internal compiler
error or a failed allocation now builds again once, and the report says so; a second crash gives the
verdict `compiler crashed` (exit 1), not `red does not build`. A test binary that crashes stays a test
result.
2026-12-01 01:49:41 +01:00
3a780e4bfc docs: port RTX 4060 Laptop benchmark note 2026-12-01 00:33:07 +00:00
f806537a8c gate: summary.json gets the run's memory peaks (D3D12-GATE-MEMORY-PEAKS)
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.
2026-12-01 01:32:36 +01:00
f4c6aca754 gate: game-gate.ps1 says it needs PowerShell 7 (D3D12-GATE-PWSH7)
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.
2026-12-01 01:28:02 +01:00
be8e723711 docs/prompt_glyphs: device switches in the title reach the live slots; a visible switch is not yet seen 2026-11-30 19:06:41 -05:00
4929a0e99d Merge feat/live-prompts: button prompts follow a device switch during play 2026-11-30 18:48:36 -05:00
2878a3911c Merge pull request #2787 from TheGeogeo/test-red-green
scripts: red_green.py checks a pull request red and green locally (TEST-RED-GREEN-LOCAL)
2026-11-30 23:33:36 +01:00
ac58ddc504 fmisc_diff: do not judge the class bits of a NaN whose quiet bit is unmodelled
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>
2026-11-30 22:31:48 +00:00
3cfb115a5e docs: escape the preserved-half merge pipe in the design table
The literal pipe in the NVIDIA workaround row made tests/test_docs_design_rows.py
read the row as having more cells than the contract table header.

Co-Authored-By: SWE-2.1 Max <noreply@google.com>
2026-11-30 22:29:44 +00:00
88139a27ef rdna2spirv: extend the BitFieldUExtract workaround to cvt_i16/snorm and d16 saturate
The review of 97535ad found three more OpBitwiseAnd & 0xFFFF sites whose
operand is an %int-derived bitcast feeding a preserve-high-half merge,
the same shape NVIDIA's shader compiler miscompiles:

- v_cvt_i16_f16: OpConvertFToS %int -> Bitcast -> And, then write_lo16
  or the op_sel merge (the u16 sibling is %uint and safe)
- v_cvt_norm_i16_f16: the snorm path has the same structure (unorm safe)
- saturate_int16 signed path: SClamp %int -> Bitcast -> And reaches the
  preserve merges through the d16 image/buffer stores

All emit OpBitFieldUExtract %uint x, 0, 16 instead, spec-identical.
Audited every remaining And & 0xFFFF site: the rest are %uint-derived,
operand-side, packed-Or consumers, or constant masks.

RTX 4070 SUPER spot-checks of v_cvt_i16_f16/v_cvt_norm_i16_f16 (VOP2
form; llvm-mc rejects op_sel on these) produce the right words on both
the old and new modules, so the bug does not reproduce on this shape;
the extract removes the risky pattern regardless. Full semantic suite:
487 files, 6279 tests, 0 failures.

Co-Authored-By: Devin <noreply@cognition.ai>
2026-11-30 22:29:44 +00:00
944d4bd8cf rdna2spirv: emit OpBitFieldUExtract for the VOP3 16-bit result mask (NVIDIA And-&-0xFFFF miscompile)
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>
2026-11-30 22:29:43 +00:00