Skip to content

[integration] RT-LINUX-AMD-WORLD: what drew the world on Linux/AMD, with eleven runtime PRs, docs for running per GPU - #2350

Merged
aslan2142 merged 60 commits into
ProjectLeonida:mainfrom
aslan2142:linux-amd-world
Nov 26, 2026
Merged

aslan2142 merged 60 commits into
ProjectLeonida:mainfrom
aslan2142:linux-amd-world

Conversation

@aslan2142

Copy link
Copy Markdown
Collaborator

Claimed in the coordination issue as: RT-LINUX-AMD-WORLD

Everything that got the title's 3D world drawn on Linux with an AMD GPU (RX 7900 XTX, RADV, Wine) on 2026-11-26, as one integration PR, plus a page on how to run the game per platform and GPU.

What we measured

  • The world is drawn: opening night street and a sunset street with palms, cars and a character.
    • Over eight minutes in the world without a GPU hang, about one frame per six seconds.
    • Menus at 30 fps with no in-game compiling.
  • Five steps each removed a stop. All five are in the new docs/linux_proton.md section and in docs/running.md:
    1. amdgpu's lockup_timeout defaults to 2000 ms. World frames take seconds, so runs ended in ring gfx timeout with no page fault. It has to be raised (root, reboot).
    2. A native wave64 pack (--wave64-emulate off). Emulated single-wave compute in the round-loop form hung the GPU and drove RADV's compiler past 12 GiB (53 GB uncapped).
    3. The pipeline journal filled with gta6rt --precompile-pipelines. The pipelines stage's pipeline_cache.bin shared 0 of 5,526 pipeline keys with the game, for three reasons:
      • a different shader set;
      • different robustness features;
      • a different set-0 layout and subgroup request.
    4. LEONIDA_RT_AS=off plus LEONIDA_SKIP_COMPUTE, for the 724 library programs of 2 MiB or more (89-167 s each in the driver).
    5. The title's hang watchdog kept kicked (LEONIDA_TITLE_WATCHDOG=0 + LEONIDA_TITLE_WATCHDOG_KICK). The RVAs are measured locally and are not in the repository.
  • Still wrong:
    • frames alternate between white-out, a correct picture and black;
    • some geometry is misplaced;
    • VRAM reached 18.3 of 22.3 GB;
    • the run ended on a title int3 after 12 minutes.

Our commits

  • rdna2spirv: no round-loop fallback for single-wave emulated programs
    • 9f98dcc61's fallback no longer applies to inline_all plans: a single wave can't split at a barrier.
    • 666 main-set compute shaders return to the structured form. Translated and spirv-val counts are unchanged.
    • Tests, a fixture and a docs/design.md contract row.
  • make_game: a CPU Vulkan device does not decide the wave64 emulation
    • auto took the smallest maxSubgroupSize over all devices, so llvmpipe (8) turned emulation on beside native-wave64 GPUs (all 23,841 wave64 shaders).
    • CPU devices now count only when no GPU is listed; the runtime ranks them last anyway.
    • The log names the device that decided and the devices left out. Tests in tests/test_make_game_wave64.py.
  • Address guard, off by default (5 commits):
    • rdna2spirv.py --address-guard checks every heap_base access against a GPU page table.
    • LEONIDA_ADDRESS_GUARD=1 keeps that table current.
    • Refusals carry a module id. Console descriptor heaps outside the arena are entered as backed.
    • In one RX 7900 XTX run it refused 330,250 wild accesses, with no GPU page fault.
    • Docs, a contract row, address_guard_test and a semantic test.
  • Heap mirror: a host-RAM mirror of a console heap's copy for the release sweep (rescans of about 1 s become about 5 ms in the benchmark). Tests console_heap_copy and d3d12_console_heap_mirror.
  • VRAM: geometry copies in system memory (LEONIDA_GEOMETRY_HOST), retired when the title remaps their pages; tests in geometry_views_test and xmem_test.
  • Diagnostics, logging only unless said:
    • LEONIDA_UNKNOWN_TSHARP, LEONIDA_UNBACKED_VSHARP, LEONIDA_UPLOAD_LOG;
    • LEONIDA_UPLOAD_ALIAS (an experiment, changes behaviour);
    • LEONIDA_INPUT_FILE (button presses from a file, for headless runs).
  • dstorage history: fit packed tails against decoded BCPack siblings: refused BC7 streams in the package drop from 60 to 8 of 5,167. Test in tests/test_dstorage_history.py.
  • Docs:
    • docs/linux_proton.md: the AMD section.
    • docs/running.md: new, linked from docs/README.md. One section per platform and GPU (build, shaders, pre-compile, driver settings, environment with reasons, command, what to expect, known problems). Every value is marked measured by us, reported by others (linked) or TBD.
    • The new variables named in docs/d3d12_vulkan.md and docs/gameinput.md.
  • Merge conflicts resolved:
    • #1914 × #1886 in docs/d3d12_vulkan.md;
    • #2162 × the heap mirror (heap.copy.zero);
    • #2129 × the geometry-copy members in d3d12_vulkan_device.cpp.
    • Each merge commit says what it kept.

