Integrate post-story-load memory, queue and Vulkan fixes (RT-POST-STORY-RUNTIME) #1723

Manually merged
github merged 14 commits from gh-pr/1723/head into gh-pr/1723/base 2026-11-26 10:02:33 +00:00
Owner

@⁠Moriz82 on GitHub · 2026-11-25 09:45 UTC · original
integration/post-story-runtime → main · +27279 −8823 · 107 files · 14 commits · merged 2026-11-25 11:34 UTC

Claimed as RT-POST-STORY-RUNTIME in the coordination issue.

This follows #984, which brought the offline boot through the end of the story load on Linux/Proton and native Windows. This draft brings the subsequent runtime changes onto upstream’s pipeline-worker, descriptor and queue interfaces. It includes the queue, memory and draw changes together so reviewers can exercise the same executable the integration tests cover.

What and why

Area Change
Physical memory A reserve-only XMem window carved from a live parent keeps the ranges on either side. Page remaps, CPU/GPU aliases, first-touch handling and guarded copies now coordinate with the threads that use them. An opt-in private heap isolates title allocations.
Command lists and queues Console 32- and 64-bit writes, waits and GPU timestamps retain their position in the list. Queue page remaps keep their fence alive until completion. This overlaps the write-value work in #622.
Indirect graphics Simple DRAW and DRAW_INDEXED signatures use the recorded pipeline, targets, root data and index/vertex bindings. Bundles can record the operation and inherit the executing parent's state. The GPU checks argument counts in private scratch and applies a shared work budget per command list. Unsupported signatures still go through validation.
Descriptors and arena Unreachable buffer descriptors resolve to a null view. Unbacked slots retry under a bounded budget. Heap padding protects the covered range beyond the last resource descriptor. Arena allocation and free-block walks use the same lock.
Textures and submission Texture refresh holds references across callbacks; optional background work moves fills and geometry copies off the submitting thread. Buffer refreshes can copy only dirty tiles. Layout changes are journaled per submission. Small linear RGBA32F exposure targets have a tested readback footprint.
Ray tracing and presentation TLAS construction translates instance addresses for bottom-level acceleration structures. Startup splash detection samples the readback image sparsely.
Pipeline lifetime Background compilation and device teardown coordinate so a released pipeline cannot leave queued work using its Vulkan objects. Submission, compiler and device-fault diagnostics expose where execution stalls.
Diagnostics and tests Optional Nsight Aftermath support, frame-phase counters, a local stage timeline, GPU pixel/readback fixtures and CPU concurrency tests.

Contributors. Plaaasma co-authored the changes, including XMem window handling, list values and descriptor backing. ivanepsilondelta contributed the stateful indirect graphics and pixel tests. Both are credited on the integration commit.

Tested

Platform and build Observed result
Linux / Proton, accepted working build Offline Series S configuration on an RTX 4070. Landed at about 40 s and entered story loading at about 60 s. The loading screen had ended by the 160 s sample. The runtime continued submitting work until a title assertion at about 545 s, at roughly 0.85 title frames/s after loading. The run reported no GPU device loss.
Linux, public integration during rebase 6,280 translator tests passed across 488 files. The portable runtime suite passed 87 of 89 registered cases. Two skipped because the translated corpus and Vulkan validation mode were unset. The three changed built-in compute shaders regenerated byte-for-byte from their GLSL and passed SPIR-V validation.
Windows executable, cross-built on Linux The x64 MSVC-target executable linked and ran under Proton. The RTX 4070 passed the null-descriptor and indirect-clamp GPU fixtures. Texture-layout tests passed 465 checks. An earlier trial of the public integration stopped at a title breakpoint during initialization with the locally available shader library.
Native Windows The previously merged baseline reached the end of story loading on Windows 11 with an RTX 4070 Ti. The public integration head still needs a native Windows boot. Baseline results in #984

The accepted working build used a diagnostic configuration with title compute, indirect draws and acceleration-structure builds disabled, and stub pipelines enabled. That run establishes progress through loading. Playable world rendering and default-settings performance remain unverified.

Open checks for this draft

  • During testing the indirect bundle and heap-resource pixel fixtures exposed a replay path that read scratch arguments before the GPU clamp populated them. This commit fixes the missing dispatch. Those pixel fixtures and a direct-heap test that timed out need a fresh run after the rebase.
  • The default XMem suite on Proton still failed its system-wide commit-charge assertion, which also failed on upstream. Forced reserve mode had additional Wine view-state and protection mismatches.
  • The final rebase retained upstream's new pipeline compilation workers. The new null-buffer semantic test, data guard, diff checks and clean merge were verified on the resulting commit. The full-suite numbers above precede that final rebase. The runtime workflow path-filter test also fails on upstream and is being addressed separately in #1657.

GPUs tested: NVIDIA GeForce RTX 4070, driver 620.73.04, CachyOS with Proton Experimental. The native Windows RTX 4070 Ti result above belongs to #984.

AI-assisted: yes

Checklist

  • Rebased on upstream main and verified a clean Git merge.
  • This is a cross-subsystem integration draft for review as a single runtime change.
  • Source and synthetic fixtures only. The game-data guard passed. Private traces, captures, binaries and working-branch history stay local.
  • The translator rules are unchanged. The new semantic test covers the existing null-buffer contract.