Includes

Each PR is merged at the head below, which hadn't moved since we tested it. The open ones will be closed in favour of this one, with credit to their authors.

PR Author Head What it contributes
#1914 RT-HEAVY-PIPELINE-CACHE @kawaii-shakal a42bffdc3 a cache of the offline cache's misses, written while the game runs
#2195 RT-XMEM-STARTUP-FASTFAIL @brandostrong eaf0b8d0c the ExecuteCommandLists serial stack kept out of TLS callbacks (the startup 0xC0000409)
#2240 RT-TITLE-TEXTURE-MAP-GEN @zmasi d088ea79b TitleTexture readability synced with title_memory_map between passes (draft PR)
#2044 RT-XAPU-OPUS-DECODE @BubsMcgee 4cfbdfc0b Opus decoding through a Rust sidecar; the first game audio on our machine
#1144 RT-XAPU-CONNECT-LAYOUTS @nicoco23 6ee7ef89b xapu.dll as a command queue with the console's layouts (inside #2044)
#1957 @IlyassRS3 9520db518 a work-aware timeout clock for list value waits; 450 of 464 cross-queue gates met in the world run, 0 of 33 before
#2097 RT-MESH-PSO-CONSERVATIVE-TOPOLOGY @Snooozs b986d274b mesh PSOs with conservative rasterization no longer refused
#2162 RT-CONSOLE-FIX-NEVER-DEFER-BUFFER-VSHARP @abnalstlll-byte 2769c5a73 buffer V#s never deferred past the console-fix budget
#2129 RT-TITLE-WINDOW-WRITE-BACK @star41905453-coder 5fa864e53 a title window's GPU writes copied back to the title's pages
#2124 DSTORAGE-HOLD-PAGE-READS @QemmHD 6b09de493 reads into physical pages wait for the title's Submit
#2144 INPUT-SCRIPT-HOLD @klikso 7bd4cec02 button@seconds:hold in input scripts
#1972 RT-SLOT31-CPU-TWIN-TITLE-PAGES @kurrutako 28fc0262d a slot-31 copy leaves the title's own mappings at the paired CPU range, so the title no longer loses its pages there

Tests

Linux 7.3.6, RX 7900 XTX and Ryzen 9 7950X3D iGPU (RDNA2, gfx1036), RADV Mesa 26.3.1, Wine 11.22 (Staging).

  • Translator suite: 500 files, 6,365 tests, 0 failed (scripts/run_semantic_tests.py).
  • Standard-library tests: all 513 files tests/test_*.py with python -I pass, including test_ci_registration, test_text_write_line_endings, test_docs_env_vars and test_tool_stdout_encoding. compileall is clean.
  • check_no_game_data.py on every added or changed file (80): clean.
  • Linux runtime build and ctest on the iGPU: 112 of 112 passed.
  • Windows suite under Wine (clang-cl + xwin, iGPU), compared with main 73516a290 built the same way: no test went from pass to fail.
  • Game run (world frames): the same eleven PRs on main a73a57e13, on the RX 7900 XTX.
    • The pack was native wave64 (--wave64-emulate off), so the translator fix, which concerns emulated programs only, was not exercised there. Its own measurements are above.
    • Our address guard, heap mirror and diagnostics were not active (all off by default).
    • No game run was made from this exact branch.
  • Not tested: native Windows (MSVC), NVIDIA, Intel, macOS.

Depends on: none (the included PRs are merged here, not depended on).

AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)

nicoco23 and others added 30 commits November 24, 2026 19:22
…o silent

xapu.dll moves out of xapu_chad.cpp into xapu.cpp; chad.dll is unchanged.

The signatures, structure layouts, command kinds, option bits and error
codes come from Marvisak/VIctory (GPL-3.0-or-later,
crates/victory-hle/src/modules/apu.rs at ffe310e), which runs the retail
executable through these calls. Only facts are used, no code
(docs/related_projects.md). They settle what the old header left open:
XApuConnect's first argument is an input (processing kind, streams,
commands per stream, memory bytes, frames per output, options), and the
dword the title reads at +0x34 of a result is its output byte count.

- XApuConnect validates the input, allocates the memory the title asks
  for (zeroed) and, with option 0x8, an auto-reset result event; any
  processing kind but Opus decoding is E_NOTIMPL.
- Each accepted command gives one result in command order, with the
  console's error codes; an unknown kind, a stream out of range or a full
  stream is refused with no result.
- A process result carries the frame count of the Opus packet's TOC byte
  (RFC 6716, section 3.1), clipped from first_frame, to frame_count and to
  the output, and zeros in the output. Nothing is decoded.
- xapu_chad_test covers result order, the full queue, the error codes,
  frame counts, silence and the event.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ida#1144)

The fallback file list in build_runtime.ps1 must match the gta6rt sources
CMake has; xapu.cpp was missing, so test_build_runtime_fallback failed
and a build without CMake would have had no xapu.dll shim.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o xapu-connect-layouts

main added its own runtime/shims/xapu.cpp: the boot stack's earlier xapu.dll stub, which gta6rt does not link and
xapu_test checks. This branch's xapu.dll command queue moves to runtime/shims/xapu_queue.cpp so both stay: gta6rt,
xapu_chad_test, the cl.exe fallback list in scripts/build_runtime.ps1 and the references in xapu_chad.cpp,
xapu_chad_test.cpp and docs/audio_hal_exe_calls.md name the new file; main's xapu.cpp and xapu_test are unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GnGkjYHUWx92TkwvwCnAMe
… the game runs (RT-HEAVY-PIPELINE-CACHE)

pipeline_cache.session.bin can't keep what a crashed run compiled: it is written at device teardown only, and
a cache seeded from the multi-GiB corpus returns the whole corpus, over its write limit. So the slow builds
the corpus misses (the pipeline library's compute programs, 3 to 7 s each on an RTX 5070 Ti) are compiled
again on every boot.

Each graphics and compute build now first asks the corpus cache with
VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT. A miss is built against a second cache, seeded from
pipeline_cache.heavy.bin next to pipeline_cache.bin, so that cache holds only the misses.

A build of at least LEONIDA_HEAVY_PIPELINE_CACHE_MS (500 by default) schedules a write. A thread of its own
writes the cache 3 s after the newest slow build and no later than 20 s after the first unwritten one,
through the session cache's staging file and rename. At teardown it writes what is left. 0 turns it off,
and with it pipelineCreationCacheControl unless LEONIDA_PIPELINE_COMPILE=cache-only asks for it.

Measured with vk_pipeline_check on the RTX 5070 Ti (617.42): a cache-only create of four library compute
programs the corpus lacks returns VK_PIPELINE_COMPILE_REQUIRED in under 1 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, counted, not timed; teardown keeps fast builds too

GetTickCount64 moves in 10-16 ms steps, so a slow build noted during a write in the write's own tick was taken
as written. The schedule now counts notes. And without an offline seed every build goes to the heavy cache:
fast ones never schedule a write, so teardown writes the cache whenever any build went into it, which is what
pipeline_cache.session.bin used to keep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…U range

copy_page_mappings (queue slot 31, CopyPageMappingsBatchX) mirrors every page
it maps or unmaps at a GPU-only destination onto the paired CPU range
(title_gpu_views::to_cpu). It did so even where the title had mapped that CPU
page itself with XMemMapPhysicalPages or XMemMapPhysicalPagesScatter: a copy
replaced the title's page, and an unmap (kind 2) left the title's CPU page
reserved. The title's next read of it faulted, and the run ended.

The console's CopyPageMappingsBatchX edits only the GPU-only range's page
table, so a CPU page holding a mapping of the title's (physical, scatter or a
slot-31 copy onto that address) is now left as it is. Pages the mirror made
itself, zero plants and pages with no mapping still follow the GPU-only range,
so the D3D12 layer's reads at the CPU view keep working. Each page kept is
counted and the first ones are logged.