**@⁠Moriz82** on GitHub · 2026-11-25 09:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1723) `integration/post-story-runtime` → `main` · +27279 −8823 · 107 files · 14 commits · merged 2026-11-25 11:34 UTC Claimed as **RT-POST-STORY-RUNTIME** in [the coordination issue](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608). This follows [#984](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/984), which brought the offline boot through the end of the story load on Linux/Proton and native Windows. This draft brings the subsequent runtime changes onto upstream’s pipeline-worker, descriptor and queue interfaces. It includes the queue, memory and draw changes together so reviewers can exercise the same executable the integration tests cover. ### What and why | Area | Change | | --- | --- | | Physical memory | A reserve-only XMem window carved from a live parent keeps the ranges on either side. Page remaps, CPU/GPU aliases, first-touch handling and guarded copies now coordinate with the threads that use them. An opt-in private heap isolates title allocations. | | Command lists and queues | Console 32- and 64-bit writes, waits and GPU timestamps retain their position in the list. Queue page remaps keep their fence alive until completion. This overlaps the write-value work in [#622](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/622). | | Indirect graphics | Simple DRAW and DRAW_INDEXED signatures use the recorded pipeline, targets, root data and index/vertex bindings. Bundles can record the operation and inherit the executing parent's state. The GPU checks argument counts in private scratch and applies a shared work budget per command list. Unsupported signatures still go through validation. | | Descriptors and arena | Unreachable buffer descriptors resolve to a null view. Unbacked slots retry under a bounded budget. Heap padding protects the covered range beyond the last resource descriptor. Arena allocation and free-block walks use the same lock. | | Textures and submission | Texture refresh holds references across callbacks; optional background work moves fills and geometry copies off the submitting thread. Buffer refreshes can copy only dirty tiles. Layout changes are journaled per submission. Small linear RGBA32F exposure targets have a tested readback footprint. | | Ray tracing and presentation | TLAS construction translates instance addresses for bottom-level acceleration structures. Startup splash detection samples the readback image sparsely. | | Pipeline lifetime | Background compilation and device teardown coordinate so a released pipeline cannot leave queued work using its Vulkan objects. Submission, compiler and device-fault diagnostics expose where execution stalls. | | Diagnostics and tests | Optional Nsight Aftermath support, frame-phase counters, a local stage timeline, GPU pixel/readback fixtures and CPU concurrency tests. | **Contributors.** Plaaasma co-authored the changes, including XMem window handling, list values and descriptor backing. ivanepsilondelta contributed the stateful indirect graphics and pixel tests. Both are credited on the integration commit. ### Tested | Platform and build | Observed result | | --- | --- | | Linux / Proton, accepted working build | Offline Series S configuration on an RTX 4070. Landed at about 40 s and entered story loading at about 60 s. The loading screen had ended by the 160 s sample. The runtime continued submitting work until a title assertion at about 545 s, at roughly 0.85 title frames/s after loading. The run reported no GPU device loss. | | Linux, public integration during rebase | 6,280 translator tests passed across 488 files. The portable runtime suite passed 87 of 89 registered cases. Two skipped because the translated corpus and Vulkan validation mode were unset. The three changed built-in compute shaders regenerated byte-for-byte from their GLSL and passed SPIR-V validation. | | Windows executable, cross-built on Linux | The x64 MSVC-target executable linked and ran under Proton. The RTX 4070 passed the null-descriptor and indirect-clamp GPU fixtures. Texture-layout tests passed 465 checks. An earlier trial of the public integration stopped at a title breakpoint during initialization with the locally available shader library. | | Native Windows | The previously merged baseline reached the end of story loading on Windows 11 with an RTX 4070 Ti. The public integration head still needs a native Windows boot. [Baseline results in #984](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/984) | The accepted working build used a diagnostic configuration with title compute, indirect draws and acceleration-structure builds disabled, and stub pipelines enabled. That run establishes progress through loading. Playable world rendering and default-settings performance remain unverified. **Open checks for this draft** - During testing the indirect bundle and heap-resource pixel fixtures exposed a replay path that read scratch arguments before the GPU clamp populated them. This commit fixes the missing dispatch. Those pixel fixtures and a direct-heap test that timed out need a fresh run after the rebase. - The default XMem suite on Proton still failed its system-wide commit-charge assertion, which also failed on upstream. Forced reserve mode had additional Wine view-state and protection mismatches. - The final rebase retained upstream's new pipeline compilation workers. The new null-buffer semantic test, data guard, diff checks and clean merge were verified on the resulting commit. The full-suite numbers above precede that final rebase. The runtime workflow path-filter test also fails on upstream and is being addressed separately in [#1657](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/1657). GPUs tested: NVIDIA GeForce RTX 4070, driver 620.73.04, CachyOS with Proton Experimental. The native Windows RTX 4070 Ti result above belongs to #984. AI-assisted: yes ### Checklist - [x] Rebased on upstream main and verified a clean Git merge. - [ ] This is a cross-subsystem integration draft for review as a single runtime change. - [x] Source and synthetic fixtures only. The game-data guard passed. Private traces, captures, binaries and working-branch history stay local. - The translator rules are unchanged. The new semantic test covers the existing null-buffer contract.
Preserve physical window aliases across remaps, order console list values,
and replay bounded indirect graphics with captured draw state. Coordinate
pipeline lifetime, texture refresh and queue teardown. Add synthetic CPU
and GPU coverage for the integrated paths.

Co-authored-by: Plaaasma <[email protected]>
Co-authored-by: ivanepsilondelta <[email protected]>
Both headers now include <windows.h>, and the test targets that reach them
through vulkan_replay.h (replay_uav_clear_offset_test first) do not define
NOMINMAX, so windows.h's max/min macros broke the std::max/std::min calls in
vulkan_replay.h ("expected unqualified-id") and the runtime's test build
failed. Guard the include the way vulkan_gpu_labels.h already does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The list-values test of #1723 installs `record_page_mapping` as the
CopyPageMappingsBatchX hook and checks `g_page_mapping`, but neither was
defined, so xs_proxy_mock_test did not compile. The recorder counts the
calls and keeps the arguments plus a copy of the first batch's first
ranges, so section 6 can tell a deferred remap of the proxy's copy from
one made at the call with the caller's array. It is written from
`CopyPageMappingsHook` (shims/d3d12_xs_device.h) and the fields the test
reads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
xs_proxy_mock failed at line 4791: on a queue whose presentation is
managed outside (set_presentation_handler), raw(queue, 31, 0) must be
E_NOTIMPL and must not reach SuspendX. #1723's CopyPageMappingsBatchX
dispatch answered every slot-31 call itself, and with no hook and no
xmem (a proxy compiled alone) queue_copy_page_mappings returned S_OK
having mapped nothing.

The test was right. The file's own comment says that without xmem the
slot is refused as before, and check_queue_copy_page_mappings expects
the console-only answer every unmodelled queue slot gets in that case.
The new dispatch now runs only when something can remap (a hook set
with set_copy_page_mappings_hook, or xmem's copy_page_mappings_fn);
otherwise the call goes on to the presentation routes and the
unmodelled-slot answer as on main. With xmem linked, as in gta6rt,
nothing changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
d3d12_title_va failed at line 502 and d3d12_unmapped_vsharp at line 191:
a V# the CPU writes into a bound table of a layer heap, naming an
address nothing backs (an unknown high address, a view past the end of a
real buffer), kept its base after the table scan, so a shader would add
heap_base to it and fault.

The tests were right. #1723 added fix_vsharp, which rebases a V# into
the title's memory and writes one with no GPU backing as zero-size, and
gave it an "inline table" path (VsharpPath::table), but only the console
heap copy calls it; scan_title_table still called rebase_title_vsharp,
which leaves an unbacked base as it is, and only the slot's first V#.
scan_title_table now runs fix_vsharp on both V#s of each slot (the
second is a UAV's counter), as fix_console_slot does.

With line 502 passing, the rest of d3d12_title_va runs again, #1539's
check_declined_imports and check_import_over_shadow (run by d3d12_geometry_views)
included. The same executable's d3d12_api_descriptor_copy and
d3d12_rebound_* registrations stopped at line 502 too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On the RDNA2 iGPU (RADV) d3d12_compute went from pass (main) to fail at
line 676, and #1723's d3d12_unmapped_vsharp failed at line 135 and
d3d12_graphics_indirect_heap_resources at line 478. In each, a view of
an upload buffer came out zero-size ("buffer SRV: address
0xffffffffffe20000 (16 bytes) has no GPU copy; zero records"). Measured
there: RADV puts upload buffers below the arena, so their VA (device
address minus heap_base) is negative, 0xffffffffffe30000 in
unmapped_vsharp. llvmpipe puts them above it, and all three pass there.

main was right. docs/design.md ("Heap-relative buffer device
addresses") makes the V# base a signed 48-bit offset: the translator
sign-extends it, and main wrote such an offset for the layer's own
buffers. d3d12_compute's shader reads it sign-extended, as the contract
says. #1723's vsharp_address accepted a negative offset only with
LEONIDA_IMPORT_BELOW_ARENA=1, the switch that decides whether title
memory may be imported below the arena, and wrote every other view of
such a buffer as zero-size.

encodable() now accepts a negative offset that fits in 48 signed bits
whatever the switch says. backed() still requires a buffer registered
in gpu_backings or the geometry copies, so the switch alone still
decides whether there is a title import there. An already-written V#
whose bit 47 is set is also read as negative when that is what names a
backing. Unbacked addresses still become zero-size, as #1723 wants.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
d3d12_xmem_placed failed at line 113 (to_cpu(dst) == dst) and line 244
(independently_mapped(gpu, size)). #1723 added View::independent_pages,
the to_cpu branch and independently_mapped for a GPU-only range that
queue slot 31 maps by itself, but nothing ever sets the flag: xmem
calls note_reservation without it, so every pair it makes is the legacy
kind, read at its CPU view. Nothing in the runtime read
independently_mapped either, although its comment says a slot-133
buffer there must be a shadow, not an import.

Neither side is simply right. The tests express #1723's design, but no
rule exists for which of the title's pairs are independent, and none
can be inferred: marking every GPU-only pair independent (tried) breaks
main's xmem test, whose pair (attributes 0x23/0x3, protect 0x2004 then
0x801, two constant sets docs/xmem_exe_calls.md lists among the
title's sites) must read at the CPU view, and
would move where DirectStorage, slot-70 views and slot 31's CPU mirror
read and write in the game. That rule is left to #1723's author.

So:
- title_gpu_views::set_independent_pages(gpu) marks a pair. Nothing in
  the runtime calls it yet, so the game's behaviour does not change.
- create_host_buffer declines an import over an independently mapped
  range before making anything, as independently_mapped's comment asks,
  and the shadow answers. On llvmpipe the import otherwise succeeded and
  the twin was never guarded (line 264, seen with every pair marked).
- d3d12_xmem_placed marks its two windows. It now also checks that xmem
  made them the legacy kind and that marking changes to_cpu and
  independently_mapped. Everything after that (slot 31 remapping only
  the GPU range, the CPU view untouched, the guarded twin, pins, host
  and kernel writes) is checked as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
d3d12_rebound_tables, d3d12_rebound_second_device and
d3d12_api_descriptor_copy went from pass (main) to fail at line 896 of
d3d12_title_va_test: 0/64 GPU words matched on both submissions,
although the mirrored CBV in the layer heap was right (checked by
printing the slot after the submission). They had been hidden behind
line 502 in the same executable.

main was right. Its rebound-table check selects the test shader's
indexed CBV mode with s5 = 0xFFFFFFFB. #1723 added a mode that returns
a descriptor's words instead, also on 0xFFFFFFFB, ahead of main's
branch, so the rebound tables read the words at s8 (unset, address 0)
instead of the CBV's data. #1723's mode now uses 0xFFFFFFFA, which
nothing else uses, and its one caller (the out[3] dispatch in
check_title_va) passes that. Both checks run as written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#1723's new d3d12_compile_teardown failed on llvmpipe at line 436: no
pipeline_cache.session.bin after teardown. It passes on the iGPU.

The runtime was right and the test assumed every driver keeps compiled
pipelines in a VkPipelineCache. Measured with a print in
save_session_pipeline_cache: after the warm-up build, llvmpipe's
vkGetPipelineCacheData returns VK_SUCCESS and 32 bytes, the header alone
(the save limit was 64 MiB). The runtime writes no file of a bare header
on purpose, as it is no cache.

The check now reads the driver ID (VkPhysicalDeviceDriverProperties).
On llvmpipe the file must be absent; on every other driver it must be
written at teardown, as before. The rest of the case (the background
build ran, the worker joined) is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Found by the comparison agent, not by a failing test. #1723's console
list slot path still handed slots 71 and 72 to main's GPU-label hook
(record_gpu_label, LEONIDA_GPU_LABELS) when its own list values track
the list (track_values, on by default with LEONIDA_LIST_VALUES). The
--first-run-ui profile sets LEONIDA_GPU_LABELS=1 (runtime/src/main.cpp).
With both on, two threads stored to one title address, one from a
Vulkan command buffer's completion and query, the other from the part's
fence and a D3D12 timestamp query. A late label could rewind a rising
counter or split a begin/end pair. The suite did not catch it:
xbox_gpu_label_completion submits its real list straight to the queue,
so only the label path landed there.

The list values are the right owner. They land slots 71 to 74 in
queue order behind the gates, and they also do the waits the labels
cannot do. Now:
- The label hook runs only for a list the list values do not track
  (LEONIDA_LIST_VALUES=0, bundles). Each handoff is counted in
  ListValueStats::labels_handed.
- The --first-run-ui profile no longer sets LEONIDA_GPU_LABELS.
  runtime/README.md and docs/first_run_ui.md say so.
- xbox_gpu_label_completion runs its label section with the list values
  off, as it always measured the label path alone, and checks that all
  five writes went there. A new section turns both on and records one
  write32 and one write64 on a tracked list, submitted through the queue
  proxy. Each lands exactly once: writes_landed == 2, labels_handed == 0,
  and the values are in memory. With the old condition this section
  fails at line 136 (labels_handed was 2), on llvmpipe and the iGPU.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
runtime/test/xs_proxy_mock_test.cpp: main added check_depth_provider_refusal()
next to check_placed_resource_x() (#1558); this branch added the list-values
checks, which must run last because they start and stop the list-values
threads. Both kept, the list-values checks still last.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The integration of the post-story-load runtime changes (#1723) reads 32
environment variables that no document named, so tests/test_docs_env_vars.py
failed. Each now has a row in the D3D12 switches table of runtime/README.md
with its default and what its values do, read from the code: the console heap
fix and retry budgets, the per-frame and asynchronous refresh trade-offs, the
title texture fill and view settings, the XMem and queue slot 31 switches,
the hang exit, the thread sampler, the submit-phase line and the Aftermath
extras. Diagnostic-only switches are marked so.

LEONIDA_QUEUE_PAGE_MAPPINGS is read by rt::xmem::queue_page_mappings_enabled(),
which nothing calls; its row says it has no effect at present.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
indirect_clamp_test came with #1723 and was registered through the foreach
over ${test}_test with the other self-checking Vulkan tests, which
tests/test_ctest_registration.py cannot see, so it reported the executable as
built but never run. It is now registered next to its own add_executable, with
the same SKIP_RETURN_CODE 77 and BUILD_TESTING guard, and left out of the
foreach. Built and run with ctest on Linux: passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:02:29 +00:00
github manually merged commit 9177972ae8 into gh-pr/1723/base 2026-11-26 10:02:33 +00:00
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-25 10:19 UTC · original

I ran the post-rebase pixel checks on native Windows 11, RTX 4090 (NVIDIA 616.64), at the unmodified PR head ba626820e. I built the three test executables with MSVC 19.44 in Release. The default CTest run passed 11 of 12 selected cases, with one repeatable failure.

Check Result
Six stateful indirect draw cases All passed. The fixtures checked 36 images, 4,096 pixels each, with zero RGBA mismatches.
Indirect bundles Both indirect operations matched direct drawing across two parent states on the RTX. The opt-out control passed. The separate Windows WARP reference also passed.
Direct heaps Both the enabled and disabled cases passed. The enabled case finished in about 0.22 s on five further runs, including its mesh draw.
d3d12_graphics_indirect_heap_resources Failed all four default runs. Both direct controls and all three indirect draws returned the pixel shader's sentinel. The recorded draw state and the vertex outputs matched.

The failing fixture sign-extends the 48-bit resource offset in ps_indirect_heap_resource.frag. On this machine the upload buffers landed below the arena. With the default offset mode, the runtime logged a 16-byte buffer SRV with zero records. A diagnostic that kept both shader guards and changed their return colors showed the heap comparison passed on all five draws, then the descriptor check saw zero records. Moving uploads to system memory reproduced the same result.

With only LEONIDA_IMPORT_BELOW_ARENA=1 set for this test, the stock fixture passed 5/5 consecutive runs, with exact vertex heap state and pixel resource payloads for all five draws each time. Setting this CTest case's environment to match its authored shader would make its intended signed-offset coverage explicit. These measurements cover synthetic draws. I did not run a retail boot or Vulkan validation layers. AI-assisted verification.

**@⁠ecox982745** on GitHub · 2026-11-25 10:19 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1723#issuecomment-7159531742) I ran the post-rebase pixel checks on native Windows 11, RTX 4090 (NVIDIA 616.64), at the unmodified PR head `ba626820e`. I built the three test executables with MSVC 19.44 in Release. The default CTest run passed 11 of 12 selected cases, with one repeatable failure. | Check | Result | | --- | --- | | Six stateful indirect draw cases | All passed. The fixtures checked 36 images, 4,096 pixels each, with zero RGBA mismatches. | | Indirect bundles | Both indirect operations matched direct drawing across two parent states on the RTX. The opt-out control passed. The separate Windows WARP reference also passed. | | Direct heaps | Both the enabled and disabled cases passed. The enabled case finished in about 0.22 s on five further runs, including its mesh draw. | | `d3d12_graphics_indirect_heap_resources` | Failed all four default runs. Both direct controls and all three indirect draws returned the pixel shader's sentinel. The recorded draw state and the vertex outputs matched. | The failing fixture sign-extends the 48-bit resource offset in `ps_indirect_heap_resource.frag`. On this machine the upload buffers landed below the arena. With the default offset mode, the runtime logged a 16-byte buffer SRV with zero records. A diagnostic that kept both shader guards and changed their return colors showed the heap comparison passed on all five draws, then the descriptor check saw zero records. Moving uploads to system memory reproduced the same result. With **only `LEONIDA_IMPORT_BELOW_ARENA=1`** set for this test, the stock fixture passed **5/5 consecutive runs**, with exact vertex heap state and pixel resource payloads for all five draws each time. Setting this CTest case's environment to match its authored shader would make its intended signed-offset coverage explicit. These measurements cover synthetic draws. I did not run a retail boot or Vulkan validation layers. AI-assisted verification.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 10:23 UTC · original

@⁠Moriz82 heads-up: we're merging this, but the runtime's test build doesn't compile on this head. We're fixing it on the branch (maintainer edits) together with a merge of current main; nothing for you to do unless the helper below isn't what you meant.

  • windows.h without NOMINMAX: runtime/src/submit_phases.h and runtime/src/thread_sampler.h now include <windows.h>. Test targets that reach them through vulkan_replay.h and don't define NOMINMAX (replay_uav_clear_offset_test first) get the max/min macros, and the std::max/std::min calls in vulkan_replay.h fail ("expected unqualified-id"). Fix: the same #ifndef NOMINMAX guard vulkan_gpu_labels.h uses, in both headers.
  • A missing test helper: check_list_values_more() in runtime/test/xs_proxy_mock_test.cpp uses record_page_mapping (as the queue slot 31 hook) and g_page_mapping, but neither is defined anywhere in the PR. We're adding a small PageMappingRecord with that hook, which records the call count, the batch pointer, pool, pages, flags and the first batch's destination and ranges, written from the hook's signature and from what the test checks. Please check that it matches what you had locally.
  • Everything else builds; gta6rt itself was never affected, which is probably why this didn't show on your side.
  • Next: the full Windows suite (clang-cl under Wine, llvmpipe and an RDNA2 iGPU) on main + this branch + the two fixes is running now; the merge follows when nothing goes from pass to fail. Then #622 is brought up to date on top, so slots 71/72 have one owner.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-25 10:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1723#issuecomment-7159624584) @⁠Moriz82 heads-up: we're merging this, but the runtime's test build doesn't compile on this head. We're fixing it on the branch (maintainer edits) together with a merge of current `main`; nothing for you to do unless the helper below isn't what you meant. - **`windows.h` without `NOMINMAX`:** `runtime/src/submit_phases.h` and `runtime/src/thread_sampler.h` now include `<windows.h>`. Test targets that reach them through `vulkan_replay.h` and don't define `NOMINMAX` (`replay_uav_clear_offset_test` first) get the `max`/`min` macros, and the `std::max`/`std::min` calls in `vulkan_replay.h` fail ("expected unqualified-id"). Fix: the same `#ifndef NOMINMAX` guard `vulkan_gpu_labels.h` uses, in both headers. - **A missing test helper:** `check_list_values_more()` in `runtime/test/xs_proxy_mock_test.cpp` uses `record_page_mapping` (as the queue slot 31 hook) and `g_page_mapping`, but neither is defined anywhere in the PR. We're adding a small `PageMappingRecord` with that hook, which records the call count, the batch pointer, pool, pages, flags and the first batch's destination and ranges, written from the hook's signature and from what the test checks. Please check that it matches what you had locally. - **Everything else builds;** `gta6rt` itself was never affected, which is probably why this didn't show on your side. - **Next:** the full Windows suite (clang-cl under Wine, llvmpipe and an RDNA2 iGPU) on `main` + this branch + the two fixes is running now; the merge follows when nothing goes from pass to fail. Then #622 is brought up to date on top, so slots 71/72 have one owner. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠OreoFR on GitHub · 2026-11-25 10:37 UTC · original

Native Windows retail boot of this head, as the description asks. One machine; counts only, no game data.

Setup:

  • Windows 11, RTX 4070 Laptop 8 GB (NVIDIA 591.59), 40 GB RAM, own 1.0.2.1 copy.
  • gta6rt built with MSVC from main 57ba40bd6 + #1558 (3cf0a41bc, needed on NVIDIA to get past the landing screen) + this PR at ba626820e.
  • #1558 and this PR conflict in runtime/test/xs_proxy_mock_test.cpp only. I took this PR's side for the test file; gta6rt itself merges cleanly.
  • Default switches, plus LEONIDA_TITLE_WATCHDOG=0 and LEONIDA_DEVICE_FAULT=1. Shaders from make_game.py (--wave64-emulate), a saved profile (straight to the story load), A every 15 to 60 s.

Result, 600 s run (stopped by me): no device loss and no exception, but the load stalls. On this machine without this PR, the story load loses the device at about 250 to 270 s (WRITE_INVALID, lib_cs_01468 in flight; see #1608). With it, the device is never lost, but the stall below begins at about 240 s, before that point. So this run doesn't show whether the WRITE_INVALID stop is gone, only that the load now waits instead:

  • At about 240 s, the fence-mirror and list-value counters stop moving: the last 36 ten-second reports, up to 600 s, are identical.
    • list values so far: 15918 writes recorded, 15811 landed, 0 failed; 2417 waits recorded, 2392 met at submission, 1 relayed; 7 gates held, 0 met, 7 timed out;
    • fence slot 12 mirrors: 5 live; in 10 s 0 waits ended on an event, ~3,180 on the 10 ms timeout, every 10 s.
  • So 107 recorded list writes never land, the 7 gates all time out, and title threads keep polling a mirror whose value never arrives. Submissions stop at about #4,788.
  • Before that, long inline compute compiles: 35 library compute pipelines, several at 38 to 45 s each (lib_cs_01339 45.4 s, lib_cs_00959 38.5 s). The window stops answering at about 200 s.
  • One dstorage_failure at 152 s (not fatal).
  • Peak 19.9 GB working set, 24.4 GB private.

Second run, same build plus #1671, #1691 and #1703 (the slot 57 blend, depth/raster and dual-source state, which merge cleanly with this PR). Same switches and presses, and the same picture:

  • No device loss and no exception in 600 s.
  • The counters freeze at about 230 s, at 17062 writes recorded, 17023 landed (39 never land) and 5 gates held, 0 met, 5 timed out.
  • A dstorage_failure at 167 s (0x89240030, E_DSTORAGE_DECOMPRESSION_ERROR); the first run had two.
  • The driver cache was warmer, so the longest compile was 11.3 s instead of 45 s, and the load got a little further before the stall.

So the stall reproduces across two runs, with or without the rendering PRs.

Happy to rerun with any switch or diagnostic you want on this machine.

AI-assisted.

**@⁠OreoFR** on GitHub · 2026-11-25 10:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1723#issuecomment-7159957675) Native Windows retail boot of this head, as the description asks. One machine; counts only, no game data. **Setup:** - Windows 11, RTX 4070 Laptop 8 GB (NVIDIA 591.59), 40 GB RAM, own 1.0.2.1 copy. - `gta6rt` built with MSVC from `main` `57ba40bd6` + #1558 (`3cf0a41bc`, needed on NVIDIA to get past the landing screen) + this PR at `ba626820e`. - #1558 and this PR conflict in `runtime/test/xs_proxy_mock_test.cpp` only. I took this PR's side for the test file; `gta6rt` itself merges cleanly. - Default switches, plus `LEONIDA_TITLE_WATCHDOG=0` and `LEONIDA_DEVICE_FAULT=1`. Shaders from `make_game.py` (`--wave64-emulate`), a saved profile (straight to the story load), A every 15 to 60 s. **Result, 600 s run (stopped by me): no device loss and no exception, but the load stalls.** On this machine without this PR, the story load loses the device at about 250 to 270 s (WRITE_INVALID, `lib_cs_01468` in flight; see #1608). With it, the device is never lost, but the stall below begins at about 240 s, before that point. So this run doesn't show whether the WRITE_INVALID stop is gone, only that the load now waits instead: - At about 240 s, the fence-mirror and list-value counters stop moving: the last 36 ten-second reports, up to 600 s, are identical. - `list values so far: 15918 writes recorded, 15811 landed, 0 failed; 2417 waits recorded, 2392 met at submission, 1 relayed; 7 gates held, 0 met, 7 timed out`; - `fence slot 12 mirrors: 5 live; in 10 s 0 waits ended on an event, ~3,180 on the 10 ms timeout`, every 10 s. - So 107 recorded list writes never land, the 7 gates all time out, and title threads keep polling a mirror whose value never arrives. Submissions stop at about #4,788. - Before that, long inline compute compiles: 35 library compute pipelines, several at 38 to 45 s each (`lib_cs_01339` 45.4 s, `lib_cs_00959` 38.5 s). The window stops answering at about 200 s. - One `dstorage_failure` at 152 s (not fatal). - Peak 19.9 GB working set, 24.4 GB private. **Second run, same build plus #1671, #1691 and #1703** (the slot 57 blend, depth/raster and dual-source state, which merge cleanly with this PR). Same switches and presses, and the same picture: - No device loss and no exception in 600 s. - The counters freeze at about 230 s, at `17062 writes recorded, 17023 landed` (39 never land) and `5 gates held, 0 met, 5 timed out`. - A `dstorage_failure` at 167 s (`0x89240030`, `E_DSTORAGE_DECOMPRESSION_ERROR`); the first run had two. - The driver cache was warmer, so the longest compile was 11.3 s instead of 45 s, and the load got a little further before the stall. So the stall reproduces across two runs, with or without the rendering PRs. Happy to rerun with any switch or diagnostic you want on this machine. AI-assisted.
Author
Owner

@⁠Tortoche on GitHub · 2026-11-25 11:32 UTC · original

Tested on native Windows 11, AMD Radeon RX 7800 XT (driver 26.11.2) with #1723 + #1715 + #1728 (manually merged) and LEONIDA_TITLE_WINDOWS_MB=1024, LEONIDA_ARENA_MB=2048.

Results:

  • Splash → profile selector → loading screen all work.
  • With #1728 merged, we get past the previous ~6994 GPU submissions crash (+0x2474606 / untranslated title V# AV in hash_bytes) and reach 9621+ GPU submissions (~7 min).
  • However, the run still ends in a hard crash right after 201 dstorage_failure events (0x89240030, reason=missing-profile) on ttdb_terrain_image_based_0_1.ttpf.
  • Also observed: 19 gate timeouts in d3d12_xs (19 gates held, 0 met, 19 timed out) and staged title texture upload failures for formats 133, 134, 145.

AI-assisted: yes

**@⁠Tortoche** on GitHub · 2026-11-25 11:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1723#issuecomment-7161177044) Tested on **native Windows 11, AMD Radeon RX 7800 XT (driver 26.11.2)** with #1723 + #1715 + #1728 (manually merged) and `LEONIDA_TITLE_WINDOWS_MB=1024`, `LEONIDA_ARENA_MB=2048`. **Results:** - Splash → profile selector → loading screen all work. - With #1728 merged, we get past the previous ~6994 GPU submissions crash (`+0x2474606` / untranslated title V# AV in `hash_bytes`) and reach **9621+ GPU submissions** (~7 min). - However, the run still ends in a hard crash right after **201 `dstorage_failure` events (`0x89240030`, `reason=missing-profile`)** on `ttdb_terrain_image_based_0_1.ttpf`. - Also observed: **19 gate timeouts** in `d3d12_xs` (`19 gates held, 0 met, 19 timed out`) and staged title texture upload failures for formats **133, 134, 145**. AI-assisted: yes
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 11:34 UTC · original

Merged. Thank you, @⁠Moriz82: on our machine this is the biggest single step of the boot so far.

  • Why it goes in now: retail boot, RX 7900 XTX under Wine (RADV), 10 minutes, same scripted input:
    • main reached 549 presents (about 0.7 a second late in the run).
    • main + this branch reached 9,166 presents (about 15 a second) and the first page advance 90 s sooner.
    • Almost all of that is the whole-section commit under Wine (LEONIDA_XMEM_SEC_COMMIT). It does nothing on native Windows, which still needs its own measurement.
  • Claim: RT-POST-STORY-RUNTIME in #1608 was edited after posting, which our claim rule normally doesn't accept; the maintainer accepted it for this PR.
  • What we changed before merging (each commit says what failed and which side was right):
    • The runtime's test build didn't compile:
      • windows.h without NOMINMAX in submit_phases.h and thread_sampler.h;
      • a test helper (record_page_mapping, g_page_mapping) used but never defined.
    • Queue slot 31 without a mapper keeps the unmodelled answer again (main's #769 test was right).
    • Inline-table V#s now go through fix_vsharp, and V#s for layer buffers below the arena keep their signed offset, as docs/design.md says. RADV places upload buffers there. This also fixed main's d3d12_compute on an RDNA2 iGPU.
    • The new test-shader mode gets its own value (0xFFFFFFFA), since 0xFFFFFFFB was main's.
    • compile_teardown expects no cache file from llvmpipe.
    • title_gpu_views gains set_independent_pages(). A pair marked independent is not imported. Nothing in the game sets the flag yet.
    • Console list slots 71/72 now have one writer. With LEONIDA_GPU_LABELS=1 (which --first-run-ui used to set), this branch's list values and main's GPU labels both wrote the same address, with different timestamp sources. The label hook now only takes lists the list values don't track, and the profile no longer sets the variable.
    • Merged current main twice. The second merge took in #1558's new mock check, keeping the list-values checks last.
    • Documented the 32 LEONIDA_* variables this branch reads, in runtime/README.md's switch table, so test_docs_env_vars passes. LEONIDA_QUEUE_PAGE_MAPPINGS is read by a function nothing calls; its row says so.
    • Registered indirect_clamp_test beside its add_executable, so test_ctest_registration passes.
  • Windows suite under Wine (llvmpipe and an RDNA2 iGPU): nothing goes from pass to fail against main, and 29 more tests pass (this branch's new ones). xmem_no_write_watch failed once in the last full run on both devices under load and passes alone 4 of 4 times on both.
  • Left for you:
    • Decide which of the title's GPU-only pairs are independent and call set_independent_pages.
    • Wire in or drop the unused batch slot-31 path (rt::xmem::copy_page_mappings, queue_page_mappings_enabled()).
    • Remove the now-dead four-argument queue_copy_page_mappings and rebase_title_vsharp.
    • Confirm that zeroing negative V# offsets was not meant for older shader libraries.
    • Please send follow-ups as one PR per item, each with its own claim, and name the tool and model in the AI note.
  • #622 (RT-LIST-WRITE-VALUE, @⁠Mby159) overlaps slots 71/72 and is handled separately.
  • Checked on main bcaa13dad + 9177972ae: it merges cleanly; the semantic suite passes (489 files, 6,288 tests, 0 files failed); the 14 docs and writer tests pass; check_no_game_data.py is clean on the 107 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-25 11:34 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1723#issuecomment-7161231004) Merged. Thank you, @⁠Moriz82: on our machine this is the biggest single step of the boot so far. - **Why it goes in now:** retail boot, RX 7900 XTX under Wine (RADV), 10 minutes, same scripted input: - `main` reached 549 presents (about 0.7 a second late in the run). - `main` + this branch reached 9,166 presents (about 15 a second) and the first page advance 90 s sooner. - Almost all of that is the whole-section commit under Wine (`LEONIDA_XMEM_SEC_COMMIT`). It does nothing on native Windows, which still needs its own measurement. - **Claim:** `RT-POST-STORY-RUNTIME` in #1608 was edited after posting, which our claim rule normally doesn't accept; the maintainer accepted it for this PR. - **What we changed before merging** (each commit says what failed and which side was right): - The runtime's test build didn't compile: - `windows.h` without `NOMINMAX` in `submit_phases.h` and `thread_sampler.h`; - a test helper (`record_page_mapping`, `g_page_mapping`) used but never defined. - Queue slot 31 without a mapper keeps the unmodelled answer again (`main`'s #769 test was right). - Inline-table V#s now go through `fix_vsharp`, and V#s for layer buffers below the arena keep their signed offset, as `docs/design.md` says. RADV places upload buffers there. This also fixed `main`'s `d3d12_compute` on an RDNA2 iGPU. - The new test-shader mode gets its own value (`0xFFFFFFFA`), since `0xFFFFFFFB` was `main`'s. - `compile_teardown` expects no cache file from llvmpipe. - `title_gpu_views` gains `set_independent_pages()`. A pair marked independent is not imported. Nothing in the game sets the flag yet. - **Console list slots 71/72 now have one writer.** With `LEONIDA_GPU_LABELS=1` (which `--first-run-ui` used to set), this branch's list values and `main`'s GPU labels both wrote the same address, with different timestamp sources. The label hook now only takes lists the list values don't track, and the profile no longer sets the variable. - Merged current `main` twice. The second merge took in #1558's new mock check, keeping the list-values checks last. - Documented the 32 `LEONIDA_*` variables this branch reads, in `runtime/README.md`'s switch table, so `test_docs_env_vars` passes. `LEONIDA_QUEUE_PAGE_MAPPINGS` is read by a function nothing calls; its row says so. - Registered `indirect_clamp_test` beside its `add_executable`, so `test_ctest_registration` passes. - **Windows suite under Wine (llvmpipe and an RDNA2 iGPU):** nothing goes from pass to fail against `main`, and 29 more tests pass (this branch's new ones). `xmem_no_write_watch` failed once in the last full run on both devices under load and passes alone 4 of 4 times on both. - **Left for you:** - Decide which of the title's GPU-only pairs are independent and call `set_independent_pages`. - Wire in or drop the unused batch slot-31 path (`rt::xmem::copy_page_mappings`, `queue_page_mappings_enabled()`). - Remove the now-dead four-argument `queue_copy_page_mappings` and `rebase_title_vsharp`. - Confirm that zeroing negative V# offsets was not meant for older shader libraries. - Please send follow-ups as one PR per item, each with its own claim, and name the tool and model in the AI note. - **#622 (`RT-LIST-WRITE-VALUE`, @⁠Mby159)** overlaps slots 71/72 and is handled separately. - **Checked on `main` `bcaa13dad` + `9177972ae`:** it merges cleanly; the semantic suite passes (489 files, 6,288 tests, 0 files failed); the 14 docs and writer tests pass; `check_no_game_data.py` is clean on the 107 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-25 11:47 UTC · original

Verified the merged commit ed94fbef9 on native Windows 11, RTX 4090 (616.64), with the default allocation settings. This closes the failure I reported on ba626820e.

On the earlier head, d3d12_graphics_indirect_heap_resources failed 4/4 default runs. On the merge it passed 5/5 consecutive reruns. Each run checked the pixels from three indirect draws and two direct controls across descriptor heap changes. The same 12 targeted CTests, including the WARP control, now pass (previously 11/12). No LEONIDA_IMPORT_BELOW_ARENA override was needed.

Synthetic fixtures only. AI-assisted verification with OpenAI Codex.

**@⁠ecox982745** on GitHub · 2026-11-25 11:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1723#issuecomment-7161498132) Verified the merged commit `ed94fbef9` on native Windows 11, RTX 4090 (616.64), with the default allocation settings. This closes the failure I reported on `ba626820e`. On the earlier head, `d3d12_graphics_indirect_heap_resources` failed 4/4 default runs. On the merge it passed 5/5 consecutive reruns. Each run checked the pixels from three indirect draws and two direct controls across descriptor heap changes. The same 12 targeted CTests, including the WARP control, now pass (previously 11/12). No `LEONIDA_IMPORT_BELOW_ARENA` override was needed. Synthetic fixtures only. AI-assisted verification with OpenAI Codex.
This discussion has been locked. Commenting is limited to contributors.
No description provided.