The unmaps these paths make are now labelled in the read-fault report
(CopyPageMappingsBatchX unmap / paired CPU page / remap / hole,
XMemMapPhysicalPagesScatter unmap / remap) instead of the default "unmap".

xmem_test: test_copy_page_mappings_cpu_view now checks that a copy onto, and
an unmap of, a GPU-only page whose paired CPU page the title mapped keep the
title's bytes at the CPU page. Both checks fail on the old code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ail route

queue_copy_page_mappings logs once whether CopyPageMappingsBatchX goes to an
installed batch hook or to the default adapter over xmem's range callback
(copy_page_mappings_fn), so a boot's read-fault reports can be matched to the
implementation the tests cover. Nothing in the runtime installs a hook, so a
retail run takes the default adapter.

d3d12_xmem_placed_test gains queue_remap_default_route, for that route: no
hook, a legacy-paired GPU-only destination, and a GPU-only pool backed only
through its CPU alias. The title maps a page of its own at one CPU twin while
the remap waits behind queue work (deferred with list values, waited for with
LEONIDA_LIST_VALUES=0), so ownership is checked when the remap is applied.
After the copy the GPU-only pages hold the pool's bytes, the other twin follows
them and the title's page keeps its bytes; after an unmap the GPU-only pages
and the mirrored twin are reserved and the title's page still holds its bytes.
On the code before this pull request the title's page check fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…DECODE)

Builds on ProjectLeonida#1144 (RT-XAPU-CONNECT-LAYOUTS): the queue and layouts stay there;
fill() decodes each process packet through a Rust C-ABI crate over BSD-3
opus-pure when cargo builds it, and keeps the table-of-contents silence path
otherwise. Adds xapu_opus_test (a generated 440 Hz stereo packet decoded to
960 frames) and the CMake wiring; xapu_chad_test keeps covering the layouts
and the silent path. No game data.
…ype (RT-MESH-PSO-CONSERVATIVE-TOPOLOGY)

Finding by Undefined3301 in ProjectLeonida#1608.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A queue with auto-submit on submits itself once the entries enqueued
since the last submit reach half its capacity. A request whose
destination is a physical page list names its pages through
DestinationPageArray, a pointer into the title's own page-number table,
and the worker reads that table only when the request runs
(page_transfer). The title fills the page table just before Submit. So a
read started by the self-submit found page 0 (the entry failed) or the
number the slot held before (the data landed in a page that now belongs
to something else, with no error).

A self-submit now stops at the first read into physical pages. That read
and every entry behind it wait for the title's Submit, in order, so a
status entry, fence or event behind a held read still comes after it. A
full queue submits the held entries too, since the title cannot call
Submit while it waits in an enqueue. Close submits everything, as
before. A hold also ends after LEONIDA_DSTORAGE_HOLD_MS (2000 ms unless
set; 0 means no limit), so a path that never calls Submit cannot stall
for good. LEONIDA_DSTORAGE_HOLD_PAGES=0 restores the old self-submit of
everything.

"[rt] ds-hold" counts self-submits, held reads, full-queue and timed
releases, and destination lists that named page 0 when written. It is
printed at each power of two of the counter that moved
(runtime/src/dstorage_hold.h).

The idea is from Marvisak/VIctory eddde73; it also appears in
fxceless/victory-fork 79cfdd9. Written anew for this queue.

Test: dstorage_test, test_page_reads_wait_for_submit: a list changed
between the self-submit and Submit, a list still empty at the
self-submit, a full queue, the default and an explicit time limit, no
limit, the switch, and the page-0 counter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
…INDOW-WRITE-BACK)

A window of the title's memory is a read-side mirror refreshed before every
submission, so a UAV or raw write into one landed in the copy and the title
never saw it. At the world start that is the WRITE_INVALID device loss of
ProjectLeonida#1537 (QemmHD, 160 s into the load, past the cap): the culling compute writes
through addresses that name title memory, and nothing ever reads the result
back into the pages.

The layer now keeps every title range a submission's bindings reach (the
resolve path, so root views, table V#s and created views alike) and copies
those ranges from the copy to the title's pages at the start of the next
refresh, before the forward copy. A page the title wrote in between takes the
title's newer bytes and its GPU result is dropped; the tracker already knows
those pages (guarded, hot and clean). Caps: 8,192 ranges and 64 MiB a
submission, logged once; LEONIDA_TITLE_WRITEBACK=0 turns it off.

Test: d3d12_title_window_write_back, a dispatch through a root UAV at the
title's pages: the written words reach the pages, hold across two
submissions, and a title write survives the next forward copy. No game files.

Item: RT-TITLE-WINDOW-WRITE-BACK (claimed in ProjectLeonida#1608)

Wine against llvmpipe.
…LETE snapshot

Review of RT-HEAVY-PIPELINE-CACHE:
- The writer thread marked a generation written even when the save failed, so the
  cache stayed unsaved until teardown. A failed save now keeps the cache dirty and
  is retried after a bounded backoff (5 s, doubling, capped at 2 min), so a write
  that keeps failing does not spin. WriteSchedule::failed() holds that decision and
  heavy_pipeline_cache_test checks it.
- save_heavy_pipeline_cache accepted VK_INCOMPLETE and published the truncated blob
  over a complete file. It now requires VK_SUCCESS, like the session cache, and
  keeps the previous file; the next try queries a fresh size.

Changes made by Claude Code (AI-assisted).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JPqXc6svM4pbBagTsVEYA3
…TITLE-WINDOW-WRITE-BACK)

The first cut copied the reached ranges back at the next refresh whether or not
the submission that wrote them had finished, so a range the GPU was still
filling could be read half done.

A batch is now kept with the retire ticket of the submission that will use it,
and the ranges are copied back only once the context reports that ticket done.
Anything not yet retired stays queued and is copied on a later refresh, still
before that refresh's forward copy, so the ordering that keeps the title's own
newer bytes is unchanged.

The test is unchanged and still passes: it asserts the pages are untouched
until the next submission and then hold exactly what the shader wrote.
main's per-pipeline compute journal (pipeline_cache_journal.h) now persists every compute build and survives a
crash, so the compute build takes main's build_compute_pipeline and the heavy cache keeps graphics pipelines only.
CMake keeps both test sets; docs and the create_pipeline comment say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-NEVER-DEFER-BUFFER-VSHARP)

In fix_console_slots, when the LEONIDA_CONSOLE_FIX_US budget expires, do not null or defer buffer descriptors (!(w3 >> 30)). Only defer image T# descriptors to retry_console_slots.

Buffer V# descriptors only rebase address offsets and are fast to fix, whereas image T#s perform costly texture lookups and view creation. Compute shaders during world transition (e.g. lib_cs_01144) read loop bounds and record counts from buffer descriptors; nulling them causes infinite loops and device loss.

Tested with console_heap_vsharp_slots_test and vk_console_heap_gpu_test.

AI-assisted (Claude Code).
At world-start frame rates the retail title reads its pad every few seconds,
so a 0.3 s scripted press falls between two reads and never arrives. An
entry may now give its own hold time; without one the press stays 0.3 s.
Holds of 0 or less, over 600 s or that are not a number reject the entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ProjectLeonida#2098 gave the SDL path its own loop (held 300 ms, then until the title
has read the pads six times, at most 5 s), which ignored button@seconds:hold.
A press now lasts its own hold, then the read latch, and never past 5 s or
its hold if longer. The long-script test checks both: X kept past 300 ms
until six reads, Y kept for its 0.6 s after them. It fails on the old loop.

Found by AndreiKocherzhinskiiA on ProjectLeonida#1608.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
861bb05 added geometry_execute_serials() as a function-local
thread_local std::vector. A C++ thread_local with a destructor in
gta6rt.exe adds TLS callbacks to the image, which the loader's TLS
index-0 move must not have (pe_loader.cpp reserve_tls_index0; see
VulkanContext::stage_xdxr_table). With it the title's CRT startup hits
ucrtbase's one-shot _register_thread_local_exe_atexit_callback guard
and terminates: 0xC0000409 (info0=7) at ~1.6 s, before any D3D12 call.

Use a fixed aggregate instead: no destructor, no TLS callbacks, the same
per-thread LIFO, bounded at 32 replays with overflow reported once.

Tested: runtime builds; with LEONIDA_D3D12=vulkan the fix boots past
startup and submits, while 0b11d86 exits 0xC0000409 at ~1.5 s.
NVIDIA RTX 4090, driver 616.64, Windows 11.

AI-assisted (Claude Code).

Co-Authored-By: Claude Code <noreply@anthropic.com>
…WRITE-BACK)

A slot-133 buffer the driver will not import is a shadow of the title's pages,
and the write through it landed in the copy exactly as a window's did. The
mechanism is already the same one - the pages are title memory, the alias of
the buffer resolves through the noter, and the tracker carries the range - but
nothing said so and nothing tested it.

d3d12_placed_write_back: a root UAV over a placed buffer. The pages keep the
title's words until the next submission, then hold the shader's; a write by the
title over the result survives the copy forward.
…nced (RT-TITLE-WINDOW-WRITE-BACK)

A fenced batch waits for its submission's retire ticket. On a queue the layer
holds back (console ordering) the ticket is not ours, and in the worst case
nothing retires soon: the pending list would grow for the rest of the run.

Past 64 pending batches the oldest is now copied back without waiting, once
each, and the fact is logged once. Docs say so.
Between periodic refresh_title_textures passes, synchronous slot-70 view creation and the async fill worker checked TextureReadability with a constant generation, missing title_memory_map range changes since the last pass. Track the map generation on TextureReadability and consult title_memory_map::changes_since outside refresh passes so unmapped or decommitted pages defer before hashing and newly mapped pages publish immediately without waiting for a submission.

Also mark mix_words and hash_bytes LEONIDA_GUARDED_NO_BUILTIN using an unaligned 64-bit load so clang-cl cannot emit CRT memcpy calls inside the __try frame, and classify non-title read faults over unmapped title pages in xmem::physical_page_fault as FaultExit::passed_guarded.
…mment

Review follow-up (MoonEyes): the InputScript help in boot.ps1 now says
each press is held 300 ms and that button@seconds:hold holds it longer.
The header comment in gameinput_script.h is wrapped at 120 like the rest
of the file. Comments only; no code change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
translate() re-translated every emulated wave64 program whose inline
structured form has an OpControlBarrier under a selection or loop as the
round loop (barriers_under_control_flow), for NVIDIA, which hangs on a
barrier only part of the workgroup reaches. A single-wave workgroup
(plan mode inline_all) is one wave: its barriers sit at the top level or
under %pc-only guards, which every invocation takes alike, so the
fallback only applies to multi-wave plans now.

The round form keeps nearly the whole register file live across the
loop and drove RADV/ACO's spiller past 12 GiB (53 GB uncapped) on large
single-wave programs, and made programs with long loops 10-100 times
slower. 666 main-set compute shaders return to the structured form;
translated and spirv-val counts are unchanged.

Restores the single-wave expectations in test_wave64_emulate_opt.py,
test_loop_ballot_barrier.py and test_loop_iteration_guard.py (its round
scheduler check now uses --dispatch-loop), adds
test_wave64_single_wave_barrier.py with a hand-written fixture, and a
docs/design.md contract row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A diagnostic for the world's missing textures: each distinct base address a title-written T# names with no
texture there is logged once (format, type, the SW_MODE bits, size, mips, layers, and whether it is title
memory), with a summary by shape every 8192 lookups. Off by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aw words

Two more diagnostics for the world's missing data: the buffer V#s fix_vsharp writes empty because nothing
backs their base, by distinct base and by 4 GiB range, and the raw words of the first unknown T#s, so the
address bits can be checked against the decoder. Off by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aslan2142 added a commit to aslan2142/leonida that referenced this pull request Nov 26, 2026
…ead it again

GetEnvironmentVariableA at every remap ran under g_phys_mutex in every scatter call; with it, xmem_test's split race
("the reader of the views' last pages never faults or misreads") failed in two full Wine runs in a row, where main
passed it twice. The value is cached as before ProjectLeonida#2350's default changed; rt::xmem::reload_remap_release_setting lets
test_remap_releases switch it. Two full runs since: no change against main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aslan2142 added a commit to aslan2142/leonida that referenced this pull request Nov 26, 2026
…OR=1

The mirror (7460590, in ProjectLeonida#2350) was on by default. World runs on merged main on an RX 7900 XTX (RADV), the same
settings otherwise:

- remap release on, mirror on: GPU page fault and a lost device about 40 s into the world;
- remap release off, mirror on: no evictions and no page fault, but a hang in a library compute program on the
  direct queue about a minute in, a ring timeout and a lost device;
- both off: past five minutes in the world with no fault or hang, ending where the build before ProjectLeonida#2350 ended, on the
  title's own breakpoint.

Why the mirror hangs the GPU is not known. It is off unless the variable is 1; the release sweep then reads the copy,
as before the mirror.

Tests: d3d12_console_heap_mirror sets LEONIDA_HEAP_MIRROR=1; a new ctest entry, d3d12_console_heap_mirror_default,
runs the same program without the variable and expects no mirror (it fails on main).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aslan2142 added a commit that referenced this pull request Nov 26, 2026
…P_RELEASE=1

Since #2350 a remap of physical pages that gives a page another frame retired the geometry copies over it, on by
default. In the first world run of that main on an RX 7900 XTX (RADV) the copies were retired by the thousand
(evicted 15010 in about 40 s) and the run ended in a GPUVM page fault (TCP read) and a lost device; the same build
settings without it ran eight minutes with evicted 0 and no fault.

A remap leaves the address valid on the console, so the title keeps using what names it, and not everything that
names a copy's address is rewritten when the copy goes:

- a root view is resolved while its list is recorded (d3d12_com.cpp, GraphicsCommandList::address); a list recorded
  before the retirement and executed in an ExecuteCommandLists begun after it is not among the replays the
  retirement waits for (kAfterExecutes covers only those in progress), so it reads the freed copy;
- a placed buffer view written outside a console heap carries the copy's address for as long as the descriptor lives.

The remap release is now off unless the variable is 1, read at every remap; the copies follow the new pages through
the refresh, as before #2350. Freeing, decommitting and unmapping still retire copies.

Tests: xmem_test test_remap_releases checks that a remap releases nothing by default and with 0, then the existing
checks with 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aslan2142 added a commit that referenced this pull request Nov 26, 2026
Self-merge by a maintainer: it fixes two regressions that our own merge of #2350 caused (a world run on main lost the device within about a minute). Tested on main fbf100b: Linux ctest 112/112; Wine suite (clang-cl + xwin, RDNA2 iGPU, RADV) with no test going from pass to fail; three world runs on the RX 7900 XTX with the two variables set by hand, the one with both off holding 5+ minutes in the world. No game run from this exact build yet; the next world run from main is that check. AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2).
aslan2142 added a commit that referenced this pull request Nov 26, 2026
Both came in with #2350 as additions on top of stopgap mechanisms, broke world runs (remap release: a GPUVM page
fault and a lost device; the mirror: a GPU hang) and were made opt-in by #2356. They go completely; with both
variables unset, main behaves as before.

Remap release (LEONIDA_GEOMETRY_REMAP_RELEASE, from 36771ec):
- xmem.cpp: RemapReleases, remap_releases_enabled() and the page recording in unmap_range_locked; the four call
  sites (XMemMapPhysicalPages, the scatter call, both copy_page_mappings).
- xmem.h/xmem.cpp: the test seam rt::xmem::reload_remap_release_setting().
- xmem_test: test_remap_releases (and the title_geometry_watch.h include only it used).
- README row, the docs/d3d12_vulkan.md paragraph; comments that named it.

Console heap mirror (LEONIDA_HEAP_MIRROR, LEONIDA_HEAP_MIRROR_CHECK, from 7460590):
- src/console_heap_copy.h goes. ConsoleHeap::copy is a plain std::uint8_t* again, written with memcpy/memset as
  before the mirror, including the zeroing site that #2350's merge of #2162 resolved as heap.copy.zero(); the
  compute-input probe reads it directly again. Without the mirror, view() was the copy itself, so nothing changes.
- heap_mirror_enabled(), heap_mirror_check_enabled(), check_console_heap_mirror(), the per-heap check counters and
  log line, and the test API console_heap_mirror_mismatches() (d3d12_com.h).
- Tests console_heap_copy, d3d12_console_heap_mirror, _off and _default with their CMake entries; README rows and
  the docs/d3d12_vulkan.md sentences.

Kept, because other paths use them or main's behaviour with the variable unset depends on them:
- LEONIDA_GEOMETRY_HOST and its DeviceState memory-type assert (dc9ef1a).
- The final copy at retirement (GeometryViews::retire_range's final_copy, "copied at retirement" in the geometry
  buffers line): XMemFree of a title heap block (free_title_block) reports a release while the block's memory stays
  committed and readable, so that copy is still made without remap release. Comments now say that instead of
  naming remaps; geometry_views_test case 15 stays.
- forget_pool_span and "retired with their copy" in the title memory line: any retirement (free, decommit, unmap)
  feeds it.
- The release queue's joining of touching ranges (title_geometry_watch.h): unmaps report page runs too;
  geometry_views_test case 16 stays.
- LEONIDA_CONSOLE_RELEASE_FILTER, which predates the mirror; its sweep reads the copy again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mike7581 added a commit to Mike7581/leonida that referenced this pull request Nov 26, 2026
…by shims/xapu_chad.cpp

Since ubiquitarianism#1144 merged (via ubiquitarianism#2350), xapu_chad.cpp serves only chad.dll and xapu.dll comes from xapu_queue.cpp, which runtime/CMakeLists.txt links into gta6rt and build_runtime.ps1's cl.exe fallback compiles. Wording from nicoco23's review.
vinceychu added a commit to vinceychu/leonidas that referenced this pull request Nov 26, 2026
…nd LLVM_MC are unset

The script, added in ubiquitarianism#2350 after this PR was opened, also defaulted --llvm-mc
to os.environ.get("LLVM_MC", "llvm-mc") and checked that name with
shutil.which, so with only Ubuntu's llvm-21 it skipped (exit 77). It now asks
mc_command.mc_command() like run_gpu_tests.py, and the guard test added here
passes on main again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RAL8MMXUuNpQAVa1iiyAMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.