[integration] PageMirror, GPU detile, async queue & RDNA2->SPIR-V performance stack (INTEGRATION-PERF-CPU-GPU-R6) #2566

Manually merged
github merged 238 commits from github-bot/gh-2566 into main 2026-11-30 10:29:39 +00:00 AGit
Owner

@⁠aslan2142 on GitHub · 2026-11-28 06:24 UTC · original
aslan2142:integration/perf-cpu-gpu-r6 → main · +69924 −5545 · 237 files · 238 commits · merged 2026-11-30 10:24 UTC

Claimed in the coordination issue as: INTEGRATION-PERF-CPU-GPU-R6

What and why

Integration PR (aslan2142:integration/perf-cpu-gpu-r6, merged cleanly with upstream main d48a957bb) combining the PageMirror / in-place console descriptor heap / GPU detile runtime stack with ten rounds of CPU submission, bindless GC, memory-tracking, async synchronization, and RDNA2 → SPIR-V translator performance & correctness work.

1. RDNA2 → SPIR-V Translator Correctness & GPU Codegen (tools/rdna2spirv.py, tools/shader_meta.py, tools/lane_masks.py, docs/design.md)

  • Absent-lane subgroup UB elimination: Guards wave-uniform v_readfirstlane_b32, v_readlane_b32, v_permlane16_b32/v_permlanex16_b32, DPP (fi:1 & out-of-row), ds_append/ds_consume/ds_permute/ds_lane_read, and non-fragment s_wqm against unlaunched/absent subgroup lanes; adds static SPIR-V invariant checker (tests/semantic/check_absent_lane_ub.py), partial-wave CPU regression suite (tests/semantic/test_absent_lane_ub.py), and live GPU test (tests/test_absent_lane_gpu.py).
  • FTZ32 & fmulz enablement: Checks exact HW_REG_MODE bit overlap with [4, 6) (FP_DENORM.fp32) in _disables_ftz32(), re-enabling FTZ32 and fmulz across the corpus while keeping explicit software denormal flushing (force=True) on v_exp_f32 (GLSL.std.450 Exp2).
  • Compact outlined sbuf_slow + NonWritable SMEM: Replaces expanded per-load slow paths with compact OpLoopMerge ... DontUnroll %sbuf_slow_{ro,rw}_xN helpers with overflow-safe 64-bit bounds, and adds CFG store-reachability (WAR-safe) + descriptor-provenance NonWritable SMEM tagging.
  • Image, sampler, coherent VMM & write-back metadata:
    • SPV_KHR_vulkan_memory_model (MakePointerVisible/MakePointerAvailable) for glc/dlc loads & stores + reads_glc_buffer metadata.
    • Compile-time literal S# sampler OpSpecConstant specialization (literal_samplers / literal_sampler_spec_base) bypassing FNV-1a bindless probes.
    • Float-only image_read_typed dead-branch elision (f32/f16 consumers + bilinear/linear-mip literal samplers) and table-driven buffer_store_format.
    • writes_buffer and buffer_write_slots metadata for gating passive write-back.
    • Wide s_buffer_load, SPV_KHR_integer_dot_product (v_dot4), heap T# bindless index word in dword 6, and pure scalar-spill VGPR parking.
  • All new translator rules are documented in the contract table of docs/design.md.

2. Runtime PageMirror, Console Heaps in Place & GPU Detiling (runtime/src/title_mirror.h, title_mirror_hot_cold.h, shadow_keep.h, vulkan_title_detile.h, runtime/shims/d3d12_*, xmem.cpp)

  • PageMirror & in-place console descriptor heaps: Mirrors title memory pages into sparse device-local chunks (Chunk::pages[32768] direct table) with 256-byte piece-level CPU/GPU merge, hot/cold submission write tracking (kPromote = 6/8), 64 MiB copy-queue readback with sub-page 256 B copies, page_mirror_buffer resolve_cache, and hoisted FilterCacheScope + parallel Phase-A/disjoint-WC-flush console heap filtering (local_mirror chunk cache, AVX2 32-byte slots_equal_32, 8 KiB L1d seen_keys, per-batch T# dedup, lock-free in_place_work_pending fast-skip).
  • AVX2 / x86-64-v3 SIMD & 8-worker mirror pool: Enables /arch:AVX2 (x64 MSVC/clang-cl) and -march=x86-64-v3 (x86-64 GCC/Clang) for C/C++ targets; adds 4×256-bit AVX2 + 4×128-bit SSE2 shadow_keep::sum_of(), sum_of_batch_256(), and fused SEH-safe guarded::copy_and_sum_256(), plus an 8-worker TitleMirror::WorkerPool with 50 µs spin and WC streaming copies.
  • Low-syscall VM guard tracking & shared Cell::known_*: Unlocked parallel Phase-1 readback pre-hashing, shared Cell::known_* across CellGuard & TitleTextureCells (excluding PAGE_READONLY from VQ caches), TitleHeap::hooks.commit/decommit map-change scoping, batched copy_page_mappings(), safe per-tile bridged VirtualProtect rollback (preserving already-armed gap tiles), zero-syscall all_armed fast paths, and range-scoped reopen() / changes_since().
  • GPU detiling & batched texture refresh (title_texture_watch.h, title_texture_refresh.h, d3d12_title_image_upload.h):
    • GPU compute detiling directly from TitleMirror chunks + TitleMirror::range_sum() skip + 512-job / 128 MiB GPU-mirror upload batching (TitleImagePool 8 MiB/16 MiB cap, kMaxScratchSlots=64).
    • Deferred slot-70 uploads to GPU detile + publish_streamed_texture() fix, separated title_texel_writes, Stage-2 TextureVqCache + Stage-2b Cell::restore[] readability bypass, single-lock page_mirror_check_batch(), and TitleTextureWatch::examine_batch() + TitleTextureCells::arm_batch().
  • Bindless view sharing & two-phase dead-sweep GC (vulkan_bindless.h, d3d12_vulkan_device.cpp):
    • Refcounted ViewKey sharing, O(1) BindlessSet free-lists, single-lock bind_title_image(), ConsoleHeapSlotRecords kTexture/kSettled live tracking, and explicit evictable classification.
    • Two-phase GC (Phase 1 dead-key sweep with 0 texture notifications + 8,192-slot hysteresis, Phase 2 emergency live-LRU only on hard_full, multi-key sv.keys liveness, dim_2d mirror-slot room notifications) eliminating 65,536-slot saturation and GC thrash in long gameplay sessions.

3. Runtime Async Queue, Replay Cache, List-Value Sync & Single-Flight Coalescing (runtime/src/vulkan_backend.h, queue_holds.h, vulkan_replay.h, vulkan_presenter.h, runtime/shims/d3d12_com.cpp, d3d12_xs_list_values.h)

  • Dynamic rendering scope batching & ReplayStateCache: Batches compatible consecutive draws into single dynamic rendering scopes, elides redundant Vulkan pipeline/descriptor/push/viewport/scissor binds in emit_commands(), caches CommandList summaries, and fans out synchronous unbuilt PSOs concurrently via PipelineCompiler.
  • Zero-unmet list-value sync & GPU-to-GPU relays: Fixed Pump::choose_release() TOCTOU + quiet window (0 released unmet), dedicated QueueHolds barrier-drain thread, non-blocking release_ready(), SEH aligned volatile read_value(), 1000 ms slot-12 timeout, VulkanFence::signal_gpu_relay() (vis_seq=0) + retroactive QueueHolds::relay_wait() / VulkanQueue::apply_wait_relay() with WriteGroup::bare visibility safety, exact landed-value console_value_met() verification, wait_met re-check, relay_wait() gate preservation, and signal-only consumed_wait_vis transitivity.
  • Single-flight BeforeExecuteCoalescer + feed-only mirror drain: Reordered global refresh (wb -> mirror -> flush -> tex -> shadows -> 2nd flush) with decoupled lazy gpu_profile_.resolve() and 4-deep VulkanPresenter::frames_; coalesced submissions run a lock-free O(1) check / drain_page_mirror_feed_only() (0.11–0.29 ms when CopyPageMappingsBatchX remaps are queued) achieving 96–97% coalescing with 0 single-flight waits (opt-out LEONIDA_BEFORE_EXECUTE_COALESCE=0).

Measured Impact (RX 7900 XTX, RADV, Wine)

  • Stability: Continuous multi-minute cutscene + in-game runs (run107, post-merge run108: 370–400+ s) with 0 GPUVM faults, 0 VK_ERROR_DEVICE_LOST, 0 unmet list-value gates (across 28,372–42,047 held gates), and 0 bindless GC thrash (3 clean dead-sweeps of 8,192 dead keys each, 0 textures notified).
  • Opening cutscene FPS: Rose from ~0.6–0.8 fps baseline (3.6–5.9 fps at Round 6) to 7.4–13.9 fps (96–97% before-execute coalesced, 0 single-flight waits, own threads 50.8–88.3 ms/f, title threads 8.6–11.3 ms/f).
  • In-game gameplay FPS: Stable 6.0–7.4 fps (79–84 ms/f own threads, 7.0–15.1 ms/f title threads, Direct GPU now 66–75% utilized / 101–121 ms/f busy — shifting the bottleneck from CPU to GPU).

Tested

  • Shader translator & semantic suites (post-merge 232b4a1ee):
    • python3 -m compileall -q make_game.py tools tests: 0 errors.
    • python3 -m unittest tests/semantic/test_alu_exp_f32.py tests/semantic/test_ftz32_fmulz.py tests/semantic/test_buffer_format_d16_hi.py -v: 14/14 PASS.
    • All 17 merged-feature semantic suites (test_absent_lane_ub, test_ds_permute_eager, test_cvt_f16_denorm_mods, test_f16_denorm_preserve, test_buffer_format_d16_hi, test_gather4_c_lz, test_sample_g16, test_high_half_shared_readers, test_ftz32_fmulz, test_wave64_emulate_opt, test_wave64_halves, test_fma_denorm_product, test_alu_sat_pk_u8_i16, test_lds_bound_access, test_lds_write2_equal_offsets, test_active_runs, test_fp_edge_conformance): 278/278 PASS.
    • Full-corpus retranslation (32 shards): 29,267 / 29,267 shaders translated & spirv-val-valid; full-corpus check_absent_lane_ub.py sweep: 0 flagged / 0 UB sites.
  • Linux portable build & Vulkan tests (-march=x86-64-v3, MESA_VK_DEVICE_SELECT='1002:164e!'):
    • cmake --build runtime/build + ctest --test-dir runtime/build --output-on-failure -j8: 136/136 PASS (2 skipped: shader_library_corpus, vk_sync_validation).
    • LEONIDA_VK_VALIDATION=1 on list_value_progress, submit_frame, vk_title_mirror, vk_title_detile, vk_bindless_grow, vk_bindless_dimensions, title_mirror_hooks, r3b_runtime_hooks, replay_state_cache: 9/9 PASS, 0 validation errors.
  • Windows cross-build (clang-cl /arch:AVX2) & targeted Wine iGPU suite (r10-main-merge-igpu):
    • gta6rt.exe + gta6rt_tls_host.dll: clean build, 0 errors.
    • Targeted 41-test Wine iGPU suite (d3d12_existing_heap, d3d12_heap_in_place, d3d12_queue_wait, xbox_list_value_fallback, list_value_progress, submit_frame, console_heap_slot_records, title_mirror, shadow_keep, xmem, vk_bindless, vk_title_detile, d3d12_pipeline_checkpoint, xs_proxy_mock, acphal, d3d12_fence_timing): 40/41 PASS (xmem_write_watch passed on re-run; only upstream d3d12_fence_timing's EnumAdapterByLuid failed under headless Wine Xvfb without DRI3 — its GPU/CPU clock calibration checks passed).
  • Hygiene:
    • python3 -I scripts/check_no_game_data.py: PASS.

GPUs tested:

  • AMD Radeon RX 7900 XTX (RADV NAVI31), Mesa 26.3.1-arch1.3, Linux 7.3.6-zen1-1-zen (Wine)
  • AMD Ryzen 9 7950X3D iGPU (RADV RAPHAEL_MENDOCINO), Mesa 26.3.1-arch1.3, Linux 7.3.6-zen1-1-zen (native Linux + Wine)

AI-assisted: yes — Antigravity (Gemini 4 Neon & Claude Opus 5.5).

Checklist

  • Based on current main and merges cleanly (merged d48a957bb, reviewed by two independent reviewers).
  • One topic; follow-up work goes in a new pull request (integration PR of the PageMirror + CPU/GPU performance stack).
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
**@⁠aslan2142** on GitHub · 2026-11-28 06:24 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566) `aslan2142:integration/perf-cpu-gpu-r6` → `main` · +69924 −5545 · 237 files · 238 commits · merged 2026-11-30 10:24 UTC Claimed in the coordination issue as: [INTEGRATION-PERF-CPU-GPU-R6](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why Integration PR (`aslan2142:integration/perf-cpu-gpu-r6`, merged cleanly with upstream `main` `d48a957bb`) combining the PageMirror / in-place console descriptor heap / GPU detile runtime stack with ten rounds of CPU submission, bindless GC, memory-tracking, async synchronization, and RDNA2 → SPIR-V translator performance & correctness work. #### 1. RDNA2 → SPIR-V Translator Correctness & GPU Codegen (`tools/rdna2spirv.py`, `tools/shader_meta.py`, `tools/lane_masks.py`, `docs/design.md`) - **Absent-lane subgroup UB elimination:** Guards wave-uniform `v_readfirstlane_b32`, `v_readlane_b32`, `v_permlane16_b32`/`v_permlanex16_b32`, DPP (`fi:1` & out-of-row), `ds_append`/`ds_consume`/`ds_permute`/`ds_lane_read`, and non-fragment `s_wqm` against unlaunched/absent subgroup lanes; adds static SPIR-V invariant checker (`tests/semantic/check_absent_lane_ub.py`), partial-wave CPU regression suite (`tests/semantic/test_absent_lane_ub.py`), and live GPU test (`tests/test_absent_lane_gpu.py`). - **FTZ32 & `fmulz` enablement:** Checks exact `HW_REG_MODE` bit overlap with `[4, 6)` (`FP_DENORM.fp32`) in `_disables_ftz32()`, re-enabling FTZ32 and `fmulz` across the corpus while keeping explicit software denormal flushing (`force=True`) on `v_exp_f32` (`GLSL.std.450 Exp2`). - **Compact outlined `sbuf_slow` + `NonWritable` SMEM:** Replaces expanded per-load slow paths with compact `OpLoopMerge ... DontUnroll` `%sbuf_slow_{ro,rw}_xN` helpers with overflow-safe 64-bit bounds, and adds CFG store-reachability (WAR-safe) + descriptor-provenance `NonWritable` SMEM tagging. - **Image, sampler, coherent VMM & write-back metadata:** - `SPV_KHR_vulkan_memory_model` (`MakePointerVisible`/`MakePointerAvailable`) for `glc`/`dlc` loads & stores + `reads_glc_buffer` metadata. - Compile-time literal S# sampler `OpSpecConstant` specialization (`literal_samplers` / `literal_sampler_spec_base`) bypassing FNV-1a bindless probes. - Float-only `image_read_typed` dead-branch elision (`f32`/`f16` consumers + bilinear/linear-mip literal samplers) and table-driven `buffer_store_format`. - `writes_buffer` and `buffer_write_slots` metadata for gating passive write-back. - Wide `s_buffer_load`, `SPV_KHR_integer_dot_product` (`v_dot4`), heap T# bindless index word in dword 6, and pure scalar-spill VGPR parking. - All new translator rules are documented in the contract table of `docs/design.md`. #### 2. Runtime PageMirror, Console Heaps in Place & GPU Detiling (`runtime/src/title_mirror.h`, `title_mirror_hot_cold.h`, `shadow_keep.h`, `vulkan_title_detile.h`, `runtime/shims/d3d12_*`, `xmem.cpp`) - **PageMirror & in-place console descriptor heaps:** Mirrors title memory pages into sparse device-local chunks (`Chunk::pages[32768]` direct table) with 256-byte piece-level CPU/GPU merge, hot/cold submission write tracking (`kPromote = 6/8`), 64 MiB copy-queue readback with sub-page 256 B copies, `page_mirror_buffer` `resolve_cache`, and hoisted `FilterCacheScope` + parallel Phase-A/disjoint-WC-flush console heap filtering (`local_mirror` chunk cache, AVX2 32-byte `slots_equal_32`, 8 KiB L1d `seen_keys`, per-batch T# dedup, lock-free `in_place_work_pending` fast-skip). - **AVX2 / x86-64-v3 SIMD & 8-worker mirror pool:** Enables `/arch:AVX2` (x64 MSVC/`clang-cl`) and `-march=x86-64-v3` (x86-64 GCC/Clang) for C/C++ targets; adds 4×256-bit AVX2 + 4×128-bit SSE2 `shadow_keep::sum_of()`, `sum_of_batch_256()`, and fused SEH-safe `guarded::copy_and_sum_256()`, plus an 8-worker `TitleMirror::WorkerPool` with 50 µs spin and WC streaming copies. - **Low-syscall VM guard tracking & shared `Cell::known_*`:** Unlocked parallel Phase-1 readback pre-hashing, shared `Cell::known_*` across `CellGuard` & `TitleTextureCells` (excluding `PAGE_READONLY` from VQ caches), `TitleHeap::hooks.commit/decommit` map-change scoping, batched `copy_page_mappings()`, safe per-tile bridged `VirtualProtect` rollback (preserving already-armed gap tiles), zero-syscall `all_armed` fast paths, and range-scoped `reopen()` / `changes_since()`. - **GPU detiling & batched texture refresh (`title_texture_watch.h`, `title_texture_refresh.h`, `d3d12_title_image_upload.h`):** - GPU compute detiling directly from `TitleMirror` chunks + `TitleMirror::range_sum()` skip + 512-job / 128 MiB GPU-mirror upload batching (`TitleImagePool` 8 MiB/16 MiB cap, `kMaxScratchSlots=64`). - Deferred slot-70 uploads to GPU detile + `publish_streamed_texture()` fix, separated `title_texel_writes`, Stage-2 `TextureVqCache` + Stage-2b `Cell::restore[]` readability bypass, single-lock `page_mirror_check_batch()`, and `TitleTextureWatch::examine_batch()` + `TitleTextureCells::arm_batch()`. - **Bindless view sharing & two-phase dead-sweep GC (`vulkan_bindless.h`, `d3d12_vulkan_device.cpp`):** - Refcounted `ViewKey` sharing, O(1) `BindlessSet` free-lists, single-lock `bind_title_image()`, `ConsoleHeapSlotRecords` `kTexture`/`kSettled` live tracking, and explicit `evictable` classification. - Two-phase GC (Phase 1 dead-key sweep with 0 texture notifications + 8,192-slot hysteresis, Phase 2 emergency live-LRU only on `hard_full`, multi-key `sv.keys` liveness, `dim_2d` mirror-slot room notifications) eliminating 65,536-slot saturation and GC thrash in long gameplay sessions. #### 3. Runtime Async Queue, Replay Cache, List-Value Sync & Single-Flight Coalescing (`runtime/src/vulkan_backend.h`, `queue_holds.h`, `vulkan_replay.h`, `vulkan_presenter.h`, `runtime/shims/d3d12_com.cpp`, `d3d12_xs_list_values.h`) - **Dynamic rendering scope batching & `ReplayStateCache`:** Batches compatible consecutive draws into single dynamic rendering scopes, elides redundant Vulkan pipeline/descriptor/push/viewport/scissor binds in `emit_commands()`, caches `CommandList` summaries, and fans out synchronous unbuilt PSOs concurrently via `PipelineCompiler`. - **Zero-unmet list-value sync & GPU-to-GPU relays:** Fixed `Pump::choose_release()` TOCTOU + quiet window (`0 released unmet`), dedicated `QueueHolds` barrier-drain thread, non-blocking `release_ready()`, SEH aligned volatile `read_value()`, 1000 ms slot-12 timeout, `VulkanFence::signal_gpu_relay()` (`vis_seq=0`) + retroactive `QueueHolds::relay_wait()` / `VulkanQueue::apply_wait_relay()` with `WriteGroup::bare` visibility safety, exact landed-value `console_value_met()` verification, `wait_met` re-check, `relay_wait()` gate preservation, and signal-only `consumed_wait_vis` transitivity. - **Single-flight `BeforeExecuteCoalescer` + feed-only mirror drain:** Reordered global refresh (`wb -> mirror -> flush -> tex -> shadows -> 2nd flush`) with decoupled lazy `gpu_profile_.resolve()` and 4-deep `VulkanPresenter::frames_`; coalesced submissions run a lock-free O(1) check / `drain_page_mirror_feed_only()` (`0.11–0.29 ms` when `CopyPageMappingsBatchX` remaps are queued) achieving **96–97% coalescing** with **0 single-flight waits** (opt-out `LEONIDA_BEFORE_EXECUTE_COALESCE=0`). #### Measured Impact (RX 7900 XTX, RADV, Wine) - **Stability:** Continuous multi-minute cutscene + in-game runs (`run107`, post-merge `run108`: 370–400+ s) with **0 GPUVM faults**, **0 `VK_ERROR_DEVICE_LOST`**, **0 unmet list-value gates** (across 28,372–42,047 held gates), and **0 bindless GC thrash** (3 clean dead-sweeps of 8,192 dead keys each, `0` textures notified). - **Opening cutscene FPS:** Rose from `~0.6–0.8 fps` baseline (`3.6–5.9 fps` at Round 6) to **`7.4–13.9 fps`** (`96–97%` `before-execute` coalesced, `0` single-flight waits, `own threads` `50.8–88.3 ms/f`, `title threads` `8.6–11.3 ms/f`). - **In-game gameplay FPS:** Stable **`6.0–7.4 fps`** (`79–84 ms/f` own threads, `7.0–15.1 ms/f` title threads, Direct GPU now **`66–75%` utilized / `101–121 ms/f` busy** — shifting the bottleneck from CPU to GPU). ### Tested - **Shader translator & semantic suites (post-merge `232b4a1ee`):** - `python3 -m compileall -q make_game.py tools tests`: 0 errors. - `python3 -m unittest tests/semantic/test_alu_exp_f32.py tests/semantic/test_ftz32_fmulz.py tests/semantic/test_buffer_format_d16_hi.py -v`: **14/14 PASS**. - All 17 merged-feature semantic suites (`test_absent_lane_ub`, `test_ds_permute_eager`, `test_cvt_f16_denorm_mods`, `test_f16_denorm_preserve`, `test_buffer_format_d16_hi`, `test_gather4_c_lz`, `test_sample_g16`, `test_high_half_shared_readers`, `test_ftz32_fmulz`, `test_wave64_emulate_opt`, `test_wave64_halves`, `test_fma_denorm_product`, `test_alu_sat_pk_u8_i16`, `test_lds_bound_access`, `test_lds_write2_equal_offsets`, `test_active_runs`, `test_fp_edge_conformance`): **278/278 PASS**. - Full-corpus retranslation (32 shards): **29,267 / 29,267** shaders translated & `spirv-val`-valid; full-corpus `check_absent_lane_ub.py` sweep: **0 flagged / 0 UB sites**. - **Linux portable build & Vulkan tests (`-march=x86-64-v3`, `MESA_VK_DEVICE_SELECT='1002:164e!'`):** - `cmake --build runtime/build` + `ctest --test-dir runtime/build --output-on-failure -j8`: **136/136 PASS** (2 skipped: `shader_library_corpus`, `vk_sync_validation`). - `LEONIDA_VK_VALIDATION=1` on `list_value_progress`, `submit_frame`, `vk_title_mirror`, `vk_title_detile`, `vk_bindless_grow`, `vk_bindless_dimensions`, `title_mirror_hooks`, `r3b_runtime_hooks`, `replay_state_cache`: **9/9 PASS, 0 validation errors**. - **Windows cross-build (`clang-cl /arch:AVX2`) & targeted Wine iGPU suite (`r10-main-merge-igpu`):** - `gta6rt.exe` + `gta6rt_tls_host.dll`: clean build, 0 errors. - Targeted 41-test Wine iGPU suite (`d3d12_existing_heap`, `d3d12_heap_in_place`, `d3d12_queue_wait`, `xbox_list_value_fallback`, `list_value_progress`, `submit_frame`, `console_heap_slot_records`, `title_mirror`, `shadow_keep`, `xmem`, `vk_bindless`, `vk_title_detile`, `d3d12_pipeline_checkpoint`, `xs_proxy_mock`, `acphal`, `d3d12_fence_timing`): **40/41 PASS** (`xmem_write_watch` passed on re-run; only upstream `d3d12_fence_timing`'s `EnumAdapterByLuid` failed under headless Wine Xvfb without DRI3 — its GPU/CPU clock calibration checks passed). - **Hygiene:** - `python3 -I scripts/check_no_game_data.py`: PASS. GPUs tested: - AMD Radeon RX 7900 XTX (RADV NAVI31), Mesa 26.3.1-arch1.3, Linux 7.3.6-zen1-1-zen (Wine) - AMD Ryzen 9 7950X3D iGPU (RADV RAPHAEL_MENDOCINO), Mesa 26.3.1-arch1.3, Linux 7.3.6-zen1-1-zen (native Linux + Wine) AI-assisted: yes — Antigravity (Gemini 4 Neon & Claude Opus 5.5). ### Checklist - [x] Based on current `main` and merges cleanly (merged `d48a957bb`, reviewed by two independent reviewers). - [x] One topic; follow-up work goes in a new pull request (integration PR of the PageMirror + CPU/GPU performance stack). - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
The arena was one allocation of its whole size, made at start: with LEONIDA_ARENA_MB=4095 a world run used about
0.8 GB of it (peak end about 1 GB) and held 4 GiB of Resizable BAR memory. Where the device can, the arena is now a
sparse buffer: LEONIDA_ARENA_MB bounds the address range, and memory is bound as it is used.

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

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RADV puts sparse buffers 64 TiB above ordinary ones, so with the sparse arena of the previous commit every geometry
copy and title-window block lay below heap_base and TitleBufferWindows::allocate refused it (it accepted only a
positive offset below 2^47). Shaders translated since 2026-11-24 sign-extend a V#'s 48-bit base and say so in their
index entry (vsharp_base_sign_extended), and RADV hands out every address from one 2^47 half of the 48-bit space, so
any block is within reach of heap_base as a signed offset.

- shader_library.h: VsharpBaseCensus counts the marker over every loaded module; signed only when all have it.
- The device reads V# bases signed when the census says so (or with LEONIDA_IMPORT_BELOW_ARENA=1, as before). The
  import refusal still follows that setting alone. One line logs the census.
- create_arena: the arena is sparse only with signed offsets; otherwise one allocation, and one line says why.
- TitleBufferWindows::shader_reachable replaces the positive-only check. The first failure of each Vulkan call while
  making a block, and the first block refused for its address, are logged.
- rebase_title_vsharp sign-extends a base it already rewrote below heap_base.
- device_arena_memory (for tests); cs_user_data.comp reads V# bases sign-extended, as translated shaders do.

Tests: d3d12_title_va_game_device and d3d12_geometry_views_game_device (d3d12_title_va_test --game-device: the
device the game makes, with the arena's bind queue); geometry_views_test (shader_reachable at the measured RADV
addresses and the range edges); shader_library_test (the census). Wine suite on the iGPU: 429 pass / 23 fail against
425 / 23 on main 8bc59a74c, nothing pass to fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A title texture upload waited on the CPU, with the submit lock held, for all work submitted on every queue, at
most 250 ms, and skipped the write when that work was not done. World frames take longer, so changed textures
(the planes of a video frame among them) arrived late or out of step, and the submitting thread stalled up to
250 ms per upload (the 200-277 ms maxima of the textures phase in world runs).

The staged transfer now waits for that work on the GPU: write_staged_title_image hands it every queue timeline
value submitted so far. Every such value is already submitted, and console waits whose signal is not submitted
live in QueueHolds, so the GPU wait cannot deadlock. The upload slots are reused once their transfer is done
(looked up, not waited for), and new ones are made while all are in flight. Every title fill goes through this
upload, so the host-copy path for title textures (write_host_texture, its bounded wait and
LEONIDA_ORDER_TEXTURE_UPLOADS) goes. As before, the transfer is submitted on the primary queue before the
submission whose before_execute runs the refresh, and the other queues wait for it on the GPU, so that
submission's draws sample the new texels.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Before every submission (at most every 16 ms, and not at all when a view held the registry), the refresh hashed
every mapped or stale texture and a round robin of the rest (sampled, a full hash every sixth pass), within
byte and time budgets that could split the planes of one video frame over passes.

Now each title texture filled from memory is watched through the geometry watch's cells: its 64 KiB tiles, at
its CPU view and every other address xmem maps them at, are armed read-only; a write faults once per tile, and
the fault, a mapping change or a kernel write's opening queues the tile (geometry_writes::WriteQueue, new). The
refresh, at every submission and with the registry waited for, takes that queue and reads only the textures over
the written tiles (TitleTextureWatch, src/title_texture_watch.h), arming them again before the read; a texture
nobody wrote costs nothing. A tile that cannot be armed (not committed, pinned, no fault handler) names its
textures at every pass: the one fallback. A fill whose full hash equals the last one uploads nothing. A slot-70
view no longer hashes its texture: it fills only one never filled or known changed.

Removed with the hash pass: LEONIDA_TITLE_TEXTURE_PERIOD_MS, _CHECK_KB, _FILL_MB, _FILL_MS,
LEONIDA_TEXTURE_HASH_BUDGET_US, LEONIDA_TEXTURE_SWEEP_BUDGET_US, LEONIDA_TITLE_EVERY_BUDGET_US,
LEONIDA_TITLE_VIEW_REFRESH_MS and the async mode LEONIDA_TEXTURE_REFRESH_ASYNC (its worker pass, first-use
fills, mapped list and range index). A line every 10 s counts passes, textures looked at, uploaded, unchanged,
written tiles and arms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The records' two indexes kept each V# half in a bucket per power-of-two span class and 64 KiB-or-larger block,
and a change visited every entry of every bucket it reached, plus resolved halves for an addition that only
re-fixes waiting ones: 82,000-472,000 slots looked at per submission for 2-15 changes and 1,450-3,150 slots
fixed in the busiest world windows of one run, 4.4-13.4 ms a submission.

Now each index holds the halves by their exact range: halves naming the same range share a group with a resolved
and a waiting list, each half keeping its place in its list (a move or a removal is O(1), no stale entries, an
empty group goes). Groups are ordered by start per power-of-two class of their length; a query searches each
class in use once and walks the groups starting less than one class length before the change. A change looks at
exactly the halves whose range overlaps it (an addition: the waiting ones only); the groups compared besides are
those that start within one class length before it and end before it, one comparison each and no slot. 20 bytes
a half (was 24), plus a group per distinct range. Interface and device code unchanged.

Test: 300,000 slots of 16 bytes packed into 74 blocks of 64 KiB; a 40-byte release looks at the 3 it overlaps
(the bucketed index looked at the whole block and fails), by source it also finds a 1 MiB range starting two
blocks earlier, a moved slot leaves nothing behind, and an addition over all of them looks at the 1,000 waiting.
The 400 random rounds against a full re-resolution still pass (entries looked at 792,825 -> 133,506 for the same
81,005 slots fixed); copies that skip large ranges or the waiting lists on a removal fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The console queue's CopyPageMappingsBatchX goes through xmem's range callback in a retail run. It host-mapped every
destination page of a paired GPU-only range twice: the GPU-only page and its CPU twin. Each map is a VirtualQuery, a
placeholder split and a MapViewOfFile3/UnmapViewOfFile2, which are wineserver round trips under Wine. All of it ran on
the render thread under g_phys_mutex, which DirectStorage's page transfers take too. A local world run spent 3.9-6.0 s
mapping per 10-12 s.

Nothing on the host reads a GPU-only address of a paired range:
- the D3D12 layer, DirectStorage and the texture refresh read the CPU twin (title_gpu_views::to_cpu);
- the runtime reads a page by number through its section's scratch view (host_page);
- the title's CPU never touches the range (PAGE_NOACCESS on the console).

So such a page now gets its physical page in g_mapped and g_table_pages alone, with no host view, as the console edits
GPU page tables only. The twin is mapped as before, and so is a destination with no CPU pair: an independent-pages
range (LEONIDA_SLOT31_RUNS), whose pages are read where they are.
- A view the title mapped there itself is unmapped once when a copy lands on it.
- unmap_range_locked drops table pages in its range, so the title's own unmap or release clears them.
- A table page is not one of its physical page's host addresses (no note_mapping, no alias peer). It can be neither
  written nor guarded on the host, so a twin plus a GPU-only page is no longer "aliased" for the slot-133 shadows and
  the geometry watch.
- A table update raises title_memory_map::changed and geometry_writes::notify(replaced) for the GPU-only address, as
  a host remap did. A remap changes bytes, not what a V# resolves to, so the slot-record change list is not involved.
- The periodic slot-31 line gains "pages N by table, M by host remap" (slot31_mapping_counts).

Tests (Wine):
- xmem_test, test_copy_page_mappings_cpu_view: no host view on the GPU-only range; one host remap per page, not two;
  a copy from a GPU-only page finds what its table entry holds; a page the title mapped there is replaced by a table
  entry; the title's unmap clears the table.
- d3d12_xmem_placed, queue_remap_default_route: it read the GPU-only pages directly (the old behaviour). It now reads
  them through a slot-31 copy and checks that they have no host view.

Wine suite on the iGPU: 425 pass / 23 fail, the same as main e5a7c8942, nothing changed. Linux ctest on llvmpipe:
115/115.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A title-written T# that found no texture went on a retry list that every submission tried again, round robin, for
500 us (LEONIDA_CONSOLE_RETRY_US). World runs had up to ~35,000 waiting, 200-550 retried per submission, and every
retry counted again as a T# "naming no texture" (1.56 million in 27 log windows of one run). A bound T# whose texture
went never came back unless the title rewrote its slot.

The per-slot records of RT-VSHARP-SLOT-RECORDS now hold T#s too (src/console_heap_slot_records.h): the exact base
address and bound / waiting / waiting for room, with an index by that address. Texture changes go on the same change
list: note_image_address, a GPU placement added and a streamed texture published (texture_added), forget_image and a
placement removed (texture_gone), freed bindless entries (texture_room), each also at the other view of pool memory.
The next submission fixes exactly the T#s naming the address. A V# refused a geometry copy for lack of room is fixed
again when geometry copies are freed (geometry_room, GeometryViews::free_generation), closing the gap A1 left.

"No texture at the T# address" is counted in "unbound T#s by reason" by what the address is: title memory, a texture
of ours that is gone, low 32 bits naming one of ours (same shape / other shape / gone), or none. The slot records
line gives T#s recorded, waiting, fixes left waiting and refills.

Removed: retry_console_slots. LEONIDA_CONSOLE_RETRY_US applies only to the opt-in GPU heap pass now; slots deferred
by LEONIDA_CONSOLE_FIX_US are fixed first at the next submission (fix_deferred_slots).

Tests: console_heap_slot_records_test (T# and room cases), new d3d12_tsharp_refill_test (the last of 60,001 waiting
T#s samples its texture at the first submission after it appears; its T# leaves the hash table when it goes),
d3d12_unbound_tsharp_rules_test (address classes). Linux ctest 115/115 (llvmpipe); Wine suite (clang-cl, iGPU RADV)
425 pass / 24 fail, against test/three-fixes 425/23: d3d12_tsharp_refill new and passing, xmem (known flake) the
only pass->fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A list value wait (wait32/wait64) that is not met at submission holds its queue until memory meets it. The fixed
200 ms timeout, LEONIDA_VALUE_WAIT_TIMEOUT_MS and the 4 ms demotions are removed (in Linux world runs 14-63 gates a
run timed out with the writer's value not there yet).

A held gate goes without its value only when nothing else can make progress (releaser idle, no title
ExecuteCommandLists in progress, nothing of the pump's running on the GPU; work the layer holds behind a wait is not
running, asked through the new rt::d3d12::fence_signal_submitted), and then only: in a cycle (at once), at a present
queued behind it (VIctory-Belobug-AMD's rule, queue/behind.rs step, queue.rs release_held), or when the title has made
no queue call for 2 s; every gate goes at device loss. src/list_value_progress.h (portable) replaces
list_value_wait_budget.h. Each release is logged with gate, queue, wait and reason; released waits met later are
counted. stop() drops gates it leaves shut so they no longer hold their queues.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A pending stream texture whose first bytes arrive through a noted write (the pending slot-70 views case of
d3d12_existing_heap) kept its cached unreadable answer and was never filled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
runtime/README.md: the sparse arena changed the LEONIDA_IMPORT_BELOW_ARENA row and the texture work removed the LEONIDA_ORDER_TEXTURE_UPLOADS row next to it; the arena's row is kept and the removed row stays removed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The T# records, the room lists and the texture and room changes of descriptor-refill now live in the exact-range
index of slot-records-index. src/console_heap_slot_records.h: a third index, by T# address (the exact range
[address, address + 1)), of the same groups with a settled and a waiting list; a texture gone visits exactly the
T#s recorded for its address, a texture added the waiting ones. The records waiting for room (V# halves refused a
geometry copy, T#s refused for a full bindless array) are kept in a list per kind with each record's place, so a
record leaves it in O(1) and room made visits only the records waiting for it. Interface as descriptor-refill
has it (states, set_texture, base, textures, textures_waiting); device code, README rows and both sides' docs kept.
32 bytes a half.

Tests: console_heap_slot_records_test, both sides' cases (60,010-slot release; 300,000 slots in 74 blocks, a
40-byte release looks at 3; 400 random rounds against a full re-resolution; a texture registered looks at the 10 of
60,015 waiting on its address; room changes touch only the records waiting for room); a copy that skips settled
lists on a removal fails. Linux ctest 115/115.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
runtime/README.md: the console-heap rows come from the refill branch, the shadow rows from #1867.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Run 57 showed 99.9 % of the arms refused, 60,637 tiles not armed and about 8,700 textures looked at per pass
(60-68 ms a pass). The refusals were this watch's own: a tile with any page not committed was refused, so
every streamed texture registered before its memory arrived was named and its arming retried at every pass,
and a texture never filled because its memory was not readable was named again at every pass too.

Now pages not committed are left as they are: xmem's commit or mapping bumps the tile's cell, and the mapping
change makes the textures over it probe their memory again. A texture whose memory is not readable is not
named again until then, except one the title mapped (its pages may be committed under the Map pointer). A tile
pinned for a kernel write is busy: the texture is not read (which uploaded half-written textures at every pass
until the write ended) and is read once the pin is gone. Only a tile whose guard cannot be set is read at every
pass. The log line counts busy looks and arms apart from refusals.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
One world run with the merged index showed 60,000-135,000 records looked at per submission for 1,300-2,600 slots
fixed again and 130-210 changes. Two causes in ConsoleHeapSlotRecords::touched:

- An addition (an alias range, title memory, a backing) visited every waiting record whose range overlapped it.
  Waiting V#s with large spans (data words that read as V#s of up to 4 GiB into title memory) were visited by every
  addition anywhere inside their span, at nearly every submission, and fixed again to no effect. A V# resolves only
  through an alias range, backing, copy or title memory that holds its base (or a backing that holds its refused
  target), so an addition now visits the waiting records whose range starts inside it; the groups with waiting
  records are kept by start a second time for this, so only those are walked. TitleVaAliases tells title memory as
  the merged range it is now part of (a V# whose base lies in the older part may fit only now), and nothing for a
  commit inside a range it already has.
- A record named by several changes of one submission was looked at once per change. Each group's two lists now
  carry the touched() call that last visited them, so a record is looked at once an index a call at most.

Test: 5,000 waiting halves of 4 GiB; 200 additions inside their spans that hold no base look at none (the previous
index looked at all of them 200 times and fails), one that holds 10 bases looks at those 10; 200 removals over the
same 5,000 resolved halves look at each once. The 400 random rounds against a full re-resolution still pass (slots
fixed again there 81,005 -> 75,919, looked at 133,506 -> 97,952); a copy whose removals skip waiting records fails.
Linux ctest 115/115.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Run 58: with the watch in effect a pass still read, hashed and detiled every named texture on the title's
submitting thread, one after another: about 1,250 textures and 95 MiB a pass in the world load, 198 ms a pass,
up to 795 ms (read from write-combined title memory, a full hash, the detile into the upload slot).

The upload is split into three steps (TitleImageUpload::reserve, fill, commit). The pass reserves a slot for
each named texture on its own thread, a small pool of threads of ours (TitleReadPool, a quarter of the cores,
at most seven, plus the submitting thread) copies, hashes and detiles them in batches of 16 or 64 MiB, and the
submitting thread then records and submits the transfers one by one in key order, still before the submission
whose draws sample them. The reads of different textures are independent; only the submissions carry the
ordering, and they stay where they were.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Two findings from one world run (every slot records line: 0 refills; fixing slots 18.2 ms a submission).

T#s: the title rebuilds T#s of the layer's textures from 32 bits. The run's unbound T#s name 0x7f0000021400 for the
layer's 0x100021400 and 0x2ef600 for 0x1002ef600 (bits 32-39 clear, 0x7f or 0 in bits 40-47): "its low 32 bits name
a texture of ours that is gone" (291-3,794 a window) and "no title memory and no texture of ours" (270-4,585, low bits
past the last address handed out: textures still to come). They were recorded under that address, while a texture's
arrival is announced at the layer's address, so no arrival ever reached them, and bind_title_image looked them up by
the exact address only. tsharp_texture_key maps such an address outside the title's memory to the layer's texture
address with the same low 32 bits (while fewer than 2^24 were handed out); the T# waits under it, and
bind_title_image takes the texture there when its shape fits (another shape stays unbound, as before).

V#s: about 2,100 rewritten V# halves a submission, 70% resolving to nothing at about 9 us each (the alias table,
the backings, the geometry copies and the title memory walked again, VirtualQuery included), 63% with words seen
before. A waiting record is fixed again by every change that could let it resolve, so while one waits its answer
stands: a rewritten half whose exact range another half of the heap waits for takes that answer
(ConsoleHeapSlotRecords::waiting_answer, one hash lookup; a half that asks for a geometry copy only from one that did,
and not after geometry room was freed since the refresh). To keep answers current, the submission's changes are
applied before the rewritten slots, and the changes noted during the pass (a window a fix made, a buffer another
thread released) are applied to the heap before an answer is taken (sync_slot_changes). The records keep a third
list per range for waiting halves that asked for a geometry copy. The slot records line counts the answered halves.

Tests: d3d12_tsharp_refill_test also writes the texture's T# in the title's two 32-bit forms before the texture exists
and expects both bound at the first submission after it appears, and gone with it. d3d12_unbound_tsharp_rules_test:
the 0x7f form with the texture's shape binds (it expected "no texture"). console_heap_slot_records_test: in the 400
random rounds half the writes take a waiting answer after applying the changes noted so far, and each answer must be
what resolving at that moment gives (a copy that skips applying them fails); the rounds still equal a full
re-resolution. Linux ctest 115/115.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Blocks of older frames in run 58: a texture without GPU-write flags placed over the memory of a GPU-written
one (a render target, depth or UAV texture) was filled from the title's pages there. Those pages never hold
what our GPU renders into the target's image, only what the CPU last put there, and every write mark over
them (a write-back of a GPU copy, a neighbour's write in the same tile) re-uploaded those old bytes. The
registry now keeps the CPU-view range of every GPU-written texture (DeviceState::gpu_owned), and a texture
over such a range is not watched or filled by the refresh (index_texture); one already watched stops when the
target is registered. Test: d3d12_existing_heap's "texture over a render target's memory" (fails without
this: the written 64 KiB piece shows in the texture).

Upload at first use: a title texture no descriptor names is not read, uploaded or watched. Its first
descriptor of any kind (a D3D12 view, a slot-70 view, a T# the title wrote into a console heap: all reach
Resource::note_shader_view) queues it, and the refresh before that submission reads it whole and uploads it.
A texture whose descriptors are all gone later stays on the write-driven path (nothing counts them down).

Reads by written tiles: each texture keeps a hash of its part in every 64 KiB tile (TilePieces). When some
of its tiles were written, those parts are hashed in place first; equal, and the texture is unchanged
without a whole read. The watch reports writes per 64 KiB tile (the geometry cells' fault reopens a whole
tile), so a neighbour in a written tile costs its share of that tile, not a read of all of it.

The 10 s line: textures written or new, read whole, found unchanged by their parts, uploaded, named for the
first time, not named by any descriptor (not read), ms a pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
f7c3df172 stopped filling such a texture from the title's pages; its own image then held nothing the GPU
drew. A GPU-written texture placed at the address (render target, depth or UAV) now answers first, for
console T#s (bind_title_image) and slot-70 views (place_title_view), when the description fits: the T#'s
extent and samples, and mips and layers within the target's (TitleGpuPlacements::matches), in any format the
target's image takes a view in (its own, a castable one, or one its view list allows). Otherwise the other
texture answers as before, and the reason is counted (format; extent or samples; mips or layers) in a line
next to the refresh's.

Either order at one address: a render target placed over a texture placed first leaves that texture's
registry entry in place and drops its T# bindings, so they bind again, to the target. The ranges GPU-written
textures cover are kept by the resource (DeviceState::gpu_owned), so a texture placed later at the same
address does not take the target's range away; when the target goes, the texture at its address is filled
from memory again and its T#s find it. D3D12 views the title made of the plain resource itself still name
its own image.

Test: d3d12_existing_heap's "view over a render target" (both orders, and the target's release).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A diagnostic, off by default. Each submission on a queue whose family has
timestamp bits gets a query pool, reset once at the start of its command
buffer, and bottom-of-pipe timestamps: after the opening barrier and
bindless upload, before each run of consecutive draws or dispatches of one
pipeline, after a run that another command follows, and at the end. The
difference between two consecutive timestamps is what lies between them
added to the queue's work: a run's GPU time, or "other" when no draw or
dispatch lies between. The results are read on the fence callback once the
submission is done, never waited for, and summed by pipeline under its
stages' ShaderLibrary names (as the pass trace prints them), else its id.

Every 10 s, [rt] gpu profile lines give per frame the compute, graphics
and mesh totals, other work, per queue kind the busy time (measured as
LEONIDA_GPU_LATENCY does) against the timestamped span and the share in
draws and dispatches, and the 20 pipelines with the most GPU time (ms per
frame, share, kind, calls per frame, ms per call).

PSOs register their names with the context when the profile is on, as
they already do for the device-fault report; the device passes the
families' timestamp bits to the context. Off: one test per submission and
per command. On: about 1 us per timestamp on the Raphael iGPU, submit to
idle (vk_gpu_profile_test).

vk_gpu_profile_test runs known dispatches of two pipelines and a draw
through VulkanQueue and checks each pipeline's name, calls, runs, a time
that grows with its loop count, and that the intervals add up to the span.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Step 2 of the memory model. After step 1 the console queue's CopyPageMappingsBatchX gave a paired GPU-only page its
physical page by table, but still host-mapped the paired CPU page (the "twin") for the D3D12 layer and DirectStorage,
which read and write GPU-only memory there: one unmap plus MapViewOfFile3 per page through Wine's server. In the newest
local world run that was 47% of slot 31's pages and most of its 1.7-2.5 s of mapping per 10 s. By the log every host
remap was such a twin (pages by table minus pages by host equals the twins the title mapped itself, which are kept);
destinations with no CPU pair were none.

Now the twin is a table page too (map_table_page), and the host reaches table pages through their frames:
- src/title_frames.h: xmem's lookup (page -> its section's scratch view, held alive), its peers, monotonic bounds so
  other memory costs two loads, and for_each_part / run_end to split a range into table and host parts.
- xmem: g_table_frames under its own SRW lock (readers never wait behind g_phys_mutex), g_page_tables per physical
  page. A table page is aliased, its alias peers being its physical page's host views (note_mapping keeps them in
  step), so #1867's alias cells guard it where the title's CPU can write it. The title's unmap of a table page now
  tells its readers. transfer_physical pins and notifies table pages too.
- Readers: copy_guarded, texture_memory_readable, readable_page / readable_run_end (stream-pool extents),
  to_host_view, the ShadowPages walk and fill (a table page is read like a read-only page that is not the tracker's,
  clean while its cells are; a block with no host view anywhere is armed on its own cell), the geometry provider,
  the title buffers for vertex and index views, raw sampled surfaces, console value reads.
- Writers: kernel_writes::write and store write the frame and pin its peers; read_file reads into a bounce buffer
  first. DirectStorage goes through these.
- The slot-31 line keeps "pages N by table, M by host remap" and adds the paths behind them.

Not through the table: imports (a table page has no host pages; such buffers are shadows), GPU write-back into a
table page (left out like every aliased page; per-frame write-back is step 6), the LEONIDA_MAP_READBACK diagnostic,
the fsdraw and compute-input probes (host pages only), the batch hook's LEONIDA_SLOT31_CPU_TWIN mirror (not installed
in retail runs), and the title's own ReadFileEx/ReadFileScatter (the title has no CPU mapping there on the console).

Tests: title_frames_test (portable); xmem_test copy_page_mappings_cpu_view (no host view at either page, no host map,
reads and host writes through the frame, a write through the title's own mapping seen, remaps, kept twins, views
replaced once); d3d12_xmem_placed queue_remap_default_route (slot-133 buffers over the GPU-only pages and the twin read
them, a guarded title write through the pool's own mapping and a remap reach the GPU, no host remap).
Linux ctest (llvmpipe) 119/119; Wine suite on the iGPU against main e5a7c8942: no pass-to-fail (432 pass, the same 23
failures).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Run 60: 80 % of the looks were whole reads, 89 % of them unchanged. index_texture runs at every Map of a
slot-133 texture, at a layout found by a view and at a first naming, and each call re-tracked the texture:
its tiles were released and acquired again (so not armed) and it was named, so the next pass read it whole
although nothing had been written. Tracking again over the same tiles now changes nothing; a texture that
must be read (never filled, or known changed) is touched instead. Fills made outside the refresh (at a
slot-70 view, on the fill worker) now keep part hashes too, so the next written tile is decided by parts
rather than by a whole read. A line every 10 s counts whole reads by why: never filled, no part hashes,
one tile (its part is all of it), every tile written, no tile written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
With LEONIDA_DEVICE_MARKERS=1 every draw the replay records takes a seq from the dispatch numbering and writes the
VK_AMD_buffer_marker pair: started before its helper passes and rendering scope, finished after the scope ends (the
legacy indirect path inside the caller's scope, which the extension allows). The marker history (now 65,536 items)
keeps each draw's kind and counts, pipeline names, execute, list, command and its place among the draws to the same
targets. The loss and stall reports name the last finished item, the likely hang, the rest in flight and an idle
queue's next one not started, for draws and dispatches alike; a device-fault address is followed by the last draw
each queue started. Tests: the CPU marker test records draws and dispatches and checks the lines; the GPU marker
test writes draw markers outside and inside a dynamic-rendering scope.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Found by two world runs on the step-2 build (60, 61) that lost the device at the start of the 3D opening with a GPU
read of a garbage address, deterministic, where a run without step 2 (62) went past it.

map_table_page returned early when the table page already held the copy's page number. A number is not a page of
memory: XMemFreePhysicalPages puts the slot on g_free_slots and the next XMemAllocatePhysicalPages takes it back
first, naming a page of a new section. A stream pool's pages are freed and allocated again while the title keeps the
table entries, so the next copy of the same number left the table page on the freed page's frame (its entry holds
that section alive), and the readers of the GPU-only page and its CPU twin got the freed page's old bytes. Before
step 2 the twin was a host view, and map_page maps the number's current page every time, so the readers followed;
the GPU-only page had no readers.

The early return now also requires the frame the entry holds to be the number's current page (section and offset).

Test: xmem_test test_copy_page_mappings_reused_number: copy a page onto a paired GPU-only page, free it, allocate
again (the same number, asserted), map and fill it, copy again: the GPU-only page and its twin read the new page.
It failed before the change ("the table pages read the new page behind the number, not the freed one") and passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Run 62 died on a write to a title page left read-only with no guard to answer for it ("stray read-only title
page ... no guard owns it"). TitleVirtualProtect passed the title's call straight through: over a page one of
our guards (a slot-133 shadow's, or a geometry-watch cell, which the title texture watch now arms over all
watched texture memory) had made read-only, the call returned that read-only protection in `old`, and its
Event::replaced made the cell forget the page. A title that saves `old` and sets it back later then made the
page read-only for good, with no owner, and its next write faulted.

The call now runs under a kernel-write pin over the range (kernel_writes::begin_write, as ReadFile does): our
guards come off first and no refresh puts one back until it returns, so `old` is the title's own protection.

Test: d3d12_xmem_placed's "title VirtualProtect over a guard" (an armed cell, the title's VirtualProtect to
read-write and back to what it reported, then a write); it fails without this (`old` is PAGE_READONLY).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A measurement for the page mirror's layout, not a ctest: a 3 GiB sparse buffer and a 256 MiB pool, binds of 1 to
4,096 64 KiB pages with scattered or ordered memory, unbinds, one page at many offsets, and a remap load of 63
calls of 32 pages. Raphael iGPU (RADV, Mesa 26.3.1), natively: the call returns in microseconds, the binds complete
at about 43 us per page with scattered memory and 21 us per page with memory in order (no coalescing), unbinds about
21 us per page; 2,016 scattered pages took 105 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Run 63: with nothing written a pass costs 0.05-0.1 ms; the average comes from the changed textures, about
0.8 ms per MiB uploaded (the opening's video planes and streamed textures: 1,720 uploads, 6.8 GB in 10 s).
Each was read by one thread, start to end: the copy from write-combined title memory, a full hash, the
part hashes (a second pass), and the detile. A burst of three large planes used three threads at most.

Now a texture read whole is copied and hashed in pieces of 16 tiles (1 MiB), spread over all the read
threads; its hash is made of its parts' hashes (TilePieces::combined, at every fill too), so its bytes are
read once and hashed once; the detile stays per texture. The 10 s split line gives, per pass: finding what to
look at, naming/arming/reserving, reading (and detiling, summed over the threads), MiB read whole, and
recording/submitting the transfers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The heap phase in the 3D opening of one world run: fixing slots 6.4-7.5 ms a submission for about 2,000 changed
V# halves; the V# resolution counters there are device-wide (2,904 resolutions a submission against 1,340 changed
halves) and say nothing about the heap.

A resolved record is fixed again by every release or removal of its range or its copy, so while it stands, a
resolution of the same exact range made the same way gives its answer: a rewritten half now takes it from a current
record of its range (ConsoleHeapSlotRecords::answer, the resolved records kept by whether they asked for a geometry
copy, as the waiting ones), after the changes noted since are applied, as for waiting answers. Nothing else of a
resolution is lost: a window's write-back is noted per submission and an unchanged slot is not resolved again
either.

New per-heap line every log window: halves answered by a resolved record and by a waiting one, halves resolved anew
with their time, the classes of those that resolved to nothing (a copy not backed, an arena offset, bit 47, no copy
asked, not title memory, past its range, a buffer's, private pages, no room, pool alias, other; geometry_va reports
why it gave no copy), the longest refresh with its parts (pages, changes, slots), and the waits for the heap lock,
which the heaps phase of the submit counters includes.

Test: in the 400 random rounds half the writes take a record's answer, resolved or waiting, each checked against a
resolution at that moment (a copy that skips applying the changes noted since fails). Linux ctest 120/120.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Raphael iGPU, RADV, natively: a 3 GiB sparse buffer asked for at 0xffffffb4a0000000, 0xffffffb8a0000000 or
0xffffffff00000000 is made exactly there; one asked for below 0xffffc00000000000 is made 0x400000000000 higher
(RADV's sparse range is the top 64 TiB), and 0xffff800100000000 is refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A V# or 64-bit pointer the title writes into its own memory names a title address, and the translated shaders read
heap_base + sext48(address). Nothing was there: run 63 lost the device on such a V# into the stream pool's GPU-only
window, which read zeros before step 2. The mirror puts the title's bytes there.

- src/title_mirror_space.h: xmem places every XMemVirtualAlloc reservation the title lets it place (address null) in
  [16 TiB, 48 TiB), handed out in order at reservation time, so no title pointer ever holds an old address. RADV makes
  sparse buffers at a chosen address only in its top 64 TiB, where heap_base (the sparse arena) is; heap_base + an
  address there stays inside it. A reservation the range cannot take is placed by the host, as before.
- src/title_mirror.h (TitleMirror, Vulkan through hooks): 2 GiB sparse chunks at heap_base + title address
  (bufferDeviceAddressCaptureReplay), one home per physical page (64 KiB of a 32 MiB host-visible unit), every page
  that shows a physical page bound to its one home (aliases share bytes and GPU writes; a remap is a rebind), the binds
  of a submission in one batch (the last bind of a page wins), homes freed after the retire ticket.
- src/title_frames.h Feed/Attach, xmem: every change of what a page of the range shows (host views in note_mapping,
  table pages in note_table_page), in order, with the physical page's scratch bytes; attaching feeds the pages mapped
  now under g_phys_mutex.
- src/title_mirror_tracking.h: the dirty set behind a small interface (watch, unwatch, collect: re-armed before the
  caller copies), with GuardTracking (a geometry-watch cell guard per page) until a measured policy replaces it.
- DeviceState::create_page_mirror / refresh_page_mirror (first in the before-execute hook): chunks for new
  reservations, the feed bound, written pages filled again once, the batch on the arena's bind queue signalling a
  timeline value; VulkanContext::note_mirror_bind makes every queue's next submission wait for it (the ordering rule).
  Off, with one line saying why, without capture-replay addresses, aliased strict sparse buffers, the bind queue, a
  sparse arena, signed V# offsets, xmem or the write-fault handler (llvmpipe), or with LEONIDA_PAGE_MIRROR=0.
  page_mirror_covers / page_mirror_address for the readers that move onto it. A log line every 10 s.

Tests: vk_title_mirror_test (native and under Wine, Raphael iGPU and RX 7900 XTX): a title-written V# read from a buffer
and dereferenced as the translated shaders do reaches its page, an alias the same, an unbound page reads zero; a remap,
a write (one upload for two aliases) and an unmap reach the next dispatch that waits for the batch; a home is freed only
after its ticket. d3d12_page_mirror_test (Wine, the game's device over xmem's pages): after slot-31 copies the GPU-only
page, its twin and the title's view hold the bytes at heap_base + address; a title write through its view reaches them
with one upload; a remap is a rebind with no host remap; an unmapped page reads zero. xmem_test: reservations land in
the range, the pair still pairs, the feed reports attach, host maps, table copies and unmaps in order, nothing after
detaching. Linux ctest (llvmpipe) 121/121.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
guard_fault_bench (Windows, prints a table): VirtualProtect per call and per page from 4 KiB to 4 MiB, one write
fault through a minimal handler and through the geometry watch's cells on one thread and on eight, re-arming a
tile, GetWriteWatch on private memory and on a section view, and Linux's soft-dirty bits through Z:\proc\self.
Under Wine on this machine: a fault 2-2.5 us, a tile re-armed 3 us, VirtualProtect 1.3 us for 4 KiB and 8 us for
4 MiB in one call against about 1 us a page one call at a time; GetWriteWatch works on private memory (37 of 37
pages) and not on a section view (error 87, as on Windows); soft-dirty bits read back clear (not usable here).

The geometry watch's cells reopened a faulted tile page by page, a VirtualQuery and a VirtualProtect each (16 us
a fault): reopen() now does one query and one protect per region of equal protection (5.3 us; 5.8 us of wall
time a fault with eight threads faulting, from 24).

TitleWritePolicy (src/title_write_policy.h, portable): pages written in most intervals are left writable and
copied at every collect, the others guarded and copied once a write faults; a page is armed before it is named,
so a write during the copy is in the next collect; hot pages are probed (guarded for one interval) every 32. Test
title_write_policy: scripted (hot stops faulting, cold faults once an interval, a quiet hot page turns cold) and
randomised against a byte-exact reference, writes during the copy and refused guards included.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HotColdTracking (src/title_mirror_hot_cold.h) implements TitleMirrorTracking (watch, unwatch, collect) over the
geometry watch's cells with TitleWritePolicy, so it can replace GuardTracking with no change in the mirror:
collect() returns the pages written since the last collect, each armed again first, and every time the pages
written so often that they are left writable. One collect is one interval of the policy's history.

A hot page's probe is now armed at the collect after it is asked for and judged on the interval after that;
judged on the interval of the arming itself, a page written every interval looked quiet and was turned cold
(seven promotions and six demotions of one page in 200 intervals). Test title_mirror_hot_cold (Windows, real
guards and a handler that does what the layer's does first): the page written every interval stops faulting
(12 faults in 200 intervals, the warm-up and the probes), the page written every 10th faults 19 times, and the
copy the collects name equals the memory after every collect.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
25,865 of the corpus's 26,503 shaders keep only the low 32 bits of a descriptor-table pointer (docs/d3d12_vulkan.md,
"Descriptor-table high-dword truncation"), so a console heap whose pages live in the page mirror at heap_base + the
title's address (tens of TiB up) must also be readable at heap_base + an offset below 4 GiB: in the sparse arena.
The mechanism is a second sparse bind of the same home. On a real device, with no shader: one VkDeviceMemory bound
into two sparse aliased buffers shows the same bytes through both, for CPU writes into the home and GPU writes through
either buffer; the arena pages after the heap, with nothing bound, read zero (the null-slot guard needs no memory);
unbinding the mirror's view leaves the arena's. Skips (77) without sparse aliased buffers with strict residency.

Ryzen 9 7950X3D iGPU, RADV, Mesa 26.3.1: passes, 0 validation errors; llvmpipe skips (no strict residency).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two additive hooks in src/title_mirror.h for console descriptor heaps read in place; nothing changes for a mirror
that uses neither.

- alias(lo, hi, buffer, offset) / unalias(lo): the pages of [lo, hi) are also bound into `buffer` at offset +
  (va - lo), follow their remaps and unmaps, and go in the same bind batches as the chunk binds, so the one wait
  (VulkanContext::note_mirror_bind) orders a reader of either address. A heap uses it to be read below 4 GiB of the
  arena, where 32-bit descriptor-table pointers reach. Pages not mapped stay unbound there and read zero.
- filter_range(lo, hi) / unfilter_range(lo) and TitleMirrorHooks::filter: the home of a page in a filtered range is
  filled through the filter (the title's bytes in, what the GPU reads into the home), fresh when the home is made or
  its filter changes, not fresh on a refill after a write (the home then holds the filter's last output). The
  title's bytes are never written: the filter writes the home only, which is the mirror's own GPU memory. A home
  shown at a filtered and an unfiltered address holds the filtered bytes; when the filtered address goes it is filled
  as a copy again. home_bytes(va) gives a mapped page's home for writing one changed slot between fills. The
  counters count filtered fills.

Test: title_mirror_hooks_test (no GPU, fake handles): binds into the second buffer with the chunk binds, after a
map, a remap and an unmap, and none after unalias; filtered fills fresh and not, a copy outside the range, a home
shown twice, refiltering a mapped page, unfiltering, and the title's bytes unchanged. vk_title_mirror_test passes
as before (Ryzen 9 7950X3D iGPU, RADV, Mesa 26.3.1, under validation).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two always-on lines every LEONIDA_SUBMIT_FRAME_SECONDS (10 by default, 0
off), from the counters the phase line already keeps and a few more:

[rt] submit frame: frames presented and, per frame, the submissions by
queue kind and the milliseconds the title's threads spent in the layer:
the existing phases counted per frame instead of per submission, plus
what the phase line leaves out - ExecuteCommandLists outside the phases
(list unwrapping, the console's list-value waits and writes, the queue
lock), the queues' Signal and Wait, and the present. Inside those, the
vkQueueSubmit calls and waits for contended submission-path locks are
given apart. Then the window's worst frame and the time of our own
threads per frame: the submit worker (LEONIDA_SUBMIT_ASYNC), the texture
read threads and filler, the console heap resolver, the geometry
refresher, the list values' pump and releaser, the fence callbacks.

[rt] submit floor: how many submissions changed nothing (no heap slot or
page, shadow page, geometry, texture fill or pipeline build), their
average and least cost and their phases, against all submissions.

Title calls are timed once, at their outermost entry, less the phases
inside them; a WorkerScope marks our own threads so their phases are not
counted as the title's. A frame ends at each present the presenter takes.

submit_frame_test checks a scripted run on the CPU (frame sums, title and
own threads, worst frame, floor) and, with a Vulkan device, that the floor
of 20 empty submissions through VulkanQueue sums to exactly what the
phase totals grew by.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On the console a texture access loads the T# and samples. Translated shaders hashed the eight T# words and probed up
to eight slots of the descriptor table for every access: 62 lookups and 19,714 RADV instructions in the tiled-lighting
pixel shader (3,080 in the native program).

The layer now writes the index into dword 6 of every T# in the heaps shaders read, as TAG 0xA [31:28] | storage kind
[27:23] | sampled kind [22:16] | index [15:0] (gfx10_descriptors.h, tsharp_index_word): the console resource heap
copies (fix_console_slot, again whenever the texture at the T#'s address comes, goes or is replaced) and its own
shader-visible heaps (write_image_descriptor, refreshed for bound tables by scan_title_table). The title's bytes and
the T#'s table key keep the title's dword 6.

The translator (tools/descriptor_sources.py, Gen.tsharp_index_sgpr) follows the SGPR dataflow and takes the index from
dword 6, with no lookup, for every T# whose dword 6 it traces to a heap slot (an s_load from a 32-bit descriptor-table
or heap pointer in user data); index 0 unless the word has the tag and dword 3 names an image. Other T#s are looked up
and prefer a tagged word. S#s keep the lookup (sampler heaps are read in place; 40% are literals).

Over the 1.0.2.1 corpus (tools/descriptor_source_census.py) 438,353 of 439,415 T# operands (99.76%) take the word and
17,432 of 17,540 modules keep no T# lookup; no scalar instruction reads dword 5-7 of a heap T#. RADV on an RX 7900 XTX,
lighting shader: instructions 19,714 -> 17,568, latency 73,690 -> 32,458, inverse throughput 16,453 -> 7,468.

Modules record "tsharp_index": "dword6"; the runtime writes the word when the library's modules read it, so packs
translated before keep working as they did. LEONIDA_CONSOLE_HEAP_GPU's pass copies T#s as written, so such a library's
console heaps are fixed on the CPU.

Tests: tests/semantic/test_tsharp_index_word.py (interpreter and dataflow), gfx10_descriptors_test, shader_library_test;
ps_texture_sample and ps_table_fetch now load their T# through a table pointer and vk_texture_test writes the word
(integrated GPU, RADV).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Step B. Where the page mirror holds a title range, every reader takes the title's address as its shader VA (heap_base +
address is the mirror's chunk), so no geometry copy, pool extent or title buffer is made for it:
- vsharp_address (title memory, after the alias table: slot-133 buffers keep their shadows until step C),
  geometry_va, resolve_title_memory (before pool extents and windows), copy_title_range, make_title_buffer (vertex and
  index views), device_reachable;
- VulkanContext::buffer_at falls back to the mirror (set_mirror_buffer): a vertex, index, copy or indirect binding of a
  mirrored title address is its chunk and offset, cut at the chunk's end (counted).
Ordinary memory is mirrored when a reader first names it (page_mirror_resolve: each page its own home, watched, then
filled; at most 256 MiB not yet mirrored at once, else the old backing), and leaves on release or decommit
(geometry_writes::note_released). xmem also places the title's own VirtualAlloc reservations in the mirror's range, and
records which reservations are ordinary memory. The binds go in one batch at the end of the before-execute hook
(flush_page_mirror), after every reader of the submission has named what it reads.

The geometry copies remain only for title memory outside the mirror (the XMemAlloc heap) and on devices without the
mirror (llvmpipe). The mem-probe breakdown line has a "page mirror" item: units allocated, homes bound, pages
mirrored, chunks; the mirror's line counts ranges resolved, refused, ordinary pages mirrored and released, and
bindings cut; the console heap line counts V#s resolved into the mirror.

Not here: write-back of GPU writes into mirrored pages to the title's pages. The geometry copies these readers used
had none either (only slot-133 shadows do, and they stay until step C), so nothing is lost; the per-page rule for
pages dirty on both sides comes with step C.

Tests: d3d12_page_mirror_test (Wine, iGPU): committed XMemVirtualAlloc memory named by a constant-buffer view keeps the
title address as its V# base, the GPU reads it and a later title write there; a binding of it, and of a GPU-only pool
page, is served by the mirror's chunk; a page named on its own is mirrored. memory_breakdown_test: the new item.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
v_dot4_i32_i8, v_dot4c_i32_i8, v_dot4_u32_u8 and v_dot4c_u32_u8 become one
OpSDot / OpUDot on the packed bytes plus OpIAdd for the addend, and
OpSDotAccSat / OpUDotAccSat under clamp (both saturate the addend plus the
exact sum, as the hardware does). op_sel halves are put together into one
dword first. RADV did not re-form v_dot4 from the old expansion (four
extracts, multiplies and adds each), which made the FidelityFX upscaler
passes ALU bound.

--integer-dot-fallback keeps the expansion for a device without
shaderIntegerDotProduct (required by Vulkan 1.3): vk_subgroup_info.py
reports integer_dot_product and make_game.py turns the flag on where it is
false. The runtime and vk_pipeline_check enable the feature where the
device has it; the interpreters of the semantic tests run the new ops.

Tested: tests/semantic/test_packed_dot4.py (new fixtures), the translator
suite, tools/dot_diff.py on the four ops, a wave32 GPU program on the
Radeon iGPU (gfx1036) and the RX 7900 XTX against the gfx1036-measured
words, RADV statistics of the upscaler passes (docs/design.md row).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
s_load_dwordx2/4/8/16 and s_buffer_load_dwordx2/4/8/16 read their dwords as
uvec4 / uvec2 loads instead of one uint each. An s_buffer_load with a
run-time bound checks its last dword once and takes the wide loads; a load
that is partly out of range keeps the per-dword path, so out-of-range dwords
are still 0 and not read. The vectors go through a NonWritable block (SMEM
on RADV) only in modules that write no memory: with the decoration in a
module that stores, RADV ordered the load before the store and
valu_fuzz --family mem read old words in 18 of 600 programs.

Tested: tests/semantic/test_wide_scalar_load.py (new fixture),
SmemHardwareRuleTests, the translator suite, valu_fuzz --family mem on the
Radeon iGPU (600/600, wave32 and wave64), scripts/run_gpu_tests.py on the
iGPU (same results as before), a synthetic GPU program on the RX 7900 XTX
(docs/design.md row).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Step C, with the previous WIP commit.
- Resource::create_mirror_buffer: a slot-133 buffer over title memory the mirror holds in one chunk is bound to that
  chunk at heap_base + its title address: no import, no shadow, no per-submission walk or guard of its own. Its GPU VA
  is the title address; V#s and root views naming it keep that address. Title windows and stream-pool extents are not
  made for mirrored memory (resolve_title_memory answers the mirror first, since step B).
- Write-back (DeviceState::page_mirror_write_back, from write_back_titles after the reaching submission retired): the
  256-byte pieces whose home differs from the title's page are written back through kernel_writes, on pages nothing
  wrote since they were last armed (TitleMirrorTracking::unwritten); a page written on both sides keeps the title's
  bytes, which are uploaded over the home before the next submission. Ranges are noted (note_title_write, with its
  caps) where a V#, a writable geometry range, a title-memory resolution or a BVH range is answered by the mirror.
- The mirror's tracking is HotColdTracking (src/title_mirror_hot_cold.h); it now answers unwritten() for cold pages
  from the version its guard was armed at (an additive change to that file and to the interface, default false).
- Homes go to device-local memory while VK_EXT_memory_budget keeps 1.5 GiB (or an eighth of the budget) for the
  title's textures and render targets after a unit, to host memory otherwise, decided per 32 MiB unit and logged when
  it switches; the mirror's line and the mem-probe item count units of each kind.
- The mirror's line adds hot and cold pages, write faults, hot and cold copies, and KiB uploaded a submission and a
  frame.

Not moved: the XMemAlloc heap (HeapCreate places it). RtlCreateHeap over a reservation in the mirror's range faults
under Wine (it writes the reserved base), so it stays outside the mirror; slot-133 buffers there keep their shadows.

Tests: d3d12_page_mirror_test (Wine, iGPU): a slot-133 buffer over mirrored memory has the title's address as its GPU
VA and is no shadow; a GPU write into its home goes back to the title's page (one 256-byte piece), a page written on
both sides keeps the title's write. Linux ctest (llvmpipe) 122/122; xmem_test OK.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Unlocking a mutex on another thread is undefined; MSVC's runtime throws, and under
Wine the test stopped on msvcp140's missing _Throw_Cpp_error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
When every page of a console CBV/SRV/UAV heap lies in the page mirror (a reservation xmem placed in its range),
add_heap_in_place gives it no copy and no page tracker of its own. 25,865 of the corpus's 26,503 shaders keep 32 bits
of a descriptor-table pointer, so the heap's pages are bound a second time into the arena below 4 GiB
(TitleMirror::alias, same bind batches and wait as the mirror's), at a range of whole arena blocks with no arena
memory behind it (arena_reserve_unbacked); the null slots after the heap are that range's rest, unbound, reading
zero. Table pointers go there as before (console_heap_ranges).

The mirror fills the pages' home through filter_heap_page (TitleMirror::filter_range): the title's page is only
read; a slot whose bytes changed since it was last filtered, or that a change touched (the records' change list,
applied at the mirror's refresh before the written pages are filled, filtered straight into the home), is fixed as a
copied slot was, into the home: a V# whose base lies in the arena, the mirror or a buffer of ours stays as the title
wrote it (reachable_as_written, no record); another V# is resolved as before (an interim until every title allocation
is in the mirror) or written with no base and no records and waits; a T# is bound as before [TSHARP-INDEX: its
bindless index in the entry]; other words are null. A GPU write-back is never taken from these pages: the mirror has
none, and no window is made for them.

A heap the mirror does not hold (a device without the mirror, memory outside its range) is copied as before. New
log line per in-place heap: pages filtered and slots changed per submission and per frame, the ms, and the V#
halves read as the title wrote them. arena_gpu_read reads the arena with the GPU after the mirror's last bind
(tests).

Test: d3d12_heap_in_place_test (Wine, iGPU): a heap in physical pages of an XMemVirtualAlloc reservation; the GPU
reads, below 4 GiB, a V# into nobody's memory and a data word null and V#s into the arena and the mirror as written,
while the title's bytes stay as written byte for byte; a rewrite through the title's own view reaches the GPU at the
next refresh, filtered, and the title keeps what it wrote; the null slots read zero. It fails on the copy path. Linux
ctest 123/123.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The XMemAlloc heap (src/title_heap.h) is the runtime's own over a 32 GiB reservation that xmem places in the
mirror's range. It does not use RtlCreateHeap over a given base, which faults under Wine. Size classes of 64 bytes up
to 1 KiB, then powers of two up to 32 KiB, in 1 MiB spans. Larger blocks are runs of 64 KiB pages, committed when
handed out and decommitted when freed. Freed blocks are kept on lists outside the title's memory, and one lock covers
every call. Committed pages are fed to the mirror as they are committed, so a pointer the title writes into a block
reads the block's bytes without anything naming the range first. The title sees the same as before: 64-byte
alignment, size 0 as 1 byte, and XMemFree of a block from either entry point. When the range is full, blocks come
from the host's heap as before. With LEONIDA_TITLE_HEAP=0 they come from the CRT.

Pages written on both sides: each home keeps a 64-bit sum per 256-byte piece of what both sides last agreed on.
- An upload copies only the pieces the title changed, so a piece only the GPU wrote keeps the GPU's bytes.
- Write-back copies only the pieces the GPU changed while the title's piece still matches the sum.
- A piece both sides changed keeps the title's bytes and is counted.
The mirror's 10 s line gives uploaded and written-back KiB per submission and per frame, and the count of pieces
written on both sides.

Tests:
- title_heap: classes, large blocks, and 20000 random allocations and frees checked against a reference.
- d3d12_page_mirror part 7: one page, the GPU writes piece A and the title piece B in one window, and both survive.
- d3d12_page_mirror part 8: the GPU reads XMemAlloc blocks through pointers nothing named, and a freed large block
  reads zero.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/design.md states what the pack and the runtime agree on (the tag 0xA << 28, index 0, how an older pack is
recognised) with the counts; runtime/README.md says what LEONIDA_CONSOLE_HEAP_GPU does with an index-word pack;
make_game.py and runtime/cmake/translator_deps.cmake list the translator's new imports (descriptor_sources.py,
heap_index_census.py), so a pack and the test shaders are made again when they change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With the mirror's steps B and C (title memory resolved to heap_base + its address, ordinary memory mirrored when a
reader names it, the write-back of GPU stores from the homes, a separate bind flush), the in-place filter changes:

- Lock order console_heap_mutex, then page_mirror.mutex, then slot_change_mutex. vsharp_address's mirror path takes
  the mirror's lock under console_heap_mutex now, so the filter, which runs inside the mirror's fills, takes no other
  lock of ours: the in-place heaps' filter state is under the mirror's lock (page_mirror.in_place), and the mirror's
  refresh no longer takes console_heap_mutex. Under the lock the filter does only reachability (arena, a buffer of
  ours, or the mirror through page_mirror_resolve_locked, which names ordinary memory as any reader does), nulls and
  the list of what is left: a V# the mirror does not hold and a T# to bind are finished in the heap's refresh
  (finish_in_place), outside the mirror's lock, and written into the home unless the title rewrote the slot since.
  The change list is taken under the mirror's lock when a heap is read in place, so the entries it has not read stay.
- No write-back from a heap read in place: page_mirror_write_back skips filtered pages (TitleMirror::filtered_at), as
  their homes hold the filtered slots, not the title's bytes.
- The heap's pages are named to the mirror when the heap is made (ordinary memory is mirrored then), after its
  filter range and its second binding are set. The binds go in flush_page_mirror's batch.

d3d12_heap_in_place_test also checks that a GPU store into the heap's pages is not copied back over the title's
bytes; title_mirror_hooks_test checks filtered_at.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
title_mirror.h: a filtered page's sums per 256-byte piece are of the title's bytes (title compared with title); the
filter runs after that compare, only when a piece changed or the home is fresh, and writes the home. write_back skips
a filtered home, so page_mirror_write_back takes TitleMirror::write_back as is. A home leaving its filter is copied
whole once.

The T# index word (tsharp_index_word) is written by finish_in_place into the home's dword 6 once the T# is bound; the
filter leaves 0 (the fallback) there meanwhile, so the title's own dword 6 is never read as an index. Copy-path heaps
keep fix_console_slot's write. d3d12_heap_in_place_test checks a T# slot reads the tag and index while the title's
bytes keep their dword 6; title_mirror_hooks_test checks write-back skips filtered homes and the filter is not called
again for unchanged title bytes. set_tsharp_index_words_for_test for the test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Run 64w spent a constant 14.5 s in a submission's shadows phase whenever new V# ranges reached the write-back. A
console V# has no read/write bit, so each new range is noted as possibly written, up to the 64 MiB cap a submission.
page_mirror_write_back then summed every 256-byte piece of those homes on the CPU. The homes are in device-local,
host-visible memory, and an uncached CPU read over the bus costs about 1.7 us per 8 bytes: 64 MiB takes 14.5 s. It
was measured here at 1.6 s for 16 MiB on the RX 7900 XTX. The bind wait was not the cause: it is a GPU-side wait.

Now the homes of the mirrored pages in the range are copied by the GPU into a host-cached buffer, 16 MiB at a time,
on the device's staging queue. The copy waits for the mirror's last bind batch and signals a timeline semaphore of
its own. The merge then reads the copy (TitleMirror::homes_in, and write_back with a staged copy). Under the
mirror's lock nothing is filled between the copy and the merge. The CPU never reads a home now.

The mirror's 10 s line gives the write-back's calls, ms each, the GPU copy's share, the longest, and the MiB copied
out.

Test: d3d12_page_mirror part 9 runs the write-back over 64 MiB with one piece written by the GPU. That piece goes
back, and the call must take under a second. It took 10 ms here, and 6.3 s before the change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A pipeline-library depth reduction loads s_buffer_load_dwordx4 s[20:23], s[20:23]
through a V# read from memory. The wide path loads every dword before it writes a
destination SGPR, and keeps the out-of-range dwords 0 and unread, under every
NUM_RECORDS of both buffers (48 cases), as the translation before the rule does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A slot-133 texture placed where a slot-70 view had made a texture of the layer's takes the address over
(place_at_title_address); register_title_texture then retires the slot-70 entry, and retire_title_texture erased the
address from images_by_address unconditionally - the placed texture's key. Every T# naming that address found no
texture ("no texture at the T# address: title memory"), the texture was never named, so never filled, and the slot
read the fallback.

forget_image_of(address, owner) erases the address and its views only while `owner` is registered there, under one
descriptor_mutex hold; retire_title_texture and ~Resource use it (the latter checked in two steps before). The views
of the retired texture left when the address was taken over.

d3d12_heap_in_place_test: a slot-70 view, then a slot-133 texture at the same address in a reservation at 16 TiB and
up, named by a T# the title writes into a heap read in place: it binds with the tag and its index, reads the fallback
(index 0, the 1x1 zeros) when the texture goes, and binds again when a texture is placed there again. It failed
(index word 0) before the fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Run 64w2 hung in a min-pyramid dispatch whose loop bounds divide sizes from one constant buffer by divisors behind a
V# from its descriptor table. Its log cannot name that buffer: it has no record of the dispatch. The heap's line
counts V# halves resolved to nothing (not title memory 14378, bit 47 12312, arena offset 5506 in 10 s) but not where
their bases lie.

- Always on, the console heap's "resolved to nothing" line now splits the arena-offset and not-title-memory classes
  by what the host has at the base: image, mapped, private, reserved or free (one VirtualQuery per V# half that
  resolves to nothing).
- LEONIDA_COMPUTE_INPUTS (with LEONIDA_DEVICE_FAULT) knows the page mirror. The slot words of a heap read in place are
  read from its home, where the GPU reads them. A V# base is classed mirror-home or mirror-unbound before the older
  backings. Each V# prints the host's kind of memory at its base, the title's first 16 dwords there and whether the
  GPU-side bytes differ. A slot the layer turned to null prints the title's V#, where it lies and its bytes.
  LEONIDA_COMPUTE_INPUT_SLOTS takes runs such as 5/0-15.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Run 64w3's records came out cut by fsdraw lines from other threads, because a record was many writes to stderr. Now
each record is built in a buffer and written once.

A T# whose GPU-side dword 6 carries the layer's index word read "texture key=absent", because the registry holds the
title's words. It is now also looked up by the title's words.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Two trackers guarded the same 64 KiB pages through the same cells: the page mirror's HotColdTracking and the
title texture watch. When the mirror found a page hot it reopened the cell behind the other's back; the texture
watch then armed it again, so the page faulted at every write for one tracker while the other meant it to be
writable (two guards racing on one page), and when the mirror turned a hot page cold for a probe, a write made
while it was hot reached no other tracker at all (the video plane's write of that interval was never uploaded).

One owner of the guard now: the cell. An owner that leaves a page writable holds it hot (geometry_writes::
set_hot); a hot cell is not armed by anyone and hot_tiles() lists it, so the texture watch takes it as written
at every pass; when the last owner lets go, the cell counts as written once more for every subscriber.
HotColdTracking holds its hot pages that way and ignores its own hot-to-cold turn (a cell that has not moved
since it was armed was not written).

Also: the FSDRAW census reset the refresh line's passes, changed and filled counters, which then read 0 uploads.

Test: title_mirror_hot_cold now runs the texture watch over the same cells as the mirror's tracking: the plane
written every interval is named at every interval, probes included, and its page stops faulting once hot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The title keeps plain data inline in its descriptor heap pages and points V#s at it. With one filtered home bound
at both addresses, the filter's output reached those V#s: four words a compute program reads as sizes looked like
a V# with a base nothing holds, three of them were nulled, the program read [0 0 0 720] and spun until the ring
timeout.

title_mirror.h: alias(lo, hi, buffer, offset) gives each page of the range a second home, the filtered copy, bound
at the alias in the same batches as the mirror's binds and filled by hooks.filter whenever the title's bytes change
(a piece's sum, or write-back); the page's own home is always the title's bytes. filter_range, unfilter_range and
filtered_at are gone; copy_bytes(va) is the copy the filter's caller writes slots into; unalias takes the ticket its
copies are freed after; write_back and homes_in take every home again.

The device writes slots into the copy (apply_in_place_changes, finish_in_place). An unreachable V# half is null
whole, all four words, in the filter and in fix_vsharp.

d3d12_heap_in_place_test: inline data after a table, a V# of the title pointing at it, and a rewrite on the same
page: the V# reads the title's four words, the table the filtered entries ([0 0 0 0] for the data), the title's
bytes unchanged; on the previous commit it read [0 0 0 720] at both addresses. A GPU store into the heap's page
now goes back to the title's bytes. title_mirror_hooks_test covers the alias's own homes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The copy path's null of an unbacked V# keeps word 3 (d3d12_title_va_test and d3d12_geometry_views check that), so
fix_vsharp nulls three words again; finish_in_place clears word 3 itself, so a half nothing holds is null whole in
an in-place heap's filtered copy, as the filter nulls it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
- TitleMirror (runtime/src/title_mirror.h):
  - Add has_pending(va) and skip pages with unflushed pending_ binds in
    homes_in(), homes_in_ranges(), write_back(), and write_back_batch() so
    write-back never copies stale/unbound sparse chunk bindings over live CPU
    memory.
  - Pass each page's physical frame address (mapped->second + k * kPiece) to
    the write-back callback instead of its virtual address so concurrent CPU
    remaps cannot receive a previous mapping's bytes.
  - Replace the unconditional O(homes_.size()) refilter scan at the end of
    write_back() with an O(changed) local list of touched aliased homes.
  - Add HomeRef, homes_in_ranges(), and write_back_batch() for batched
    multi-range GPU readback with concurrent-remap frame validation.
  - Copy a full 64 KiB page in one hooks_.copy call inside fill() via a
    reusable member scratch buffer, falling back to 256-byte pieces only if
    the whole-page copy fails.
- TitleHeap (runtime/src/title_heap.h):
  - Add a per-span live-slot occupancy bitmap so release() rejects small-block
    double-frees without duplicating the freelist, and size_of()/release()
    reject freed slots, interior pointers, and unused span tails.
- Unit tests (title_mirror_hooks_test, title_heap_test):
  - Add regressions covering pending_ skip, physical-frame destination,
    O(changed) refilter scaling over 10k+ homes, 1-shot fill + per-piece
    fallback, batched multi-range coalescing/conflicts/remap skip, and
    TitleHeap double-free / interior-pointer / tail-slot rejection.

AI-assisted: Antigravity, Gemini 4 Neon
- Replace TitleWritePolicy's O(N) std::map full scans in collect() and frame()
  with unordered_map + O(1) swap-and-pop active vectors (hot_list_, dirty_list_,
  history_active_), preserving promotion/demotion/probe/arm-failure semantics
  and address-ordered collect() delivery (~0.001 ms/iter for 200k cold + 100 hot).
- Add writable flag (default true) to TitleVaAliases::resolve() plus optional
  AccessResolver hook; call note_reached() iff writable && to != 0 so read-only
  CBV/SRV root views do not queue GPU write-back for either aliases or mirrored
  pages.
- Pass writable=false for root CBV/SRV and writable=true only for root UAVs in
  d3d12_com.cpp; record explicit GPU buffer-write destinations (CopyBufferRegion,
  CopyTiles, CopyTextureRegion to footprint, CopyResource buffer dst,
  WriteBufferImmediate, AtomicCopyBuffer, ClearUnorderedAccessView buffer,
  ResolveQueryData) and note them for write-back at ExecuteCommandLists.
- Add scale/correctness tests in title_write_policy_test.cpp and read-only vs
  writable tests in title_va_alias_test.cpp.

AI-assisted: Antigravity (Gemini 4 Neon).
Run write_back_titles() first in before_execute_() before refresh_page_mirror()
and refresh_console_heaps(), never force-drain unretired batches, coalesce
intervals in note_title_write() and across retired batches, batch GPU readback
copies without holding page_mirror.mutex across vkWaitSemaphores, stop marking
read-only CBVs/SRVs writable, hoist page_mirror.mutex in finish_in_place(),
reuse filter_heap_page scratch, gate diagnostic VirtualQuery behind
LEONIDA_VSHARP_NOTHING_DETAIL=1, and attribute mirror refresh/flush/lock waits
to submit_phases.

AI-assisted: Antigravity (Gemini 4 Neon)
Aliased VAs (e.g. CPU and GPU stream-pool views) share one home keyed by
physical frame; keying readback_invalidated by std::uint8_t* frame catches
concurrent uploads/remaps through any alias while a readback copy is in flight.

AI-assisted: Antigravity (Gemini 4 Neon)
Round 1A:
- Use VsharpPath::scratch for in-place console heaps in finish_in_place and fix_console_slot so they never allocate general-purpose title windows.
- Never fall through to make_title_window / ShadowPages in resolve_title_memory for addresses already covered by the page mirror.
- Guard vsharp_address's window-creation fallback with bytes <= kTitleWindowMax so oversized V# spans cannot allocate and reject orphan windows.
- Advance <= 2 GiB reservations in title_mirror_space::take past chunk boundaries so placed buffers stay within a single 2 GiB sparse chunk.
- Track arena-backed title windows and slot-133 shadows under ArenaUse::arena_window and report them in memory_breakdown.

Round 1C:
- Add re-entrancy-safe two-pass filter_heap_page_pieces() ready for TitleMirrorHooks::filter_pieces changed-piece mask.
- Reject guaranteed-unresolvable V# halves (null, unbacked bit-47, out-of-arena spans, non-title addresses without an alias) in O(1) inside filter_slot_locked without inserting into heap.records or deferring.
- Clear deferred slot records before finish_in_place and answer repeated V# halves from heap.records under page_mirror.mutex plus a per-batch dedup cache.

Tests:
- Added Linux unit tests in console_heap_slot_records_test (chunk alignment, arena window breakdown, deferred record clearing/answering).
- Added Wine regression tests in d3d12_heap_in_place_test and d3d12_page_mirror_test.

AI-assisted: Antigravity, Gemini 4 Neon
- TitleWritePolicy (runtime/src/title_write_policy.h): lower submission-hot
  threshold (kPromote 6 -> 3 of 8), add O(active) present_frame() frame-hot
  tier (kFramePromote = 3 of 4, kFrameProbe = 16, unguarded on low-sub frames
  <= 4 subs/frame and guarded on high-sub frames so mid-frame CPU writes are
  never missed and 1-write/frame pages never copy 30x/frame), and sort/batch
  page arms via optional Guard::arm_batch().
- HotColdTracking (runtime/src/title_mirror_hot_cold.h): expose on_present(),
  coalesce contiguous 64 KiB VirtualProtect re-arms in CellGuard::arm_batch(),
  and route MEM_WRITE_WATCH pages through title_write_watch::ask() with zero
  guard faults or hot_tiles conflicts.
- TitleMirror (runtime/src/title_mirror.h): add optional TitleMirrorHooks::
  filter_pieces hook passing fill_scratch_ and the 256-bit changed-piece mask
  from fill() (eliminating duplicate 64 KiB guarded copies), and coalesce
  contiguous changed pieces into single WC-friendly memcpy bursts while
  preserving exact home.sums conflict detection.
- TitleHeap (runtime/src/title_heap.h): add portable reserve() helper for
  MEM_WRITE_WATCH with silent fallback and write_watched() tracking.
- Tests: add unit tests in title_write_policy_test.cpp,
  title_mirror_hooks_test.cpp, and title_heap_test.cpp.

AI-assisted: Antigravity (Gemini 4 Neon)
- Hook filter_heap_page_pieces() into TitleMirrorHooks::filter_pieces so in-place console heap filtering reuses TitleMirror::fill()'s scratch buffer and scans only changed 256-byte pieces.
- Call HotColdTracking::on_present() from refresh_page_mirror() under page_mirror.mutex whenever submit_phases::totals().present_serial advances.

AI-assisted: Antigravity, Gemini 4 Neon
Round 1D runtime CPU optimization:
1. Split VulkanQueue state bookkeeping (state_mutex_, microsecond hold) from
   execution serialization (executing_ + exec_cv_ + execution-local wait/pin
   staging). Callers arriving while executing_ is active append to held_ in
   strict FIFO order without blocking on before_execute_() or replay, and the
   executing thread drains ready held work before releasing executing_.
2. Coalesce consecutive ready Deferred::Kind::batch ops in release_held() /
   drain_held_while_executing() and consecutive Call::Kind::execute ops in
   async_worker() (stopping on Signal, Wait, Marker, or Present after_held
   barrier_after), inserting D3D12 inter-batch full memory barriers and
   falling back to per-batch execution on validation failure.
3. Pass closed CommandList snapshots via std::shared_ptr<const CommandList>
   from GraphicsCommandList to VulkanQueue (zero deep copies on submit;
   Reset() reuses storage with an acquire fence when unique or allocates
   fresh storage while in flight), and skip redundant visible_heaps
   scan_title_table() recording for console descriptor heaps when table-scan
   diagnostics are off.
4. Add unit tests in submit_frame_test covering unlocked before_execute_(),
   strict FIFO order, held-batch coalescing and Signal/Wait splits, invalid
   batch fallback, zero-copy Reset(), and async worker (depth=4) coalescing
   with Present barrier ordering.

AI-assisted: Antigravity (Gemini 4 Neon).
Tested on Linux (RADV RAPHAEL_MENDOCINO): 15/15 queue/submit/replay ctest
targets pass (list_value_progress, vk_queue, vk_queue_query_sync,
submit_frame, vk_queue_constructor_oom, vk_semaphore_lifetime,
vk_fence_dispatcher_sync, vk_fence_lost_by_counter, vk_command_replay,
vk_predicated_copy, vk_predicate_capture, vk_overlapping_occlusion,
vk_host_at_aliasing, vk_host_texture_order).
Fixes premature unmet release of console list-value gates at Present under
LEONIDA_SUBMIT_ASYNC and unlocked queue execution:

- QueueHolds (runtime/src/queue_holds.h): add process-wide queue_holds::any_progress()
  backed by a lock-free active CPU/async work counter (WorkGuard / work_changed),
  signaled_unpumped_ tracking across signaled() -> pump_ready(), and per-holder
  lock-free has_pending_gpu_work() protected against detach() via holders_use_mutex_.
- VulkanQueue (runtime/src/vulkan_backend.h): account for queued async inbox calls,
  active async_worker turns (through pump_ready()), pending release_requested_ flags
  (with async_stop_ guard), synchronous/draining executing_ passes (through pump_ready()),
  VulkanFence::signal() -> pump_ready(), and unretired GPU tickets (submitted_gpu_ vs
  progress_ counter). Stop cross-queue release_ready() ping-pong by waking only when
  held_front_seq_ != 0 and calling pump_ready() in async_worker() only when a call
  ran or a held op was released.
- Pump::choose_release (runtime/shims/d3d12_xs_list_values.h): treat
  leonida::queue_holds::any_progress() as active queue progress so held waits are
  never broken unmet while a producer async worker, executing pass, or GPU submission
  is still progressing; advance last_progress_ms_ so kStalledMs measures genuine quiet
  time. Genuine deadlocks (cycles, idle queues + idle GPU at Present, stalled title)
  still break cleanly.
- Tests: add CPU-only QueueHolds + list_value_progress tests in
  list_value_progress_test.cpp and real VulkanQueue async-depth=4 + Present + busy
  producer + genuine deadlock + synchronous executing_ tests in submit_frame_test.cpp.

AI-assisted: Antigravity, Gemini 4 Neon.
Tested on Linux (RADV RAPHAEL_MENDOCINO, MESA_VK_DEVICE_SELECT=1002:164e!):
8/8 passed (list_value_progress, submit_frame, vk_queue, vk_queue_query_sync,
vk_queue_constructor_oom, vk_fence_dispatcher_sync, vk_semaphore_lifetime,
vk_fence_lost_by_counter).
- TitleWritePolicy (runtime/src/title_write_policy.h): restore kPromote = 6
  (of kHistory = 8) and cleanly remove the frame_hot / present_frame() tier
  and its dead fields/counters so 1/frame pages never trigger per-submission
  over-copying or copies on empty submissions. Keep O(dirty + hot + recent)
  active lists and sorted Guard::arm_batch() batching.
- HotColdTracking (runtime/src/title_mirror_hot_cold.h) & d3d12_vulkan_device.cpp:
  remove the dead on_present() / last_present_serial hook (coordinated with
  gate-async-fixer) and unused write_watched_* getters, and cache
  region-batched MEM_WRITE_WATCH runs (bridging verified MEM_COMMIT gaps <=
  1 MiB, capped at 64 MiB per GetWriteWatch call, never bridging uncommitted
  holes, with O(1) unordered_set dirty filtering and conservative dirty
  recording + split-retry on mid-run refusal so no journaled write is lost)
  so steady-state collect() runs in O(regions + dirty) without walking
  ww_pages_.
- TitleHeap (runtime/src/title_heap.h) & xmem.cpp: upgrade for_each_committed()
  to emit maximal coalesced committed extents (exact complement of free_runs_,
  O(free_runs_.size()) instead of scanning all 32k span slots, never spanning
  uncommitted holes) and wire MEM_WRITE_WATCH with silent MEM_RESERVE fallback
  + title_write_watch registration/marks in mirror_heap_ready() (never
  combined with MEM_LARGE_PAGES, MEM_PHYSICAL, or section views).
- Tests: update title_write_policy_test.cpp (kPromote = 6/8 and zero copies
  of 1/frame pages on empty submissions) and title_heap_test.cpp (coalesced
  for_each_committed() tracking around decommitted holes).

AI-assisted: Antigravity, Gemini 4 Neon
Fix queue-sync bugs in VulkanQueue (runtime/src/vulkan_backend.h):

1. Synchronous execute_sync_impl(): when executing_ is active and this
   batch is not blocked by an unmet Wait (blocked_by_wait_locked()), wait
   on exec_cv_ with state_mutex_ unlocked instead of silently deferring
   into held_. When !executing_ && !blocked_by_wait_locked(), take
   executing_ and drain any already-ready held ops ahead of us first
   (closing the gap between QueueHolds::signaled() and pump_ready()
   reaching this queue), then hold behind a wait-blocked front if
   must_hold() remains true or execute synchronously with before_execute_()
   before returning. Wait, Signal, Marker, and genuinely wait-blocked
   batches still enqueue under state_mutex_ without blocking on
   before_execute_() or replay.
2. active_seq_ tracking: assign active_seq_ under state_mutex_ for direct
   unheld execute_sync_impl(), signal_sync(), marker_sync(), update_tiles(),
   and copy_tile_mappings(), clear active_seq_ before drain/release,
   linearize oldest_held_seq() under state_mutex_, and flush
   QueueHolds::pump_ready() after releasing state_mutex_ so after_held()
   barriers never overtake active unheld submissions.
3. Remove unsafe cross-batch coalescing in drain_held_while_executing() and
   async_worker() (along with batch_breaks, barrier_after,
   run_single_held_batch, and run_coalesced_execute*) so every
   ExecuteCommandLists runs its own before_execute_(), bindless_prepare_(),
   prelude_record_(), and fault markers in strict FIFO order.
4. Fix stale prepared[] iteration in execute_now() statistics->mesh setup
   by iterating only i < lists.size().

Update and expand submit_frame_test to cover sync exec_cv_ waiting,
unlocked wait-blocked enqueue, releaser-drain sync ordering, ready-front
drain while pump_mutex_ is held by another thread, active_seq_ protection
of after_held() across unheld execute() and signal(), per-batch FIFO
drain without coalescing, zero-copy CommandList Reset(), and QueueHolds
progress tracking.

Tested on Linux (AMD Ryzen 9 7950X3D iGPU, RADV RAPHAEL_MENDOCINO,
MESA_VK_DEVICE_SELECT=1002:164e!): 9/9 required queue ctest targets passed
(2.92s) plus 5/5 submit_frame_test stress runs.

AI-assisted: Antigravity (Gemini 4 Neon).
Root-cause fixes for four audited bugs in console heap in-place filtering
and TitleMirror:

1. finish_in_place() not_tsharp zeroing & record clear:
   Check gfx10::is_image(words) and TitleImage::not_tsharp in
   finish_in_place(), zeroing w[0..3] and clearing heap.records on
   (w[3] >> 30) slots with d.texture == Records::none (matching
   fix_console_slot) so non-T# overwrites of deferred slots never leak
   raw words into home[slot] or leave stale texture records.

2. Record-answered / batch_answers mirror write-back tracking:
   Call note_title_write(base, span) outside page_mirror.mutex when
   apply_answer() (in finish_in_place) or answered_by_record() (in
   fix_vsharp) returns a mirror-resolved identity target
   (to == base && base >= arena.size), matching vsharp_address path 6.

3. reachable_as_written() & filter_slot_locked() semantic parity:
   - Reject base == 0 in reachable_as_written(), check encodable() +
     gpu_backings + geometry.lookup, and accept bit-47 base | ~mask
     direct backings even when signed_vsharp_offsets() is off (matching
     vsharp_address:4367, 4392). Track non-sparse direct backings as
     Records::resolved so target_gone re-filters them if freed.
   - Keep O(1) permanent rejection (Records::none) only for null base,
     unbacked bit-47, and out-of-arena-span offsets (base < arena.size
     not in title_memory, aliases, or stream-pool GPU views).
   - For unresolvable base >= arena.size halves (not in title_memory
     within span, no alias, no stream-pool GPU view), null in O(1) and
     record Records::waiting directly without deferring so a later
     SlotChange::source_added still wakes and re-filters them.

4. TitleMirror single-snapshot home/sums/copy sync:
   Unify home, home.sums[], and filtered copy updates through a single
   fill_scratch_ snapshot across map() (initial aliased fill & alias
   handoff), make_copy(), and finish_write_back(), preserving GPU-only
   pieces on existing homes so A -> B -> A writes never leave stale
   filtered copies and avoiding duplicate guarded copies.

Tests:
- title_mirror_hooks_test: added make_copy_aba_staleness (make_copy,
  alias handoff, finish_write_back A->B->A) and updated
  filter_pieces_mask_and_scratch for unified single-copy initial map.
- console_heap_slot_records_test: added waiting_source_added_and_tsharp_clear.
- d3d12_heap_in_place_test: added deterministic finish_in_place not_tsharp
  zeroing and late-alias wake-up regressions.

AI-assisted: Antigravity (Gemini 4 Neon).
Lower pure scalar-spill VGPRs (touched only by immediate-lane v_writelane_b32 with non-VGPR source and immediate-lane v_readlane_b32, with every read lane definitely written on all CFG paths) to parked %sgpr slots for both wave32 and wave64 across all shader stages, instead of emitting OpGroupNonUniformShuffle.

Previously only wave64 VS/PS/GS parked pure scalar spills (halves_analysis), leaving wave32 fragment shaders shuffling spilled V# descriptors from lanes that can be inactive or unlaunched on small triangles or after discards (Vulkan SPIR-V UB returning stale physical VGPR bits, causing GPUVM read faults on RX 7900 XTX / RADV 26.3.1).

Tested:
- python3 -m unittest discover -s tests/semantic (6,393/6,393 pass) + new absent-lane wave32 PS regression test (195/195 targeted pass)
- Retranslated all 1,173 v_writelane_b32 shaders (1,173/1,173 pass spirv-val)
- Verified on RX 7900 XTX (RADV Mesa 26.3.1): two consecutive 240 s fast-load runs at 0.0 s warm graphics PSO compile time with zero GPUVM faults.

AI-assisted: Antigravity (Gemini 4 Neon).
AI-assisted: Antigravity (Gemini 4 Neon).
AI-assisted: Antigravity (Gemini 4 Neon).
AI-assisted: Antigravity (Gemini 4 Neon).
AI-assisted: Antigravity (Gemini 4 Neon).
Preserves all Round 1/2/2.1 CPU/GPU runtime optimizations alongside upstream
mandy/main changes, resolves all 10 conflicted files, and fixes arena_window
accounting on retired/dropped title windows.

AI-assisted: Antigravity (Gemini 4 Neon).
Splits QueueHolds barrier marking into Holder::note_barrier(seq) called only by
after_held(), preventing run_barriers() polls from stamping spurious barrier_after
flags on queued batches. Also adds name_texture() in check_mapped_plane_byte so
TitleTextureWatch tracks the mapped plane like check_mapped_plane.

AI-assisted: Antigravity (Gemini 4 Neon).
Guard all cross-lane subgroup shuffles and broadcasts against unlaunched
lanes, eliminate %uint_0 fallbacks in favor of SubgroupLocalInvocationId,
and add static SPIR-V verifier (check_absent_lane_ub.py), wave-interpreter
unit tests, and a Vulkan GPU validation test.

AI-assisted: Antigravity (Gemini 4 Neon).
Enable Vulkan 1.2 vulkanMemoryModel/vulkanMemoryModelDeviceScope and emit
pre-dispatch/pre-rendering barriers for reads_glc_buffer shaders, wire
literal_sampler_spec_base VkSpecializationInfo specialization constants,
and gate passive title buffer write-back on shader writes_buffer metadata
with non-blocking async readback polling.

AI-assisted: Antigravity (Gemini 4 Neon).
Emit VulkanMemoryModel NonPrivatePointer/MakePointerVisible/Available for
glc/dlc buffer ops and reads_glc_buffer metadata, specialize literal S#
samplers via OpSpecConstant, elide dead uint/sint image_read_typed paths
when float-only, replace the 77-way buffer_store_format switch with a
compact lookup table, and emit writes_buffer + buffer_write_slots metadata.

AI-assisted: Antigravity (Gemini 4 Neon).
Guard GeometryViews retirement with command_list_epochs, defer TitleMirror
freed-home ticket stamping until flush + note_mirror_bind under submit_mutex_
(including TitleImageUpload submits), fix queue lock ordering and lock-free
wait_submitted, remove dead helpers and process labels, and scrub game shader
identifiers from docs/design.md.

AI-assisted: Antigravity (Gemini 4 Neon).
Enable DenormFlushToZero 32 alongside DenormPreserve 16 (with --no-ftz32
override and fmulz fusion), add sound per-load NonWritable scalar memory
analysis for descriptor/read-only SMEM loads, and outline wide s_buffer_load
partial-OOB slow paths into shared helper functions.

AI-assisted: Antigravity (Gemini 4 Neon).
# Conflicts:
#	runtime/src/vulkan_backend.h
# Conflicts:
#	docs/design.md
#	tests/semantic/spirv_mini_interp.py
#	tools/rdna2spirv.py
Avoid SSA dominance violation when wide coherent s_buffer_load_dwordxN
falls into its inline partial-OOB slow path after calling get_ptr() in
the fast branch.

AI-assisted: Antigravity (Gemini 4 Neon).
Check exact HW_REG_MODE bit-range overlap with FP_DENORM.fp32 [5:4]
(including numeric/simm16 forms) so FP_ROUND-only writes keep FTZ32
enabled, and rewrite sbuf_slow_{ro,rw}_xN as compact DontUnroll loops
with NonWritable %sl_blk1 loads on read-only wide scalar loads.

AI-assisted: Antigravity (Gemini 4 Neon).
Cache bound pipelines, descriptor sets, dynamic graphics state, and dirty
push-constant sub-ranges across command lists in emit_commands() (with
invalidation across internal compute helpers and rendering boundaries),
and restore the two-tier submission-hot + presented-frame-hot policy in
TitleWritePolicy/HotColdTracking wired to present_serial.

AI-assisted: Antigravity (Gemini 4 Neon).
Add CFG store-reachability with WAR safety, 64-bit/multi-level/spill-safe
descriptor-only SMEM analysis, pointer-offset aliasing wrappers, complete
f32/f16 consumer coverage with transitive copy/select/pack propagation,
and per-path EXEC-superset kill tracking in float_only_image_ops.

AI-assisted: Antigravity (Gemini 4 Neon).
Promoting 1x/frame pages to unguarded hot caused HotColdTracking to copy
~5,000+ pages on every submission (~50 GiB/10 s) and dirtied all textures
sharing those tiles (~119 ms/sub). Restore the submission-hot (6/8)
policy where unguarded copies beat fault+copy cost, and accumulate actual
CPU+wait time in AsyncReadback::cpu_ms instead of async wall-clock span.

AI-assisted: Antigravity (Gemini 4 Neon).
Speeds up shadow page hashing, TitleMirror upload/write-back, and guard re-arming:
- shadow_keep::sum_of: 4x256-bit AVX2 (#if defined(__AVX2__)) and 4x128-bit SSE2 fast paths with portable scalar fallback (2.52x single-core AVX2 speedup).
- TitleMirror: lazy 6-worker thread pool with exception-safe teardown and RAII join guard parallelizing upload() and write_back_batch() for >=16 homes/jobs (4.76x upload, 6.08x write-back) while preserving exact serial aliasing semantics.
- CellGuard::arm_batch(): 1024-page contiguous runs, pin-batching outside mutex, and generation-guarded VirtualQuery cache.

AI-assisted: Antigravity (Gemini 4 Neon).
Cuts per-submission texture refresh overhead and prevents passive write-back accumulation across overlapping queues:
- title_texture_refresh.h: adds shadow_keep::sum_of-backed mirror_range_sum helpers and PassiveWriteBackTracker with retire_id watermarking so overlapping direct/compute queues promote each passive V# range without re-promoting stale ranges indefinitely.
- title_texture_watch.h: skips hot_tiles() rescans when hot_generation() is unchanged and tracks non_hot_arms to reuse synced shared hot tiles per pass.
- d3d12_title_image_upload.h: reuses detile scratch buffers across sub-batches and skips detile setup when unused.
- d3d12_vulkan_device.cpp: extends TitleMirror range_sum() skip to all 256B-aligned and partially mirrored textures, filters dirty chunk syncs by title_written_ (guarded by !t.stale), caches can_gpu_upload(), pools TitleJob buffers, runs inline single-item reads/hashes, and defers t.pieces commits until upload success.

AI-assisted: Antigravity (Gemini 4 Neon).
Cuts queue submit overhead, descriptor-heap filtering cost, and synchronous cold pipeline compile latency:
- VulkanQueue: adds pending-wait tracking (has_unsatisfied_waiter), deduplicated submit_multi(), execute+signal coalescing with cross-queue/CPU waiter splits, and coalescing-group-aware async room gating.
- d3d12_com.cpp: caches descriptor heap VAs/counts on SetDescriptorHeaps, pre-tracks command-list barrier/query/indirect/draw flags, single-alloc PinnedObjects, and linear table dedup.
- d3d12_vulkan_device.cpp: AVX2 32-byte slot equality, 8 KiB L1d seen_keys, stack-local FilterPageCache, 64 KiB page-pointer caching, and T# dedup in finish_in_place.
- vulkan_replay.h / d3d12_vulkan_device.cpp: lightweight collect_unbuilt_pipelines() pre-pass and cancel-safe batch-parallel sync compile runner backed by PipelineCompiler.

AI-assisted: Antigravity (Gemini 4 Neon).
Enables /arch:AVX2 on x64 MSVC/clang-cl and -march=x86-64-v3 on x86-64 GCC/Clang for C/C++ targets (activating AVX2 shadow_keep::sum_of, descriptor-slot scans, and auto-vectorization while keeping non-x86-64 portable builds untouched), and removes an unused local clock typedef in page_mirror_write_back_ranges.

AI-assisted: Antigravity (Gemini 4 Neon).
Removes UnalignedWord64, mix_words, hash_bytes, hash_guarded, and hashed_bytes from d3d12_vulkan_device.cpp after CPU texture hashing moved to copy_guarded + mirror_range_sum_bytes().

AI-assisted: Antigravity (Gemini 4 Neon).
Eliminates the async readback page_mirror.mutex convoy and serial fallback, and reduces page-mirror refresh cost:
- title_mirror.h / d3d12_vulkan_device.cpp: lifts WorkerPool for lock-free Phase 1 prehash_readback_slice() outside page_mirror.mutex and single-call Phase 2 write_back_prehashed() under lock (256-page slice: 0.11 ms unlocked, 0.03 ms locked), eliminating the 256x serial single-page fallback and merge_ranges() storm.
- Scopes readback invalidation to readback_slice_frames with per-frame 256-bit readback_slice_skip_masks populated from TitleMirror::upload(on_changed), preventing hot-page retry loops while preserving CPU-wins conflict semantics.
- Coalesces contiguous GPU write-back runs, batches deferred map() initial fills in parallel upload(), and replaces fed_now unordered_set with a flat sorted vector.
- title_mirror_hot_cold.h: consolidates CellGuard maps into a single TrackedCell map and adds a changes_since()-invalidated known_protect cache to halve cold re-arm VirtualQuery syscalls.

AI-assisted: Antigravity (Gemini 4 Neon).
Eliminates multi-worker global lock convoys, Wait-split async room stalls, and instrumentation blind spots:
- vulkan_backend.h / d3d12_vulkan_device.cpp / d3d12_com.cpp: adds visibility_seq_ & signaled_visibility_seq_ tracking and BeforeExecuteCoalescer so concurrent/back-to-back cross-queue submissions serialize global refresh passes to one leader and skip redundant refreshes when pass_seq >= req_seq (opt-out LEONIDA_BEFORE_EXECUTE_COALESCE=0).
- vulkan_backend.h: replaces Wait-broken pending_submit_groups_locked() with pending_frame_groups_locked() and max_batches = max(16 * depth, 64) for depth >= 2, eliminating mid-frame room_cv_ stalls on Wait-heavy frames.
- vulkan_backend.h / submit_phases.h: includes release_held() and pump_ready() in async_worker() busy time and adds worker_lock_wait_ns reporting.
- d3d12_vulkan_device.cpp / d3d12_com.cpp: lock-free ConsoleHeap::in_place_work_pending fast-skip, FilterPageCache in finish_in_place(), identical-base dedup of mirror_ranges, and cached console-heap fast-path in GraphicsCommandList::address().

AI-assisted: Antigravity (Gemini 4 Neon).
Eliminates false CPU-staged re-uploads, per-texture page_mirror.mutex churn, and unbatched tile re-arming:
- d3d12_vulkan_device.cpp: replaces per-texture page_mirror_texture_chunk/page_mirror_tiles_unchanged with a single-lock page_mirror_check_batch() snapshotting pending xmem remaps under shared feed_lock (rejecting only overlapping textures) and running one batched parallel TitleMirror::upload(); adds TitleJob::previous_mirror_hash check in hash_title_job() so GPU-uploaded textures falling back to CPU skip unchanged re-uploads; separates lock_wait_ns from collect_ns.
- title_texture_watch.h / title_texture_refresh.h: adds examine_batch() + TitleTextureCells::arm_batch() coalescing pins and contiguous VirtualProtect runs, uses direct Tile*/Texture* pointers in watch indices, and merges write/map ranges before iteration.

AI-assisted: Antigravity (Gemini 4 Neon).
Routes page_mirror_check_batch() uploads through note_readback_pieces_uploaded_locked() and console-heap page invalidations through note_readback_frame_invalidated_locked() so unrelated pages never poison readback_invalidated; renames a shadowed parameter in title_texture_watch_test.

AI-assisted: Antigravity (Gemini 4 Neon).
Renames PageMirror's Phase-1 WorkerPool to readback_hash_pool (avoiding collision with VkCommandPool readback_pool) and replaces invalid (std::max)<std::uint64_t>(...) with (std::max)(std::uint64_t(1), ...) for clang-cl/MSVC.

AI-assisted: Antigravity (Gemini 4 Neon).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 06:26:41 +00:00
Author
Owner

@⁠zmasi on GitHub · 2026-11-28 10:00 UTC · original

@⁠aslan2142 — VERIFY-2566-VEGA20-RADV: not validation-clean on fixed-wave64 gfx906, RADV Mesa 26.0.8. Tested cd8b5632 plus 3ca0707dd (local tree bf6c9ea2). The only merge conflict was in runtime/CMakeLists.txt; I kept both new CTest registrations and main’s independent skip-code property.

Synthetic CTests Result
Native Linux 19/19 CPU passed. On GPU, 8/9 passed CTest, but only 7/9 were validation-clean. GPU detile matched 182/182 cases.
Wine/PE 52 passed, 2 write-watch capability skips. Of 32 non-skipped GPU runs, 31 were host-validation clean. Two additional existing-heap aliases were withheld after the teardown error below.

Actionable diagnostics (Khronos + sync validation active):

  • vk_title_mirror returns success despite VUID-VkShaderModuleCreateInfo-pCode-08737. CMake builds its shader for Vulkan 1.3 (SPIR-V 1.6); the test requests Vulkan 1.2. Recompiling only that fixture for 1.2 gave the same 64-page readback with zero diagnostics.
  • vk_device_markers fails with repeated SYNC-HAZARD-WRITE-AFTER-WRITE on its shared start/finish marker words (10 reports, the duplicate cap). The compute-marker loop is also present on main; I did not attribute its origin to this PR.
  • Wine d3d12_existing_heap passes its readback but reports VUID-vkDestroyDevice-device-05137: 4 buffers, 3 images and 3 command buffers still live at teardown. Baseline attribution unverified. Page-mirror, in-place heap and T# refill tests passed.

Translator: 407/407 methods passed across the 25 touched semantic files. The six ordinary translator test files gave 839 passed, 5 failed, 11 excluded from the reserved PC-tail lane. The five failures also fail on the unmerged PR and pass on main: one bpermute text-pattern assertion, two WQM instruction-shape checks, and both D16 gather type-name assertions. All five modules pass spirv-val; these failures are not evidence of incorrect pixels. Both absent-lane fragment readbacks passed on physical subgroup64; the wave32-only compute case skipped before dispatch. Four signed/unsigned dot and scalar-fallback graphics pipelines created successfully; the updated table-fetch and texture fixtures also passed.

Synthetic correctness results only, not a world-frame or performance claim.

AI-assisted.

**@⁠zmasi** on GitHub · 2026-11-28 10:00 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7237612777) @⁠aslan2142 — `VERIFY-2566-VEGA20-RADV`: **not validation-clean** on fixed-wave64 gfx906, RADV Mesa 26.0.8. Tested `cd8b5632` plus `3ca0707dd` (local tree `bf6c9ea2`). The only merge conflict was in `runtime/CMakeLists.txt`; I kept both new CTest registrations and main’s independent skip-code property. | Synthetic CTests | Result | |---|---| | Native Linux | 19/19 CPU passed. On GPU, 8/9 passed CTest, but only 7/9 were validation-clean. GPU detile matched 182/182 cases. | | Wine/PE | 52 passed, 2 write-watch capability skips. Of 32 non-skipped GPU runs, 31 were host-validation clean. Two additional existing-heap aliases were withheld after the teardown error below. | **Actionable diagnostics** (Khronos + sync validation active): - `vk_title_mirror` returns success despite `VUID-VkShaderModuleCreateInfo-pCode-08737`. CMake builds its shader for Vulkan 1.3 (SPIR-V 1.6); the test requests Vulkan 1.2. Recompiling only that fixture for 1.2 gave the same 64-page readback with **zero** diagnostics. - `vk_device_markers` fails with repeated `SYNC-HAZARD-WRITE-AFTER-WRITE` on its shared start/finish marker words (10 reports, the duplicate cap). The compute-marker loop is also present on main; I did not attribute its origin to this PR. - Wine `d3d12_existing_heap` passes its readback but reports `VUID-vkDestroyDevice-device-05137`: 4 buffers, 3 images and 3 command buffers still live at teardown. Baseline attribution unverified. Page-mirror, in-place heap and T# refill tests passed. **Translator:** 407/407 methods passed across the 25 touched semantic files. The six ordinary translator test files gave **839 passed, 5 failed, 11 excluded** from the reserved PC-tail lane. The five failures also fail on the unmerged PR and pass on main: one bpermute text-pattern assertion, two WQM instruction-shape checks, and both D16 gather type-name assertions. All five modules pass `spirv-val`; these failures are not evidence of incorrect pixels. Both absent-lane fragment readbacks passed on physical subgroup64; the wave32-only compute case skipped before dispatch. Four signed/unsigned dot and scalar-fallback graphics pipelines created successfully; the updated table-fetch and texture fixtures also passed. Synthetic correctness results only, not a world-frame or performance claim. AI-assisted.
Author
Owner

@⁠zmasi on GitHub · 2026-11-28 10:11 UTC · original

On pristine 33db04a70, vk_device_markers reproduced the same 10 write-after-write reports (the duplicate-report cap) on the same gfx906 / RADV Mesa 26.0.8 device with Khronos synchronization validation enabled. The started/finished marker words still read back 5/5 and 8/8, but CTest failed on validation, confirming that the hazard also exists on main without #2566.

AI-assisted.

**@⁠zmasi** on GitHub · 2026-11-28 10:11 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7237736765) On pristine `33db04a70`, `vk_device_markers` reproduced the same 10 write-after-write reports (the duplicate-report cap) on the same gfx906 / RADV Mesa 26.0.8 device with Khronos synchronization validation enabled. The started/finished marker words still read back 5/5 and 8/8, but CTest failed on validation, confirming that the hazard also exists on main without #2566. AI-assisted.
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-28 11:36 UTC · original · edited 2026-11-28 14:00 UTC

Resolved on the integration branch. The test change in this PR fixes both D16 gather assertions. On its parent 232b4a1eed, the fixed level-zero (lz) case passed and both explicit-LOD cases failed. On PR head a8b1abe4c2, all three passed. The separate test patch linked below is no longer needed for these failures.

I also regenerated the 12 synthetic fragment modules on a8b1abe4c2. All passed Vulkan 1.2 SPIR-V validation and were byte-identical to the modules from the earlier RTX 4090 run. The hardware results below are from that earlier run.

The two D16 gather failures in the Vega verification come from the test matching a SPIR-V type name. At cd8b5632b8, explicit-LOD gather still emits four float, four signed integer and four unsigned integer fetches. The unsigned vector is named %v4uint_sl; the assertion expects %v4uint_st.

One-file test fix · apply-ready patch. It resolves each fetch result through its four-component vector declaration before counting element types. The test still requires zero fetches for lz and exactly four of each type for l and l_o.

  • CPU: At the PR head, the parametrized test went from one pass and two failures to three passes. All three passed on main 4a54aedcb6 before and after the test edit. The related texture selection passed 95/95 on the PR. Including the separately reported WQM test adds one failure outside this patch.
  • GPU: Windows, RTX 4090, driver 616.64. I translated the same synthetic gathers on both revisions and ran them through the same PR-head vk_texture_test. I checked lz, explicit LOD 0, and explicit LOD 0 with a signed X offset of −1, with all four channel masks on UNORM, UINT and SINT textures. The fragment output exposed all four raw 16-bit tap values independently. All 36 main/PR pairs matched the expected texture values and tap order across 72 draws and 294,912 RGBA pixels. All 24 fragment modules passed spirv-val for Vulkan 1.2.
  • The first unscored run with hardware DenormFlushToZero 32 requested produced a validation diagnostic on this device. The scored comparison used the translator's --no-ftz32 setting on both sides and had zero Vulkan validation diagnostics. All inputs were synthetic.

AI-assisted with OpenAI Codex (GPT-6).

**@⁠ecox982745** on GitHub · 2026-11-28 11:36 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7238658542) · edited 2026-11-28 14:00 UTC **Resolved on the integration branch.** The [test change in this PR](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566/commits/d1f53516d327d7df118d7399ab04d40746145092) fixes both D16 gather assertions. On its parent `232b4a1eed`, the fixed level-zero (`lz`) case passed and both explicit-LOD cases failed. On PR head `a8b1abe4c2`, all three passed. The separate test patch linked below is no longer needed for these failures. I also regenerated the 12 synthetic fragment modules on `a8b1abe4c2`. All passed Vulkan 1.2 SPIR-V validation and were byte-identical to the modules from the earlier RTX 4090 run. The hardware results below are from that earlier run. The two D16 gather failures in the [Vega verification](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566) come from the test matching a SPIR-V type name. At `cd8b5632b8`, explicit-LOD gather still emits four float, four signed integer and four unsigned integer fetches. The unsigned vector is named `%v4uint_sl`; the assertion expects `%v4uint_st`. [One-file test fix](https://github.com/ProjectLeonida/mandy/commit/c9883b37805f1f3db6937f76b23be121e5a05ca0) · [apply-ready patch](https://github.com/ProjectLeonida/mandy/commit/c9883b37805f1f3db6937f76b23be121e5a05ca0.patch). It resolves each fetch result through its four-component vector declaration before counting element types. The test still requires zero fetches for `lz` and exactly four of each type for `l` and `l_o`. - **CPU:** At the PR head, the parametrized test went from one pass and two failures to three passes. All three passed on main `4a54aedcb6` before and after the test edit. The related texture selection passed 95/95 on the PR. Including the separately reported WQM test adds one failure outside this patch. - **GPU:** Windows, RTX 4090, driver 616.64. I translated the same synthetic gathers on both revisions and ran them through the same PR-head `vk_texture_test`. I checked `lz`, explicit LOD 0, and explicit LOD 0 with a signed X offset of −1, with all four channel masks on UNORM, UINT and SINT textures. The fragment output exposed all four raw 16-bit tap values independently. All 36 main/PR pairs matched the expected texture values and tap order across **72 draws and 294,912 RGBA pixels**. All 24 fragment modules passed `spirv-val` for Vulkan 1.2. - The first unscored run with hardware `DenormFlushToZero 32` requested produced a validation diagnostic on this device. The scored comparison used the translator's `--no-ftz32` setting on both sides and had zero Vulkan validation diagnostics. All inputs were synthetic. AI-assisted with OpenAI Codex (GPT-6).
Cuts replay CPU and Direct GPU render-pass overhead:
- vulkan_replay.h: merges consecutive draws with matching (colors, depth + depth_aspects, area, layers) into one vkCmdBeginRendering..vkCmdEndRendering scope with coalesced same-layout attachment barriers, closing cleanly on non-draw/glc/indirect_clamp/quad/query/stats/gpu_profile/marker boundaries; elides no-op LayoutTracker::set() journaling; adds per-pass 32-entry PrepareViewCache and lightweight Prepared::reset().
- console_heap_gpu.h: caches all 20 PFN_vk* device proc pointers once in VkFns.
- replay_state_cache_test.cpp: adds scope batching, boundary split, LayoutTracker no-op, PrepareViewCache, and live VVL GPU tests.

AI-assisted: Antigravity (Gemini 4 Neon).
Cuts PageMirror refresh, write-fault, unwatch, and GPU write-back overhead:
- d3d12_vulkan_device.cpp / title_mirror.h / console_heap_slot_records.h: hoists 1024-entry FilterPageCache across upload(), buffers filtered slots in 64 KiB host scratch with coalesced WC BAR flushes, parallelizes pure read-only Phase A heap filtering across WorkerPool with sequential Phase B under page_mirror.mutex, and adds none->none / idempotent place() fast paths.
- title_mirror_hot_cold.h / title_geometry_watch.h / xmem.cpp: fixes HotColdTracking::unwatch() triple-lock/bogus-WriteQueue bug with single-lock geometry_writes::release(addr, was_hot), skips redundant 2nd VirtualQuery in notify(Event::fault), and passes ranged changed(start, end) from xmem.cpp.
- d3d12_vulkan_device.cpp / title_mirror.h: raises kReadbackPages to 1024 (64 MiB), routes readback copies onto info.copy_queues, bypasses kernel_writes::write() on xmem scratch frames (frame != page_va), batches begin_write/end_write per ordinary page, and lowers whole_title_ok threshold to 2.

AI-assisted: Antigravity (Gemini 4 Neon).
Eliminates single-texture slot-70 storms, multi-queue TitleImageUpload lock/submit stalls, gratuitous coalescer invalidations, and Present pump_mutex_ blocks:
- d3d12_vulkan_device.cpp: defers slot-70 make_title_texture()/refresh_title_texture() to batched refresh_title_textures() (with texture_watch.touch); skips re-dirtying hot pages when mirror_just_synced; ports changes_since()-tracked known_protect cache into TitleTextureCells::arm_batch().
- d3d12_title_image_upload.h / vulkan_title_detile.h / vulkan_backend.h / vulkan_indirect_clamp.h: caches PFN_vk* procs, raises kMaxBatchCmds=64 / kMaxScratchSlots=32, waits on oldest_in_flight_scratch_value(), batches vkUpdateDescriptorSets, replaces empty consumer submits with lazy note_title_upload_locked waits in submit_multi(), unlocks submit_mutex_ during upload recording, decouples prepare_indirect_clamp from tracker_mutex_, caches ReplayFunctions, and times tracker_lock waits.
- queue_holds.h / vulkan_backend.h / vulkan_present.h / d3d12_com.cpp: tracks per-(fence,value) vis_seq in QueueHolds (stopping GPU-signal & list-values false invalidations), fixes BeforeExecuteCoalescer cv.wait loop + adds 5-step leader timing, decouples QueueHolds::run_barriers() from pump_mutex_ via barrier_mutex_, and expands VulkanPresenter::frames_ to 4.

AI-assisted: Antigravity (Gemini 4 Neon).
Fixes two clang-cl compile errors in d3d12_vulkan_device.cpp after hoisting FilterPageCache into FilterCacheScope.

AI-assisted: Antigravity (Gemini 4 Neon).
Preserves immediate bindless descriptor indexing for pending_stream slot-70 textures once their pages become readable (fixing d3d12_existing_heap slot-70 view map changes test) while still deferring texel uploads to batched refresh_title_textures().

AI-assisted: Antigravity (Gemini 4 Neon).
Calls publish_streamed_texture(from) after back_title_texture() in refresh_title_texture() so deferred pending_stream slot-70 descriptors immediately bind their views when pages arrive while texel upload remains deferred to batched refresh_title_textures().

AI-assisted: Antigravity (Gemini 4 Neon).
- CellGuard::arm_batch(): per-batch sync_known_protect, range-scoped changes_since(), gap-bridging (<=8 cold tiles, pin-guarded), reopen() fast-path via Cell::armed_map_gen
- shadow_keep::sum_of_batch_256() hoisted AVX2/SSE2/scalar batch hash + 4 KiB L1-hot strips in TitleMirror::upload() & prehash_readback_slice()
- TitleWritePolicy PageRef active lists (no frame_hot) + TitleMirror 2-level per-chunk direct page table + has_pending() fast-path + refs>1 alias handoff
- Feed coalescing + watch_batch/unwatch_batch in refresh_page_mirror()
- Sub-page 256B-aligned vkCmdCopyBuffer readback, page_mirror_buffer resolve_cache, OutScratchGuard WC buffering in apply_in_place_changes/finish_in_place, lock-free reclaim_arena/update_address_guard

AI-assisted: Antigravity (Gemini 4 Neon).
- Zero ResourceDesc padding words [1,2,3,13], compare non-format words + compatible formats in title_texture_matches(), preserve layout-equal slot-133 textures & mirror_hash_valid on unmap
- Guard refresh_title_texture() touch() against unreadable pending_stream textures while preserving deferred backing & publish_streamed_texture
- Zero-syscall already-armed Cell::restore[] check + table-page backed skip + PAGE_READONLY region cache in TitleTextureCells::arm_batch(); sync_tile_peers() skip in examine_batch()
- Snapshot geometry_writes serial before refresh_page_mirror() to skip redundant page_mirror_check_batch() dirtying on both CPU and GPU views; parallelize Pass 3 range_sum() >= 8 MiB
- Decouple GPU-mirror batching (512 jobs / 128 MiB) from CPU 64-slot limit, single-call vkAllocateDescriptorSets per sub-batch, kMaxScratchSlots=64, 4-part examine_ns telemetry

AI-assisted: Antigravity (Gemini 4 Neon).
- Fix Pump::choose_release() TOCTOU on already-completed unlanded write groups/action gates + 10 ms quiet window on Reason::present
- Skip before_execute/visibility_seq on empty batches (preserving pending_wait_vis_seq_), coalesce past GPU-completed Waits (merging CPU vis_seq), cache CommandList summary, atomic unbuilt_sync_pipelines_ & BindlessSet clean fast-paths, hoist EmitScratch
- Dedicated QueueHolds barrier-drain thread with active_work_ tracking, wait_barriers_drained() ordering, cancel_after() wait, and non-blocking VulkanQueue::release_ready()
- Batch copy_page_mappings() per contiguous range & notify Event::replaced on mirror_heap decommit in xmem.cpp
- SEH-guarded aligned volatile read_value() (no noexcept under /EHsc) + 1000 ms slot-12 Vulkan fence mirror timeout

AI-assisted: Antigravity (Gemini 4 Neon).
Titles and d3d12_existing_heap rely on ExecuteCommandLists(empty) + Signal() as
a synchronization point that flushes pending streamed views and title textures.

AI-assisted: Antigravity (Gemini 4 Neon).
- CellGuard::arm_batch(): zero-syscall all_armed + outside-s.mutex title_frames table-backed skip, MEM_RESERVE/PAGE_READONLY VQ cache with explicit cached_state, kMaxBridgeGap=32 (pin-guarded), disarm_batch/set_hot_batch for policy_.frame()
- geometry_writes::reopen(): range-scoped title_memory_map::changes_since() fast path with VirtualProtect(old) rollback
- TitleMirror::upload(): WC-aware copy_guarded_host(..., true) (MOVNTDQA), kStripBytes=16 KiB (64-piece strip mask), ~50 us WorkerPool spin, per-Unit sums slab
- 7-part refresh_page_mirror() sub-split telemetry (lock/feed/collect/arm/upload/filter/other + arm/upload breakdowns)
- watch_batch() in page_mirror_resolve_locked(), defer_fill=true only in page_mirror_chunk(), VulkanContext::cached_completed_retire_ticket(), pass_seq after write_back_titles()

AI-assisted: Antigravity (Gemini 4 Neon).
- Separate title_texel_writes from title_map_changes_ (retry t.memory only when pending/filled_from/!fills) and coalesce title_texel_writes::note() up to 16,384 spans before overflow
- Enable cache_success=guard + sync_map() for t.mapped while keeping cache_failure=guard&&!mapped
- Single-lock zero-shared_ptr title_frames::run_end & backed_batch hooks + Stage-2 TextureVqCache
- TitleTextureCells::arm_batch(): range_clean_since() at all 3 sites, kMaxBridgeGap=8 pin-guarded bridging, c->armed_map_gen, batched sync_tile_peers()
- Raise TitleImagePool::largest_slot to 8 MiB (16 MiB page cap), pool non-RT/non-DS deferred textures, best-fit TitleImageUpload::take_slot(), 16 MiB job.tiled retention, linear 3D mips>1, readable/back/arm/cpu_fallback_by[6] telemetry

AI-assisted: Antigravity (Gemini 4 Neon).
- Refcounted ViewKey sharing across distinct T# keys with identical Vulkan view state + safe pressure-triggered GC of stale from_title_heap entries (preserving 16-bit ABI, API views, and live TitleTextures)
- O(1) low/high free-lists & counts in BindlessSet + sync_fast_state() held_images_/held_samplers_ hardening
- Pre-check bindless->has_free_image() before vkCreateImageView(), emit SlotChange::texture_room only when slots actually return to free, skip room_[1] wake when total_free_images()==0
- Zero-alloc const char* UnboundTsharpTracker & heap.refused_reasons, skip unchanged zero-index WC BAR writes
- Single-lock bind_title_image() out_index_word, unordered_map image_entries, GeometryViews dedicated WriteQueue + hot_overlap_tiles_, atomic console_heap_signature for update_address_guard()

AI-assisted: Antigravity (Gemini 4 Neon).
Two distinct deferred shared-BC slot-133 placements share a placeholder VkImage
until promoted; keying non-title-heap ViewKeys by image.address gives each
resource its own bindless slot while preserving full title-heap ViewKey dedup.

AI-assisted: Antigravity (Gemini 4 Neon).
- Track exact live console-heap textures via ConsoleHeapSlotRecords 0<->1 callback under pure leaf live_console_textures_mutex
- Classify non-UAV non-MS !known_heap placed-texture views as evictable when console_heap_count > 0; preserve evictable across PendingImage::keys & publish_streamed_texture()
- Propagate is_zero_view in bind_image_locked() and gate api_owner_address on is_zero_view && console_heap_count==0
- Two-phase GC (Phase 1 dead-key sweep emitting 0 texture_gone, Phase 2 emergency live-LRU only on hard_full) with evictable_views_in_dim O(1) exit, 8192-slot hysteresis, strict retire-ticket & wall-clock cooldown (always stamped on empty candidates)
- Emit SlotChange::texture_room in set_bindless_release() only on 0 -> >0 free-slot transitions

AI-assisted: Antigravity (Gemini 4 Neon).
- Move title_memory_map::changed() into TitleHeap::hooks.commit/decommit and !from_mirror_heap in free_title_block()
- Share Cell::known_* across CellGuard & TitleTextureCells (no PAGE_READONLY no-guard cache; MEM_RESERVE intra-pass in TitleTextureCells, cross-pass in CellGuard; seed on xmem::map_view)
- Persist TitleTextureCells VQ cache across outer batches; bridge across run_already_armed_ tiles with uniform restore[0..15] up to kMaxBridgeGap=64
- Persist 1024-entry local_mirror per ConsoleHeap*, flush Phase A/B disjointly, handle !base V#s in Phase A, skip redundant WC BAR writes for waiting T#s
- Fused SEH-safe AVX2/SSE2 guarded::copy_and_sum_256(), kMaxWorkers=8, single-reader title_write_watch::ask() fast path preserving mark() entries

AI-assisted: Antigravity (Gemini 4 Neon).
- Add VulkanFence::signal_gpu_relay() (vis_seq=0) strictly for GPU-landed list-value gates (!force && !lost && !action && !cpu_met)
- Retroactive GPU-to-GPU relay via QueueHolds::relay_wait() + VulkanQueue wait substitution (never GPU-signaling values->gate, reversing wait() before add_gate(), requiring after_gate==0 && different queue)
- Decouple gpu_profile_.resolve() onto lazy resolver thread off FenceWaitDispatcher & throttle take_open() device-loss checks
- Reorder BeforeExecuteCoalescer to wb -> mirror -> flush -> tex -> shadows -> 2nd flush -> conditional 2nd tex (killing in_feed CPU fallbacks)
- Hoist host_stop & add negative caching in TextureVqCache + Stage 2b all-16 Cell::restore[] readability bypass

AI-assisted: Antigravity (Gemini 4 Neon).
AI-assisted: Antigravity (Gemini 4 Neon).
AI-assisted: Antigravity (Gemini 4 Neon).
AI-assisted: Antigravity (Gemini 4 Neon).
AI-assisted: Antigravity (Gemini 4 Neon).
Resolved conflicts in docs/design.md, runtime/CMakeLists.txt, and tests/semantic/spirv_wave_interp.py.
AI-assisted: Antigravity (Gemini 4 Neon).
Fixes the post-merge interaction between upstream's v_exp_f32 denormal flush
(eb39d2765) and our FTZ32 fast path in Gen.flush_f32(), and keeps _vgpr_reads_of
aligned with read_before_write_vgprs (3ad34dddc).

AI-assisted: Antigravity (Gemini 4 Neon).
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-28 12:19 UTC · original

Pushed Rounds 7–10c (232b4a1ee) and merged up-to-date main (d48a957bb, 508 commits) cleanly into integration/perf-cpu-gpu-r6.

Summary of Changes Since Round 6 (cd8b5632b → 232b4a1ee)

  • Round 7 — Rendering batching, parallel console heap filter & 64 MiB readback:
    • Dynamic rendering scope batching (replay ~2× faster), hoisted FilterCacheScope + parallel Phase-A filter, 64 MiB copy-queue readback, deferred slot-70 uploads to GPU detile + publish_streamed_texture() fix, per-fence vis_seq, unlocked QueueHolds::run_barriers(), 4-deep VulkanPresenter::frames_.
  • Round 8 — Zero unmet gates, 2-level mirror table & GPU texture batching:
    • Fixed Pump::choose_release() TOCTOU + present quiet window (0 released unmet), dedicated QueueHolds barrier-drain thread, batched copy_page_mappings(), SEH aligned volatile read_value(), 1000 ms slot-12 timeout (0 timeouts).
    • Chunk::pages[32768] direct table, sum_of_batch_256(), sub-page 256 B readback copies, page_mirror_buffer resolve_cache, OutScratchGuard, 512-job / 128 MiB GPU-mirror texture upload batching.
  • Round 9 — Low-syscall VM guards, WC streaming & bindless ViewKey sharing:
    • CellGuard zero-syscall all_armed, VQ cache, disarm_batch/set_hot_batch, range-scoped reopen(), WC streaming copy (kStripBytes=16 KiB), WorkerPool 50 µs spin.
    • Separated title_texel_writes, Stage-2 TextureVqCache, TitleImagePool 8 MiB/16 MiB cap, refcounted ViewKey sharing, O(1) BindlessSet free-lists, single-lock bind_title_image(), GeometryViews dedicated WriteQueue.
  • Round 10 / 10b / 10c — Two-phase bindless GC, GPU-to-GPU relays, fused AVX2 copy+sum & feed-only mirror drain:
    • Two-phase dead-sweep bindless GC (ConsoleHeapSlotRecords kTexture/kSettled live tracking, explicit evictable classification, Phase 1 dead-key sweep with 0 texture notifications + 8,192-slot hysteresis, dim_2d mirror-slot room notifications, multi-key sv.keys liveness) — eliminated 65,536-slot saturation and GC thrash.
    • Shared Cell::known_* cache across CellGuard & TitleTextureCells (with PAGE_READONLY excluded from VQ caches and safe per-tile bridged VirtualProtect rollback), TitleHeap::hooks.commit/decommit map-change scoping, fused SEH-safe AVX2/SSE2 guarded::copy_and_sum_256(), 8-worker pool, disjoint Phase A/B WC flushes & chunk-local local_mirror cache.
    • VulkanFence::signal_gpu_relay() (vis_seq=0) + retroactive QueueHolds::relay_wait() / VulkanQueue::apply_wait_relay() with WriteGroup::bare visibility safety, exact landed-value console_value_met() check, wait_met re-check, relay_wait() gate preservation, and signal-only consumed_wait_vis transitivity.
    • Lightweight drain_page_mirror_feed_only() on coalesced before-execute submissions (0.11–0.29 ms when CopyPageMappingsBatchX remaps are queued, 0 single-flight waits, 96–97% coalesced), plus decoupled lazy gpu_profile_.resolve(), reordered BeforeExecuteCoalescer, and Stage-2b Cell::restore[] readability bypass.
  • Upstream main (d48a957bb) merge & post-merge audit (66d4723f4, 232b4a1ee):
    • Resolved 3 conflicts (docs/design.md, runtime/CMakeLists.txt, tests/semantic/spirv_wave_interp.py) and audited with two independent reviewers.
    • Fixed a silent post-merge interaction in tools/rdna2spirv.py where upstream's v_exp_f32 denormal flush called Gen.flush_f32() under FTZ32 (added force=True for v_exp_f32) and synced _vgpr_reads_of with buffer_load_format_d16_hi_x.

Post-Merge Verification (232b4a1ee)

  • Live RX 7900 XTX (RADV NAVI31, Mesa 26.3.1-arch1.3, Wine) post-merge run (370+ s, visible + audio):
    • 0 GPUVM faults, 0 VK_ERROR_DEVICE_LOST, 0 unmet gates (28,372 gates held, 429 relayed, 0 failed), 3 clean bindless dead-sweeps (8,192 dead keys each, 0 textures notified).
    • Opening cutscene: 7.4–13.9 fps (up from 3.6–5.9 fps at Round 6), 96–97% before-execute coalesced, 0 single-flight waits.
    • In-game gameplay: stable 6.0–7.4 fps (79–84 ms/f own threads, 7.0–15.1 ms/f title threads, Direct GPU now 66–75% busy — bottleneck has shifted from CPU to GPU).
  • Automated suites:
    • Linux (-march=x86-64-v3, RDNA2 iGPU 1002:164e): 136/136 ctest PASS, 9/9 VVL PASS (0 VUIDs).
    • Python translator tests: compileall PASS, check_no_game_data.py PASS, 14/14 test_alu_exp_f32 + test_ftz32_fmulz + test_buffer_format_d16_hi PASS, 278/278 across all 17 merged-feature semantic suites PASS.
    • Windows (clang-cl /arch:AVX2): gta6rt.exe built cleanly; targeted Wine iGPU suite 40/41 PASS (xmem_write_watch passed on re-run; only upstream d3d12_fence_timing's EnumAdapterByLuid failed on headless Wine Xvfb lacking DRI3 — clock calibration checks passed).

AI-assisted: Antigravity (Gemini 4 Neon & Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-28 12:19 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7239151055) Pushed Rounds 7–10c (`232b4a1ee`) and merged up-to-date `main` (`d48a957bb`, 508 commits) cleanly into `integration/perf-cpu-gpu-r6`. ### Summary of Changes Since Round 6 (`cd8b5632b` → `232b4a1ee`) - **Round 7 — Rendering batching, parallel console heap filter & 64 MiB readback:** - Dynamic rendering scope batching (`replay` ~2× faster), hoisted `FilterCacheScope` + parallel Phase-A filter, 64 MiB copy-queue readback, deferred slot-70 uploads to GPU detile + `publish_streamed_texture()` fix, per-fence `vis_seq`, unlocked `QueueHolds::run_barriers()`, 4-deep `VulkanPresenter::frames_`. - **Round 8 — Zero unmet gates, 2-level mirror table & GPU texture batching:** - Fixed `Pump::choose_release()` TOCTOU + present quiet window (**0 released unmet**), dedicated `QueueHolds` barrier-drain thread, batched `copy_page_mappings()`, SEH aligned volatile `read_value()`, 1000 ms slot-12 timeout (`0` timeouts). - `Chunk::pages[32768]` direct table, `sum_of_batch_256()`, sub-page 256 B readback copies, `page_mirror_buffer` `resolve_cache`, `OutScratchGuard`, 512-job / 128 MiB GPU-mirror texture upload batching. - **Round 9 — Low-syscall VM guards, WC streaming & bindless ViewKey sharing:** - `CellGuard` zero-syscall `all_armed`, VQ cache, `disarm_batch`/`set_hot_batch`, range-scoped `reopen()`, WC streaming copy (`kStripBytes=16 KiB`), `WorkerPool` 50 µs spin. - Separated `title_texel_writes`, Stage-2 `TextureVqCache`, `TitleImagePool` 8 MiB/16 MiB cap, refcounted `ViewKey` sharing, O(1) `BindlessSet` free-lists, single-lock `bind_title_image()`, `GeometryViews` dedicated `WriteQueue`. - **Round 10 / 10b / 10c — Two-phase bindless GC, GPU-to-GPU relays, fused AVX2 copy+sum & feed-only mirror drain:** - Two-phase dead-sweep bindless GC (`ConsoleHeapSlotRecords` `kTexture`/`kSettled` live tracking, explicit `evictable` classification, Phase 1 dead-key sweep with 0 texture notifications + 8,192-slot hysteresis, `dim_2d` mirror-slot room notifications, multi-key `sv.keys` liveness) — eliminated 65,536-slot saturation and GC thrash. - Shared `Cell::known_*` cache across `CellGuard` & `TitleTextureCells` (with `PAGE_READONLY` excluded from VQ caches and safe per-tile bridged `VirtualProtect` rollback), `TitleHeap::hooks.commit/decommit` map-change scoping, fused SEH-safe AVX2/SSE2 `guarded::copy_and_sum_256()`, 8-worker pool, disjoint Phase A/B WC flushes & chunk-local `local_mirror` cache. - `VulkanFence::signal_gpu_relay()` (`vis_seq=0`) + retroactive `QueueHolds::relay_wait()` / `VulkanQueue::apply_wait_relay()` with `WriteGroup::bare` visibility safety, exact landed-value `console_value_met()` check, `wait_met` re-check, `relay_wait()` gate preservation, and signal-only `consumed_wait_vis` transitivity. - Lightweight `drain_page_mirror_feed_only()` on coalesced `before-execute` submissions (`0.11–0.29 ms` when `CopyPageMappingsBatchX` remaps are queued, **0 single-flight waits**, **96–97% coalesced**), plus decoupled lazy `gpu_profile_.resolve()`, reordered `BeforeExecuteCoalescer`, and Stage-2b `Cell::restore[]` readability bypass. - **Upstream `main` (`d48a957bb`) merge & post-merge audit (`66d4723f4`, `232b4a1ee`):** - Resolved 3 conflicts (`docs/design.md`, `runtime/CMakeLists.txt`, `tests/semantic/spirv_wave_interp.py`) and audited with two independent reviewers. - Fixed a silent post-merge interaction in `tools/rdna2spirv.py` where upstream's `v_exp_f32` denormal flush called `Gen.flush_f32()` under `FTZ32` (added `force=True` for `v_exp_f32`) and synced `_vgpr_reads_of` with `buffer_load_format_d16_hi_x`. ### Post-Merge Verification (`232b4a1ee`) - **Live RX 7900 XTX (`RADV NAVI31`, Mesa `26.3.1-arch1.3`, Wine) post-merge run (`370+ s`, visible + audio):** - **0 GPUVM faults**, **0 `VK_ERROR_DEVICE_LOST`**, **0 unmet gates** (`28,372` gates held, `429` relayed, `0` failed), **3** clean bindless dead-sweeps (`8,192` dead keys each, `0` textures notified). - **Opening cutscene:** **`7.4–13.9 fps`** (up from `3.6–5.9 fps` at Round 6), `96–97%` `before-execute` coalesced, `0` single-flight waits. - **In-game gameplay:** stable **`6.0–7.4 fps`** (`79–84 ms/f` own threads, `7.0–15.1 ms/f` title threads, Direct GPU now **`66–75%` busy** — bottleneck has shifted from CPU to GPU). - **Automated suites:** - Linux (`-march=x86-64-v3`, RDNA2 iGPU `1002:164e`): **136/136 `ctest` PASS**, **9/9 VVL PASS** (0 VUIDs). - Python translator tests: `compileall` PASS, `check_no_game_data.py` PASS, **14/14** `test_alu_exp_f32` + `test_ftz32_fmulz` + `test_buffer_format_d16_hi` PASS, **278/278** across all 17 merged-feature semantic suites PASS. - Windows (`clang-cl /arch:AVX2`): `gta6rt.exe` built cleanly; targeted Wine iGPU suite **40/41 PASS** (`xmem_write_watch` passed on re-run; only upstream `d3d12_fence_timing`'s `EnumAdapterByLuid` failed on headless Wine Xvfb lacking DRI3 — clock calibration checks passed). AI-assisted: Antigravity (Gemini 4 Neon & Claude Opus 5.5).
- docs/design.md: escape bare pipes in wide scalar load table row
- runtime/README.md: document LEONIDA_BEFORE_EXECUTE_COALESCE and LEONIDA_CLWB_PATCH
- .github/workflows/runtime.yml: add descriptor_sources.py and heap_index_census.py path triggers
- tools/ptr_truncation_census.py: accept extra= kwarg in shader_meta.collect capture hook
- tools/shader_diff.py: disable FTZ32 during cpu_ref differential comparison (cpu_ref preserves denorms)
- tests/test_translate.py: update wave32 bpermute, ballot-based WQM, and deduplicated uvec4 OpImageFetch assertions
- runtime/test/replay_state_cache_test.cpp: add always-true gl_FragCoord.x >= 0.0 scalar select guard in build_fs_spirv to avoid Mesa llvmpipe linear-fastpath push-constant bug
- runtime/test/vk_gpu_profile_test.cpp: skip positive-duration checks on Apple Paravirtual GPUs returning constant zero-span timestamps while keeping all structural/query checks

AI-assisted: Antigravity (Gemini 4 Neon). Verified with full translator-tests pytest suite (2004 passed), PR-specific CI/check unit tests, and replay_state_cache_test + vk_gpu_profile_test on llvmpipe and Radeon iGPU (VVL=1).
# Conflicts:
#	tools/vk_subgroup_info.py
Author
Owner

@⁠azsekazvamdimitar on GitHub · 2026-11-28 13:36 UTC · original

Tested #2566 on NVIDIA (RTX 3090, Linux, GE-Proton11-14 and WineHQ 11.22, merged onto main 493867366): the runtime cannot create the GPU address arena there, so the title does not get past startup.

  • create_arena (runtime/shims/d3d12_vulkan_device.cpp, the sparse decision): with every loaded module sign-extending its V# base, the arena is made sparse. NVIDIA's driver offers no host-visible memory type for a sparse buffer (memoryTypeBits 0x2, device-local only), so the first unit's allocate(..., kArenaRequiredMemory, ...) fails: GPU address arena: no memory for its first 448 KiB -> the GPU address arena could not be created -> every pipeline refused (pipelines need the GPU address arena, ~70,000 refusals) -> the title crashes about 2 minutes in (two boots, cold and warm caches). There is no fallback to the one-allocation arena.
  • arena_sparse_gpu fails on the same card for the same reason (line 184: type != UINT32_MAX), natively, under WineHQ and under GE-Proton.
  • With a local fallback (create a probe buffer with the sparse flags; if memoryTypeBits has no type with kArenaRequiredMemory, log it and make the arena one allocation as before) the branch boots. Compared with main + the same caches on this card: world reached in about 5 min instead of about 12, a coherent picture where main showed untextured blocks, our submit path 4-25% of the wall time in the world instead of 100%+, no device loss or stalls in 3 boots. The frame rate in the world stays at 0.2-0.4 frames/s; the title then mostly waits on fences (99% of the fence-mirror waits end on the 10 ms timeout). The page mirror is off on this card either way (no aliased strict sparse buffers). Cold-cache boots still freeze on synchronous compiles.

AI-assisted (Claude). The fallback is about 25 lines; happy to push it as a suggestion if you want it in this PR.

**@⁠azsekazvamdimitar** on GitHub · 2026-11-28 13:36 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7240052214) Tested #2566 on NVIDIA (RTX 3090, Linux, GE-Proton11-14 and WineHQ 11.22, merged onto main 493867366): the runtime cannot create the GPU address arena there, so the title does not get past startup. - `create_arena` (`runtime/shims/d3d12_vulkan_device.cpp`, the `sparse` decision): with every loaded module sign-extending its V# base, the arena is made sparse. NVIDIA's driver offers no host-visible memory type for a sparse buffer (`memoryTypeBits` 0x2, device-local only), so the first unit's `allocate(..., kArenaRequiredMemory, ...)` fails: `GPU address arena: no memory for its first 448 KiB` -> `the GPU address arena could not be created` -> every pipeline refused (`pipelines need the GPU address arena`, ~70,000 refusals) -> the title crashes about 2 minutes in (two boots, cold and warm caches). There is no fallback to the one-allocation arena. - `arena_sparse_gpu` fails on the same card for the same reason (`line 184: type != UINT32_MAX`), natively, under WineHQ and under GE-Proton. - With a local fallback (create a probe buffer with the sparse flags; if `memoryTypeBits` has no type with `kArenaRequiredMemory`, log it and make the arena one allocation as before) the branch boots. Compared with main + the same caches on this card: world reached in about 5 min instead of about 12, a coherent picture where main showed untextured blocks, our submit path 4-25% of the wall time in the world instead of 100%+, no device loss or stalls in 3 boots. The frame rate in the world stays at 0.2-0.4 frames/s; the title then mostly waits on fences (99% of the fence-mirror waits end on the 10 ms timeout). The page mirror is off on this card either way (`no aliased strict sparse buffers`). Cold-cache boots still freeze on synchronous compiles. AI-assisted (Claude). The fallback is about 25 lines; happy to push it as a suggestion if you want it in this PR.
Author
Owner

@⁠timbot103 on GitHub · 2026-11-28 13:57 UTC · original · reviewed

Independently verified 232b4a1ee (Rounds 7–10c) on native Windows 11 (MSVC 19.44 + Ninja, Python 3.14, AMD LLVM 23 llvm-mc) across two desktop Vulkan GPUs with zero game files:

  • NVIDIA GeForce RTX 5080 (driver 32.0.16.1664, wave32, shaderDenormFlushToZeroFloat32 == VK_FALSE)
  • AMD Radeon(TM) Graphics (gfx1036) (driver 32.0.21030.2001, wave32..64 default 64)

(Checked the diff 232b4a1ee..a8b1abe4c pushed while this run was finishing: d1f53516d/a8b1abe4c already fixed the 5 tests/test_translate.py assertions and resolved the tools/vk_subgroup_info.py merge conflict against main, so those are omitted below. All 6 native Windows / MSVC / NVIDIA / cross-GPU runtime issues below remain untouched in a8b1abe4c.)

What Passed Cleanly

  • Native Windows MSVC 19.44 + Ninja build: 1,119/1,119 targets compiled and linked with 0 errors.
  • Hygiene: scripts/check_no_game_data.py and python -m compileall -q make_game.py tools tests both pass.
  • Targeted #2566 semantic suites (18 files, including test_absent_lane_ub, test_ftz32_fmulz, test_alu_exp_f32, test_buffer_format_d16_hi, test_wave64_emulate_opt, test_wave64_halves): 285/285 PASS.
  • Full semantic suite (tests/semantic, 529 files, 6,563 tests): 528/529 files (6,561/6,563 tests) PASS; the sole failing file (test_valu_cvt_f16_int16_mods, 2 subtests in v_cvt_u16_f16/v_cvt_i16_f16) reproduces identically on clean merge-base d48a957bb (0 semantic regressions).
  • Live GPU absent-lane test (tests/test_absent_lane_gpu.py): 2/2 PASS on AMD Radeon gfx1036 with LEONIDA_VK_VALIDATION=1 (0 validation errors), and 2/2 PASS functionally on RTX 5080 with LEONIDA_VK_VALIDATION=0 (see validation blocker #3 and Windows .exe note below).
  • Key #2566 runtime & Vulkan CTests passing with LEONIDA_VK_VALIDATION=1 (0 validation errors) on both RTX 5080 and AMD Radeon gfx1036: vk_title_detile (187 cases + batched/3D/pool checks), vk_bindless_grow, vk_bindless_dimensions, vk_console_heap_gpu, d3d12_bindless_churn, d3d12_bindless_churn_validated, d3d12_tsharp_refill, d3d12_unbound_tsharp_rules, d3d12_queue_wait*, d3d12_xmem_placed, title_mirror_hooks, title_mirror_hot_cold, r3b_runtime_hooks, replay_state_cache, list_value_progress, d3d12_compute, d3d12_draw, d3d12_shadow_keep_refill.

Remaining Blockers Found on Native Windows / MSVC / NVIDIA (Still Present in a8b1abe4c)

  1. Native MSVC gta6rt.exe fails gta6rt_no_tls_callbacks (#35) — non-trivial thread_local destructors linked in:

    • check_pe_tls_callbacks.py rejects gta6rt.exe because MSVC emits __dyn_tls_init (MSVCRT:tlsdyn.obj) and __dyn_tls_dtor (MSVCRT:tlsdtor.obj) in the PE TLS directory (which causes the title's _register_thread_local_exe_atexit_callback to fast-fail with 0xC0000409).
    • Non-trivially destructible thread_local additions in #2566:
      • runtime/shims/d3d12_vulkan_device.cpp:4615 (static thread_local std::vector<...> stack)
      • runtime/shims/d3d12_vulkan_device.cpp:8286 (thread_local std::unique_ptr<FilterPageCache> tls_cache)
      • runtime/shims/d3d12_vulkan_device.cpp:8406 (thread_local std::unique_ptr<std::uint8_t[]> tls_buf)
      • runtime/shims/d3d12_vulkan_device.cpp:8893 (thread_local std::vector<PageWork> tls_page_work)
      • runtime/shims/d3d12_vulkan_device.cpp:8932 (thread_local std::vector<std::uint8_t> tls_batch_bufs)
      • runtime/shims/d3d12_vulkan_device.cpp:24469 (static thread_local std::vector<std::uint8_t> scratch)
  2. NVIDIA RTX 5080 sparse GPU address arena fails to initialize (confirming @⁠azsekazvamdimitar's Linux RTX 3090 finding on native Windows):

    • On NVIDIA Vulkan, a VkBuffer created with VK_BUFFER_CREATE_SPARSE_BINDING_BIT | VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT only exposes non-HOST_VISIBLE (DEVICE_LOCAL-only) memory types in vkGetBufferMemoryRequirements().memoryTypeBits.
    • In runtime/shims/d3d12_vulkan_device.cpp:22073-22101, sparse is enabled without verifying that requirements.memoryTypeBits includes a kArenaRequiredMemory (HOST_VISIBLE | HOST_COHERENT) type or falling back to the single-allocation non-sparse arena. arena.backing.acquire(0, head, true) fails (GPU address arena: no memory for its first 448 KiB -> the GPU address arena could not be created) and leaves arena.size == 0.
    • On RTX 5080 this cascades into failures/skips across arena_sparse_gpu (line 184: type != UINT32_MAX + leaks VkBuffer on early exit), vk_heap_alias (line 186: home_info.memoryTypeIndex != UINT32_MAX), vk_title_mirror (line 257), d3d12_page_mirror (Skipped), d3d12_heap_in_place (Skipped), d3d12_texture_tiles, d3d12_xdxr_rt, xbox_bvh_builder, d3d12_dxr_validation, d3d12_dxr_validation_khr, d3d12_placed_dimensions, d3d12_placed_heap_lifetime, d3d12_method_variants, d3d12_heap_properties, d3d12_title_va_game_device, d3d12_geometry_views_game_device, and d3d12_vulkan_device.
    • (Related note: arena_sparse_gpu_test.cpp:97, vk_heap_alias_test.cpp:100, and vk_title_mirror_test.cpp:114 pick physical device 0 directly and ignore LEONIDA_VK_DEVICE.)
  3. Default DenormFlushToZero 32 violates Vulkan validation on NVIDIA (shaderDenormFlushToZeroFloat32 == VK_FALSE):

    • Running tests/test_absent_lane_gpu.py on RTX 5080 with LEONIDA_VK_VALIDATION=1 emits 2 validation errors on FTZ32-enabled shaders:
      • VUID-VkShaderModuleCreateInfo-pCode-08740 (Capability DenormFlushToZero declared with no supported float width)
      • VUID-RuntimeSpirv-shaderDenormFlushToZeroFloat32-06300 (shaderDenormFlushToZeroFloat32 is VK_FALSE)
    • Either DenormFlushToZero 32 needs to be gated by a device probe (shaderDenormFlushToZeroFloat32) like the other translator fallbacks, or default off when the target GPU does not advertise it.
  4. Cross-GPU CTest regressions failing identically on both RTX 5080 and AMD Radeon gfx1036:

    • d3d12_com (#235): fails at d3d12_com_test.cpp:244 (rt::d3d12::last_execute_result(queue.p) == ReplayResult::list_open), which also causes run_tiny_frame (#452) and run_tiny_frame_queue_test_settings (#453) to fail --probe exited with code 1.
    • d3d12_present (#364): fails at d3d12_present_test.cpp:524 (driver::binary.size() == 2), out of sync with the 4-deep VulkanPresenter::frames_ change.
    • vk_presenter_sync (#229): hits VK_ERROR_DEVICE_LOST from vkWaitForFences (present readback) and fails at vk_presenter_sync_test.cpp:406 (presenter.presented() == shown + 3 && presenter.composed_presents() >= 1).
  5. NVIDIA RTX 5080 vk_gpu_profile (#211) unsigned 64-bit timestamp underflow:

    • Fails reproducibly at vk_gpu_profile_test.cpp:310 (e->ms > 0 && e->ms < 2000): vs spin_vertices reports 18446744073709.5469 ms (~2^64 wraparound in runtime/src/vulkan_gpu_profile.h:259: (ticks[k] - ticks[k - 1]) & r.mask_ when ticks[k] < ticks[k - 1]). Passes cleanly with 0 validation errors on AMD Radeon gfx1036. (Note: d1f53516d only added an Apple Paravirtual check in vk_gpu_profile_test.cpp, leaving vulkan_gpu_profile.h:259 unchanged.)
  6. Teardown leaks under LEONIDA_VK_VALIDATION=1 + minor Windows/Radeon notes:

    • d3d12_existing_heap, d3d12_existing_heap_no_write_watch, d3d12_existing_heap_write_watch, and xbox_list_value_fallback log VUID-vkDestroyDevice-device-05137 (VkDevice has 87 leaked objects that have not been destroyed) at teardown on both RTX 5080 and AMD Radeon gfx1036.
    • On AMD Radeon gfx1036 under LEONIDA_VK_VALIDATION=1, vk_device_markers (#207, vkCmdWriteBufferMarker2AMD) read back started=0 finished=0 (expected 5) with 0 validation errors (passed with LEONIDA_VK_VALIDATION=0), and submit_frame (#202) flaked once at submit_frame_test.cpp:95 (worker_ns[worker_texture_reads] > 0, passed on RTX 5080 and Radeon without validation).
    • tests/test_absent_lane_gpu.py:31-32 hardcodes runtime/build/vk_compute_test and runtime/build/vk_ps_sweep without .exe, so it skips automatically on Windows unless patched.
    • (On AMD Radeon gfx1036, d3d12_page_mirror and d3d12_heap_in_place skipped cleanly due to missing bufferDeviceAddressCaptureReplay on Windows AMDVLK.)

Full CTest totals on 232b4a1ee (507 tests, 2 not run / 15–17 skipped): RTX 5080 25 failed (17 cascading from #2 above + #1, #4, #5), AMD Radeon gfx1036 15 failed (incl. #1, #4, the 3 device-0-hardcoded sparse tests from #2, plus Windows AMDVLK driver/test items vk_null_descriptor, d3d12_texture_tiles, pipeline_cache_seed, d3d12_clear, d3d12_mesh*).

**@⁠timbot103** on GitHub · 2026-11-28 13:57 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#pullrequestreview-6098201240) · **reviewed** Independently verified `232b4a1ee` (Rounds 7–10c) on **native Windows 11** (MSVC 19.44 + Ninja, Python 3.14, AMD LLVM 23 `llvm-mc`) across two desktop Vulkan GPUs with **zero game files**: - **NVIDIA GeForce RTX 5080** (driver `32.0.16.1664`, wave32, `shaderDenormFlushToZeroFloat32 == VK_FALSE`) - **AMD Radeon(TM) Graphics (`gfx1036`)** (driver `32.0.21030.2001`, wave32..64 default 64) *(Checked the diff `232b4a1ee..a8b1abe4c` pushed while this run was finishing: `d1f53516d`/`a8b1abe4c` already fixed the 5 `tests/test_translate.py` assertions and resolved the `tools/vk_subgroup_info.py` merge conflict against `main`, so those are omitted below. All 6 native Windows / MSVC / NVIDIA / cross-GPU runtime issues below remain untouched in `a8b1abe4c`.)* ### What Passed Cleanly - **Native Windows MSVC 19.44 + Ninja build:** **1,119/1,119** targets compiled and linked with 0 errors. - **Hygiene:** `scripts/check_no_game_data.py` and `python -m compileall -q make_game.py tools tests` both pass. - **Targeted `#2566` semantic suites (18 files, including `test_absent_lane_ub`, `test_ftz32_fmulz`, `test_alu_exp_f32`, `test_buffer_format_d16_hi`, `test_wave64_emulate_opt`, `test_wave64_halves`):** **285/285 PASS**. - **Full semantic suite (`tests/semantic`, 529 files, 6,563 tests):** **528/529 files (6,561/6,563 tests) PASS**; the sole failing file (`test_valu_cvt_f16_int16_mods`, 2 subtests in `v_cvt_u16_f16`/`v_cvt_i16_f16`) reproduces identically on clean merge-base `d48a957bb` (**0 semantic regressions**). - **Live GPU absent-lane test (`tests/test_absent_lane_gpu.py`):** **2/2 PASS** on AMD Radeon `gfx1036` with `LEONIDA_VK_VALIDATION=1` (0 validation errors), and **2/2 PASS** functionally on RTX 5080 with `LEONIDA_VK_VALIDATION=0` *(see validation blocker #3 and Windows `.exe` note below)*. - **Key `#2566` runtime & Vulkan CTests passing with `LEONIDA_VK_VALIDATION=1` (0 validation errors) on both RTX 5080 and AMD Radeon `gfx1036`:** `vk_title_detile` (187 cases + batched/3D/pool checks), `vk_bindless_grow`, `vk_bindless_dimensions`, `vk_console_heap_gpu`, `d3d12_bindless_churn`, `d3d12_bindless_churn_validated`, `d3d12_tsharp_refill`, `d3d12_unbound_tsharp_rules`, `d3d12_queue_wait*`, `d3d12_xmem_placed`, `title_mirror_hooks`, `title_mirror_hot_cold`, `r3b_runtime_hooks`, `replay_state_cache`, `list_value_progress`, `d3d12_compute`, `d3d12_draw`, `d3d12_shadow_keep_refill`. --- ### Remaining Blockers Found on Native Windows / MSVC / NVIDIA (Still Present in `a8b1abe4c`) 1. **Native MSVC `gta6rt.exe` fails `gta6rt_no_tls_callbacks` (`#35`) — non-trivial `thread_local` destructors linked in:** - `check_pe_tls_callbacks.py` rejects `gta6rt.exe` because MSVC emits `__dyn_tls_init` (`MSVCRT:tlsdyn.obj`) and `__dyn_tls_dtor` (`MSVCRT:tlsdtor.obj`) in the PE TLS directory (which causes the title's `_register_thread_local_exe_atexit_callback` to fast-fail with `0xC0000409`). - Non-trivially destructible `thread_local` additions in `#2566`: - `runtime/shims/d3d12_vulkan_device.cpp:4615` (`static thread_local std::vector<...> stack`) - `runtime/shims/d3d12_vulkan_device.cpp:8286` (`thread_local std::unique_ptr<FilterPageCache> tls_cache`) - `runtime/shims/d3d12_vulkan_device.cpp:8406` (`thread_local std::unique_ptr<std::uint8_t[]> tls_buf`) - `runtime/shims/d3d12_vulkan_device.cpp:8893` (`thread_local std::vector<PageWork> tls_page_work`) - `runtime/shims/d3d12_vulkan_device.cpp:8932` (`thread_local std::vector<std::uint8_t> tls_batch_bufs`) - `runtime/shims/d3d12_vulkan_device.cpp:24469` (`static thread_local std::vector<std::uint8_t> scratch`) 2. **NVIDIA RTX 5080 sparse GPU address arena fails to initialize (confirming @⁠azsekazvamdimitar's Linux RTX 3090 finding on native Windows):** - On NVIDIA Vulkan, a `VkBuffer` created with `VK_BUFFER_CREATE_SPARSE_BINDING_BIT | VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT` only exposes non-`HOST_VISIBLE` (`DEVICE_LOCAL`-only) memory types in `vkGetBufferMemoryRequirements().memoryTypeBits`. - In `runtime/shims/d3d12_vulkan_device.cpp:22073-22101`, `sparse` is enabled without verifying that `requirements.memoryTypeBits` includes a `kArenaRequiredMemory` (`HOST_VISIBLE | HOST_COHERENT`) type or falling back to the single-allocation non-sparse arena. `arena.backing.acquire(0, head, true)` fails (`GPU address arena: no memory for its first 448 KiB` -> `the GPU address arena could not be created`) and leaves `arena.size == 0`. - On RTX 5080 this cascades into failures/skips across `arena_sparse_gpu` (`line 184: type != UINT32_MAX` + leaks `VkBuffer` on early exit), `vk_heap_alias` (`line 186: home_info.memoryTypeIndex != UINT32_MAX`), `vk_title_mirror` (`line 257`), `d3d12_page_mirror` (Skipped), `d3d12_heap_in_place` (Skipped), `d3d12_texture_tiles`, `d3d12_xdxr_rt`, `xbox_bvh_builder`, `d3d12_dxr_validation`, `d3d12_dxr_validation_khr`, `d3d12_placed_dimensions`, `d3d12_placed_heap_lifetime`, `d3d12_method_variants`, `d3d12_heap_properties`, `d3d12_title_va_game_device`, `d3d12_geometry_views_game_device`, and `d3d12_vulkan_device`. - *(Related note: `arena_sparse_gpu_test.cpp:97`, `vk_heap_alias_test.cpp:100`, and `vk_title_mirror_test.cpp:114` pick physical device 0 directly and ignore `LEONIDA_VK_DEVICE`.)* 3. **Default `DenormFlushToZero 32` violates Vulkan validation on NVIDIA (`shaderDenormFlushToZeroFloat32 == VK_FALSE`):** - Running `tests/test_absent_lane_gpu.py` on RTX 5080 with `LEONIDA_VK_VALIDATION=1` emits 2 validation errors on FTZ32-enabled shaders: - `VUID-VkShaderModuleCreateInfo-pCode-08740` (`Capability DenormFlushToZero` declared with no supported float width) - `VUID-RuntimeSpirv-shaderDenormFlushToZeroFloat32-06300` (`shaderDenormFlushToZeroFloat32 is VK_FALSE`) - Either `DenormFlushToZero 32` needs to be gated by a device probe (`shaderDenormFlushToZeroFloat32`) like the other translator fallbacks, or default off when the target GPU does not advertise it. 4. **Cross-GPU CTest regressions failing identically on both RTX 5080 and AMD Radeon `gfx1036`:** - `d3d12_com` (`#235`): fails at `d3d12_com_test.cpp:244` (`rt::d3d12::last_execute_result(queue.p) == ReplayResult::list_open`), which also causes `run_tiny_frame` (`#452`) and `run_tiny_frame_queue_test_settings` (`#453`) to fail `--probe exited with code 1`. - `d3d12_present` (`#364`): fails at `d3d12_present_test.cpp:524` (`driver::binary.size() == 2`), out of sync with the 4-deep `VulkanPresenter::frames_` change. - `vk_presenter_sync` (`#229`): hits `VK_ERROR_DEVICE_LOST from vkWaitForFences (present readback)` and fails at `vk_presenter_sync_test.cpp:406` (`presenter.presented() == shown + 3 && presenter.composed_presents() >= 1`). 5. **NVIDIA RTX 5080 `vk_gpu_profile` (`#211`) unsigned 64-bit timestamp underflow:** - Fails reproducibly at `vk_gpu_profile_test.cpp:310` (`e->ms > 0 && e->ms < 2000`): `vs spin_vertices` reports `18446744073709.5469 ms` (`~2^64` wraparound in `runtime/src/vulkan_gpu_profile.h:259`: `(ticks[k] - ticks[k - 1]) & r.mask_` when `ticks[k] < ticks[k - 1]`). Passes cleanly with 0 validation errors on AMD Radeon `gfx1036`. *(Note: `d1f53516d` only added an Apple Paravirtual check in `vk_gpu_profile_test.cpp`, leaving `vulkan_gpu_profile.h:259` unchanged.)* 6. **Teardown leaks under `LEONIDA_VK_VALIDATION=1` + minor Windows/Radeon notes:** - `d3d12_existing_heap`, `d3d12_existing_heap_no_write_watch`, `d3d12_existing_heap_write_watch`, and `xbox_list_value_fallback` log `VUID-vkDestroyDevice-device-05137` (`VkDevice has 87 leaked objects that have not been destroyed`) at teardown on **both** RTX 5080 and AMD Radeon `gfx1036`. - On AMD Radeon `gfx1036` under `LEONIDA_VK_VALIDATION=1`, `vk_device_markers` (`#207`, `vkCmdWriteBufferMarker2AMD`) read back `started=0 finished=0` (expected `5`) with 0 validation errors (passed with `LEONIDA_VK_VALIDATION=0`), and `submit_frame` (`#202`) flaked once at `submit_frame_test.cpp:95` (`worker_ns[worker_texture_reads] > 0`, passed on RTX 5080 and Radeon without validation). - `tests/test_absent_lane_gpu.py:31-32` hardcodes `runtime/build/vk_compute_test` and `runtime/build/vk_ps_sweep` without `.exe`, so it skips automatically on Windows unless patched. - *(On AMD Radeon `gfx1036`, `d3d12_page_mirror` and `d3d12_heap_in_place` skipped cleanly due to missing `bufferDeviceAddressCaptureReplay` on Windows AMDVLK.)* Full CTest totals on `232b4a1ee` (507 tests, 2 not run / 15–17 skipped): RTX 5080 `25 failed` (17 cascading from #2 above + #1, #4, #5), AMD Radeon `gfx1036` `15 failed` (incl. #1, #4, the 3 device-0-hardcoded sparse tests from #2, plus Windows AMDVLK driver/test items `vk_null_descriptor`, `d3d12_texture_tiles`, `pipeline_cache_seed`, `d3d12_clear`, `d3d12_mesh*`).
Author
Owner

@⁠Tauwni on GitHub · 2026-11-28 14:22 UTC · original

Another device class, in case it helps: Apple M3 under Wine on macOS (Wine 11.0 with its MoltenVK 1.4.1, macOS 26.5.1), Windows cross-build of the runtime tests, no game files. This head (a8b1abe4c) conflicts with today's main in runtime/README.md, so both sides are on main 7ce011205, the tree this branch merged cleanly onto.

Test main 7ce011205 + this PR
d3d12_existing_heap passes 3/3 fails 3/3
d3d12_title_va passes 3/3 fails 3/3
d3d12_title_va_shadow passes 3/3 fails 3/3

(MEASURED, 3 runs each side, same machine and build directory.)

  • d3d12_existing_heap: vulkan slot-133 written pages line 795: first_difference(got, want) == -1, twice per run. That is step 4 of the written-pages check, which this pull request does not change: 64 bytes written to the first watched page from another thread, then a GPU read. No other line N: failure is printed.
  • d3d12_title_va and _shadow: line 276: srv_other == 0, with read-write pages: GPU copy in the arena (shader VA an arena offset); V# read run, 64/64 words matched, 32/64 read the other buffer's (negative control). The test's module now has "vsharp_base_sign_extended": true, so this may be the V# sign extension reaching the neighbouring buffer on this device. That cause is ASSUMED, not traced: I have not checked whether the arena is sparse here.

The 41-test Wine suite in the description ran on RADV, where the arena can be sparse; NVIDIA's arena problem above is a different one. Happy to rerun anything on this Mac.

Not checked by a second agent or human yet.

AI-assisted (Claude Code).

**@⁠Tauwni** on GitHub · 2026-11-28 14:22 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7240623909) Another device class, in case it helps: Apple M3 under Wine on macOS (Wine 11.0 with its MoltenVK 1.4.1, macOS 26.5.1), Windows cross-build of the runtime tests, no game files. This head (`a8b1abe4c`) conflicts with today's `main` in `runtime/README.md`, so both sides are on `main` `7ce011205`, the tree this branch merged cleanly onto. | Test | `main` `7ce011205` | + this PR | |---|---|---| | `d3d12_existing_heap` | passes 3/3 | fails 3/3 | | `d3d12_title_va` | passes 3/3 | fails 3/3 | | `d3d12_title_va_shadow` | passes 3/3 | fails 3/3 | (MEASURED, 3 runs each side, same machine and build directory.) - `d3d12_existing_heap`: `vulkan slot-133 written pages line 795: first_difference(got, want) == -1`, twice per run. That is step 4 of the written-pages check, which this pull request does not change: 64 bytes written to the first watched page from another thread, then a GPU read. No other `line N:` failure is printed. - `d3d12_title_va` and `_shadow`: `line 276: srv_other == 0`, with `read-write pages: GPU copy in the arena (shader VA an arena offset); V# read run, 64/64 words matched, 32/64 read the other buffer's (negative control)`. The test's module now has `"vsharp_base_sign_extended": true`, so this may be the V# sign extension reaching the neighbouring buffer on this device. That cause is ASSUMED, not traced: I have not checked whether the arena is sparse here. The 41-test Wine suite in the description ran on RADV, where the arena can be sparse; NVIDIA's arena problem above is a different one. Happy to rerun anything on this Mac. Not checked by a second agent or human yet. AI-assisted (Claude Code).
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-28 14:44 UTC · original

The cross-thread written-pages mismatch reported on Mac/Wine did not reproduce on native Windows 11 build 26300 with an RTX 4090 and NVIDIA driver 616.64.

Revision Fresh processes Cross-thread updates matched Full-buffer GPU readbacks matched
Main 7ce011205869 3 12/12 48/48
PR head a8b1abe4c201 3 12/12 48/48

I built each revision with MSVC in Release and used a local test entry point to run just the four existing check_written_pages layouts. The comparison function and production code were unchanged. Each layout checks initial data, a partial rewrite, an unchanged submission, and finally a 64-byte write by a second thread followed by GPU readback. This includes both half-committed layouts and the fully committed write-combined layouts at offsets 0 and 64. Every byte matched, with Vulkan validation enabled and zero diagnostics.

This narrows the platform comparison for the written-pages case. The title-VA failures in the Mac report are separate. To distinguish the two failing Mac layouts, the final assertion can print its existing kind argument and the offset returned by first_difference(got, want).

Coordination claim. AI-assisted with OpenAI Codex (GPT-6).

**@⁠ecox982745** on GitHub · 2026-11-28 14:44 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7240890407) The [cross-thread written-pages mismatch reported on Mac/Wine](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566) did not reproduce on native Windows 11 build 26300 with an RTX 4090 and NVIDIA driver 616.64. | Revision | Fresh processes | Cross-thread updates matched | Full-buffer GPU readbacks matched | |---|---:|---:|---:| | Main `7ce011205869` | 3 | 12/12 | 48/48 | | PR head `a8b1abe4c201` | 3 | 12/12 | 48/48 | I built each revision with MSVC in Release and used a local test entry point to run just the four existing `check_written_pages` layouts. The comparison function and production code were unchanged. Each layout checks initial data, a partial rewrite, an unchanged submission, and finally a 64-byte write by a second thread followed by GPU readback. This includes both half-committed layouts and the fully committed write-combined layouts at offsets 0 and 64. Every byte matched, with Vulkan validation enabled and zero diagnostics. This narrows the platform comparison for the written-pages case. The title-VA failures in the Mac report are separate. To distinguish the two failing Mac layouts, the final assertion can print its existing `kind` argument and the offset returned by `first_difference(got, want)`. [Coordination claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/2570). AI-assisted with OpenAI Codex (GPT-6).
Author
Owner

@⁠Tauwni on GitHub · 2026-11-28 14:55 UTC · original

Thanks for the Windows run. Here is the kind and offset on the Mac (same setup as my comment above; head a8b1abe4c on main 7ce011205). I added one diagnostic line before the final assertion of check_written_pages, printing kind, first_difference(got, want) and both bytes; nothing else changed. 3/3 runs, identical output (MEASURED):

DIAG vulkan slot-133 written pages: half-committed range: step 4 first wrong byte at 16: got 00 want d0 (size 262144)
DIAG vulkan slot-133 written pages: half-committed write-combined range: step 4 first wrong byte at 16: got 00 want d0 (size 262144)

So only the two half-committed layouts fail; the fully committed ones pass. In both, bytes 0-15 of the other thread's 64-byte write reach the GPU and byte 16 onward does not (0xd0 = 0xc0 + 16). Under Wine, not native Windows.

AI-assisted (Claude Code).

**@⁠Tauwni** on GitHub · 2026-11-28 14:55 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7241044362) Thanks for the Windows run. Here is the `kind` and offset on the Mac (same setup as my comment above; head `a8b1abe4c` on `main` `7ce011205`). I added one diagnostic line before the final assertion of `check_written_pages`, printing `kind`, `first_difference(got, want)` and both bytes; nothing else changed. 3/3 runs, identical output (MEASURED): ``` DIAG vulkan slot-133 written pages: half-committed range: step 4 first wrong byte at 16: got 00 want d0 (size 262144) DIAG vulkan slot-133 written pages: half-committed write-combined range: step 4 first wrong byte at 16: got 00 want d0 (size 262144) ``` So only the two half-committed layouts fail; the fully committed ones pass. In both, bytes 0-15 of the other thread's 64-byte write reach the GPU and byte 16 onward does not (`0xd0` = `0xc0 + 16`). Under Wine, not native Windows. AI-assisted (Claude Code).
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-28 15:01 UTC · original

The Mac result at byte 16 rules out one explanation. At that offset the preceding, successful GPU readback contained 0x3b (the fixture's pattern_byte(16, 11)). The worker then writes 0xd0. The 0x00 seen on Mac matches neither value. The first-difference report establishes where the mismatch starts. Checking the remaining 47 bytes separately would show how far it extends.

I added a test-only diagnostic at head a8b1abe4c201. It records the previous GPU byte, the CPU byte after the writer joins and before submission, and the new GPU byte after the fence. Two 64-bit masks record every mismatch in the updated region, one bit per byte. On the native Windows RTX 4090 all four layouts gave 3b → d0 → d0, both masks zero, with Vulkan validation enabled. Running that diagnostic on Mac would distinguish a discrepancy already visible to the CPU from one first observed on GPU readback.

Diagnostic patch for the stock PR test
--- a/runtime/test/d3d12_existing_heap_test.cpp
+++ b/runtime/test/d3d12_existing_heap_test.cpp
@@ -790,8 +790,19 @@
     }, pages, 0, nullptr);
     EXPECT(writer != nullptr && WaitForSingleObject(writer, 10000) == WAIT_OBJECT_0);
     CloseHandle(writer);
-    for (int i = 0; i < 64; ++i) want[i] = std::uint8_t(0xc0 + i);
+    const unsigned previous16 = got.at(16);
+    const unsigned cpu16 = pages[16];
+    std::uint64_t cpuMismatch = 0, gpuMismatch = 0;
+    for (int i = 0; i < 64; ++i) {
+        want[i] = std::uint8_t(0xc0 + i);
+        if (pages[i] != want[i]) cpuMismatch |= std::uint64_t{1} << i;
+    }
     EXPECT(reader.read(buffer.p, got) == 0);
+    for (int i = 0; i < 64; ++i)
+        if (got.at(i) != want[i]) gpuMismatch |= std::uint64_t{1} << i;
+    std::printf("step4 %s prev16=%02x cpu16=%02x gpu16=%02x cpuMismatch=%016llx gpuMismatch=%016llx\n",
+                kind, previous16, cpu16, unsigned(got.at(16)),
+                (unsigned long long)cpuMismatch, (unsigned long long)gpuMismatch);
     EXPECT(first_difference(got, want) == -1);
     const DWORD after = protection_of(pages);
     buffer.p->Release();

AI-assisted with OpenAI Codex (GPT-6).

**@⁠ecox982745** on GitHub · 2026-11-28 15:01 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7241138562) The [Mac result at byte 16](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566) rules out one explanation. At that offset the preceding, successful GPU readback contained `0x3b` (the fixture's `pattern_byte(16, 11)`). The worker then writes `0xd0`. The `0x00` seen on Mac matches neither value. The first-difference report establishes where the mismatch starts. Checking the remaining 47 bytes separately would show how far it extends. I added a test-only diagnostic at head `a8b1abe4c201`. It records the previous GPU byte, the CPU byte after the writer joins and before submission, and the new GPU byte after the fence. Two 64-bit masks record every mismatch in the updated region, one bit per byte. On the native Windows RTX 4090 all four layouts gave `3b → d0 → d0`, both masks zero, with Vulkan validation enabled. Running that diagnostic on Mac would distinguish a discrepancy already visible to the CPU from one first observed on GPU readback. <details><summary>Diagnostic patch for the stock PR test</summary> ```diff --- a/runtime/test/d3d12_existing_heap_test.cpp +++ b/runtime/test/d3d12_existing_heap_test.cpp @@ -790,8 +790,19 @@ }, pages, 0, nullptr); EXPECT(writer != nullptr && WaitForSingleObject(writer, 10000) == WAIT_OBJECT_0); CloseHandle(writer); - for (int i = 0; i < 64; ++i) want[i] = std::uint8_t(0xc0 + i); + const unsigned previous16 = got.at(16); + const unsigned cpu16 = pages[16]; + std::uint64_t cpuMismatch = 0, gpuMismatch = 0; + for (int i = 0; i < 64; ++i) { + want[i] = std::uint8_t(0xc0 + i); + if (pages[i] != want[i]) cpuMismatch |= std::uint64_t{1} << i; + } EXPECT(reader.read(buffer.p, got) == 0); + for (int i = 0; i < 64; ++i) + if (got.at(i) != want[i]) gpuMismatch |= std::uint64_t{1} << i; + std::printf("step4 %s prev16=%02x cpu16=%02x gpu16=%02x cpuMismatch=%016llx gpuMismatch=%016llx\n", + kind, previous16, cpu16, unsigned(got.at(16)), + (unsigned long long)cpuMismatch, (unsigned long long)gpuMismatch); EXPECT(first_difference(got, want) == -1); const DWORD after = protection_of(pages); buffer.p->Release(); ``` </details> AI-assisted with OpenAI Codex (GPT-6).
Author
Owner

@⁠OreoFR on GitHub · 2026-11-28 15:43 UTC · original

Review of #2566 on Windows / NVIDIA (RTX 4070 Laptop 8 GB): crashes before world entry; root cause found (sparse arena memory type)

Verdict: request changes. On this machine the PR does not run: the GPU address arena cannot be created, so every
pipeline and heap creation fails and the title crashes with 0xc0000005 at about t = 180 s (3 runs out of 3, two
heads). The cause is a one-line assumption in the new sparse arena (details below), not the shader pack. With a
local 25-line fallback to the one-allocation arena, the PR runs 600 s without a crash, but it does not improve
the world-entry stall compared with raw main on this machine (table below). The ctest suite has 23 new failures
here, most of them the same arena problem, plus a real gta6rt_no_tls_callbacks regression.

Head note: tested at 232b4a1ee. The PR has since moved to a8b1abe4c (a merge of main plus d1f53516d, CI and
docs fixes). Between the two heads runtime/shims/ is unchanged, so the arena crash, the thread_local findings
and the game numbers still apply; d1f53516d documents LEONIDA_BEFORE_EXECUTE_COALESCE (finding 3 is fixed) and
changes vk_gpu_profile_test.cpp, which I have not re-run.

Backend: every run here is the runtime/ loader (gta6rt.exe) with the D3D12 to Vulkan shims, not the separate
d3d12/ runtime. The run script sets LEONIDA_D3D12=vulkan, and each run log says so:
[rt] d3d12: Vulkan device: NVIDIA GeForce RTX 4070 Laptop GPU (maxPushConstantsSize: 256 bytes) and
[rt] d3d12_xs: D3D12XboxCreateDevice -> proxy ... (Vulkan device ...). The driver version appears as
cached calibration of NVIDIA 621.40 in the compile-gate line.

AI-assisted review (Claude Code, Claude Opus 5.5). GPU: NVIDIA GeForce RTX 4070 Laptop GPU 8 GB (Resizable BAR),
driver 621.40, Intel Core Ultra 7 155H, Windows 11, MSVC 14.44, Ninja RelWithDebInfo.

What was tested

  • main = 7ce011205, #2566 head = 232b4a1ee. Local branch test/2566-on-main = main + git merge --no-ff 232b4a1ee
    (merge commit 1d8304f76, not pushed).
  • One conflict, resolved by keeping both sides:
    • tools/vk_subgroup_info.py, query(): main added driver_version to the chosen tuple (barycentric fallback
      for old AMD drivers), #2566 added integer_dot. Resolution: the tuple carries both, in that order
      (..., driver, driver_version, integer_dot), and the unpacking takes both. python -I tools/vk_subgroup_info.py
      then prints "integer_dot_product": true and "barycentric_fallback": false on this GPU.
  • A = main build, B = merged build, B' = merged build + a local diagnostic patch (see "Root cause"), not part of
    the PR. Each side had its own build folder and its own copy of gta6rt.exe/pdb.

Root cause of the crash: the sparse arena takes no host-visible memory on NVIDIA

The run log of B, in order (no game content):

[rt] d3d12: V# bases: signed offsets from heap_base (29279 of 29279 modules sign-extend)
[rt] d3d12: GPU address arena: 1024 MiB of address range (LEONIDA_ARENA_MB 1024), sparse: memory bound in 2 MiB blocks as allocations need it
[rt] d3d12: GPU address arena: no memory for its first 448 KiB
[rt] d3d12: the GPU address arena could not be created
[rt] d3d12: page mirror off: no aliased strict sparse buffers; title-written addresses read as before
[rt] d3d12: pipelines need the GPU address arena (bufferDeviceAddress); stage 1
[rt] d3d12_xs: slot 67 call N failed with 0x80004001 (...)          <- 2690 such lines
[rt] d3d12: GraphicsCommandList::clear_unordered_access rejected a call (d3d12_com.cpp:1454): ...
[rt] XboxBvhBuilder shim: RehydrateRaytracingAccelerationStructureBatched2X: ScratchAccelerationStructureData is 0 ...
[rt] d3d12: ExecuteCommandLists: list 8 is invalid; refusing batch
[rt] unhandled exception 0xc0000005 ...

Windows' crash record: faulting module "unknown", fault offset ending in ...65ff (same as on the previous head
cd8b5632b, 2 runs). The slot-67 E_NOTIMPL comes from create_compute (d3d12_vulkan_device.cpp:18427-18429):
!device_.arena_ready() -> stream_unsupported(...); graphics PSOs take the same exit (:17577, the "stage 1" line). So every compute PSO, heap and scratch buffer fails, and the
title eventually uses something it did not get (the exact faulting object is a hypothesis; the cascade is not).

Why the arena fails: create_arena() picks a sparse arena whenever the device can bind sparse buffers on a spare
queue and every module sign-extends V# bases (d3d12_vulkan_device.cpp:21983-21995). Each 2 MiB unit is then
allocated with kArenaRequiredMemory = HOST_VISIBLE | HOST_COHERENT and mapped (hooks.make,
d3d12_vulkan_device.cpp:22078-22101). On NVIDIA 621.40, a buffer created with SPARSE_BINDING | SPARSE_RESIDENCY
reports memoryTypeBits = 0x2, a single type that is not host-visible, so the first block cannot be allocated
and the function returns false with no fallback (d3d12_vulkan_device.cpp:22173-22184). The comment at
d3d12_vulkan_device.cpp:22044-22045 ("A sparse arena's memory comes in blocks, which any heap holds") does not
hold here.

The PR's own GPU test shows it without the game: arena_sparse_gpu fails at
arena_sparse_gpu_test.cpp:184 (type != UINT32_MAX): its pick_type finds no host-visible type in the sparse
buffer's memoryTypeBits on this GPU.

It is not the shader pack: the pack used by both sides declares vsharp_base_sign_extended on all 29,279 modules
(the log line above), has no writes_buffer / tsharp_index keys (so ShaderLibrary keeps the conservative paths,
shader_library.h WritesBufferCensus / TsharpIndexCensus), and the arena is created before any shader matters.
A retranslation with the PR's translator would not change the memory types the driver reports.

Check used for B' (local only, 25 lines, not proposed as is): in create_arena(), before deciding sparse,
create a 2 MiB sparse probe buffer and keep the sparse arena only if its memoryTypeBits contains a
kArenaRequiredMemory type; otherwise one allocation. With it the log reads
sparse buffers take no host-visible coherent memory (memoryTypeBits 0x2): one allocation, then
page mirror off: the arena is one allocation, and the run has 0 slot-67 failures and no crash. Note that this
also turns PageMirror off (it needs the sparse arena), so B' measures the rest of the PR, not PageMirror.

ctest (same exclusion on both sides: the tests that launch gta6rt against the game)

main 7ce011205 merged 1d8304f76
result 483 / 484 passed 480 / 504 passed
failures xbox_present (also fails on main) 24 (23 new)

New failures with the merged build, grouped by what the output says:

  • Arena / sparse memory type (same root cause as the crash): arena_sparse_gpu (line 184, no host-visible type),
    vk_heap_alias (line 186, home_info.memoryTypeIndex != UINT32_MAX), vk_title_mirror (line 257, mirror cover),
    d3d12_title_va_game_device and d3d12_geometry_views_game_device (line 1823, arena.size != 0),
    d3d12_texture_tiles (line 109, CreateHeap), d3d12_placed_dimensions (CreateHeap ... failed (0x80004001)),
    d3d12_placed_heap_lifetime (CreateHeap), d3d12_heap_properties (line 420, mismatches),
    d3d12_dxr_validation, d3d12_dxr_validation_khr (BLAS+TLAS execution failed), d3d12_xdxr_rt (Close returns
    E_INVALIDARG), xbox_bvh_builder (batched builds did not complete), d3d12_vulkan_device
    (ExecuteCommandLists failed: invalid copy or resolve), d3d12_com (line 244), d3d12_method_variants.
    Hypothesis: most of these pass once the arena falls back to one allocation; I did not rebuild the whole test
    set with the B' patch.
  • gta6rt_no_tls_callbacks: gta6rt.exe has the C++ runtime's thread_local callbacks (__dyn_tls_init/__dyn_tls_dtor).
    This is the trap in AGENTS.md ("No thread_local with a destructor in gta6rt.exe"); see the code findings.
  • Timing / present: d3d12_m4_compute_async_small_waits hits the 900 s timeout (2.05 s on main),
    vk_gpu_profile (line 310, e->ms > 0 && e->ms < 2000), vk_presenter_sync (line 406), d3d12_present.
    Not investigated further; the first one may also follow from the arena (hypothesis).

Python, on the merged tree: the PR's 31 new or changed test files (unittest, one file at a time),
tests/test_docs_env_vars.py and the full translator suite scripts/run_semantic_tests.py tests/semantic
(529 files, 6,563 tests, 951 s on 22 jobs): one failing file, test_valu_cvt_f16_int16_mods (2 subtests, Unsupported not raised), which fails
the same way on main; everything else passes, including all the PR's new semantic files. The six top-level files
the PR touches (test_absent_lane_gpu (2 skipped: no GPU harness), test_desc_cache, test_f64_float_controls,
test_image_load_typed, test_make_game_translator_flags, test_vk_subgroup_info) pass.
tests/test_translate.py needs pytest and was not run. test_docs_env_vars fails on both trees:
on main for LEONIDA_CLWB_PATCH (from #2559, not this PR); the merge adds LEONIDA_BEFORE_EXECUTE_COALESCE
(read at d3d12_vulkan_device.cpp:21076, documented in no .md).

Game A/B (one variable: the build), warm pipeline caches

Same script on every side (run_2566.ps1: 600 s, LEONIDA_ARENA_MB=1024, LEONIDA_STACKS=345,420, the same
shader pack, NVIDIA cache and input script; full env list at the end), except that each side has its own
persistent pipeline cache
(a copy of the shared one). Warm-up runs were repeated per side until a run made no
more than a handful of pipeline-cache misses; one was enough on each side:

run pipeline creates cache misses (hit=0)
A warm-up 1 1,493 3
B' warm-up 1 1,463 1
A measured 1,482 1
B' measured 1,475 1

(The cold runs below were already nearly warm: 1,480 / 1,483 creates with 1 miss each.) One gta6rt at a time,
closed after each run. B (the merged build unpatched) is not in the warm table: it crashes the same way every time.

warm, measured run A: main B': merged + arena fallback
end of run 600 s (stopped by the script) 600 s (stopped)
submissions/s t=60-100 66.1 79.3
submissions/s t=100-200 41.4 45.9
submissions/s t=200-299 3.71 2.75
submissions/s t=300-440 (min) 1.64 (0.34) 1.57 (0.44)
submissions/s t=440-610 1.17 1.15
submissions in all 9,855 11,385
frames/s t=60-100 (mean) 33.0 39.6
frames/s t=440-610 (mean) 0.07 0.08
window not responding (first) t=273 (12 checks) t=242 (13 checks)
not done within 250 ms lines 9 0
gpu-stall / device-stall 20 / 2 (first ticket submitted t=262) 57 / 3 (first t=220)
OUT_OF_DEVICE_MEMORY / device lost / crash 0 / 0 / 0 0 / 0 / 0
list-value gates held / met / released unmet 146 / 140 / 0 355 / 327 / 0
peak memory allocated (mem-probe) 12,222 MiB 11,635 MiB

Frame times per phase. The log has no per-present timestamps, only one [rt] submit phases t=Ns: ... in D s ..., F frames/s line per window of about 5 s. Mean = total time / total frames over the phase (sum of D / sum of F x D),
median = median over the windows of 1000 / F. A window with no frame counts as longer than any other, so "> 5 s"
means that most windows of the phase had no frame at all. There are no scene markers in the log, so the phases are
time ranges: t=60-100 is before the world, the world is entered around t=200-300.

warm, frame time: mean / median (windows, windows with 0 frames) A: main B'
t=60-100 30 / 30 ms (8, 0) 25 / 25 ms (8, 0)
t=100-200 48 / 47 ms (20, 0) 44 / 33 ms (20, 0)
t=200-299 599 / 457 ms (14, 2) 1,219 / 5,132 ms (12, 3)
t=300-440 17.1 s / > 5 s (17, 9) 15.8 s / 14.3 s (12, 4)
t=440-610 24.2 s / > 5 s (16, 9) 22.0 s / > 5 s (17, 9)

Reading:

  • Before the world (t=60-200), B' submits 10-20 % more per second than A and draws more frames (39.6 vs 33.0 fps
    at t=60-100). Run to run spread is of the same order (B' warm-up: 79.0 / 38.0 subs/s; A warm-up: 71.6 / 45.0), so
    only the t=60-100 gain is consistent over the four warm runs.
  • At world entry both stall the same way: from t ≈ 240-270 the window stops answering and the rate falls to ~1-2
    submissions/s, under 0.1 fps. B' has no not done within 250 ms (the CPU-side wait in
    write_staged_title_image is gone, as the PR intends) but about three times as many gpu-stall lines (57 vs 20)
    starting earlier: the time moved to the GPU, it did not go away.
  • Stacks at t=345 and t=420 of the warm runs: on both sides no runtime thread is in a GPU wait or in the texture
    refresh; the queue watchers report no GPU progress (watch_queue_progress, gpu-stall lines). Both are GPU-bound
    there.

Cold runs (first builds, shared pipeline cache), kept for reference; B is the merged build unpatched:

A: main B: merged B': merged + arena fallback
end of run 600 s (stopped by the script) crash 0xc0000005 at t ≈ 180 s 600 s (stopped)
submissions/s t=60-100 63.2 295.1 (nothing builds) 83.3
submissions/s t=100-200 30.8 39.6 51.8
submissions/s t=200-299 4.43 - 2.93
submissions/s t=300-440 (min) 1.82 (0.13) - 1.27 (0.31)
submissions/s t=440-610 1.46 - 1.19
submissions in all 8,975 32,342 (to t=179) 12,212
frames/s t=60-100 (mean) 31.5 147.7 41.6
frames/s at the end 0.20 (t=602) 0.77 (t=179) 0.19 (t=601)
window not responding (first) t=274 (12 checks) t=182 (just before the crash) t=212 (14 checks)
not done within 250 ms lines 10 0 0
gpu-stall / device-stall 23 / 2 (first t=270) 0 / 0 52 / 8 (first t=223)
OUT_OF_DEVICE_MEMORY / device lost 0 / 0 0 / 0 0 / 0
list-value gates held / met / released unmet 174 / 159 / 0 - 323 / 295 / 0
slot 67 ... failed with 0x80004001 0 2,690 0
peak device memory allocated (mem-probe) 14,277 MiB 8,094 MiB (t=174) 14,834 MiB

Cold frame times, same method (mean / median, windows, windows with 0 frames):

cold A: main B: merged B'
t=60-100 32 / 30 ms (8, 0) 7 / 6 ms (8, 0; nothing builds) 24 / 24 ms (8, 0)
t=100-200 65 / 59 ms (20, 0) 51 / 230 ms (16, 0; up to the crash) 39 / 33 ms (20, 0)
t=200-299 499 / 391 ms (15, 2) - 1,147 / 5,409 ms (12, 3)
t=300-440 15.3 s / 12.5 s (17, 8) - 19.5 s / 20.0 s (11, 4)
t=440-610 18.3 s / > 5 s (18, 9) - 20.9 s / > 5 s (16, 8)

In the cold B' run, t=345 showed a title thread in slot 70 (proxy_create_placed_view_x ->
write_placed_texture_view, d3d12_vulkan_device.cpp:29168) blocked on a std::mutex while the releaser was in
release_held -> drain_held_while_executing -> execute_now -> refresh_title_textures
(d3d12_vulkan_device.cpp:23307) -> TitleReadPool::run (:24645), and cold A showed the known
write_staged_title_image -> wait_submitted_locked (vulkan_backend.h:1677) wait. Neither shape came back in the
warm runs, so I do not draw a conclusion from them.

So on this 8 GB NVIDIA laptop: the PR (minus PageMirror) gives a modest gain before the world, does not fix the
world-entry stall, and makes GPU stalls more frequent. PageMirror itself could not be measured here.

Code findings

  1. Sparse arena without a host-visible type has no fallback (d3d12_vulkan_device.cpp:21983-21995,
    22078-22101, 22173-22184). Either check the sparse buffer's memoryTypeBits against kArenaRequiredMemory
    before choosing sparse (the B' check above), or retry create_arena() non-sparse when the first unit fails.
    Without one of them, Windows NVIDIA (and any driver that keeps sparse memory device-local only) loses the arena,
    every pipeline, and the run. arena_sparse_gpu_test.cpp:184 should SKIP (as the runtime would fall back), not
    fail, on such a device.
  2. thread_local with destructors in gta6rt.exe (AGENTS.md, Runtime traps), caught by
    gta6rt_no_tls_callbacks:
    • d3d12_vulkan_device.cpp:4615 static thread_local std::vector<std::pair<const DeviceState*, std::uint64_t>> stack;
      (write_back_exec_stack()). main had a plain aggregate here on purpose, with the comment "A std::vector here
      made the title's CRT abort at startup"; the merge removes that comment.
    • d3d12_vulkan_device.cpp:8286 (std::unique_ptr<FilterPageCache>), :8406 (std::unique_ptr<std::uint8_t[]>),
      :8893 (std::vector<PageWork>), :8932 (std::vector<std::uint8_t>), :24469 (std::vector<std::uint8_t>).
      The runs here did not abort at startup, but the test fails and AGENTS.md documents an 0xC0000409 abort before
      the first frame from exactly this. Fixed-size plain-data thread_locals, members of the worker objects, or
      per-call scratch would avoid it.
  3. Undocumented env var: LEONIDA_BEFORE_EXECUTE_COALESCE (d3d12_vulkan_device.cpp:21076) needs a row in
    runtime/README.md (tests/test_docs_env_vars.py).
  4. Removed env vars (no longer read): LEONIDA_VALUE_WAIT_TIMEOUT_MS, LEONIDA_TITLE_EVERY_BUDGET_US,
    LEONIDA_TEXTURE_REFRESH_ASYNC, LEONIDA_TITLE_TEXTURE_FILL_MS/MB, LEONIDA_TITLE_TEXTURE_PERIOD_MS,
    LEONIDA_TITLE_TEXTURE_CHECK_KB, LEONIDA_TITLE_VIEW_REFRESH_MS, LEONIDA_TEXTURE_HASH_BUDGET_US,
    LEONIDA_TEXTURE_SWEEP_BUDGET_US, LEONIDA_ORDER_TEXTURE_UPLOADS. The README rows are gone, good; people's run
    scripts still set some of them (ours did), so a line in the description listing them would help.
  5. LEONIDA_TITLE_HEAP README row (runtime/README.md:419) still says "unset / 1 makes ...", while the code
    reads it as on by default, 0 off (shims/xmem.cpp:84, :110, :161). Pre-existing on main, but the PR
    changes what the heap is (now in the page mirror's range), so the row is worth fixing here.
  6. Scope. 165 files and ~53k added lines (translator, runtime, tests) in one PR make a regression like (1)
    hard to bisect. The arena backing + PageMirror part could go first, separately from the translator rules and the
    submission/coalescing work, each with its own A/B.

Suggestions

  • Fix (1) and (2), then I can rerun the same A/B here with PageMirror actually on (if the driver allows a sparse
    arena at all; if not, PageMirror is off on Windows NVIDIA and the description should say so).
  • Add the Windows / NVIDIA result to "GPUs tested"; all measurements in the description are RADV.
  • The world-entry stall on this machine is GPU-side in B' (more gpu-stall); per-pipeline GPU times with
    LEONIDA_GPU_PROFILE would show which work grew.

Not done

  • Shader retranslation with the PR's translator (estimated ~1-1.5 h on 12 processes from a timed 1/130 slice:
    204 shaders in 193 s on one core). Not needed for the crash, which happens before shaders matter; it would only
    affect the B' numbers through the new translator rules.
  • Aslan's own settings (LEONIDA_ARENA_MB=4095, LEONIDA_SUBMIT_ASYNC=4, ...): not run; both sides used the
    recipe above.

Env of every run: LEONIDA_VALUE_WAIT_TIMEOUT_MS=30000 LEONIDA_MAP_READBACK=1 LEONIDA_HOST_IMAGE_COPY=0 LEONIDA_DEVICE_TYPE=6 LEONIDA_SERIAL_BIG_COMPILES=0 LEONIDA_PIPELINE_PREWARM_ORDER=1 LEONIDA_MEM_PROBE=10 LEONIDA_TRACE_XGAMESAVE=1 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_TITLE_WATCHDOG_KICK=<2 addresses> LEONIDA_DEVICE_FAULT=1 LEONIDA_STACKS=345,420 LEONIDA_ASYNC_PIPELINES=1 LEONIDA_REFRESH_MAPPED_TEXTURES=0 LEONIDA_TITLE_EVERY_BUDGET_US=4000 LEONIDA_DEVICE_FAULT_ROOTS=1 LEONIDA_STARTUP_CACHE_CHECKPOINTS=1 LEONIDA_PIPELINE_CACHE_DIR=<shared folder (cold runs) / one copy per side (warm runs)> LEONIDA_TRACE_PIPELINE_COMPILE=1 LEONIDA_COMPUTE_WARMUP=0 LEONIDA_GEOMETRY_MB=6144 LEONIDA_GEOMETRY_HOST=1 LEONIDA_DEBUG_TIME_SHADER=<one shader> LEONIDA_ARENA_MB=1024. LEONIDA_VALUE_WAIT_TIMEOUT_MS and
LEONIDA_TITLE_EVERY_BUDGET_US are ignored by the merged build. LEONIDA_PAGE_MIRROR, LEONIDA_GPU_DETILE,
LEONIDA_BEFORE_EXECUTE_COALESCE unset (defaults: on).

**@⁠OreoFR** on GitHub · 2026-11-28 15:43 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7241687969) ## Review of #2566 on Windows / NVIDIA (RTX 4070 Laptop 8 GB): crashes before world entry; root cause found (sparse arena memory type) **Verdict: request changes.** On this machine the PR does not run: the GPU address arena cannot be created, so every pipeline and heap creation fails and the title crashes with `0xc0000005` at about t = 180 s (3 runs out of 3, two heads). The cause is a one-line assumption in the new sparse arena (details below), not the shader pack. With a local 25-line fallback to the one-allocation arena, the PR runs 600 s without a crash, but it does **not** improve the world-entry stall compared with raw `main` on this machine (table below). The ctest suite has 23 new failures here, most of them the same arena problem, plus a real `gta6rt_no_tls_callbacks` regression. Head note: tested at `232b4a1ee`. The PR has since moved to `a8b1abe4c` (a merge of `main` plus `d1f53516d`, CI and docs fixes). Between the two heads `runtime/shims/` is unchanged, so the arena crash, the `thread_local` findings and the game numbers still apply; `d1f53516d` documents `LEONIDA_BEFORE_EXECUTE_COALESCE` (finding 3 is fixed) and changes `vk_gpu_profile_test.cpp`, which I have not re-run. Backend: every run here is the `runtime/` loader (`gta6rt.exe`) with the D3D12 to Vulkan shims, not the separate `d3d12/` runtime. The run script sets `LEONIDA_D3D12=vulkan`, and each run log says so: `[rt] d3d12: Vulkan device: NVIDIA GeForce RTX 4070 Laptop GPU (maxPushConstantsSize: 256 bytes)` and `[rt] d3d12_xs: D3D12XboxCreateDevice -> proxy ... (Vulkan device ...)`. The driver version appears as `cached calibration of NVIDIA 621.40` in the `compile-gate` line. AI-assisted review (Claude Code, Claude Opus 5.5). GPU: NVIDIA GeForce RTX 4070 Laptop GPU 8 GB (Resizable BAR), driver 621.40, Intel Core Ultra 7 155H, Windows 11, MSVC 14.44, Ninja RelWithDebInfo. ### What was tested - `main` = `7ce011205`, #2566 head = `232b4a1ee`. Local branch `test/2566-on-main` = `main` + `git merge --no-ff 232b4a1ee` (merge commit `1d8304f76`, not pushed). - One conflict, resolved by keeping both sides: - `tools/vk_subgroup_info.py`, `query()`: `main` added `driver_version` to the `chosen` tuple (barycentric fallback for old AMD drivers), #2566 added `integer_dot`. Resolution: the tuple carries both, in that order (`..., driver, driver_version, integer_dot`), and the unpacking takes both. `python -I tools/vk_subgroup_info.py` then prints `"integer_dot_product": true` and `"barycentric_fallback": false` on this GPU. - A = `main` build, B = merged build, B' = merged build + a local diagnostic patch (see "Root cause"), not part of the PR. Each side had its own build folder and its own copy of `gta6rt.exe`/pdb. ### Root cause of the crash: the sparse arena takes no host-visible memory on NVIDIA The run log of B, in order (no game content): ``` [rt] d3d12: V# bases: signed offsets from heap_base (29279 of 29279 modules sign-extend) [rt] d3d12: GPU address arena: 1024 MiB of address range (LEONIDA_ARENA_MB 1024), sparse: memory bound in 2 MiB blocks as allocations need it [rt] d3d12: GPU address arena: no memory for its first 448 KiB [rt] d3d12: the GPU address arena could not be created [rt] d3d12: page mirror off: no aliased strict sparse buffers; title-written addresses read as before [rt] d3d12: pipelines need the GPU address arena (bufferDeviceAddress); stage 1 [rt] d3d12_xs: slot 67 call N failed with 0x80004001 (...) <- 2690 such lines [rt] d3d12: GraphicsCommandList::clear_unordered_access rejected a call (d3d12_com.cpp:1454): ... [rt] XboxBvhBuilder shim: RehydrateRaytracingAccelerationStructureBatched2X: ScratchAccelerationStructureData is 0 ... [rt] d3d12: ExecuteCommandLists: list 8 is invalid; refusing batch [rt] unhandled exception 0xc0000005 ... ``` Windows' crash record: faulting module "unknown", fault offset ending in `...65ff` (same as on the previous head `cd8b5632b`, 2 runs). The slot-67 `E_NOTIMPL` comes from `create_compute` (`d3d12_vulkan_device.cpp:18427-18429`): `!device_.arena_ready()` -> `stream_unsupported(...)`; graphics PSOs take the same exit (`:17577`, the "stage 1" line). So every compute PSO, heap and scratch buffer fails, and the title eventually uses something it did not get (the exact faulting object is a hypothesis; the cascade is not). Why the arena fails: `create_arena()` picks a sparse arena whenever the device can bind sparse buffers on a spare queue and every module sign-extends V# bases (`d3d12_vulkan_device.cpp:21983-21995`). Each 2 MiB unit is then allocated with `kArenaRequiredMemory` = `HOST_VISIBLE | HOST_COHERENT` and mapped (`hooks.make`, `d3d12_vulkan_device.cpp:22078-22101`). On NVIDIA 621.40, a buffer created with `SPARSE_BINDING | SPARSE_RESIDENCY` reports **`memoryTypeBits = 0x2`**, a single type that is not host-visible, so the first block cannot be allocated and the function returns `false` with no fallback (`d3d12_vulkan_device.cpp:22173-22184`). The comment at `d3d12_vulkan_device.cpp:22044-22045` ("A sparse arena's memory comes in blocks, which any heap holds") does not hold here. The PR's own GPU test shows it without the game: `arena_sparse_gpu` fails at `arena_sparse_gpu_test.cpp:184` (`type != UINT32_MAX`): its `pick_type` finds no host-visible type in the sparse buffer's `memoryTypeBits` on this GPU. It is not the shader pack: the pack used by both sides declares `vsharp_base_sign_extended` on all 29,279 modules (the log line above), has no `writes_buffer` / `tsharp_index` keys (so `ShaderLibrary` keeps the conservative paths, `shader_library.h` `WritesBufferCensus` / `TsharpIndexCensus`), and the arena is created before any shader matters. A retranslation with the PR's translator would not change the memory types the driver reports. **Check used for B' (local only, 25 lines, not proposed as is):** in `create_arena()`, before deciding `sparse`, create a 2 MiB sparse probe buffer and keep the sparse arena only if its `memoryTypeBits` contains a `kArenaRequiredMemory` type; otherwise one allocation. With it the log reads `sparse buffers take no host-visible coherent memory (memoryTypeBits 0x2): one allocation`, then `page mirror off: the arena is one allocation`, and the run has 0 slot-67 failures and no crash. Note that this also turns PageMirror off (it needs the sparse arena), so B' measures the rest of the PR, not PageMirror. ### ctest (same exclusion on both sides: the tests that launch `gta6rt` against the game) | | `main` `7ce011205` | merged `1d8304f76` | |---|---|---| | result | 483 / 484 passed | 480 / 504 passed | | failures | `xbox_present` (also fails on `main`) | 24 (23 new) | New failures with the merged build, grouped by what the output says: - **Arena / sparse memory type (same root cause as the crash):** `arena_sparse_gpu` (line 184, no host-visible type), `vk_heap_alias` (line 186, `home_info.memoryTypeIndex != UINT32_MAX`), `vk_title_mirror` (line 257, mirror cover), `d3d12_title_va_game_device` and `d3d12_geometry_views_game_device` (line 1823, `arena.size != 0`), `d3d12_texture_tiles` (line 109, `CreateHeap`), `d3d12_placed_dimensions` (`CreateHeap ... failed (0x80004001)`), `d3d12_placed_heap_lifetime` (`CreateHeap`), `d3d12_heap_properties` (line 420, mismatches), `d3d12_dxr_validation`, `d3d12_dxr_validation_khr` (BLAS+TLAS execution failed), `d3d12_xdxr_rt` (`Close` returns `E_INVALIDARG`), `xbox_bvh_builder` (batched builds did not complete), `d3d12_vulkan_device` (`ExecuteCommandLists failed: invalid copy or resolve`), `d3d12_com` (line 244), `d3d12_method_variants`. Hypothesis: most of these pass once the arena falls back to one allocation; I did not rebuild the whole test set with the B' patch. - **`gta6rt_no_tls_callbacks`**: `gta6rt.exe has the C++ runtime's thread_local callbacks (__dyn_tls_init/__dyn_tls_dtor)`. This is the trap in AGENTS.md ("No `thread_local` with a destructor in `gta6rt.exe`"); see the code findings. - **Timing / present:** `d3d12_m4_compute_async_small_waits` hits the 900 s timeout (2.05 s on `main`), `vk_gpu_profile` (line 310, `e->ms > 0 && e->ms < 2000`), `vk_presenter_sync` (line 406), `d3d12_present`. Not investigated further; the first one may also follow from the arena (hypothesis). Python, on the merged tree: the PR's 31 new or changed test files (unittest, one file at a time), `tests/test_docs_env_vars.py` and the full translator suite `scripts/run_semantic_tests.py tests/semantic` (529 files, 6,563 tests, 951 s on 22 jobs): one failing file, `test_valu_cvt_f16_int16_mods` (2 subtests, `Unsupported not raised`), which fails the same way on `main`; everything else passes, including all the PR's new semantic files. The six top-level files the PR touches (`test_absent_lane_gpu` (2 skipped: no GPU harness), `test_desc_cache`, `test_f64_float_controls`, `test_image_load_typed`, `test_make_game_translator_flags`, `test_vk_subgroup_info`) pass. `tests/test_translate.py` needs pytest and was not run. `test_docs_env_vars` fails on both trees: on `main` for `LEONIDA_CLWB_PATCH` (from #2559, not this PR); the merge adds `LEONIDA_BEFORE_EXECUTE_COALESCE` (read at `d3d12_vulkan_device.cpp:21076`, documented in no `.md`). ### Game A/B (one variable: the build), warm pipeline caches Same script on every side (`run_2566.ps1`: 600 s, `LEONIDA_ARENA_MB=1024`, `LEONIDA_STACKS=345,420`, the same shader pack, NVIDIA cache and input script; full env list at the end), except that each side has its **own persistent pipeline cache** (a copy of the shared one). Warm-up runs were repeated per side until a run made no more than a handful of pipeline-cache misses; one was enough on each side: | run | pipeline creates | cache misses (`hit=0`) | |---|---|---| | A warm-up 1 | 1,493 | 3 | | B' warm-up 1 | 1,463 | 1 | | A measured | 1,482 | 1 | | B' measured | 1,475 | 1 | (The cold runs below were already nearly warm: 1,480 / 1,483 creates with 1 miss each.) One `gta6rt` at a time, closed after each run. B (the merged build unpatched) is not in the warm table: it crashes the same way every time. | warm, measured run | A: `main` | B': merged + arena fallback | |---|---|---| | end of run | 600 s (stopped by the script) | 600 s (stopped) | | submissions/s t=60-100 | 66.1 | 79.3 | | submissions/s t=100-200 | 41.4 | 45.9 | | submissions/s t=200-299 | 3.71 | 2.75 | | submissions/s t=300-440 (min) | 1.64 (0.34) | 1.57 (0.44) | | submissions/s t=440-610 | 1.17 | 1.15 | | submissions in all | 9,855 | 11,385 | | frames/s t=60-100 (mean) | 33.0 | 39.6 | | frames/s t=440-610 (mean) | 0.07 | 0.08 | | window not responding (first) | t=273 (12 checks) | t=242 (13 checks) | | `not done within 250 ms` lines | 9 | 0 | | `gpu-stall` / `device-stall` | 20 / 2 (first ticket submitted t=262) | 57 / 3 (first t=220) | | `OUT_OF_DEVICE_MEMORY` / device lost / crash | 0 / 0 / 0 | 0 / 0 / 0 | | list-value gates held / met / released unmet | 146 / 140 / 0 | 355 / 327 / 0 | | peak memory allocated (mem-probe) | 12,222 MiB | 11,635 MiB | Frame times per phase. The log has no per-present timestamps, only one `[rt] submit phases t=Ns: ... in D s ..., F frames/s` line per window of about 5 s. Mean = total time / total frames over the phase (sum of D / sum of F x D), median = median over the windows of 1000 / F. A window with no frame counts as longer than any other, so "> 5 s" means that most windows of the phase had no frame at all. There are no scene markers in the log, so the phases are time ranges: t=60-100 is before the world, the world is entered around t=200-300. | warm, frame time: mean / median (windows, windows with 0 frames) | A: `main` | B' | |---|---|---| | t=60-100 | 30 / 30 ms (8, 0) | 25 / 25 ms (8, 0) | | t=100-200 | 48 / 47 ms (20, 0) | 44 / 33 ms (20, 0) | | t=200-299 | 599 / 457 ms (14, 2) | 1,219 / 5,132 ms (12, 3) | | t=300-440 | 17.1 s / > 5 s (17, 9) | 15.8 s / 14.3 s (12, 4) | | t=440-610 | 24.2 s / > 5 s (16, 9) | 22.0 s / > 5 s (17, 9) | Reading: - Before the world (t=60-200), B' submits 10-20 % more per second than A and draws more frames (39.6 vs 33.0 fps at t=60-100). Run to run spread is of the same order (B' warm-up: 79.0 / 38.0 subs/s; A warm-up: 71.6 / 45.0), so only the t=60-100 gain is consistent over the four warm runs. - At world entry both stall the same way: from t ≈ 240-270 the window stops answering and the rate falls to ~1-2 submissions/s, under 0.1 fps. B' has no `not done within 250 ms` (the CPU-side wait in `write_staged_title_image` is gone, as the PR intends) but about three times as many `gpu-stall` lines (57 vs 20) starting earlier: the time moved to the GPU, it did not go away. - Stacks at t=345 and t=420 of the warm runs: on both sides no runtime thread is in a GPU wait or in the texture refresh; the queue watchers report no GPU progress (`watch_queue_progress`, gpu-stall lines). Both are GPU-bound there. Cold runs (first builds, shared pipeline cache), kept for reference; B is the merged build unpatched: | | A: `main` | B: merged | B': merged + arena fallback | |---|---|---|---| | end of run | 600 s (stopped by the script) | crash `0xc0000005` at t ≈ 180 s | 600 s (stopped) | | submissions/s t=60-100 | 63.2 | 295.1 (nothing builds) | 83.3 | | submissions/s t=100-200 | 30.8 | 39.6 | 51.8 | | submissions/s t=200-299 | 4.43 | - | 2.93 | | submissions/s t=300-440 (min) | 1.82 (0.13) | - | 1.27 (0.31) | | submissions/s t=440-610 | 1.46 | - | 1.19 | | submissions in all | 8,975 | 32,342 (to t=179) | 12,212 | | frames/s t=60-100 (mean) | 31.5 | 147.7 | 41.6 | | frames/s at the end | 0.20 (t=602) | 0.77 (t=179) | 0.19 (t=601) | | window not responding (first) | t=274 (12 checks) | t=182 (just before the crash) | t=212 (14 checks) | | `not done within 250 ms` lines | 10 | 0 | 0 | | `gpu-stall` / `device-stall` | 23 / 2 (first t=270) | 0 / 0 | 52 / 8 (first t=223) | | `OUT_OF_DEVICE_MEMORY` / device lost | 0 / 0 | 0 / 0 | 0 / 0 | | list-value gates held / met / released unmet | 174 / 159 / 0 | - | 323 / 295 / 0 | | `slot 67 ... failed with 0x80004001` | 0 | 2,690 | 0 | | peak device memory allocated (mem-probe) | 14,277 MiB | 8,094 MiB (t=174) | 14,834 MiB | Cold frame times, same method (mean / median, windows, windows with 0 frames): | cold | A: `main` | B: merged | B' | |---|---|---|---| | t=60-100 | 32 / 30 ms (8, 0) | 7 / 6 ms (8, 0; nothing builds) | 24 / 24 ms (8, 0) | | t=100-200 | 65 / 59 ms (20, 0) | 51 / 230 ms (16, 0; up to the crash) | 39 / 33 ms (20, 0) | | t=200-299 | 499 / 391 ms (15, 2) | - | 1,147 / 5,409 ms (12, 3) | | t=300-440 | 15.3 s / 12.5 s (17, 8) | - | 19.5 s / 20.0 s (11, 4) | | t=440-610 | 18.3 s / > 5 s (18, 9) | - | 20.9 s / > 5 s (16, 8) | In the cold B' run, t=345 showed a title thread in slot 70 (`proxy_create_placed_view_x` -> `write_placed_texture_view`, `d3d12_vulkan_device.cpp:29168`) blocked on a `std::mutex` while the releaser was in `release_held` -> `drain_held_while_executing` -> `execute_now` -> `refresh_title_textures` (`d3d12_vulkan_device.cpp:23307`) -> `TitleReadPool::run` (`:24645`), and cold A showed the known `write_staged_title_image` -> `wait_submitted_locked` (`vulkan_backend.h:1677`) wait. Neither shape came back in the warm runs, so I do not draw a conclusion from them. So on this 8 GB NVIDIA laptop: the PR (minus PageMirror) gives a modest gain before the world, does not fix the world-entry stall, and makes GPU stalls more frequent. PageMirror itself could not be measured here. ### Code findings 1. **Sparse arena without a host-visible type has no fallback** (`d3d12_vulkan_device.cpp:21983-21995`, `22078-22101`, `22173-22184`). Either check the sparse buffer's `memoryTypeBits` against `kArenaRequiredMemory` before choosing sparse (the B' check above), or retry `create_arena()` non-sparse when the first unit fails. Without one of them, Windows NVIDIA (and any driver that keeps sparse memory device-local only) loses the arena, every pipeline, and the run. `arena_sparse_gpu_test.cpp:184` should `SKIP` (as the runtime would fall back), not fail, on such a device. 2. **`thread_local` with destructors in `gta6rt.exe`** (AGENTS.md, Runtime traps), caught by `gta6rt_no_tls_callbacks`: - `d3d12_vulkan_device.cpp:4615` `static thread_local std::vector<std::pair<const DeviceState*, std::uint64_t>> stack;` (`write_back_exec_stack()`). `main` had a plain aggregate here on purpose, with the comment "A std::vector here made the title's CRT abort at startup"; the merge removes that comment. - `d3d12_vulkan_device.cpp:8286` (`std::unique_ptr<FilterPageCache>`), `:8406` (`std::unique_ptr<std::uint8_t[]>`), `:8893` (`std::vector<PageWork>`), `:8932` (`std::vector<std::uint8_t>`), `:24469` (`std::vector<std::uint8_t>`). The runs here did not abort at startup, but the test fails and AGENTS.md documents an `0xC0000409` abort before the first frame from exactly this. Fixed-size plain-data `thread_local`s, members of the worker objects, or per-call scratch would avoid it. 3. **Undocumented env var:** `LEONIDA_BEFORE_EXECUTE_COALESCE` (`d3d12_vulkan_device.cpp:21076`) needs a row in `runtime/README.md` (`tests/test_docs_env_vars.py`). 4. **Removed env vars** (no longer read): `LEONIDA_VALUE_WAIT_TIMEOUT_MS`, `LEONIDA_TITLE_EVERY_BUDGET_US`, `LEONIDA_TEXTURE_REFRESH_ASYNC`, `LEONIDA_TITLE_TEXTURE_FILL_MS/MB`, `LEONIDA_TITLE_TEXTURE_PERIOD_MS`, `LEONIDA_TITLE_TEXTURE_CHECK_KB`, `LEONIDA_TITLE_VIEW_REFRESH_MS`, `LEONIDA_TEXTURE_HASH_BUDGET_US`, `LEONIDA_TEXTURE_SWEEP_BUDGET_US`, `LEONIDA_ORDER_TEXTURE_UPLOADS`. The README rows are gone, good; people's run scripts still set some of them (ours did), so a line in the description listing them would help. 5. **`LEONIDA_TITLE_HEAP` README row** (`runtime/README.md:419`) still says "unset / `1` makes ...", while the code reads it as on by default, `0` off (`shims/xmem.cpp:84`, `:110`, `:161`). Pre-existing on `main`, but the PR changes what the heap is (now in the page mirror's range), so the row is worth fixing here. 6. **Scope.** 165 files and ~53k added lines (translator, runtime, tests) in one PR make a regression like (1) hard to bisect. The arena backing + PageMirror part could go first, separately from the translator rules and the submission/coalescing work, each with its own A/B. ### Suggestions - Fix (1) and (2), then I can rerun the same A/B here with PageMirror actually on (if the driver allows a sparse arena at all; if not, PageMirror is off on Windows NVIDIA and the description should say so). - Add the Windows / NVIDIA result to "GPUs tested"; all measurements in the description are RADV. - The world-entry stall on this machine is GPU-side in B' (more `gpu-stall`); per-pipeline GPU times with `LEONIDA_GPU_PROFILE` would show which work grew. ### Not done - Shader retranslation with the PR's translator (estimated ~1-1.5 h on 12 processes from a timed 1/130 slice: 204 shaders in 193 s on one core). Not needed for the crash, which happens before shaders matter; it would only affect the B' numbers through the new translator rules. - Aslan's own settings (`LEONIDA_ARENA_MB=4095`, `LEONIDA_SUBMIT_ASYNC=4`, ...): not run; both sides used the recipe above. Env of every run: `LEONIDA_VALUE_WAIT_TIMEOUT_MS=30000 LEONIDA_MAP_READBACK=1 LEONIDA_HOST_IMAGE_COPY=0 LEONIDA_DEVICE_TYPE=6 LEONIDA_SERIAL_BIG_COMPILES=0 LEONIDA_PIPELINE_PREWARM_ORDER=1 LEONIDA_MEM_PROBE=10 LEONIDA_TRACE_XGAMESAVE=1 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_TITLE_WATCHDOG_KICK=<2 addresses> LEONIDA_DEVICE_FAULT=1 LEONIDA_STACKS=345,420 LEONIDA_ASYNC_PIPELINES=1 LEONIDA_REFRESH_MAPPED_TEXTURES=0 LEONIDA_TITLE_EVERY_BUDGET_US=4000 LEONIDA_DEVICE_FAULT_ROOTS=1 LEONIDA_STARTUP_CACHE_CHECKPOINTS=1 LEONIDA_PIPELINE_CACHE_DIR=<shared folder (cold runs) / one copy per side (warm runs)> LEONIDA_TRACE_PIPELINE_COMPILE=1 LEONIDA_COMPUTE_WARMUP=0 LEONIDA_GEOMETRY_MB=6144 LEONIDA_GEOMETRY_HOST=1 LEONIDA_DEBUG_TIME_SHADER=<one shader> LEONIDA_ARENA_MB=1024`. `LEONIDA_VALUE_WAIT_TIMEOUT_MS` and `LEONIDA_TITLE_EVERY_BUDGET_US` are ignored by the merged build. `LEONIDA_PAGE_MIRROR`, `LEONIDA_GPU_DETILE`, `LEONIDA_BEFORE_EXECUTE_COALESCE` unset (defaults: on).
Author
Owner

@⁠Tauwni on GitHub · 2026-11-28 16:00 UTC · original

Your diagnostic patch, applied as is to a8b1abe4c on main 7ce011205, on the Mac under Wine (same setup as above). 3/3 runs, identical output (MEASURED):

step4 half-committed range prev16=3b cpu16=00 gpu16=00 cpuMismatch=00000000ffff0000 gpuMismatch=00000000ffff0000
step4 half-committed write-combined range prev16=3b cpu16=00 gpu16=00 cpuMismatch=00000000ffff0000 gpuMismatch=00000000ffff0000
step4 write-combined range prev16=3b cpu16=d0 gpu16=d0 cpuMismatch=0000000000000000 gpuMismatch=0000000000000000
step4 write-combined range, 64 bytes in prev16=3b cpu16=d0 gpu16=d0 cpuMismatch=0000000000000000 gpuMismatch=0000000000000000

So the discrepancy is already visible to the CPU: in both half-committed layouts, bytes 16-31 of the page read 00 after the writer thread joins and before submission, and the GPU readback matches the CPU exactly. Bytes 0-15 and 32-63 hold the writer's values. The fully committed layouts are right on both sides.

AI-assisted (Claude Code).

**@⁠Tauwni** on GitHub · 2026-11-28 16:00 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7241895744) Your diagnostic patch, applied as is to `a8b1abe4c` on `main` `7ce011205`, on the Mac under Wine (same setup as above). 3/3 runs, identical output (MEASURED): ``` step4 half-committed range prev16=3b cpu16=00 gpu16=00 cpuMismatch=00000000ffff0000 gpuMismatch=00000000ffff0000 step4 half-committed write-combined range prev16=3b cpu16=00 gpu16=00 cpuMismatch=00000000ffff0000 gpuMismatch=00000000ffff0000 step4 write-combined range prev16=3b cpu16=d0 gpu16=d0 cpuMismatch=0000000000000000 gpuMismatch=0000000000000000 step4 write-combined range, 64 bytes in prev16=3b cpu16=d0 gpu16=d0 cpuMismatch=0000000000000000 gpuMismatch=0000000000000000 ``` So the discrepancy is already visible to the CPU: in both half-committed layouts, bytes 16-31 of the page read `00` after the writer thread joins and before submission, and the GPU readback matches the CPU exactly. Bytes 0-15 and 32-63 hold the writer's values. The fully committed layouts are right on both sides. AI-assisted (Claude Code).
Author
Owner

@⁠DadaCap on GitHub · 2026-11-28 19:01 UTC · original

Review of #2566 on an RTX 5080: A/B against raw main

Tested at head 232b4a1ee. The PR has moved since, to a8b1abe4c, so the newer commits are not covered here.

Summary

  • NVIDIA blocker, now fixed locally.
    • The bug: #2566's sparse GPU address arena can't be created on NVIDIA. The sparse buffer allows only memoryTypeBits 0x2, which is device-local and has no HOST_VISIBLE | HOST_COHERENT type. Every pipeline is then refused (2,690 DeserializeComputePipelineStateX calls fail with 0x80004001), and the title stays on its first loading image. This happened in 3 runs out of 3 on our RTX 5080, and OreoFR saw the same on an RTX 4070.
    • The fix below: a fallback to the single-allocation arena when the sparse buffer can't be mapped. With it there are 0 refused pipelines, and the game runs normally.
  • Gains over raw main (4 warm runs per side):
    • No device loss: 0 in 7 runs with #2566, against 1 in 5 runs on raw main (at t≈124 s).
    • Graphics pipelines survive a crash or kill: #2566 writes its session pipeline cache during the run. Raw main writes pipeline_cache.session.bin only on a clean exit (d3d12_compile_exit.h), so a crash or force-quit loses every graphics pipeline built in that session. Over two hard-killed warm-ups, main's file stayed at 62.7 MB.
    • Slightly faster in the first two minutes: 21.2 against 20.5 FPS in the first minute, and 5.5 against 4.4 FPS in the second.
    • Nearly twice as many frames in the heavy part: after 120 s, 167 frames against 87, a median of 1.8 against 0.9 FPS, and a p99 frame time of 15.8 s against 21.9 s.
    • Much less CPU in the heavy part: the game uses 7.8 % of the CPU against 21.2 % on main, and the whole system 20 % against 36 %.
  • Costs and regressions:
    • Worse lows in the first minute: 1 % low of 1.8 against 4.3 FPS, and p99 frame time of 569 against 319 ms.
    • Bursty frame pacing: presents come in bursts, with a 95th/99th-percentile FPS of several hundred, then long gaps.
    • No new frames while graphics pipelines compile. In a cold run the image froze for minutes, and one frame lasted 416 s while compute pipelines compiled.
    • More memory: in the heavy part, 36.0 against 32.9 GB of RAM, and 13.9 + 9.7 GB of VRAM (dedicated + shared) against 13.2 + 7.6 GB.
  • Caveats:
    • PageMirror is off on NVIDIA with the fallback, so these numbers are #2566 without PageMirror.
    • Small sample: n = 4 warm runs per side, and the usage figures come from 1 sampled run per side.
    • The scene after ~120 s is GPU-bound on both builds, with the GPU at 80-84 % and about one frame every 5-10 s, mostly mesh shaders: 8.9 s of mesh work per frame measured by #2566's GPU profile. That isn't a #2566 regression.

Setup

  • Hardware: NVIDIA GeForce RTX 5080 (16 GB, driver 621.24), Windows 11 Pro 10.0.26200, 24 logical CPUs (the game gets 18), 62 GB RAM.
  • Builds:
    • A = raw main at d48a957bb. Its runtime/ and translator are identical to 20a4e5d89: the 10 commits between them touch neither.
    • B = 20a4e5d89 plus #2566 at 232b4a1ee, with the local NVIDIA fallback below.
    • Both are RelWithDebInfo builds, and B's shaders were translated again with #2566's translator.
  • Settings: the same on both sides. Aslan's run settings from docs/running.md, including LEONIDA_ASYNC_PIPELINES=1, LEONIDA_SUBMIT_ASYNC=4, LEONIDA_GPU_DETILE=1, LEONIDA_MAP_READBACK=1, LEONIDA_RT_AS=off, LEONIDA_ARENA_MB=4095, and the same scripted inputs.
  • Warm caches on both sides:
    • Each side was warmed until no new pipeline build started for 5 minutes.
    • Main also needed clean exits (Ctrl+Break) to keep its graphics pipelines; that's the gain above.
    • Over the measured runs, compile time was 30-49 s for graphics on both sides, and 54-70 s (main) against 70-216 s (#2566) for compute.
  • Runs: alternating A and B, 600 s each.
    • Kept: 4 runs per side. One A run lost the device at 124 s.
    • Left out: one A run with no frame data, and one B run that was still compiling compute (5,250 s of compute compile time).
  • Measurement:
    • PresentMon 2.6.0 records every frame (MsBetweenPresents, MsCPUBusy, MsGPUTime).
    • One run per side was also sampled every 2 s: GPU utilization (nvidia-smi), total and game CPU, the game's private RAM, and its dedicated and shared GPU memory (Windows GPU Process Memory counters).
    • The game's own log gives device loss, pipelines, compile time and memory.

Results (mean over the warm runs, range in brackets)

Raw main's first run lost the device at 124 s. It counts in the first two phases, which pulls main's first-minute minimum down to 13.9 FPS, and it's missing from the "after 120 s" phase, where main has 3 runs.

First minute (title and loading)

Metric Raw main Main + #2566
Average FPS 20.5 (13.9-22.8) 21.2 (17.6-22.7)
1 % low FPS 4.3 (1.4-5.4) 1.8 (1.5-2.2)
5 % low FPS 16.0 (4.5-20.2) 19.8 (4.0-26.8)
Median FPS 29.4 (27.4-30.0) 30.0 (30.0-30.0)
p99 frame time (ms) 319 (187-707) 569 (451-662)
Frames over 100 ms 53 (28-125) 53 (34-99)
CPU busy (ms/frame) 50.6 (43.6-71.5) 47.3 (43.8-56.4)
GPU time (ms/frame) 48.2 (42.5-64.9) 45.3 (42.3-52.5)

60 to 120 s

Metric Raw main Main + #2566
Average FPS 4.4 (2.4-6.1) 5.5 (2.8-7.0)
1 % low FPS 0.7 (0.3-1.0) 0.9 (0.7-1.0)
5 % low FPS 1.2 (0.3-2.1) 1.7 (1.3-2.0)
Median FPS 14.2 (7.2-29.9) 13.0 (10.5-14.5)
p99 frame time (ms) 1,776 (1,040-2,995) 1,156 (960-1,432)
Frames 176 (14-251) 238 (128-293)

After 120 s (GPU-bound on both builds)

Metric Raw main Main + #2566
Average FPS 0.2 (0.1-0.2) 0.4 (0.2-0.4)
Median FPS 0.9 (0.1-1.8) 1.8 (0.2-2.5)
p99 frame time (s) 21.9 (14.0-26.6) 15.8 (12.4-22.2)
GPU time (ms/frame) 5,616 (4,586-7,450) 3,146 (2,309-5,552)
Frames 87 (63-104) 167 (85-200)

Usage per phase (one sampled run per side, 2 s samples)

The game's CPU share is measured against all 24 logical CPUs.

Phase Metric Raw main Main + #2566
0-60 s GPU utilization 8 % 8 %
0-60 s CPU total / game 25 % / 11.0 % 22 % / 10.1 %
0-60 s Game RAM (private) 12.0 GB 12.7 GB
0-60 s VRAM dedicated / shared 2.1 / 4.5 GB 3.0 / 4.4 GB
60-120 s GPU utilization 15 % 12 %
60-120 s CPU total / game 35 % / 18.3 % 32 % / 17.6 %
60-120 s Game RAM (private) 22.1 GB 25.0 GB
60-120 s VRAM dedicated / shared 9.2 / 5.3 GB 11.1 / 5.9 GB
120 s-end GPU utilization 84 % 80 %
120 s-end CPU total / game 36 % / 21.2 % 20 % / 7.8 %
120 s-end Game RAM (private) 32.9 GB 36.0 GB
120 s-end VRAM dedicated / shared 13.2 / 7.6 GB 13.9 / 9.7 GB
120 s-end Free system RAM 26.2 GB 23.5 GB

The first two minutes are not GPU-bound on either build (8-15 % GPU), so their frame rate is set by the CPU side and by waits. After 120 s the GPU is saturated on both.

Stability and pipelines

Run Side Device lost Refused pipelines Pipelines (g / c) Compile s (g / c) Slow pipelines (g / c)
1 raw main at 124 s 0 193 / 1083 7.5 / 54.4 0 / 0
2 raw main no 0 682 / 1391 30.4 / 68.3 0 / 0
3 raw main no 0 657 / 1363 36.5 / 67.5 1 / 0
4 raw main no 0 684 / 1392 33.1 / 69.5 2 / 0
1 main + #2566 no 0 687 / 1457 31.9 / 105.0 0 / 22
2 main + #2566 no 0 727 / 1458 30.1 / 216.3 2 / 5
3 main + #2566 no 0 686 / 1438 30.2 / 69.5 0 / 0
4 main + #2566 no 0 700 / 1453 48.7 / 211.6 3 / 8

The NVIDIA fix (suggested change, tested locally)

The sparse arena binds each 2 MiB block with kArenaRequiredMemory (HOST_VISIBLE | HOST_COHERENT) and maps it. When the sparse buffer allows no such type, no block can be bound, and create_arena fails. In d3d12_vulkan_device.cpp, after create_buffer(), we now check the real buffer's memoryTypeBits. If no mappable type is allowed, we destroy the buffer and recreate it without the sparse flags, keeping the single-allocation arena that raw main uses. That costs 44 lines in 3 files.

  • runtime/src/arena_size.h: a new sparse_arena_mappable(memory, type_bits), built on memory_type_order.
  • runtime/shims/d3d12_vulkan_device.cpp: sparse and limits lose their const, and the check above is added, logging: GPU address arena: one allocation, not sparse: the device's sparse buffer allows no HOST_VISIBLE | HOST_COHERENT memory type (memoryTypeBits 0x...).
  • runtime/test/arena_size_test.cpp: a new sparse_mappable case covering device-local only (the NVIDIA case), host-visible, Resizable BAR, and no type.

AMD keeps sparse mode. Running PageMirror on NVIDIA would need a staging path for blocks that can't be mapped, which is a larger change for Aslan to decide on.

Other notes

  • Frozen image while compiling: #2566 presents no frames while graphics pipelines compile. In a cold warm-up, the GPU profile showed 0 frames for minutes.
  • Frame pacing: #2566's 95th/99th-percentile FPS are in the hundreds in every phase, meaning several presents land within a millisecond and are then followed by long gaps. Main's are 45-60 FPS. That's worth a look in the async submit path.
  • Compute cache: the first warm #2566 run rebuilt compute pipelines for its whole duration (5,250 s of compute compile time, frozen for about 7 minutes). The next runs took 70-216 s, against a steady 54-70 s on main.

AI-assisted (Claude Code, Claude Opus 5.5), for DadaCap. Tested on an NVIDIA GeForce RTX 5080 (driver 621.24), Windows 11 Pro 10.0.26200.

**@⁠DadaCap** on GitHub · 2026-11-28 19:01 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7244235880) # Review of #2566 on an RTX 5080: A/B against raw main Tested at head `232b4a1ee`. The PR has moved since, to `a8b1abe4c`, so the newer commits are not covered here. ## Summary - **NVIDIA blocker, now fixed locally.** - **The bug:** #2566's sparse GPU address arena can't be created on NVIDIA. The sparse buffer allows only `memoryTypeBits 0x2`, which is device-local and has no HOST_VISIBLE | HOST_COHERENT type. Every pipeline is then refused (2,690 `DeserializeComputePipelineStateX` calls fail with `0x80004001`), and the title stays on its first loading image. This happened in 3 runs out of 3 on our RTX 5080, and OreoFR saw the same on an RTX 4070. - **The fix below:** a fallback to the single-allocation arena when the sparse buffer can't be mapped. With it there are 0 refused pipelines, and the game runs normally. - **Gains over raw main** (4 warm runs per side): - **No device loss:** 0 in 7 runs with #2566, against 1 in 5 runs on raw main (at t≈124 s). - **Graphics pipelines survive a crash or kill:** #2566 writes its session pipeline cache during the run. Raw main writes `pipeline_cache.session.bin` only on a clean exit (`d3d12_compile_exit.h`), so a crash or force-quit loses every graphics pipeline built in that session. Over two hard-killed warm-ups, main's file stayed at 62.7 MB. - **Slightly faster in the first two minutes:** 21.2 against 20.5 FPS in the first minute, and 5.5 against 4.4 FPS in the second. - **Nearly twice as many frames in the heavy part:** after 120 s, 167 frames against 87, a median of 1.8 against 0.9 FPS, and a p99 frame time of 15.8 s against 21.9 s. - **Much less CPU in the heavy part:** the game uses 7.8 % of the CPU against 21.2 % on main, and the whole system 20 % against 36 %. - **Costs and regressions:** - **Worse lows in the first minute:** 1 % low of 1.8 against 4.3 FPS, and p99 frame time of 569 against 319 ms. - **Bursty frame pacing:** presents come in bursts, with a 95th/99th-percentile FPS of several hundred, then long gaps. - **No new frames while graphics pipelines compile.** In a cold run the image froze for minutes, and one frame lasted 416 s while compute pipelines compiled. - **More memory:** in the heavy part, 36.0 against 32.9 GB of RAM, and 13.9 + 9.7 GB of VRAM (dedicated + shared) against 13.2 + 7.6 GB. - **Caveats:** - **PageMirror is off on NVIDIA** with the fallback, so these numbers are #2566 without PageMirror. - **Small sample:** n = 4 warm runs per side, and the usage figures come from 1 sampled run per side. - **The scene after ~120 s is GPU-bound on both builds,** with the GPU at 80-84 % and about one frame every 5-10 s, mostly mesh shaders: 8.9 s of mesh work per frame measured by #2566's GPU profile. That isn't a #2566 regression. ## Setup - **Hardware:** NVIDIA GeForce RTX 5080 (16 GB, driver 621.24), Windows 11 Pro 10.0.26200, 24 logical CPUs (the game gets 18), 62 GB RAM. - **Builds:** - A = raw main at `d48a957bb`. Its `runtime/` and translator are identical to `20a4e5d89`: the 10 commits between them touch neither. - B = `20a4e5d89` plus #2566 at `232b4a1ee`, with the local NVIDIA fallback below. - Both are RelWithDebInfo builds, and B's shaders were translated again with #2566's translator. - **Settings:** the same on both sides. Aslan's run settings from docs/running.md, including `LEONIDA_ASYNC_PIPELINES=1`, `LEONIDA_SUBMIT_ASYNC=4`, `LEONIDA_GPU_DETILE=1`, `LEONIDA_MAP_READBACK=1`, `LEONIDA_RT_AS=off`, `LEONIDA_ARENA_MB=4095`, and the same scripted inputs. - **Warm caches on both sides:** - Each side was warmed until no new pipeline build started for 5 minutes. - Main also needed clean exits (Ctrl+Break) to keep its graphics pipelines; that's the gain above. - Over the measured runs, compile time was 30-49 s for graphics on both sides, and 54-70 s (main) against 70-216 s (#2566) for compute. - **Runs:** alternating A and B, 600 s each. - Kept: 4 runs per side. One A run lost the device at 124 s. - Left out: one A run with no frame data, and one B run that was still compiling compute (5,250 s of compute compile time). - **Measurement:** - PresentMon 2.6.0 records every frame (`MsBetweenPresents`, `MsCPUBusy`, `MsGPUTime`). - One run per side was also sampled every 2 s: GPU utilization (nvidia-smi), total and game CPU, the game's private RAM, and its dedicated and shared GPU memory (Windows GPU Process Memory counters). - The game's own log gives device loss, pipelines, compile time and memory. ## Results (mean over the warm runs, range in brackets) Raw main's first run lost the device at 124 s. It counts in the first two phases, which pulls main's first-minute minimum down to 13.9 FPS, and it's missing from the "after 120 s" phase, where main has 3 runs. ### First minute (title and loading) | Metric | Raw main | Main + #2566 | |---|---|---| | Average FPS | 20.5 (13.9-22.8) | 21.2 (17.6-22.7) | | 1 % low FPS | 4.3 (1.4-5.4) | 1.8 (1.5-2.2) | | 5 % low FPS | 16.0 (4.5-20.2) | 19.8 (4.0-26.8) | | Median FPS | 29.4 (27.4-30.0) | 30.0 (30.0-30.0) | | p99 frame time (ms) | 319 (187-707) | 569 (451-662) | | Frames over 100 ms | 53 (28-125) | 53 (34-99) | | CPU busy (ms/frame) | 50.6 (43.6-71.5) | 47.3 (43.8-56.4) | | GPU time (ms/frame) | 48.2 (42.5-64.9) | 45.3 (42.3-52.5) | ### 60 to 120 s | Metric | Raw main | Main + #2566 | |---|---|---| | Average FPS | 4.4 (2.4-6.1) | 5.5 (2.8-7.0) | | 1 % low FPS | 0.7 (0.3-1.0) | 0.9 (0.7-1.0) | | 5 % low FPS | 1.2 (0.3-2.1) | 1.7 (1.3-2.0) | | Median FPS | 14.2 (7.2-29.9) | 13.0 (10.5-14.5) | | p99 frame time (ms) | 1,776 (1,040-2,995) | 1,156 (960-1,432) | | Frames | 176 (14-251) | 238 (128-293) | ### After 120 s (GPU-bound on both builds) | Metric | Raw main | Main + #2566 | |---|---|---| | Average FPS | 0.2 (0.1-0.2) | 0.4 (0.2-0.4) | | Median FPS | 0.9 (0.1-1.8) | 1.8 (0.2-2.5) | | p99 frame time (s) | 21.9 (14.0-26.6) | 15.8 (12.4-22.2) | | GPU time (ms/frame) | 5,616 (4,586-7,450) | 3,146 (2,309-5,552) | | Frames | 87 (63-104) | 167 (85-200) | ### Usage per phase (one sampled run per side, 2 s samples) The game's CPU share is measured against all 24 logical CPUs. | Phase | Metric | Raw main | Main + #2566 | |---|---|---|---| | 0-60 s | GPU utilization | 8 % | 8 % | | 0-60 s | CPU total / game | 25 % / 11.0 % | 22 % / 10.1 % | | 0-60 s | Game RAM (private) | 12.0 GB | 12.7 GB | | 0-60 s | VRAM dedicated / shared | 2.1 / 4.5 GB | 3.0 / 4.4 GB | | 60-120 s | GPU utilization | 15 % | 12 % | | 60-120 s | CPU total / game | 35 % / 18.3 % | 32 % / 17.6 % | | 60-120 s | Game RAM (private) | 22.1 GB | 25.0 GB | | 60-120 s | VRAM dedicated / shared | 9.2 / 5.3 GB | 11.1 / 5.9 GB | | 120 s-end | GPU utilization | 84 % | 80 % | | 120 s-end | CPU total / game | 36 % / 21.2 % | 20 % / 7.8 % | | 120 s-end | Game RAM (private) | 32.9 GB | 36.0 GB | | 120 s-end | VRAM dedicated / shared | 13.2 / 7.6 GB | 13.9 / 9.7 GB | | 120 s-end | Free system RAM | 26.2 GB | 23.5 GB | The first two minutes are not GPU-bound on either build (8-15 % GPU), so their frame rate is set by the CPU side and by waits. After 120 s the GPU is saturated on both. ### Stability and pipelines | Run | Side | Device lost | Refused pipelines | Pipelines (g / c) | Compile s (g / c) | Slow pipelines (g / c) | |---|---|---|---|---|---|---| | 1 | raw main | at 124 s | 0 | 193 / 1083 | 7.5 / 54.4 | 0 / 0 | | 2 | raw main | no | 0 | 682 / 1391 | 30.4 / 68.3 | 0 / 0 | | 3 | raw main | no | 0 | 657 / 1363 | 36.5 / 67.5 | 1 / 0 | | 4 | raw main | no | 0 | 684 / 1392 | 33.1 / 69.5 | 2 / 0 | | 1 | main + #2566 | no | 0 | 687 / 1457 | 31.9 / 105.0 | 0 / 22 | | 2 | main + #2566 | no | 0 | 727 / 1458 | 30.1 / 216.3 | 2 / 5 | | 3 | main + #2566 | no | 0 | 686 / 1438 | 30.2 / 69.5 | 0 / 0 | | 4 | main + #2566 | no | 0 | 700 / 1453 | 48.7 / 211.6 | 3 / 8 | ## The NVIDIA fix (suggested change, tested locally) The sparse arena binds each 2 MiB block with `kArenaRequiredMemory` (HOST_VISIBLE | HOST_COHERENT) and maps it. When the sparse buffer allows no such type, no block can be bound, and `create_arena` fails. In `d3d12_vulkan_device.cpp`, after `create_buffer()`, we now check the real buffer's `memoryTypeBits`. If no mappable type is allowed, we destroy the buffer and recreate it without the sparse flags, keeping the single-allocation arena that raw main uses. That costs 44 lines in 3 files. - **`runtime/src/arena_size.h`:** a new `sparse_arena_mappable(memory, type_bits)`, built on `memory_type_order`. - **`runtime/shims/d3d12_vulkan_device.cpp`:** `sparse` and `limits` lose their `const`, and the check above is added, logging: `GPU address arena: one allocation, not sparse: the device's sparse buffer allows no HOST_VISIBLE | HOST_COHERENT memory type (memoryTypeBits 0x...)`. - **`runtime/test/arena_size_test.cpp`:** a new `sparse_mappable` case covering device-local only (the NVIDIA case), host-visible, Resizable BAR, and no type. AMD keeps sparse mode. Running PageMirror on NVIDIA would need a staging path for blocks that can't be mapped, which is a larger change for Aslan to decide on. ## Other notes - **Frozen image while compiling:** #2566 presents no frames while graphics pipelines compile. In a cold warm-up, the GPU profile showed 0 frames for minutes. - **Frame pacing:** #2566's 95th/99th-percentile FPS are in the hundreds in every phase, meaning several presents land within a millisecond and are then followed by long gaps. Main's are 45-60 FPS. That's worth a look in the async submit path. - **Compute cache:** the first warm #2566 run rebuilt compute pipelines for its whole duration (5,250 s of compute compile time, frozen for about 7 minutes). The next runs took 70-216 s, against a steady 54-70 s on main. --- AI-assisted (Claude Code, Claude Opus 5.5), for DadaCap. Tested on an NVIDIA GeForce RTX 5080 (driver 621.24), Windows 11 Pro 10.0.26200.
Author
Owner

@⁠Maticcm on GitHub · 2026-11-28 20:38 UTC · original

Independent Ampere check for #2566, native Windows. I compared the exact PR head a8b1abe4c2016a7ecd5a9cedd4a0227fd7a6230e with its upstream merge parent 0318164b8514490b2d6f9b6b1c230c4c01276066. Both builds used RelWithDebInfo, MSVC 19.50.35717, Vulkan SDK 1.4.363.1 and Khronos validation. GPU: RTX 3080 desktop, 10 GiB, driver 630.20, Windows 11 build 26340.

CTest Upstream parent PR head, two runs
d3d12_mesh Pass Pass both times
d3d12_vulkan_device Pass Fails both times at the standalone placed CreateHeap assertion
d3d12_buffer_tiles Pass Skips both times after the sparse arena cannot back its first 448 KiB
arena_sparse_gpu Absent Fails both times at the host-visible/coherent memory type lookup (type != UINT32_MAX)

The arena fixture also reports VUID-vkDestroyDevice-device-05137 on the failing path as it destroys the device with a live buffer. The exact-head observations establish the sparse-memory compatibility problem on this Ampere configuration. The mesh fixture still rendered successfully. This was synthetic coverage, with no title run, performance measurement, or fallback patch applied.

AI-assisted (Codex).

**@⁠Maticcm** on GitHub · 2026-11-28 20:38 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7245435238) **Independent Ampere check for #2566, native Windows.** I compared the exact PR head `a8b1abe4c2016a7ecd5a9cedd4a0227fd7a6230e` with its upstream merge parent `0318164b8514490b2d6f9b6b1c230c4c01276066`. Both builds used RelWithDebInfo, MSVC 19.50.35717, Vulkan SDK 1.4.363.1 and Khronos validation. GPU: RTX 3080 desktop, 10 GiB, driver 630.20, Windows 11 build 26340. | CTest | Upstream parent | PR head, two runs | | --- | --- | --- | | `d3d12_mesh` | Pass | Pass both times | | `d3d12_vulkan_device` | Pass | Fails both times at the standalone placed `CreateHeap` assertion | | `d3d12_buffer_tiles` | Pass | Skips both times after the sparse arena cannot back its first 448 KiB | | `arena_sparse_gpu` | Absent | Fails both times at the host-visible/coherent memory type lookup (`type != UINT32_MAX`) | The arena fixture also reports `VUID-vkDestroyDevice-device-05137` on the failing path as it destroys the device with a live buffer. The exact-head observations establish the sparse-memory compatibility problem on this Ampere configuration. The mesh fixture still rendered successfully. This was synthetic coverage, with no title run, performance measurement, or fallback patch applied. AI-assisted (Codex).
Author
Owner

@⁠Maticcm on GitHub · 2026-11-28 21:23 UTC · original

Windows AMD integrated GPU complement to the RTX 3080 report above. Same exact #2566 binaries at a8b1abe4c2016a7ecd5a9cedd4a0227fd7a6230e and baseline 0318164b8514490b2d6f9b6b1c230c4c01276066. AMD Radeon integrated graphics on Ryzen 9 9950X3D, AMD driver 26.11.2, Windows 11 build 26340, Khronos validation enabled. Two runs per revision, with matching outcomes.

  • d3d12_vulkan_device and d3d12_buffer_tiles passed on both revisions. The tiled-buffer fixture matched all 12 tiles on the head. This differs from the RTX 3080 run, where the device test failed and tiled-buffer coverage skipped.
  • d3d12_mesh failed at the same mixed-pipeline statistics assertion on both AMD revisions (line 774, unexpected invocations or primitives in a stage expected to report zero).
  • The head-only arena_sparse_gpu still failed the compatible host-visible/coherent memory type assertion and reached the same live-buffer destruction VUID. The shared device and tiled-buffer fixtures did not exhibit the NVIDIA initialization failure here.

Synthetic fixtures only. AI-assisted (Codex).

**@⁠Maticcm** on GitHub · 2026-11-28 21:23 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7245988053) Windows AMD integrated GPU complement to the RTX 3080 report above. Same exact #2566 binaries at `a8b1abe4c2016a7ecd5a9cedd4a0227fd7a6230e` and baseline `0318164b8514490b2d6f9b6b1c230c4c01276066`. AMD Radeon integrated graphics on Ryzen 9 9950X3D, AMD driver 26.11.2, Windows 11 build 26340, Khronos validation enabled. Two runs per revision, with matching outcomes. - `d3d12_vulkan_device` and `d3d12_buffer_tiles` passed on both revisions. The tiled-buffer fixture matched all 12 tiles on the head. This differs from the RTX 3080 run, where the device test failed and tiled-buffer coverage skipped. - `d3d12_mesh` failed at the same mixed-pipeline statistics assertion on both AMD revisions (line 774, unexpected invocations or primitives in a stage expected to report zero). - The head-only `arena_sparse_gpu` still failed the compatible host-visible/coherent memory type assertion and reached the same live-buffer destruction VUID. The shared device and tiled-buffer fixtures did not exhibit the NVIDIA initialization failure here. Synthetic fixtures only. AI-assisted (Codex).
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-28 22:03 UTC · original

The new head restores standalone heap creation and tiled-buffer readback on a desktop RTX 4090. I ran the same three synthetic CTests on native Windows with MSVC Release and NVIDIA 616.64, first with default settings and then with Khronos validation 1.4.369. The outcomes matched in both runs.

Test Previous head a8b1abe4c2 New head eccc71b324
d3d12_vulkan_device Failed creating the standalone placed heap Passed
d3d12_buffer_tiles Skipped after the arena could not back its first 448 KiB Passed. Vulkan matched all 12 tiles and native D3D12 matched all three GPU readbacks.
arena_sparse_gpu Failed the memory-type assertion. Validation also reported a live buffer at device destruction (VUID-vkDestroyDevice-device-05137). Skipped with the explicit unsupported-memory-type diagnostic.

On the new head the runtime reported memoryTypeBits=0x2 for the sparse buffer and selected a single allocation. The device and tile tests exercised that fallback. The dedicated sparse fixture skipped before attempting sparse binding, so this run establishes fallback coverage on Ada. The new-head validation run emitted zero validation errors. No title or frame-rate measurement was involved.

Coordination claim. AI-assisted verification with OpenAI Codex (GPT-6).

**@⁠ecox982745** on GitHub · 2026-11-28 22:03 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7246463873) The new head restores standalone heap creation and tiled-buffer readback on a desktop **RTX 4090**. I ran the same three synthetic CTests on native Windows with MSVC Release and NVIDIA 616.64, first with default settings and then with Khronos validation 1.4.369. The outcomes matched in both runs. | Test | Previous head `a8b1abe4c2` | New head `eccc71b324` | | --- | --- | --- | | `d3d12_vulkan_device` | Failed creating the standalone placed heap | Passed | | `d3d12_buffer_tiles` | Skipped after the arena could not back its first 448 KiB | Passed. Vulkan matched all 12 tiles and native D3D12 matched all three GPU readbacks. | | `arena_sparse_gpu` | Failed the memory-type assertion. Validation also reported a live buffer at device destruction (`VUID-vkDestroyDevice-device-05137`). | Skipped with the explicit unsupported-memory-type diagnostic. | On the new head the runtime reported `memoryTypeBits=0x2` for the sparse buffer and selected a single allocation. The device and tile tests exercised that fallback. The dedicated sparse fixture skipped before attempting sparse binding, so this run establishes fallback coverage on Ada. The new-head validation run emitted zero validation errors. No title or frame-rate measurement was involved. [Coordination claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/2570). AI-assisted verification with OpenAI Codex (GPT-6).
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-28 22:13 UTC · original

Pushed new changes, please retest on NVIDIA

**@⁠aslan2142** on GitHub · 2026-11-28 22:13 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7246578910) Pushed new changes, please retest on NVIDIA
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-28 22:33 UTC · original

I retested the queue and presenter changes on a desktop RTX 4090, driver 616.64, in response to the NVIDIA retest request. The asynchronous compute wait now completes. The stock M4 shader fixtures still fail Vulkan validation on this card.

Native Windows, MSVC Release, Khronos validation 1.4.369, synthetic tests. I compared eccc71b324 directly with its parent 660872215a.

CTest Parent PR head
vk_presenter_sync Failed presenter.presented() == shown + 1 after destroying the queue Passed 3/3, including the queued present
vk_presenter_sparse_capture Passed Passed 3/3
d3d12_m4_compute, stock shaders Four validation errors Same four errors
d3d12_m4_compute_async_small_waits, stock shaders Timed out at 30 s Finished in 0.29 s with the four validation errors

Remaining fixture issue. The head's device probe reports denorm_flush_to_zero_f32=false. The CMake fixture builder still emits DenormFlushToZero 32 for both cs_m4_fill and cs_m4_indirect, triggering VUID-VkShaderModuleCreateInfo-pCode-08740 and VUID-RuntimeSpirv-shaderDenormFlushToZeroFloat32-06300.

I rebuilt only those two synthetic shader modules with --no-ftz32 and reran the same test binaries with validation enabled. On the parent, ordinary M4 passed and the asynchronous case still timed out at 30 s. On the head, both passed 3/3. Each of the six runs read back all 1,924 expected words with zero validation errors. The synthetic FSSM inputs were byte-identical. Having runtime/test/shaders/build.py use the FTZ32 capability decision already used by make_game.py would let the stock fixture exercise the fixed wait on this driver.

Coordination claim. AI-assisted verification with OpenAI Codex (GPT-6).

**@⁠ecox982745** on GitHub · 2026-11-28 22:33 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7246820239) I retested the queue and presenter changes on a desktop **RTX 4090, driver 616.64**, in response to the [NVIDIA retest request](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566). The asynchronous compute wait now completes. The stock M4 shader fixtures still fail Vulkan validation on this card. Native Windows, MSVC Release, Khronos validation 1.4.369, synthetic tests. I compared `eccc71b324` directly with its parent `660872215a`. | CTest | Parent | PR head | | --- | --- | --- | | `vk_presenter_sync` | Failed `presenter.presented() == shown + 1` after destroying the queue | Passed 3/3, including the queued present | | `vk_presenter_sparse_capture` | Passed | Passed 3/3 | | `d3d12_m4_compute`, stock shaders | Four validation errors | Same four errors | | `d3d12_m4_compute_async_small_waits`, stock shaders | Timed out at 30 s | Finished in 0.29 s with the four validation errors | **Remaining fixture issue.** The head's device probe reports `denorm_flush_to_zero_f32=false`. The CMake fixture builder still emits `DenormFlushToZero 32` for both `cs_m4_fill` and `cs_m4_indirect`, triggering `VUID-VkShaderModuleCreateInfo-pCode-08740` and `VUID-RuntimeSpirv-shaderDenormFlushToZeroFloat32-06300`. I rebuilt only those two synthetic shader modules with `--no-ftz32` and reran the same test binaries with validation enabled. On the parent, ordinary M4 passed and the asynchronous case still timed out at 30 s. On the head, both passed **3/3**. Each of the six runs read back all **1,924 expected words** with zero validation errors. The synthetic FSSM inputs were byte-identical. Having `runtime/test/shaders/build.py` use the FTZ32 capability decision already used by `make_game.py` would let the stock fixture exercise the fixed wait on this driver. [Coordination claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/2570). AI-assisted verification with OpenAI Codex (GPT-6).
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-29 00:07 UTC · original

The attached patch fixes the stock M4 shader fixtures on the RTX 4090. It applies directly to eccc71b324 with git am. The fixture builder now passes --no-ftz32 when the selected GPU explicitly reports that it lacks float32 flush-to-zero. A supported or unknown capability keeps the translator default. The builder reuses one probe for this choice and the existing barycentric fallback.

I rebuilt d3d12_m4_compute_test from scratch on native Windows with MSVC Release, NVIDIA driver 616.64 and Khronos validation 1.4.369. Both stock CTests used the shaders generated by CMake.

Test RTX 4090 result
d3d12_m4_compute 3/3 passed
d3d12_m4_compute_async_small_waits 3/3 passed

Every run matched all 1,924 GPU output words against the CPU reference, with zero Vulkan validation errors. Both generated shaders passed spirv-val --target-env vulkan1.2. Before the patch, each stock test produced four validation errors on this same PR head. Earlier controlled comparison

The shader-builder and translator-flag suites passed 7/7 and 42/42, respectively. The patch also isolates the translator tests from the host GPU and checks that an unavailable capability probe preserves the recorded FTZ choice. AI-assisted with OpenAI Codex (GPT-6).

Apply the three-file patch to the PR branch

Copy the following block to a file and run git am shader-fixtures.patch.

From 0d505491c77801297c526fd5333d7e60f9a6f070 Mon Sep 17 00:00:00 2001
From: OpenAI Codex <[email protected]>
Date: Sun, 29 Nov 2026 10:05:52 +1000
Subject: [PATCH] tests: honor GPU float32 flush-to-zero support in shader
 fixtures

Pass --no-ftz32 when the selected device reports no float32 flush-to-zero support. Probe once for both fixture fallbacks and keep the existing default for an unknown capability. Isolate the translator flag tests from the host GPU and cover reuse of a recorded FTZ choice.

AI-assisted with OpenAI Codex (GPT-6).
---
 runtime/test/shaders/build.py            | 33 ++++++++++++++----------
 tests/test_make_game_translator_flags.py | 10 ++++++-
 tests/test_shader_build_fallbacks.py     | 27 ++++++++++++++++---
 3 files changed, 52 insertions(+), 18 deletions(-)

diff --git a/runtime/test/shaders/build.py b/runtime/test/shaders/build.py
index 377f7025e..9513cac7c 100644
--- a/runtime/test/shaders/build.py
+++ b/runtime/test/shaders/build.py
@@ -60,17 +60,25 @@ def barycentric_fallback_override():
     return None
 
 
-def barycentric_fallback():
-    override = barycentric_fallback_override()
-    if override is not None:
-        return override
+def gpu_fallback_flags():
+    """Match the selected device's barycentric and float32 flush-to-zero capabilities."""
     try:
         r = subprocess.run([sys.executable, "-I", os.path.join(TOOLS, "vk_subgroup_info.py")],
                            capture_output=True, text=True, timeout=60)
         answer = json.loads(r.stdout.strip().splitlines()[-1])
-        return answer.get("barycentric_fallback") is True
     except (OSError, ValueError, IndexError, subprocess.SubprocessError):
-        return False
+        answer = {}
+    if not isinstance(answer, dict) or "error" in answer:
+        answer = {}
+    flags = []
+    bary = barycentric_fallback_override()
+    if bary is None:
+        bary = answer.get("barycentric_fallback") is True
+    if bary:
+        flags.append("--bary-fallback")
+    if answer.get("denorm_flush_to_zero_f32") is False:
+        flags.append("--no-ftz32")
+    return flags
 
 
 def asm_mattr(path):
@@ -145,7 +153,7 @@ def gs_container():
             + b"ISG1" + chunk + b"OSG1" + chunk)
 
 
-def translate_tests(work, names):
+def translate_tests(work, names, gpu_flags):
     disasm, fssm, spirv = (work / d for d in ("disasm", "fssm", "spirv"))
     disasm.mkdir()
     fssm.mkdir()
@@ -184,11 +192,9 @@ def translate_tests(work, names):
             (work / (n + ".dxbc")).write_bytes(gs_container())
         else:
             (work / (n + ".dxbc")).write_bytes(bytes(32))  # chunk count 0
-    cmd = [sys.executable, "-I", TRANSLATOR, disasm, "--out", spirv]
+    cmd = [sys.executable, "-I", TRANSLATOR, disasm, "--out", spirv, *gpu_flags]
     if os.environ.get("LEONIDA_W64_EMULATE") == "1":   # wave64 on 32-wide subgroups (compute shaders only)
         cmd.append("--wave64-emulate")
-    if barycentric_fallback():   # raw barycentrics without VK_KHR_fragment_shader_barycentric
-        cmd.append("--bary-fallback")
     if os.environ.get("LEONIDA_FMA") in ("glsl", "khr", "exact"):   # GLSL Fma (default), OpFmaKHR, or emulated
         cmd += ["--fma", os.environ["LEONIDA_FMA"]]
     if os.environ.get("LEONIDA_F16_INTERP_FALLBACK") == "1":   # f16 interpolation without PerVertexKHR (MoltenVK)
@@ -227,7 +233,8 @@ def main():
     names = [n for n in names if n not in skipped]
     # A computed I/J pair needs PerVertexKHR inputs, which both fallbacks take away: the translator refuses it there,
     # and check.py and run_gpu_tests.py report it as SKIP. Leave it out instead of losing the whole batch.
-    if barycentric_fallback() or os.environ.get("LEONIDA_F16_INTERP_FALLBACK") == "1":
+    gpu_flags = gpu_fallback_flags()
+    if "--bary-fallback" in gpu_flags or os.environ.get("LEONIDA_F16_INTERP_FALLBACK") == "1":
         per_vertex = [n for n in names if n in NEEDS_PER_VERTEX_INPUTS]
         if per_vertex:
             print("not built (computed I/J pairs need PerVertexKHR inputs, off under the fallback):",
@@ -238,7 +245,7 @@ def main():
     out.mkdir(parents=True, exist_ok=True)
     with tempfile.TemporaryDirectory(prefix="test-shaders-", dir=out) as tmp:
         work = Path(tmp)
-        status = translate_tests(work, names)
+        status = translate_tests(work, names, gpu_flags)
         if status:
             return status
         built = work / "spirv"
@@ -266,7 +273,7 @@ def main():
         sys.path.insert(0, os.path.join(HERE, "..", "..", "..", "tools"))
         import spirv_stubs
         spirv_stubs.generate_for_index(str(spirv), combined)
-        if barycentric_fallback():
+        if "--bary-fallback" in gpu_flags:
             # The pass-through geometry shader each --bary-fallback PS is drawn with (<name>.bary_gs.spv).
             import bary_fallback_gs
             bary_fallback_gs.build_for_index(str(spirv))
diff --git a/tests/test_make_game_translator_flags.py b/tests/test_make_game_translator_flags.py
index 50336e4fe..76b6a6884 100644
--- a/tests/test_make_game_translator_flags.py
+++ b/tests/test_make_game_translator_flags.py
@@ -369,7 +369,7 @@ class ProbeFailureKeepsAutomaticFlagsTest(RecordedFlagsTest):
 
     AUTOMATIC = ("--f16-interp-fallback", "--pc-tail-ubo")
 
-    def build(self, *extra_argv, per_vertex, max_push_constants, mesh_crash=False):
+    def build(self, *extra_argv, per_vertex, max_push_constants, mesh_crash=False, denorm_ftz_f32=True):
         """One `make_game.py --stages shaders` run: (the fallbacks of each translation it started, its log)."""
         translations, lines = [], []
 
@@ -394,6 +394,8 @@ class ProbeFailureKeepsAutomaticFlagsTest(RecordedFlagsTest):
                 mock.patch("make_game.wave64_settings", return_value=(False, True)), \
                 mock.patch("make_game.runtime_gpu_per_vertex", return_value=per_vertex), \
                 mock.patch("make_game.runtime_gpu_barycentric_fallback", return_value=None), \
+                mock.patch("make_game.runtime_gpu_integer_dot_product", return_value=True), \
+                mock.patch("make_game.runtime_gpu_denorm_ftz_f32", return_value=denorm_ftz_f32), \
                 mock.patch("make_game.runtime_gpu_max_push_constants", return_value=max_push_constants), \
                 mock.patch("make_game.runtime_gpu_mesh_draws_crash", return_value=mesh_crash), \
                 mock.patch("make_game.preflight"), \
@@ -426,6 +428,12 @@ class ProbeFailureKeepsAutomaticFlagsTest(RecordedFlagsTest):
         self.assertEqual(self.build(per_vertex=False, max_push_constants=None)[0], [])
         self.assertEqual(self.recorded(), " ".join(self.AUTOMATIC))
 
+    def test_failed_ftz32_probe_keeps_the_recorded_choice(self):
+        self.assertEqual(self.build(per_vertex=True, max_push_constants=256, denorm_ftz_f32=False)[0],
+                         [("--no-ftz32",)])
+        self.assertEqual(self.build(per_vertex=True, max_push_constants=256, denorm_ftz_f32=None)[0], [])
+        self.assertEqual(self.recorded(), "--no-ftz32")
+
     def test_a_probe_that_answers_still_decides(self):
         # Another GPU, or a driver that now takes PerVertexKHR inputs and 144 bytes: translating again is right.
         self.build(per_vertex=False, max_push_constants=128)
diff --git a/tests/test_shader_build_fallbacks.py b/tests/test_shader_build_fallbacks.py
index e205bfe95..d2267f5bb 100644
--- a/tests/test_shader_build_fallbacks.py
+++ b/tests/test_shader_build_fallbacks.py
@@ -47,7 +47,7 @@ class BuildUnderFallbackTest(unittest.TestCase):
         self.out = Path(tmp.name) / "out"
         self.asked = []
 
-    def fake_translate(self, work, names):
+    def fake_translate(self, work, names, gpu_flags):
         """What rdna2spirv.py leaves in <work>/spirv: a module and an index entry per shader it validated."""
         self.asked.append(list(names))
         fallback = any(os.environ.get(v) == "1" for v in FALLBACKS)
@@ -118,13 +118,32 @@ class BuildUnderFallbackTest(unittest.TestCase):
                     mock.patch.dict(os.environ, {"LEONIDA_BARY_FALLBACK": value}, clear=False):
                 proc = SimpleNamespace(stdout=json.dumps({"barycentric_fallback": probe}) + "\n")
                 with mock.patch.object(self.build.subprocess, "run", return_value=proc):
-                    self.assertIs(self.build.barycentric_fallback(), want)
+                    self.assertEqual("--bary-fallback" in self.build.gpu_fallback_flags(), want)
+
+    def test_ftz32_flag_follows_the_probed_device_even_with_a_barycentric_override(self):
+        for report, disable in (({"denorm_flush_to_zero_f32": False}, True),
+                                ({"denorm_flush_to_zero_f32": True}, False),
+                                ({"denorm_flush_to_zero_f32": None}, False), ({}, False)):
+            with self.subTest(report=report), tempfile.TemporaryDirectory() as tmp:
+                assembled = SimpleNamespace(stdout="\ts_endpgm\n", stderr="", returncode=0)
+                probe = SimpleNamespace(stdout=json.dumps(report), returncode=0)
+                translator = SimpleNamespace(returncode=23)  # stop after recording the translator command
+                with mock.patch.dict(os.environ, {"LEONIDA_BARY_FALLBACK": "0"}), \
+                        mock.patch.object(sys, "argv", ["build.py", tmp, "cs_store"]), \
+                        mock.patch.object(self.build.mc_command, "run", return_value=assembled), \
+                        mock.patch.object(self.build.subprocess, "run", side_effect=[probe, translator]) as calls:
+                    self.assertEqual(self.build.main(), 23)
+                self.assertEqual(calls.call_count, 2)
+                command = calls.call_args.args[0]
+                self.assertIn(self.build.TRANSLATOR, command)
+                self.assertEqual("--no-ftz32" in command, disable)
+                self.assertNotIn("--bary-fallback", command)
 
     def test_a_missing_module_without_a_fallback_still_fails_the_batch(self):
         keep = self.fake_translate
 
-        def refuse(work, names):
-            keep(work, names)
+        def refuse(work, names, gpu_flags):
+            keep(work, names, gpu_flags)
             os.remove(os.path.join(work, "spirv", "cs_store.spv"))
             return 0
         self.fake_translate = refuse
**@⁠ecox982745** on GitHub · 2026-11-29 00:07 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7247889031) The attached patch fixes the stock M4 shader fixtures on the RTX 4090. It applies directly to `eccc71b324` with `git am`. The fixture builder now passes `--no-ftz32` when the selected GPU explicitly reports that it lacks float32 flush-to-zero. A supported or unknown capability keeps the translator default. The builder reuses one probe for this choice and the existing barycentric fallback. I rebuilt `d3d12_m4_compute_test` from scratch on native Windows with MSVC Release, NVIDIA driver 616.64 and Khronos validation 1.4.369. Both stock CTests used the shaders generated by CMake. | Test | RTX 4090 result | | --- | --- | | `d3d12_m4_compute` | 3/3 passed | | `d3d12_m4_compute_async_small_waits` | 3/3 passed | Every run matched all 1,924 GPU output words against the CPU reference, with zero Vulkan validation errors. Both generated shaders passed `spirv-val --target-env vulkan1.2`. Before the patch, each stock test produced four validation errors on this same PR head. [Earlier controlled comparison](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566) The shader-builder and translator-flag suites passed 7/7 and 42/42, respectively. The patch also isolates the translator tests from the host GPU and checks that an unavailable capability probe preserves the recorded FTZ choice. AI-assisted with OpenAI Codex (GPT-6). <details> <summary>Apply the three-file patch to the PR branch</summary> Copy the following block to a file and run `git am shader-fixtures.patch`. ~~~patch From 0d505491c77801297c526fd5333d7e60f9a6f070 Mon Sep 17 00:00:00 2001 From: OpenAI Codex <[email protected]> Date: Sun, 29 Nov 2026 10:05:52 +1000 Subject: [PATCH] tests: honor GPU float32 flush-to-zero support in shader fixtures Pass --no-ftz32 when the selected device reports no float32 flush-to-zero support. Probe once for both fixture fallbacks and keep the existing default for an unknown capability. Isolate the translator flag tests from the host GPU and cover reuse of a recorded FTZ choice. AI-assisted with OpenAI Codex (GPT-6). --- runtime/test/shaders/build.py | 33 ++++++++++++++---------- tests/test_make_game_translator_flags.py | 10 ++++++- tests/test_shader_build_fallbacks.py | 27 ++++++++++++++++--- 3 files changed, 52 insertions(+), 18 deletions(-) diff --git a/runtime/test/shaders/build.py b/runtime/test/shaders/build.py index 377f7025e..9513cac7c 100644 --- a/runtime/test/shaders/build.py +++ b/runtime/test/shaders/build.py @@ -60,17 +60,25 @@ def barycentric_fallback_override(): return None -def barycentric_fallback(): - override = barycentric_fallback_override() - if override is not None: - return override +def gpu_fallback_flags(): + """Match the selected device's barycentric and float32 flush-to-zero capabilities.""" try: r = subprocess.run([sys.executable, "-I", os.path.join(TOOLS, "vk_subgroup_info.py")], capture_output=True, text=True, timeout=60) answer = json.loads(r.stdout.strip().splitlines()[-1]) - return answer.get("barycentric_fallback") is True except (OSError, ValueError, IndexError, subprocess.SubprocessError): - return False + answer = {} + if not isinstance(answer, dict) or "error" in answer: + answer = {} + flags = [] + bary = barycentric_fallback_override() + if bary is None: + bary = answer.get("barycentric_fallback") is True + if bary: + flags.append("--bary-fallback") + if answer.get("denorm_flush_to_zero_f32") is False: + flags.append("--no-ftz32") + return flags def asm_mattr(path): @@ -145,7 +153,7 @@ def gs_container(): + b"ISG1" + chunk + b"OSG1" + chunk) -def translate_tests(work, names): +def translate_tests(work, names, gpu_flags): disasm, fssm, spirv = (work / d for d in ("disasm", "fssm", "spirv")) disasm.mkdir() fssm.mkdir() @@ -184,11 +192,9 @@ def translate_tests(work, names): (work / (n + ".dxbc")).write_bytes(gs_container()) else: (work / (n + ".dxbc")).write_bytes(bytes(32)) # chunk count 0 - cmd = [sys.executable, "-I", TRANSLATOR, disasm, "--out", spirv] + cmd = [sys.executable, "-I", TRANSLATOR, disasm, "--out", spirv, *gpu_flags] if os.environ.get("LEONIDA_W64_EMULATE") == "1": # wave64 on 32-wide subgroups (compute shaders only) cmd.append("--wave64-emulate") - if barycentric_fallback(): # raw barycentrics without VK_KHR_fragment_shader_barycentric - cmd.append("--bary-fallback") if os.environ.get("LEONIDA_FMA") in ("glsl", "khr", "exact"): # GLSL Fma (default), OpFmaKHR, or emulated cmd += ["--fma", os.environ["LEONIDA_FMA"]] if os.environ.get("LEONIDA_F16_INTERP_FALLBACK") == "1": # f16 interpolation without PerVertexKHR (MoltenVK) @@ -227,7 +233,8 @@ def main(): names = [n for n in names if n not in skipped] # A computed I/J pair needs PerVertexKHR inputs, which both fallbacks take away: the translator refuses it there, # and check.py and run_gpu_tests.py report it as SKIP. Leave it out instead of losing the whole batch. - if barycentric_fallback() or os.environ.get("LEONIDA_F16_INTERP_FALLBACK") == "1": + gpu_flags = gpu_fallback_flags() + if "--bary-fallback" in gpu_flags or os.environ.get("LEONIDA_F16_INTERP_FALLBACK") == "1": per_vertex = [n for n in names if n in NEEDS_PER_VERTEX_INPUTS] if per_vertex: print("not built (computed I/J pairs need PerVertexKHR inputs, off under the fallback):", @@ -238,7 +245,7 @@ def main(): out.mkdir(parents=True, exist_ok=True) with tempfile.TemporaryDirectory(prefix="test-shaders-", dir=out) as tmp: work = Path(tmp) - status = translate_tests(work, names) + status = translate_tests(work, names, gpu_flags) if status: return status built = work / "spirv" @@ -266,7 +273,7 @@ def main(): sys.path.insert(0, os.path.join(HERE, "..", "..", "..", "tools")) import spirv_stubs spirv_stubs.generate_for_index(str(spirv), combined) - if barycentric_fallback(): + if "--bary-fallback" in gpu_flags: # The pass-through geometry shader each --bary-fallback PS is drawn with (<name>.bary_gs.spv). import bary_fallback_gs bary_fallback_gs.build_for_index(str(spirv)) diff --git a/tests/test_make_game_translator_flags.py b/tests/test_make_game_translator_flags.py index 50336e4fe..76b6a6884 100644 --- a/tests/test_make_game_translator_flags.py +++ b/tests/test_make_game_translator_flags.py @@ -369,7 +369,7 @@ class ProbeFailureKeepsAutomaticFlagsTest(RecordedFlagsTest): AUTOMATIC = ("--f16-interp-fallback", "--pc-tail-ubo") - def build(self, *extra_argv, per_vertex, max_push_constants, mesh_crash=False): + def build(self, *extra_argv, per_vertex, max_push_constants, mesh_crash=False, denorm_ftz_f32=True): """One `make_game.py --stages shaders` run: (the fallbacks of each translation it started, its log).""" translations, lines = [], [] @@ -394,6 +394,8 @@ class ProbeFailureKeepsAutomaticFlagsTest(RecordedFlagsTest): mock.patch("make_game.wave64_settings", return_value=(False, True)), \ mock.patch("make_game.runtime_gpu_per_vertex", return_value=per_vertex), \ mock.patch("make_game.runtime_gpu_barycentric_fallback", return_value=None), \ + mock.patch("make_game.runtime_gpu_integer_dot_product", return_value=True), \ + mock.patch("make_game.runtime_gpu_denorm_ftz_f32", return_value=denorm_ftz_f32), \ mock.patch("make_game.runtime_gpu_max_push_constants", return_value=max_push_constants), \ mock.patch("make_game.runtime_gpu_mesh_draws_crash", return_value=mesh_crash), \ mock.patch("make_game.preflight"), \ @@ -426,6 +428,12 @@ class ProbeFailureKeepsAutomaticFlagsTest(RecordedFlagsTest): self.assertEqual(self.build(per_vertex=False, max_push_constants=None)[0], []) self.assertEqual(self.recorded(), " ".join(self.AUTOMATIC)) + def test_failed_ftz32_probe_keeps_the_recorded_choice(self): + self.assertEqual(self.build(per_vertex=True, max_push_constants=256, denorm_ftz_f32=False)[0], + [("--no-ftz32",)]) + self.assertEqual(self.build(per_vertex=True, max_push_constants=256, denorm_ftz_f32=None)[0], []) + self.assertEqual(self.recorded(), "--no-ftz32") + def test_a_probe_that_answers_still_decides(self): # Another GPU, or a driver that now takes PerVertexKHR inputs and 144 bytes: translating again is right. self.build(per_vertex=False, max_push_constants=128) diff --git a/tests/test_shader_build_fallbacks.py b/tests/test_shader_build_fallbacks.py index e205bfe95..d2267f5bb 100644 --- a/tests/test_shader_build_fallbacks.py +++ b/tests/test_shader_build_fallbacks.py @@ -47,7 +47,7 @@ class BuildUnderFallbackTest(unittest.TestCase): self.out = Path(tmp.name) / "out" self.asked = [] - def fake_translate(self, work, names): + def fake_translate(self, work, names, gpu_flags): """What rdna2spirv.py leaves in <work>/spirv: a module and an index entry per shader it validated.""" self.asked.append(list(names)) fallback = any(os.environ.get(v) == "1" for v in FALLBACKS) @@ -118,13 +118,32 @@ class BuildUnderFallbackTest(unittest.TestCase): mock.patch.dict(os.environ, {"LEONIDA_BARY_FALLBACK": value}, clear=False): proc = SimpleNamespace(stdout=json.dumps({"barycentric_fallback": probe}) + "\n") with mock.patch.object(self.build.subprocess, "run", return_value=proc): - self.assertIs(self.build.barycentric_fallback(), want) + self.assertEqual("--bary-fallback" in self.build.gpu_fallback_flags(), want) + + def test_ftz32_flag_follows_the_probed_device_even_with_a_barycentric_override(self): + for report, disable in (({"denorm_flush_to_zero_f32": False}, True), + ({"denorm_flush_to_zero_f32": True}, False), + ({"denorm_flush_to_zero_f32": None}, False), ({}, False)): + with self.subTest(report=report), tempfile.TemporaryDirectory() as tmp: + assembled = SimpleNamespace(stdout="\ts_endpgm\n", stderr="", returncode=0) + probe = SimpleNamespace(stdout=json.dumps(report), returncode=0) + translator = SimpleNamespace(returncode=23) # stop after recording the translator command + with mock.patch.dict(os.environ, {"LEONIDA_BARY_FALLBACK": "0"}), \ + mock.patch.object(sys, "argv", ["build.py", tmp, "cs_store"]), \ + mock.patch.object(self.build.mc_command, "run", return_value=assembled), \ + mock.patch.object(self.build.subprocess, "run", side_effect=[probe, translator]) as calls: + self.assertEqual(self.build.main(), 23) + self.assertEqual(calls.call_count, 2) + command = calls.call_args.args[0] + self.assertIn(self.build.TRANSLATOR, command) + self.assertEqual("--no-ftz32" in command, disable) + self.assertNotIn("--bary-fallback", command) def test_a_missing_module_without_a_fallback_still_fails_the_batch(self): keep = self.fake_translate - def refuse(work, names): - keep(work, names) + def refuse(work, names, gpu_flags): + keep(work, names, gpu_flags) os.remove(os.path.join(work, "spirv", "cs_store.spv")) return 0 self.fake_translate = refuse ~~~ </details>
Author
Owner

@⁠Tauwni on GitHub · 2026-11-29 05:11 UTC · original

AMD RDNA4 complement: vk_heap_alias (new in this PR) fails on a discrete AMD card, and an A/B narrows it to the queue the unbind runs on.

Radeon RX 9060 XT (RDNA4, 16 GB, desktop), driver 32.0.23033.1002 (Vulkan driverInfo 26.3.1, API 1.4.344), Windows 10 Pro 22H2 19045.7846, MSVC 14.44 RelWithDebInfo. PR head eccc71b32 tested as is: it does not merge into main b6bf3aa0b (conflicts in tools/rdna2spirv.py, tools/lane_masks.py, runtime/shims/d3d12_vulkan_device.cpp, runtime/test/vk_harness.cpp, docs/design.md, tests/semantic/test_wave32_lane_select.py).

ctest at the head vs main. MEASURED, full run, then failures rerun alone 3 times. Head: 12 failures out of 505; main: 11 out of 497. Only one is new and reproducible: vk_heap_alias, 3/3, line 311: got[per_page + i] == 0. The other 8 reproducible ones fail identically on main here (Windows 10's in-box D3D12/WARP and known AMD driver cases). dxgi_waitable_latency, d3d12_compile_teardown_one_worker and title_texture_watch failed only under -j 6 and passed 3/3 alone.

What the failing check reads. MEASURED, 3 runs, with a temporary print, not pushed. After bind(mirror, kTitle, VK_NULL_HANDLE), all 16384 words of the "unbound" mirror page still hold the home's words, not zero. The arena view of the same page is correct, and the earlier never-bound guard page does read zero. The device reports residencyNonResidentStrict = true, so the test does not skip.

One variable: the queue the sparse binds run on. Same binary, toggled by environment variables in a local debug build. MEASURED, 3 runs each:

  • Binds on a second queue of the work family (the test's choice: work 0/0, binds 0/1): fails 3/3.
  • Binds on a queue of another family (1/0, compute+transfer+sparse): fails 3/3.
  • Binds on the work queue itself (0/0): passes 3/3.
  • Second queue plus an empty vkQueueSubmit + vkQueueWaitIdle on the bind queue after the unbind: still fails 3/3.

So on this driver, an unbind (memory = VK_NULL_HANDLE) done on one queue is not seen by copies on another queue, even after vkQueueWaitIdle on the bind queue. Binding real memory on the other queue is seen; the first half of the test passes. As far as I read the spec, a host wait should be enough, so this looks like an AMD Windows driver issue. ASSUMED: no RADV or second AMD card here to confirm.

Why it may matter beyond the test. READ IN CODE, not measured: ArenaBacking::reclaim (runtime/src/arena_backing.h around 243-260) unbinds released units on the dedicated bind queue that pick_arena_bind_queue picks, then frees their memory. If the driver keeps the old mapping visible to the work queues, a reclaimed range may keep reading the freed allocation instead of zero. ASSUMED.

Possible ways out. Not tried in the runtime:

  • (a) Issue the unbinds on the queue that reads the range.
  • (b) Rebind released ranges to one shared zero-filled page instead of VK_NULL_HANDLE.
  • (c) At least, have vk_heap_alias skip or downgrade the mirror-unbind check on AMD Windows until a driver fix.

Happy to run any variant on this card.

Not checked by a second agent or human yet. AI-assisted: yes (Claude Code).

**@⁠Tauwni** on GitHub · 2026-11-29 05:11 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7251109193) AMD RDNA4 complement: `vk_heap_alias` (new in this PR) fails on a discrete AMD card, and an A/B narrows it to the queue the unbind runs on. Radeon RX 9060 XT (RDNA4, 16 GB, desktop), driver 32.0.23033.1002 (Vulkan driverInfo 26.3.1, API 1.4.344), Windows 10 Pro 22H2 19045.7846, MSVC 14.44 RelWithDebInfo. PR head `eccc71b32` tested as is: it does not merge into `main` `b6bf3aa0b` (conflicts in `tools/rdna2spirv.py`, `tools/lane_masks.py`, `runtime/shims/d3d12_vulkan_device.cpp`, `runtime/test/vk_harness.cpp`, `docs/design.md`, `tests/semantic/test_wave32_lane_select.py`). **ctest at the head vs `main`.** MEASURED, full run, then failures rerun alone 3 times. Head: 12 failures out of 505; `main`: 11 out of 497. Only one is new and reproducible: `vk_heap_alias`, 3/3, `line 311: got[per_page + i] == 0`. The other 8 reproducible ones fail identically on `main` here (Windows 10's in-box D3D12/WARP and known AMD driver cases). `dxgi_waitable_latency`, `d3d12_compile_teardown_one_worker` and `title_texture_watch` failed only under `-j 6` and passed 3/3 alone. **What the failing check reads.** MEASURED, 3 runs, with a temporary print, not pushed. After `bind(mirror, kTitle, VK_NULL_HANDLE)`, all 16384 words of the "unbound" mirror page still hold the home's words, not zero. The arena view of the same page is correct, and the earlier never-bound guard page does read zero. The device reports `residencyNonResidentStrict = true`, so the test does not skip. **One variable: the queue the sparse binds run on.** Same binary, toggled by environment variables in a local debug build. MEASURED, 3 runs each: - Binds on a second queue of the work family (the test's choice: work 0/0, binds 0/1): fails 3/3. - Binds on a queue of another family (1/0, compute+transfer+sparse): fails 3/3. - Binds on the work queue itself (0/0): **passes 3/3**. - Second queue plus an empty `vkQueueSubmit` + `vkQueueWaitIdle` on the bind queue after the unbind: still fails 3/3. So on this driver, an unbind (`memory = VK_NULL_HANDLE`) done on one queue is not seen by copies on another queue, even after `vkQueueWaitIdle` on the bind queue. Binding real memory on the other queue is seen; the first half of the test passes. As far as I read the spec, a host wait should be enough, so this looks like an AMD Windows driver issue. ASSUMED: no RADV or second AMD card here to confirm. **Why it may matter beyond the test.** READ IN CODE, not measured: `ArenaBacking::reclaim` (`runtime/src/arena_backing.h` around 243-260) unbinds released units on the dedicated bind queue that `pick_arena_bind_queue` picks, then frees their memory. If the driver keeps the old mapping visible to the work queues, a reclaimed range may keep reading the freed allocation instead of zero. ASSUMED. **Possible ways out.** Not tried in the runtime: - (a) Issue the unbinds on the queue that reads the range. - (b) Rebind released ranges to one shared zero-filled page instead of `VK_NULL_HANDLE`. - (c) At least, have `vk_heap_alias` skip or downgrade the mirror-unbind check on AMD Windows until a driver fix. Happy to run any variant on this card. Not checked by a second agent or human yet. AI-assisted: yes (Claude Code).
Author
Owner

@⁠bobcatchris on GitHub · 2026-11-29 06:02 UTC · original

Native Windows 11 + AMD Radeon RX 7900 XTX 24 GB A/B comparison (main 791899f65 vs PR #2566 eccc71b32), using the identical native wave64 shader pack, copied precompiled <2 MiB compute journal, and recipe (first-run UI / menu, unattended 90 s steady-state runs).

Summary (warm-to-warm, t >= 30 s)

  • Stability: 0 faults, 0 VK_ERROR_DEVICE_LOST, 0 unmet held operations on both A and B.
  • Submissions/s: 60.09 /s (main) → 30.07 /s (#2566) (−50%; direct queue 1,504 → 606 submissions per 10 s).
  • CPU heaps cost: 4.65 ms/sub (~9.30 ms/frame) → 3.79 ms/sub (~3.79 ms/frame) (>2.4× reduction per frame).
  • GPU direct queue: busy 6.5% → 5.5%, max submit-to-done latency 5.8 ms → 2.1 ms (1.8 ms cold).
  • VRAM allocated: 4,982 MiB (main) → 5,157 MiB (#2566, +175 MiB).
RUN WIN-AMD-7900XTX-2566-A | 2026-11-29 05:51 UTC | bobcatchris | AI-assisted: Antigravity (Gemini 4 Neon)
BASE:        791899f65 + 1-line local MSVC 14.39 fix in runtime/src/crt_timed_wait.cpp:26 (_CRTIMP2_PURE _Thrd_result) | shaders: make_game.py --stages shaders --wave64-emulate off (29,280 translated, all spirv-val valid)
MACHINE:     AMD Radeon RX 7900 XTX, 24 GB, desktop | AMD Windows driver 32.0.32029.2010 | Windows 11 Pro 10.0.26200 | 63.7 GB RAM (Ryzen 7 7800X3D)
RECIPE:      documented ("Linux, Wine, AMD RX 7900 XTX (RADV)" adapted to native Windows) + DEVIATIONS: no LEONIDA_TITLE_WATCHDOG_KICK, no LEONIDA_SKIP_COMPUTE, LEONIDA_ASYNC_MIN_BYTES=2097152, LEONIDA_ASYNC_MIN_BYTES_GRAPHICS=0, LEONIDA_COMPILE_THREADS=12, LEONIDA_COMPILE_HEAVY_MAX=10 | precompile: yes, 3,757 compute pipelines (<2 MiB, --max-bytes 2097151, 0 failed)
OS/DRIVER:   Windows default TdrDelay (2 s), Resizable BAR off
TARGET:      A/B control (main) | PREDICTED (written before the run): 30.0 fps, ~60 subs/s, ~4.5 ms/sub heaps, 0 faults
MEASURED:    first-run UI / menu (unattended) | 30.05 fps mean (29.90-30.55) | 60.09 subs/s (1,504 direct/10s) | heaps 4.65 ms/sub, shadows 0.69 ms/sub, geometry 0.14 ms/sub | GPU direct latency 0.74 ms avg (5.8 ms max), 6.5% busy | 4 gfx / 800 compute pipelines live (0.1 s / 0.2 s) | 4,982 MiB VRAM | 0 faults | duration 90 s
END:         time limit (90 s)
CACHES:      warm (session + precompiled compute journal) | RUN 2 of 2 (control A)
INSTRUMENTS: LEONIDA_DEVICE_FAULT=1, LEONIDA_DEVICE_MARKERS=1, LEONIDA_GPU_LATENCY=1, LEONIDA_MEM_PROBE=30, LEONIDA_TITLE_HUD=1
VERDICT:     prediction held (MEASURED, n=2)
RUN WIN-AMD-7900XTX-2566-B1 | 2026-11-29 05:53 UTC | bobcatchris | AI-assisted: Antigravity (Gemini 4 Neon)
BASE:        eccc71b32 (PR #2566) + 1-line local MSVC 14.39 fix in runtime/src/crt_timed_wait.cpp:26 (_CRTIMP2_PURE _Thrd_result) | shaders: same main pack (29,280 translated, all spirv-val valid)
MACHINE:     AMD Radeon RX 7900 XTX, 24 GB, desktop | AMD Windows driver 32.0.32029.2010 | Windows 11 Pro 10.0.26200 | 63.7 GB RAM (Ryzen 7 7800X3D)
RECIPE:      same as A | precompile: copied journal from A (3,757 compute pipelines <2 MiB)
OS/DRIVER:   Windows default TdrDelay (2 s), Resizable BAR off
TARGET:      A/B treatment (PR #2566, cold session) | PREDICTED (written before the run): 30.0 fps, 0 faults, lower CPU heap/submission overhead than A
MEASURED:    first-run UI / menu (unattended) | 30.00 fps mean (29.94-30.06) | 30.03 subs/s (610 direct/10s) | heaps 3.84 ms/sub, shadows 0.71 ms/sub, geometry 0.22 ms/sub | GPU direct latency 0.93 ms avg (1.8 ms max), 5.5% busy | 4 gfx / 800 compute pipelines live (0.1 s / 0.2 s) | 5,161 MiB VRAM | 0 faults | duration 90 s
END:         time limit (90 s)
CACHES:      cold session / copied precompiled compute journal | RUN 1 of 2 (treatment B)
INSTRUMENTS: LEONIDA_DEVICE_FAULT=1, LEONIDA_DEVICE_MARKERS=1, LEONIDA_GPU_LATENCY=1, LEONIDA_MEM_PROBE=30, LEONIDA_TITLE_HUD=1
VERDICT:     prediction held (MEASURED, n=1)
RUN WIN-AMD-7900XTX-2566-B2 | 2026-11-29 05:55 UTC | bobcatchris | AI-assisted: Antigravity (Gemini 4 Neon)
BASE:        eccc71b32 (PR #2566) + 1-line local MSVC 14.39 fix in runtime/src/crt_timed_wait.cpp:26 (_CRTIMP2_PURE _Thrd_result) | shaders: same main pack (29,280 translated, all spirv-val valid)
MACHINE:     AMD Radeon RX 7900 XTX, 24 GB, desktop | AMD Windows driver 32.0.32029.2010 | Windows 11 Pro 10.0.26200 | 63.7 GB RAM (Ryzen 7 7800X3D)
RECIPE:      same as A | precompile: copied journal from A (3,757 compute pipelines <2 MiB)
OS/DRIVER:   Windows default TdrDelay (2 s), Resizable BAR off
TARGET:      A/B treatment (PR #2566, warm session) | PREDICTED (written before the run): matches B1 at 30.0 fps, ~30 subs/s, ~3.8 ms/sub heaps, 0 faults
MEASURED:    first-run UI / menu (unattended) | 30.00 fps mean (29.94-30.07) | 30.07 subs/s (606 direct/10s) | heaps 3.79 ms/sub, shadows 0.69 ms/sub, geometry 0.22 ms/sub | GPU direct latency 0.92 ms avg (2.1 ms max), 5.5% busy | 4 gfx / 800 compute pipelines live (0.0 s / 0.1 s) | 5,157 MiB VRAM | 0 faults | duration 90 s
END:         time limit (90 s)
CACHES:      warm (session + precompiled compute journal) | RUN 2 of 2 (treatment B)
INSTRUMENTS: LEONIDA_DEVICE_FAULT=1, LEONIDA_DEVICE_MARKERS=1, LEONIDA_GPU_LATENCY=1, LEONIDA_MEM_PROBE=30, LEONIDA_TITLE_HUD=1
VERDICT:     prediction held (MEASURED, n=2)
**@⁠bobcatchris** on GitHub · 2026-11-29 06:02 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7251613650) Native **Windows 11 + AMD Radeon RX 7900 XTX 24 GB** A/B comparison (`main` `791899f65` vs PR `#2566` `eccc71b32`), using the identical native wave64 shader pack, copied precompiled `<2 MiB` compute journal, and recipe (`first-run UI` / `menu`, unattended 90 s steady-state runs). ### Summary (warm-to-warm, `t >= 30 s`) - **Stability:** 0 faults, 0 `VK_ERROR_DEVICE_LOST`, 0 unmet held operations on both A and B. - **Submissions/s:** `60.09 /s` (`main`) → **`30.07 /s`** (`#2566`) (**−50%**; direct queue `1,504` → `606` submissions per 10 s). - **CPU `heaps` cost:** `4.65 ms/sub` (`~9.30 ms/frame`) → **`3.79 ms/sub`** (`~3.79 ms/frame`) (**>2.4× reduction per frame**). - **GPU direct queue:** busy `6.5%` → **`5.5%`**, max submit-to-done latency `5.8 ms` → **`2.1 ms`** (`1.8 ms` cold). - **VRAM allocated:** `4,982 MiB` (`main`) → `5,157 MiB` (`#2566`, `+175 MiB`). ``` RUN WIN-AMD-7900XTX-2566-A | 2026-11-29 05:51 UTC | bobcatchris | AI-assisted: Antigravity (Gemini 4 Neon) BASE: 791899f65 + 1-line local MSVC 14.39 fix in runtime/src/crt_timed_wait.cpp:26 (_CRTIMP2_PURE _Thrd_result) | shaders: make_game.py --stages shaders --wave64-emulate off (29,280 translated, all spirv-val valid) MACHINE: AMD Radeon RX 7900 XTX, 24 GB, desktop | AMD Windows driver 32.0.32029.2010 | Windows 11 Pro 10.0.26200 | 63.7 GB RAM (Ryzen 7 7800X3D) RECIPE: documented ("Linux, Wine, AMD RX 7900 XTX (RADV)" adapted to native Windows) + DEVIATIONS: no LEONIDA_TITLE_WATCHDOG_KICK, no LEONIDA_SKIP_COMPUTE, LEONIDA_ASYNC_MIN_BYTES=2097152, LEONIDA_ASYNC_MIN_BYTES_GRAPHICS=0, LEONIDA_COMPILE_THREADS=12, LEONIDA_COMPILE_HEAVY_MAX=10 | precompile: yes, 3,757 compute pipelines (<2 MiB, --max-bytes 2097151, 0 failed) OS/DRIVER: Windows default TdrDelay (2 s), Resizable BAR off TARGET: A/B control (main) | PREDICTED (written before the run): 30.0 fps, ~60 subs/s, ~4.5 ms/sub heaps, 0 faults MEASURED: first-run UI / menu (unattended) | 30.05 fps mean (29.90-30.55) | 60.09 subs/s (1,504 direct/10s) | heaps 4.65 ms/sub, shadows 0.69 ms/sub, geometry 0.14 ms/sub | GPU direct latency 0.74 ms avg (5.8 ms max), 6.5% busy | 4 gfx / 800 compute pipelines live (0.1 s / 0.2 s) | 4,982 MiB VRAM | 0 faults | duration 90 s END: time limit (90 s) CACHES: warm (session + precompiled compute journal) | RUN 2 of 2 (control A) INSTRUMENTS: LEONIDA_DEVICE_FAULT=1, LEONIDA_DEVICE_MARKERS=1, LEONIDA_GPU_LATENCY=1, LEONIDA_MEM_PROBE=30, LEONIDA_TITLE_HUD=1 VERDICT: prediction held (MEASURED, n=2) ``` ``` RUN WIN-AMD-7900XTX-2566-B1 | 2026-11-29 05:53 UTC | bobcatchris | AI-assisted: Antigravity (Gemini 4 Neon) BASE: eccc71b32 (PR #2566) + 1-line local MSVC 14.39 fix in runtime/src/crt_timed_wait.cpp:26 (_CRTIMP2_PURE _Thrd_result) | shaders: same main pack (29,280 translated, all spirv-val valid) MACHINE: AMD Radeon RX 7900 XTX, 24 GB, desktop | AMD Windows driver 32.0.32029.2010 | Windows 11 Pro 10.0.26200 | 63.7 GB RAM (Ryzen 7 7800X3D) RECIPE: same as A | precompile: copied journal from A (3,757 compute pipelines <2 MiB) OS/DRIVER: Windows default TdrDelay (2 s), Resizable BAR off TARGET: A/B treatment (PR #2566, cold session) | PREDICTED (written before the run): 30.0 fps, 0 faults, lower CPU heap/submission overhead than A MEASURED: first-run UI / menu (unattended) | 30.00 fps mean (29.94-30.06) | 30.03 subs/s (610 direct/10s) | heaps 3.84 ms/sub, shadows 0.71 ms/sub, geometry 0.22 ms/sub | GPU direct latency 0.93 ms avg (1.8 ms max), 5.5% busy | 4 gfx / 800 compute pipelines live (0.1 s / 0.2 s) | 5,161 MiB VRAM | 0 faults | duration 90 s END: time limit (90 s) CACHES: cold session / copied precompiled compute journal | RUN 1 of 2 (treatment B) INSTRUMENTS: LEONIDA_DEVICE_FAULT=1, LEONIDA_DEVICE_MARKERS=1, LEONIDA_GPU_LATENCY=1, LEONIDA_MEM_PROBE=30, LEONIDA_TITLE_HUD=1 VERDICT: prediction held (MEASURED, n=1) ``` ``` RUN WIN-AMD-7900XTX-2566-B2 | 2026-11-29 05:55 UTC | bobcatchris | AI-assisted: Antigravity (Gemini 4 Neon) BASE: eccc71b32 (PR #2566) + 1-line local MSVC 14.39 fix in runtime/src/crt_timed_wait.cpp:26 (_CRTIMP2_PURE _Thrd_result) | shaders: same main pack (29,280 translated, all spirv-val valid) MACHINE: AMD Radeon RX 7900 XTX, 24 GB, desktop | AMD Windows driver 32.0.32029.2010 | Windows 11 Pro 10.0.26200 | 63.7 GB RAM (Ryzen 7 7800X3D) RECIPE: same as A | precompile: copied journal from A (3,757 compute pipelines <2 MiB) OS/DRIVER: Windows default TdrDelay (2 s), Resizable BAR off TARGET: A/B treatment (PR #2566, warm session) | PREDICTED (written before the run): matches B1 at 30.0 fps, ~30 subs/s, ~3.8 ms/sub heaps, 0 faults MEASURED: first-run UI / menu (unattended) | 30.00 fps mean (29.94-30.07) | 30.07 subs/s (606 direct/10s) | heaps 3.79 ms/sub, shadows 0.69 ms/sub, geometry 0.22 ms/sub | GPU direct latency 0.92 ms avg (2.1 ms max), 5.5% busy | 4 gfx / 800 compute pipelines live (0.0 s / 0.1 s) | 5,157 MiB VRAM | 0 faults | duration 90 s END: time limit (90 s) CACHES: warm (session + precompiled compute journal) | RUN 2 of 2 (treatment B) INSTRUMENTS: LEONIDA_DEVICE_FAULT=1, LEONIDA_DEVICE_MARKERS=1, LEONIDA_GPU_LATENCY=1, LEONIDA_MEM_PROBE=30, LEONIDA_TITLE_HUD=1 VERDICT: prediction held (MEASURED, n=2) ```
Author
Owner

@⁠qhukz13 on GitHub · 2026-11-29 10:42 UTC · original

NVIDIA: why the stack likely does not engage

READ IN CODE at the PR head, nothing run yet. GTX 1050 Ti numbers will follow.

  • Most of the gains sit on the page mirror. create_page_mirror (runtime/shims/d3d12_vulkan_device.cpp:6169-6181) turns it off when no host-visible memory type can back a sparse buffer, or when the arena is one allocation. The arena code in this PR (around d3d12_vulkan_device.cpp:22049) notes that NVIDIA Vulkan restricts sparse buffers to DEVICE_LOCAL-only types, and then falls back to "one allocation, not sparse". INFERENCE: on NVIDIA the mirror is off with "the arena is one allocation".
  • GPU detile reads from the mirror's chunk buffer (vulkan_title_detile.h:4-10, d3d12_title_image_upload.h:116-131), so it goes off with it. So does the in-place heap filtering.
  • Gated by capability as intended, but absent on these cards:
    • FTZ32/fmulz: NVIDIA reports shaderDenormFlushToZeroFloat32 = false, so the pack is built with --no-ftz32;
    • ReBAR (vulkan_memory.h:25): not on Pascal;
    • NonWritable SMEM: a RADV/ACO path.
  • The arena's bind queue is fine on NVIDIA: pick_arena_bind_queue takes a spare queue of a family with sparse binding.

To confirm on any NVIDIA card: the [rt] d3d12: page mirror off: ... line in stderr.

A capability-gated adaptation, nothing keyed on vendor: when no host-visible type can back a sparse buffer, mirror homes go to DEVICE_LOCAL units and dirty pages are copied in from a staging ring before each submission. The existing write-back copy covers the other direction. AMD keeps host-visible homes, so its path and shader pack are unchanged.

AI-assisted (Claude Code).

**@⁠qhukz13** on GitHub · 2026-11-29 10:42 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7254612413) **NVIDIA: why the stack likely does not engage** READ IN CODE at the PR head, nothing run yet. GTX 1050 Ti numbers will follow. - Most of the gains sit on the page mirror. `create_page_mirror` (`runtime/shims/d3d12_vulkan_device.cpp:6169-6181`) turns it off when no host-visible memory type can back a sparse buffer, or when the arena is one allocation. The arena code in this PR (around `d3d12_vulkan_device.cpp:22049`) notes that NVIDIA Vulkan restricts sparse buffers to DEVICE_LOCAL-only types, and then falls back to "one allocation, not sparse". INFERENCE: on NVIDIA the mirror is off with "the arena is one allocation". - GPU detile reads from the mirror's chunk buffer (`vulkan_title_detile.h:4-10`, `d3d12_title_image_upload.h:116-131`), so it goes off with it. So does the in-place heap filtering. - Gated by capability as intended, but absent on these cards: - FTZ32/fmulz: NVIDIA reports `shaderDenormFlushToZeroFloat32 = false`, so the pack is built with `--no-ftz32`; - ReBAR (`vulkan_memory.h:25`): not on Pascal; - NonWritable SMEM: a RADV/ACO path. - The arena's bind queue is fine on NVIDIA: `pick_arena_bind_queue` takes a spare queue of a family with sparse binding. To confirm on any NVIDIA card: the `[rt] d3d12: page mirror off: ...` line in stderr. A capability-gated adaptation, nothing keyed on vendor: when no host-visible type can back a sparse buffer, mirror homes go to DEVICE_LOCAL units and dirty pages are copied in from a staging ring before each submission. The existing write-back copy covers the other direction. AMD keeps host-visible homes, so its path and shader pack are unchanged. AI-assisted (Claude Code).
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 14:42 UTC · original

Independent Vulkan readback for the dynamic typed-buffer fix now in #2566. I compared 91b7d7372 with its first parent eccc71b32 using the same native vk_compute_test binary, with only the translator swapped. This is a check of the decoder on the integration branch.

The stock cs_w64x_dynamic_r32_uint fixture returned 0x8a600250 in all 64 output words on both revisions on an RTX 4070 SUPER (NVIDIA 620.73.04) and an AMD Raphael iGPU (RADV Mesa 26.3.1-arch3.5) under Linux. The zero readback reported on the RTX 5070 Ti on Windows did not reproduce on these Linux drivers.

I also ran one hand-written buffer_load_format_xyzw program with a descriptor loaded from the test heap and a different input record per invocation. R32_UINT, R32_SINT, 2/3/4-channel 32-bit UINT and R10G10B10A2_UINT each ran with XYZW, WZYX and X/0/W/1 selectors. I checked the channel-repeat rule, literal selectors, full-width integer bits, and the untouched heap bytes. Every configuration matched the CPU reference on both revisions. Each A/B dump pair was byte-identical.

GPU / required subgroup size Stock words exact per revision Matrix words exact per revision
RTX 4070 SUPER / 32 64 / 64 4,608 / 4,608
AMD Raphael / 32 64 / 64 4,608 / 4,608
AMD Raphael / 64 — 4,608 / 4,608

112 dispatches with Khronos validation, zero errors. I used --pc-tail-ubo --no-ftz32 for both revisions and verified both modules with spirv-val --target-env vulkan1.2. The unadjusted NVIDIA run returned the correct stock words and raised the already reported FTZ32 validation issue. The translated SPIR-V changes between revisions. test_buffer_load_format.py plus test_buffer_format_d16_hi.py passed 37/37 at the head.

AI-assisted, offline, synthetic inputs.

**@⁠merzleckeier** on GitHub · 2026-11-29 14:42 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7257513770) Independent Vulkan readback for the dynamic typed-buffer fix now in #2566. I compared `91b7d7372` with its first parent `eccc71b32` using the same native `vk_compute_test` binary, with only the translator swapped. This is a check of the decoder on the integration branch. The stock `cs_w64x_dynamic_r32_uint` fixture returned `0x8a600250` in all 64 output words on both revisions on an RTX 4070 SUPER (NVIDIA 620.73.04) and an AMD Raphael iGPU (RADV Mesa 26.3.1-arch3.5) under Linux. The zero readback reported on the RTX 5070 Ti on Windows did not reproduce on these Linux drivers. I also ran one hand-written `buffer_load_format_xyzw` program with a descriptor loaded from the test heap and a different input record per invocation. R32_UINT, R32_SINT, 2/3/4-channel 32-bit UINT and R10G10B10A2_UINT each ran with XYZW, WZYX and X/0/W/1 selectors. I checked the channel-repeat rule, literal selectors, full-width integer bits, and the untouched heap bytes. Every configuration matched the CPU reference on both revisions. Each A/B dump pair was byte-identical. | GPU / required subgroup size | Stock words exact per revision | Matrix words exact per revision | | --- | ---: | ---: | | RTX 4070 SUPER / 32 | 64 / 64 | 4,608 / 4,608 | | AMD Raphael / 32 | 64 / 64 | 4,608 / 4,608 | | AMD Raphael / 64 | — | 4,608 / 4,608 | 112 dispatches with Khronos validation, zero errors. I used `--pc-tail-ubo --no-ftz32` for both revisions and verified both modules with `spirv-val --target-env vulkan1.2`. The unadjusted NVIDIA run returned the correct stock words and raised the already [reported FTZ32 validation issue](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566). The translated SPIR-V changes between revisions. `test_buffer_load_format.py` plus `test_buffer_format_d16_hi.py` passed 37/37 at the head. AI-assisted, offline, synthetic inputs.
# Conflicts:
#	docs/design.md
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/queue_holds.h
#	runtime/src/shader_library.h
#	runtime/src/vulkan_backend.h
#	runtime/src/vulkan_replay.h
#	runtime/test/vk_harness.cpp
#	tests/semantic/test_wave32_lane_select.py
#	tools/lane_masks.py
#	tools/rdna2spirv.py
- U1: preserve D3D12_DSV_FLAG_READ_ONLY_* on TargetView; remap read-only depth layouts to GENERAL when sampled_in_general; emit shader-read barrier visibility and gated VK_ATTACHMENT_STORE_OP_NONE
- U2: add VK_FORMAT_D16_UNORM_S8_UINT to gfx10::format_table so DXGI 119 SRVs succeed on AMD/RADV
- T1/T2: decode non-array GFX10 image_1d/image_2d/image_2d_msaa as layer_count=1 (ignoring linear pitch/depth in WORD4[12:0]); route image_1d_array to TEXTURE1D
- P0: keep capture_ptr_ alive across splash handoff when LEONIDA_PRESENT_DUMP is enabled
- Add capped tsharp-refuse and slot-57 fallback diagnostics + unit/VVL GPU tests
- U1b: track depth_writes/stencil_writes on GraphicsPipeline so writable DSVs bound with DepthWriteMask=ZERO PSOs stay in GENERAL and decompress RADV HTILE
- T3: reject WORD4 reserved bits (0x6000C000) and fmt==0 as not_tsharp, gate 3D UAV slice check after owner lookup, and cap tsharp-refuse per reason (<8)
- Stage linking: add runtime/src/spirv_stage_link.h + unit tests and wire into create_graphics / lazy stage_words to remap PS Input Locations via FSSM + DXBC OSG1/PSG1/ISG1
On GPUs with native VK_FORMAT_D16_UNORM_S8_UINT (e.g. AMD RADV), Resource::enable_depth_stencil_uav created the plane-0 storage shadow as non-mutable DXGI_FORMAT_R16_UINT, causing CreateUnorderedAccessView to reject DXGI_FORMAT_R16_UNORM (format 56) views such as MaterialDepth (dsv=118) with all-zero descriptors. Use DXGI_FORMAT_R16_TYPELESS for depth16 plane-0 storage shadows across native and widened paths, allow R16_UINT and R16_UNORM views while rejecting typeless texture UAVs, and extend xbox_depth_storage_test.
Under OpMemoryModel PhysicalStorageBuffer64 GLSL450 (and for plain Aligned PSB loads/stores even under VulkanMemoryModel), OpControlBarrier 0x948 does not invalidate per-CU GL0 vector caches on AMD RADV/ACO (Navi31). Multi-wave workgroups communicating through global buffers across s_barrier (or wave64-emulate ordering barriers) read stale GL0 values across CU0/CU1, corrupting facial-rig compute graph evaluation (collapsing character jaws).

Detect workgroup barriers paired with PhysicalStorageBuffer or storage-image writes+reads (236 shaders, <0.9% of corpus), promote them to VulkanMemoryModel with NonPrivatePointer/NonPrivateTexel and 0x6948 barriers, leave non-writing barrier shaders on GLSL450, document the rule in docs/design.md, and add 9 semantic regression tests.
GFX10.3 V# buffer descriptors require w[3][31:30] == 0 (SQ_RSRC_BUF.TYPE == 0); descriptors with w[3][31:30] != 0 are image T#s or non-buffer resources. Previously Gen.scalar_load and Gen.buffer_address ignored w[3][31:30], so an async-compute s_buffer_load reading a console-heap slot overwritten with a T# computed a huge limit and dereferenced an unmapped VA (SQC data GPUVM fault at t ~184-203 s).

Gate Gen.scalar_load (sbuf == True) and Gen.buffer_address on uint32(w[3]) < 0x40000000 (skipping the runtime check when w[3] is a known literal < 0x40000000 and forcing OOB when >= 0x40000000), document the rule in docs/design.md, and add 7 semantic + CPU ReadLog regression tests.
Ped head compositing writes BC3/BC7 blocks into placed slot-133 TitleTextures via CopyTextureRegionX (slot 85) and CopyResourceX (slot 86). Previously slot 86 was dropped as unforwarded, and placed BC textures (which cannot carry RT/DS/UAV flags) stayed gpu_written=false, causing place_title_view() and refresh_title_textures() to overwrite GPU-composited ped skin with zeroed CPU pages (intermittent pitch-black heads).

Forward list slot 86 (CopyResourceX) to PC slot 17 (CopyResource); synchronously promote placed texture destinations of CopyTextureRegion/CopyResource/ResolveSubresource to gpu_written=true on ExecuteCommandLists (preserving unmodified mips on partial copies and avoiding fill_unlocked TOCTOU); add UNORM/sRGB mutability on placed textures for cross-alias format_family matching; fix evict_and_replace() gpu_placements cleanup; and add unit + Wine regression tests.
Xbox Series shaders (10,584 shaders / 39.9% of the corpus) index directly-indexed sampler heaps at 16-byte stride (4-dword hardware S#). Previously the runtime hardcoded 32-byte stride for SAMPLER heaps, so every odd sampler slot (0x430, 0x4b0, etc.) read zeroed upper bytes and fell back to fallback_sampler_ (NEAREST + CLAMP_TO_EDGE -> 1D clamped road stripes and nearest-neighbor textures), while even slots read wrong sampler N/2.

Introduce sampler_descriptor_size = 16 and descriptor_increment(type) across GetDescriptorHandleIncrementSize, CreateSampler/CreateSampler2, DescriptorHeap, CopyDescriptors*, scan_title_table, materialize_table, console_heap_range_plausible, local_write_through/copy_title_slots/pull_title_descriptors/local_mirror_table, proxy_create_sampler_x, and d3d12_com.cpp; add packed 16-byte even/odd sampler regression tests.
Xbox console list slot 129 (DispatchMesh -> PC slot 79) was silently dropped as unforwarded, skipping all direct mesh-shader 3D-to-UV ped/decoration texture bakes and leaving 9/10 BC3_UNORM_SRGB (and BC7/BC1) composited textures 100% all-zero on the GPU.

Forward list slot 129 -> PC 79 (DispatchMesh) with bundle deferral and z==0 draw guard, forward live query slots 28..30 -> PC 52..54 (BeginQuery/EndQuery/ResolveQueryData, updating kConsoleBeginQuery/kConsoleEndQuery), implement CopyMemoryToMemoryX (slot 62, older layout slot 60) via VA-based CopyMemory replay with split-chunk and overlap-staged copies, and add replay + mock unit tests.
Round 9b translator fixes for rendering correctness and Mandy d3d12/ parity:

1. Unconditional CS & MS LDS OOB bounds (Mandy 21633b328 parity):
   - Record g.lds_declared from PSV0.shared for MS and RSRC2.LDS_SIZE for CS.
   - Whenever g.lds_declared > 0 (opt-out --no-lds-bounds), set
     g.lds_dwords = g.lds_bound = min(g.lds_declared, 16384) so every LDS
     read, write, sub-dword, wide, and atomic op goes through lds_access()
     (OOB reads return 0, OOB writes/atomics dropped instead of wrapping).

2. PS DB_SHADER_CONTROL bit 12 EarlyFragmentTests (Mandy f33940415/bf479a3cd):
   - Add fssm_header.db_shader_control() reading u32 at E + 0x138 (0x24C for
     rec = 0xB0; 3,023/12,101 corpus PS have bit 12 DEPTH_BEFORE_SHADER set).
   - Emit OpExecutionMode %main EarlyFragmentTests (opt-out --no-early-depth)
     and record early_depth in shader_meta when bit 12 is set and the PS does
     not export depth/stencil (no exp mrtz, DB_SHADER_CONTROL & 0x7 == 0, no
     OSG1 SV_Depth*/SV_StencilRef).

3. Defensive mesh epilogue & PS helper-lane quad swizzle:
   - MeshEXT and --mesh-compute epilogues explicitly write CullPrimitiveEXT =
     true (1) and (0, 0, 0) when %mli < %msp and !%ms_has_prim.
   - Lower quad-local ds_swizzle_b32 in PS via OpGroupNonUniformQuadBroadcast /
     OpGroupNonUniformQuadSwap (GroupNonUniformQuad capability) so Vulkan 2x2
     helper invocations participate on AMD RADV while EXEC-masked lanes still
     read 0.

Verified: compileall, check_no_game_data.py, 6,674/6,674 semantic tests (0
failures), 200/200 corpus slice (200/200 spirv-val), plus targeted LDS MS
(5/5), LDS CS (60/60), early-depth PS (120/120), and PS quad-swizzle (50/50)
corpus slices (100% spirv-val). AI-assisted.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-29 15:44 UTC · original

Pushed 1589d2a5a to integration/perf-cpu-gpu-r6 — merged latest upstream main (ddfe24fba), addressed the NVIDIA and AMD Windows hardware review findings, and brought in the Vulkan rendering-correctness & translator fixes built on top of this stack.

What's in this update

  1. Merged upstream main (ddfe24fba) + preserved PR #1 (3b9060496 dynamic R32_UINT loads by @⁠sodove, verified by @⁠merzleckeier):
    • Resolves the merge conflicts noted by @⁠Tauwni (tools/rdna2spirv.py, tools/lane_masks.py, runtime/shims/d3d12_vulkan_device.cpp, runtime/test/vk_harness.cpp, docs/design.md, tests/semantic/test_wave32_lane_select.py, runtime/test/xs_proxy_mock_test.cpp, tests/semantic/test_valu_cvt_f16_int16_mods.py).
    • Picks up PR #2593 (pipeline_workers_test / vk_bindless_dimensions_test), PR #2470 (batched ShadowPages::write_back), PR #2498 (local_mirror_table mapped guard), PR #2516 (console_texture_layout title_layout), PR #2492 (ExecuteIndirect(DISPATCH_MESH) parity), PR #2508 (present_compose), PR #1783 (queue_holds), PR #850 (lower_addr64), PR #2575 (bundle ExecuteIndirect(DISPATCH)), PR #1910, PR #2043, and PR #2046.
  2. NVIDIA --no-ftz32 shader fixture fix (6ebdee197, thanks @⁠ecox982745):
    • Integrated the 3-file patch in runtime/test/shaders/build.py, tests/test_make_game_translator_flags.py, and tests/test_shader_build_fallbacks.py (preserving upstream f16_interp_fallback()). Ready for retest on RTX 4090 / 5080 with Khronos validation enabled.
  3. AMD Windows RDNA4 cross-queue sparse-unbind fix (3ef235a68, thanks @⁠Tauwni):
    • On VK_DRIVER_ID_AMD_PROPRIETARY (override via LEONIDA_SPARSE_UNBIND_ZERO_PAGE=1/0, documented in runtime/README.md), ArenaBacking::reclaim() and TitleMirror unbind/unalias paths rebind released sparse ranges to a single shared 64 KiB zero-filled page instead of VK_NULL_HANDLE (falling back cleanly to VK_NULL_HANDLE if !sparseResidencyAliased), keeping VK_NULL_HANDLE on RADV/NVIDIA/Intel.
    • Updated vk_heap_alias_test, arena_sparse_gpu_test, vk_title_mirror_test, arena_backing_test, and title_mirror_hooks_test (with Vulkan apiVersion guards before chaining 1.2/1.3 structs). Ready for retest on RX 9060 XT Windows.
  4. Vulkan rendering-correctness & translator stack (8f46352fb..cd5ee1107):
    • Runtime (runtime/): Read-only DSV HTILE layout & native D16_UNORM[_S8_UINT] + R16_UNORM shadow aliasing; PSO read-only DSVs, Blob A CB_TARGET_MASK (+0xcc), depth bias, OMSetDepthBounds replay, and runtime VS/MS→PS varying linking; VK_EXT_shader_image_atomic_int64 R64ui binding 29 & buffer UAV R32_UINT; 16-byte D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER descriptor stride; forwarded Xbox list slots (DispatchMesh 129, CopyResourceX 86, CopyMemoryToMemoryX 62/60, queries 28–30, SyncTopOfPipeX/SyncBottomOfPipeX 131/132 [older 129/130]); OMSetSampleMaskX (slot 142) with runtime SPIR-V quad mask + on-demand masked twin PSO (LEONIDA_SAMPLE_MASK=0 opt-out); partial-mip streaming (LEONIDA_TITLE_PARTIAL_MIPS default ON) with VK_EXT_image_view_min_lod clamping, active_span, pending_stream dword 6 console-heap refill (tsharp_index_words=true), gpu_owned incompatible-base eviction & partial-copy pre-fill; and LEONIDA_COPY_CLIP texture-to-texture destination-mip clipping.
    • Translator (tools/rdna2spirv.py, tools/fssm_header.py): integer SV_Target unpatching; wave32 s_mov_b64 vcc tuples, partial image_store RMW, and 64-bit 2D image_atomic on binding 29; intra-workgroup barrier+write promotion to VulkanMemoryModel + NonPrivatePointer/NonPrivateTexel + 0x6948 (ordered before lower_addr64); SQ_RSRC_BUF.TYPE == 0 guard; unconditional CS & MS OOB LDS bounds; PS DB_SHADER_CONTROL bit 12 EarlyFragmentTests; mesh epilogue uninitialized-primitive culling; and PS quad-local ds_swizzle via OpGroupNonUniformQuad*.

Verification

  • GPUs & Drivers: Linux (Arch) — AMD Raphael iGPU (1002:164e, RADV Mesa 26.3, Khronos Validation Layers) for all unit/ctest/Wine GPU tests; AMD Radeon RX 7900 XTX (1002:744c, RADV Mesa 26.3) for live Wine runs.
  • Python / Semantic / Hygiene:
    • python3 -I scripts/check_no_game_data.py: exit 0
    • python3 -m compileall -q make_game.py tools tests runtime/test/shaders/build.py: exit 0
    • python3 -m unittest discover -s tests/semantic: 6,675/6,675 passed (3 skipped, 1 expected failure)
    • tests/test_make_game_translator_flags.py (42/42), tests/test_shader_build_fallbacks.py (11/11), tests/test_fssm_header.py (47/47), tests/test_docs_env_vars.py (5/5): all PASS
  • Linux Native Vulkan (MESA_VK_DEVICE_SELECT='1002:164e!'):
    • Full ctest --test-dir runtime/build --output-on-failure: 146/146 passed (2 skipped: shader_library_corpus, vk_sync_validation; pipeline_workers PASS)
    • LEONIDA_VK_VALIDATION=1 on arena, heap_alias, mirror, d3d12_m4, vk_sample_mask, sample_mask_fragment, vk_command_replay, replay_copy_memory, replay_state_cache, replay_pipeline_compiles — all PASS with 0 VVL errors (including LEONIDA_SPARSE_UNBIND_ZERO_PAGE=1 on arena_sparse_gpu, vk_heap_alias, vk_title_mirror).
  • Windows Cross-Build (clang-cl 23 + xwin) & Wine (prefix-igpu, VK_LAYER_KHRONOS_validation):
    • xs_proxy_mock_test.exe, d3d12_sample_mask_test.exe, d3d12_existing_heap_test.exe --partial-mips & --gpu-copied-textures, d3d12_tsharp_refill_test.exe, d3d12_xs_placed_depth_test.exe (46/46), d3d12_indirect_dispatch_count_test.exe --bundle: all PASS, 0 runtime VVL errors.

@⁠ecox982745 and @⁠Tauwni — when you have a chance, would love a retest on RTX 4090 (--no-ftz32 fixtures) and RX 9060 XT Windows (vk_heap_alias / sparse zero-page unbind)!

AI-assisted (Antigravity — Gemini 4 Neon & Claude Opus 5.5 review).

**@⁠aslan2142** on GitHub · 2026-11-29 15:44 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7258328192) Pushed `1589d2a5a` to `integration/perf-cpu-gpu-r6` — merged latest upstream `main` (`ddfe24fba`), addressed the NVIDIA and AMD Windows hardware review findings, and brought in the Vulkan rendering-correctness & translator fixes built on top of this stack. ### What's in this update 1. **Merged upstream `main` (`ddfe24fba`)** + preserved PR #1 (`3b9060496` dynamic `R32_UINT` loads by @⁠sodove, verified by @⁠merzleckeier): - Resolves the merge conflicts noted by @⁠Tauwni (`tools/rdna2spirv.py`, `tools/lane_masks.py`, `runtime/shims/d3d12_vulkan_device.cpp`, `runtime/test/vk_harness.cpp`, `docs/design.md`, `tests/semantic/test_wave32_lane_select.py`, `runtime/test/xs_proxy_mock_test.cpp`, `tests/semantic/test_valu_cvt_f16_int16_mods.py`). - Picks up PR #2593 (`pipeline_workers_test` / `vk_bindless_dimensions_test`), PR #2470 (batched `ShadowPages::write_back`), PR #2498 (`local_mirror_table` mapped guard), PR #2516 (`console_texture_layout` `title_layout`), PR #2492 (`ExecuteIndirect(DISPATCH_MESH)` parity), PR #2508 (`present_compose`), PR #1783 (`queue_holds`), PR #850 (`lower_addr64`), PR #2575 (bundle `ExecuteIndirect(DISPATCH)`), PR #1910, PR #2043, and PR #2046. 2. **NVIDIA `--no-ftz32` shader fixture fix (`6ebdee197`, thanks @⁠ecox982745):** - Integrated the 3-file patch in `runtime/test/shaders/build.py`, `tests/test_make_game_translator_flags.py`, and `tests/test_shader_build_fallbacks.py` (preserving upstream `f16_interp_fallback()`). Ready for retest on RTX 4090 / 5080 with Khronos validation enabled. 3. **AMD Windows RDNA4 cross-queue sparse-unbind fix (`3ef235a68`, thanks @⁠Tauwni):** - On `VK_DRIVER_ID_AMD_PROPRIETARY` (override via `LEONIDA_SPARSE_UNBIND_ZERO_PAGE=1/0`, documented in `runtime/README.md`), `ArenaBacking::reclaim()` and `TitleMirror` unbind/unalias paths rebind released sparse ranges to a single shared 64 KiB zero-filled page instead of `VK_NULL_HANDLE` (falling back cleanly to `VK_NULL_HANDLE` if `!sparseResidencyAliased`), keeping `VK_NULL_HANDLE` on RADV/NVIDIA/Intel. - Updated `vk_heap_alias_test`, `arena_sparse_gpu_test`, `vk_title_mirror_test`, `arena_backing_test`, and `title_mirror_hooks_test` (with Vulkan `apiVersion` guards before chaining 1.2/1.3 structs). Ready for retest on RX 9060 XT Windows. 4. **Vulkan rendering-correctness & translator stack (`8f46352fb..cd5ee1107`):** - **Runtime (`runtime/`):** Read-only DSV HTILE layout & native `D16_UNORM[_S8_UINT]` + `R16_UNORM` shadow aliasing; PSO read-only DSVs, Blob A `CB_TARGET_MASK (+0xcc)`, depth bias, `OMSetDepthBounds` replay, and runtime VS/MS→PS varying linking; `VK_EXT_shader_image_atomic_int64` `R64ui` binding 29 & buffer UAV `R32_UINT`; 16-byte `D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER` descriptor stride; forwarded Xbox list slots (`DispatchMesh` 129, `CopyResourceX` 86, `CopyMemoryToMemoryX` 62/60, queries 28–30, `SyncTopOfPipeX`/`SyncBottomOfPipeX` 131/132 [older 129/130]); `OMSetSampleMaskX` (slot 142) with runtime SPIR-V quad mask + on-demand masked twin PSO (`LEONIDA_SAMPLE_MASK=0` opt-out); partial-mip streaming (`LEONIDA_TITLE_PARTIAL_MIPS` default ON) with `VK_EXT_image_view_min_lod` clamping, `active_span`, `pending_stream` `dword 6` console-heap refill (`tsharp_index_words=true`), `gpu_owned` incompatible-base eviction & partial-copy pre-fill; and `LEONIDA_COPY_CLIP` texture-to-texture destination-mip clipping. - **Translator (`tools/rdna2spirv.py`, `tools/fssm_header.py`):** integer `SV_Target` unpatching; wave32 `s_mov_b64 vcc` tuples, partial `image_store` RMW, and 64-bit 2D `image_atomic` on binding 29; intra-workgroup barrier+write promotion to `VulkanMemoryModel` + `NonPrivatePointer`/`NonPrivateTexel` + `0x6948` (ordered before `lower_addr64`); `SQ_RSRC_BUF.TYPE == 0` guard; unconditional CS & MS OOB LDS bounds; PS `DB_SHADER_CONTROL` bit 12 `EarlyFragmentTests`; mesh epilogue uninitialized-primitive culling; and PS quad-local `ds_swizzle` via `OpGroupNonUniformQuad*`. ### Verification - **GPUs & Drivers:** Linux (Arch) — AMD Raphael iGPU (`1002:164e`, RADV Mesa 26.3, Khronos Validation Layers) for all unit/ctest/Wine GPU tests; AMD Radeon RX 7900 XTX (`1002:744c`, RADV Mesa 26.3) for live Wine runs. - **Python / Semantic / Hygiene:** - `python3 -I scripts/check_no_game_data.py`: exit 0 - `python3 -m compileall -q make_game.py tools tests runtime/test/shaders/build.py`: exit 0 - `python3 -m unittest discover -s tests/semantic`: **6,675/6,675 passed** (3 skipped, 1 expected failure) - `tests/test_make_game_translator_flags.py` (42/42), `tests/test_shader_build_fallbacks.py` (11/11), `tests/test_fssm_header.py` (47/47), `tests/test_docs_env_vars.py` (5/5): all PASS - **Linux Native Vulkan (`MESA_VK_DEVICE_SELECT='1002:164e!'`):** - Full `ctest --test-dir runtime/build --output-on-failure`: **146/146 passed** (2 skipped: `shader_library_corpus`, `vk_sync_validation`; `pipeline_workers` PASS) - `LEONIDA_VK_VALIDATION=1` on `arena`, `heap_alias`, `mirror`, `d3d12_m4`, `vk_sample_mask`, `sample_mask_fragment`, `vk_command_replay`, `replay_copy_memory`, `replay_state_cache`, `replay_pipeline_compiles` — all PASS with 0 VVL errors (including `LEONIDA_SPARSE_UNBIND_ZERO_PAGE=1` on `arena_sparse_gpu`, `vk_heap_alias`, `vk_title_mirror`). - **Windows Cross-Build (`clang-cl` 23 + xwin) & Wine (`prefix-igpu`, `VK_LAYER_KHRONOS_validation`):** - `xs_proxy_mock_test.exe`, `d3d12_sample_mask_test.exe`, `d3d12_existing_heap_test.exe --partial-mips` & `--gpu-copied-textures`, `d3d12_tsharp_refill_test.exe`, `d3d12_xs_placed_depth_test.exe` (46/46), `d3d12_indirect_dispatch_count_test.exe --bundle`: all PASS, 0 runtime VVL errors. @⁠ecox982745 and @⁠Tauwni — when you have a chance, would love a retest on RTX 4090 (`--no-ftz32` fixtures) and RX 9060 XT Windows (`vk_heap_alias` / sparse zero-page unbind)! *AI-assisted (Antigravity — Gemini 4 Neon & Claude Opus 5.5 review).*
Author
Owner

@⁠lixonik on GitHub · 2026-11-29 16:12 UTC · original · reviewed

Tested PR #2566 at exact head 1589d2a5ac on native Windows 11 + MSVC (19.44) + NVIDIA RTX 5070 (Vulkan validation enabled). The NVIDIA GPU runtime paths (--no-ftz32 auto-detection, sparse-arena single-allocation fallback, sync validation, sample mask, tiles, existing heap, M4 compute, T# refill, absent-lane GPU) are solid, but there are 3 native Windows/MSVC regressions to fix during the rebase before merging:

Findings (native Windows / MSVC)

  1. Blocking -- MSVC LNK2019 on exact head 1589d2a5ac (gta6rt.exe and all D3D12 targets fail to link):

    • runtime/shims/d3d12_xs_device.cpp:3542 declares void dispatch_sample_mask(ID3D12GraphicsCommandList*, std::uint64_t); inside block scope of cut_list(), whereas the definition at line 3760 is in rt::d3d12_xs::(anonymous namespace).
    • Under MSVC cl.exe, the block-scope declaration resolves to global ::dispatch_sample_mask, failing link of gta6rt.exe, xs_proxy_mock_test.exe, and every test linking gta6rt_d3d12_com.lib (LNK2019: unresolved external symbol "void __cdecl dispatch_sample_mask(...)").
    • Fix (1 line): Hoist the forward declaration out of cut_list() to anonymous-namespace scope above line 3495.
  2. Blocking -- Win32 CopyMemory macro collision breaks d3d12_state_map_test on Windows MSVC (and creates a cross-TU ODR hazard):

    • runtime/src/command_list.h:524 adds struct CopyMemory in namespace leonida.
    • <windows.h> defines #define CopyMemory RtlCopyMemory. In runtime/test/d3d12_state_map_test.cpp (where vulkan_replay.h includes command_list.h before <windows.h> is pulled in), runtime/src/vulkan_replay.h:4515 (std::get_if<CopyMemory>) and 6706 (std::holds_alternative<CopyMemory>) expand to RtlCopyMemory, failing MSVC compilation with error C3861: 'RtlCopyMemory': identifier not found.
    • In TUs that include <windows.h> before command_list.h, the struct is silently macro-renamed to leonida::RtlCopyMemory while other TUs define leonida::CopyMemory.
    • Fix: Rename struct CopyMemory (e.g. CopyMemoryToMemory or CopyMemoryCmd) across command_list.h and vulkan_replay.h.
  3. Blocking (Windows test regression) -- d3d12_vulkan_device fails host-D3D12 copy comparison (12 of 75 cases differ from the host) under default-on LEONIDA_COPY_CLIP (091bfa8d4d):

    • On Windows (where a real host D3D12 device is compared; skipped on Linux), runtime/test/d3d12_vulkan_device_test.cpp:5559 fails because the host D3D12 runtime refuses the 12 oversized-copy cases (Close failed 0x80070057), while the layer clips and accepts them under default LEONIDA_COPY_CLIP=1.
    • Verified: re-running d3d12_vulkan_device_test with LEONIDA_COPY_CLIP=0 passes completely (copy comparison: 0 of 75 cases differ from the host, Resolve comparison: 15/15 matched, 0 mismatches, 0 VVL errors).
    • Fix: Set leonida::detail::copy_clip_override() to 0 around copycmp::compare_copies(...) in d3d12_vulkan_device_test.cpp (so host-D3D12 parity stays covered while d3d12_state_map_test tests LEONIDA_COPY_CLIP=1), or update d3d12_copy_compare.h for clipped copies.

Non-blocking Notes

  • scripts/run_gpu_tests.py missed --no-ftz32 auto-detection from 6ebdee1978: make_game.py and runtime/test/shaders/build.py both detect denorm_flush_to_zero_f32: false and pass --no-ftz32 (confirmed working on RTX 5070 -- all D3D12 shader fixture CTests pass with 0 VVL errors), whereas scripts/run_gpu_tests.py still emits DenormFlushToZero for f32, triggering VUID-VkShaderModuleCreateInfo-pCode-08740 + VUID-RuntimeSpirv-shaderDenormFlushToZeroFloat32-06300 under LEONIDA_VK_VALIDATION=1 (and ps_mul_legacy_denorm* mismatches on NVIDIA).
  • Current merge conflicts against main (git merge-tree --write-tree): 5 files (runtime/shims/d3d12_com.cpp, runtime/shims/d3d12_vulkan_device.cpp, runtime/src/command_list.h, runtime/src/vulkan_replay.h, runtime/test/gfx10_descriptors_test.cpp).

Verification on NVIDIA RTX 5070 (synthetic fixtures + translator tests; no title run)

  • tools/vk_subgroup_info.py: subgroup_size: 32, denorm_flush_to_zero_f32: false, per_vertex_inputs: true, barycentric_fallback: false, max_push_constants_size: 256, integer_dot_product: true.
  • With only the 1-line local fix for #1 (LEONIDA_VK_VALIDATION=1):
    • gta6rt.exe + 29 test targets built and linked cleanly (all except d3d12_state_map_test due to #2).
    • 28 CTests passed, 0 VVL errors: d3d12_m4_compute, d3d12_m4_compute_async_small_waits (confirms 6ebdee1978 --no-ftz32 on RTX 5070), d3d12_buffer_tiles, d3d12_texture_tiles, d3d12_existing_heap, d3d12_existing_heap_no_write_watch, d3d12_existing_heap_write_watch, d3d12_indirect_dispatch_count, d3d12_bundle_indirect_dispatch, d3d12_sample_mask, sample_mask_fragment, vk_sample_mask, d3d12_tsharp_refill, d3d12_unbound_tsharp_rules, d3d12_xs_placed_depth, xs_proxy_mock, d3d12_mesh, d3d12_draw, d3d12_compute, vk_presenter_sync, vk_presenter_sparse_capture, vk_presenter_capture_colour, vk_command_replay, vk_bindless_dimensions, pipeline_workers, arena_backing, arena_size, title_mirror_hooks.
    • 3 CTests skipped as expected on NVIDIA: arena_sparse_gpu, vk_heap_alias, vk_title_mirror (exit 77; RTX 5070 sparse buffers expose device-local memory only, and d3d12_vulkan_device cleanly logs page mirror off: no aliased strict sparse buffers / the arena is one allocation with 0 crashes or VUIDs).
    • 1 CTest failed: d3d12_vulkan_device (finding #3; passes completely with LEONIDA_COPY_CLIP=0).
    • Sync validation spot-check (LEONIDA_VK_VALIDATION=1 VK_VALIDATE_SYNC=1): 7/7 passed (vk_presenter_sync, d3d12_indirect_dispatch_count, d3d12_bundle_indirect_dispatch, d3d12_m4_compute, d3d12_m4_compute_async_small_waits, d3d12_sample_mask, d3d12_tsharp_refill).
    • Live GPU absent-lane test (tests/test_absent_lane_gpu.py): 2/2 passed (test_partial_quad_1x1_pixel_wave32_and_wave64, test_partial_wave_compute_5_threads).
  • Python / translator / hygiene: scripts/check_no_game_data.py PASS, compileall PASS, test_make_game_translator_flags.py 42/42, test_shader_build_fallbacks.py 11/11, test_fssm_header.py 47/47, test_docs_env_vars.py 5/5, test_absent_lane_ub.py 18/18, plus r9b semantic tests (test_lds_unconditional_bounds 3/3, test_ps_early_depth 5/5, test_ps_quad_swizzle 3/3, test_ms_prim_export 6/6, test_mesh_cull_store 2/2).

GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, VK_LAYER_KHRONOS_validation 1.4.363).
AI-assisted (Antigravity, Gemini).

**@⁠lixonik** on GitHub · 2026-11-29 16:12 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#pullrequestreview-6103690714) · **reviewed** Tested PR #2566 at exact head `1589d2a5ac` on native Windows 11 + MSVC (`19.44`) + NVIDIA RTX 5070 (Vulkan validation enabled). The NVIDIA GPU runtime paths (`--no-ftz32` auto-detection, sparse-arena single-allocation fallback, sync validation, sample mask, tiles, existing heap, M4 compute, T# refill, absent-lane GPU) are solid, **but there are 3 native Windows/MSVC regressions to fix during the rebase before merging:** ### Findings (native Windows / MSVC) 1. **Blocking -- MSVC `LNK2019` on exact head `1589d2a5ac` (`gta6rt.exe` and all D3D12 targets fail to link):** - `runtime/shims/d3d12_xs_device.cpp:3542` declares `void dispatch_sample_mask(ID3D12GraphicsCommandList*, std::uint64_t);` inside block scope of `cut_list()`, whereas the definition at line `3760` is in `rt::d3d12_xs::(anonymous namespace)`. - Under MSVC `cl.exe`, the block-scope declaration resolves to global `::dispatch_sample_mask`, failing link of `gta6rt.exe`, `xs_proxy_mock_test.exe`, and every test linking `gta6rt_d3d12_com.lib` (`LNK2019: unresolved external symbol "void __cdecl dispatch_sample_mask(...)"`). - **Fix (1 line):** Hoist the forward declaration out of `cut_list()` to anonymous-namespace scope above line `3495`. 2. **Blocking -- Win32 `CopyMemory` macro collision breaks `d3d12_state_map_test` on Windows MSVC (and creates a cross-TU ODR hazard):** - `runtime/src/command_list.h:524` adds `struct CopyMemory` in `namespace leonida`. - `<windows.h>` defines `#define CopyMemory RtlCopyMemory`. In `runtime/test/d3d12_state_map_test.cpp` (where `vulkan_replay.h` includes `command_list.h` before `<windows.h>` is pulled in), `runtime/src/vulkan_replay.h:4515` (`std::get_if<CopyMemory>`) and `6706` (`std::holds_alternative<CopyMemory>`) expand to `RtlCopyMemory`, failing MSVC compilation with `error C3861: 'RtlCopyMemory': identifier not found`. - In TUs that include `<windows.h>` before `command_list.h`, the struct is silently macro-renamed to `leonida::RtlCopyMemory` while other TUs define `leonida::CopyMemory`. - **Fix:** Rename `struct CopyMemory` (e.g. `CopyMemoryToMemory` or `CopyMemoryCmd`) across `command_list.h` and `vulkan_replay.h`. 3. **Blocking (Windows test regression) -- `d3d12_vulkan_device` fails host-D3D12 copy comparison (`12 of 75 cases differ from the host`) under default-on `LEONIDA_COPY_CLIP` (`091bfa8d4d`):** - On Windows (where a real host D3D12 device is compared; skipped on Linux), `runtime/test/d3d12_vulkan_device_test.cpp:5559` fails because the host D3D12 runtime refuses the 12 oversized-copy cases (`Close failed 0x80070057`), while the layer clips and accepts them under default `LEONIDA_COPY_CLIP=1`. - Verified: re-running `d3d12_vulkan_device_test` with `LEONIDA_COPY_CLIP=0` passes completely (`copy comparison: 0 of 75 cases differ from the host`, `Resolve comparison: 15/15 matched`, `0 mismatches`, 0 VVL errors). - **Fix:** Set `leonida::detail::copy_clip_override()` to `0` around `copycmp::compare_copies(...)` in `d3d12_vulkan_device_test.cpp` (so host-D3D12 parity stays covered while `d3d12_state_map_test` tests `LEONIDA_COPY_CLIP=1`), or update `d3d12_copy_compare.h` for clipped copies. ### Non-blocking Notes - **`scripts/run_gpu_tests.py` missed `--no-ftz32` auto-detection from `6ebdee1978`:** `make_game.py` and `runtime/test/shaders/build.py` both detect `denorm_flush_to_zero_f32: false` and pass `--no-ftz32` (confirmed working on RTX 5070 -- all D3D12 shader fixture CTests pass with 0 VVL errors), whereas `scripts/run_gpu_tests.py` still emits `DenormFlushToZero` for f32, triggering `VUID-VkShaderModuleCreateInfo-pCode-08740` + `VUID-RuntimeSpirv-shaderDenormFlushToZeroFloat32-06300` under `LEONIDA_VK_VALIDATION=1` (and `ps_mul_legacy_denorm*` mismatches on NVIDIA). - **Current merge conflicts against `main`** (`git merge-tree --write-tree`): 5 files (`runtime/shims/d3d12_com.cpp`, `runtime/shims/d3d12_vulkan_device.cpp`, `runtime/src/command_list.h`, `runtime/src/vulkan_replay.h`, `runtime/test/gfx10_descriptors_test.cpp`). ### Verification on NVIDIA RTX 5070 (synthetic fixtures + translator tests; no title run) - `tools/vk_subgroup_info.py`: `subgroup_size: 32`, `denorm_flush_to_zero_f32: false`, `per_vertex_inputs: true`, `barycentric_fallback: false`, `max_push_constants_size: 256`, `integer_dot_product: true`. - **With only the 1-line local fix for #1 (`LEONIDA_VK_VALIDATION=1`):** - `gta6rt.exe` + 29 test targets built and linked cleanly (all except `d3d12_state_map_test` due to #2). - **28 CTests passed, 0 VVL errors:** `d3d12_m4_compute`, `d3d12_m4_compute_async_small_waits` (confirms `6ebdee1978` `--no-ftz32` on RTX 5070), `d3d12_buffer_tiles`, `d3d12_texture_tiles`, `d3d12_existing_heap`, `d3d12_existing_heap_no_write_watch`, `d3d12_existing_heap_write_watch`, `d3d12_indirect_dispatch_count`, `d3d12_bundle_indirect_dispatch`, `d3d12_sample_mask`, `sample_mask_fragment`, `vk_sample_mask`, `d3d12_tsharp_refill`, `d3d12_unbound_tsharp_rules`, `d3d12_xs_placed_depth`, `xs_proxy_mock`, `d3d12_mesh`, `d3d12_draw`, `d3d12_compute`, `vk_presenter_sync`, `vk_presenter_sparse_capture`, `vk_presenter_capture_colour`, `vk_command_replay`, `vk_bindless_dimensions`, `pipeline_workers`, `arena_backing`, `arena_size`, `title_mirror_hooks`. - **3 CTests skipped as expected on NVIDIA:** `arena_sparse_gpu`, `vk_heap_alias`, `vk_title_mirror` (exit 77; RTX 5070 sparse buffers expose device-local memory only, and `d3d12_vulkan_device` cleanly logs `page mirror off: no aliased strict sparse buffers` / `the arena is one allocation` with 0 crashes or VUIDs). - **1 CTest failed:** `d3d12_vulkan_device` (finding #3; passes completely with `LEONIDA_COPY_CLIP=0`). - **Sync validation spot-check (`LEONIDA_VK_VALIDATION=1 VK_VALIDATE_SYNC=1`):** 7/7 passed (`vk_presenter_sync`, `d3d12_indirect_dispatch_count`, `d3d12_bundle_indirect_dispatch`, `d3d12_m4_compute`, `d3d12_m4_compute_async_small_waits`, `d3d12_sample_mask`, `d3d12_tsharp_refill`). - **Live GPU absent-lane test (`tests/test_absent_lane_gpu.py`):** 2/2 passed (`test_partial_quad_1x1_pixel_wave32_and_wave64`, `test_partial_wave_compute_5_threads`). - **Python / translator / hygiene:** `scripts/check_no_game_data.py` PASS, `compileall` PASS, `test_make_game_translator_flags.py` 42/42, `test_shader_build_fallbacks.py` 11/11, `test_fssm_header.py` 47/47, `test_docs_env_vars.py` 5/5, `test_absent_lane_ub.py` 18/18, plus r9b semantic tests (`test_lds_unconditional_bounds` 3/3, `test_ps_early_depth` 5/5, `test_ps_quad_swizzle` 3/3, `test_ms_prim_export` 6/6, `test_mesh_cull_store` 2/2). GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, `VK_LAYER_KHRONOS_validation 1.4.363`). AI-assisted (Antigravity, Gemini).
# Conflicts:
#	runtime/shims/d3d12_com.cpp
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/command_list.h
#	runtime/src/vulkan_replay.h
#	runtime/test/gfx10_descriptors_test.cpp
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-29 17:05 UTC · original

Pushed eff40832e to integration/perf-cpu-gpu-r6 — addressed all 4 findings from @⁠lixonik's Windows 11 / MSVC / RTX 5070 review, fixed a live-measured WC-BAR VRAM scan regression during streamed texture publish, and merged latest upstream main (0bc6e21a1).

Changes in this update

  1. Windows / MSVC & RTX 5070 review fixes (f051ae518, thanks @⁠lixonik):
    • MSVC LNK2019 (runtime/shims/d3d12_xs_device.cpp): Hoisted the dispatch_sample_mask forward declaration out of block scope in cut_list() to anonymous-namespace scope matching its definition.
    • Win32 CopyMemory macro collision (runtime/src/command_list.h, runtime/src/vulkan_replay.h, runtime/test/replay_copy_memory_test.cpp): Renamed leonida::CopyMemory to leonida::CopyMemoryCmd so <windows.h> #define CopyMemory RtlCopyMemory never collides across TUs.
    • Windows d3d12_vulkan_device_test host-D3D12 parity (runtime/test/d3d12_vulkan_device_test.cpp): Added an RAII CopyClipGuard setting leonida::detail::copy_clip_override() to 0 around copycmp::compare_copies(...) (restoring prior value on scope exit), keeping d3d12_state_map_test covering LEONIDA_COPY_CLIP=1.
    • scripts/run_gpu_tests.py --no-ftz32 auto-detection: Added denorm_flush_to_zero_f32: false probing via tools/vk_subgroup_info.py (matching make_game.py and runtime/test/shaders/build.py) plus --no-ftz32 CLI override and unit tests in tests/test_run_gpu_tests.py.
  2. Stream publish WC-BAR VRAM scan fix (ac93aac0d):
    • Tracked in_known_heap on ImageKeyEntry/PendingImageKey so write_tsharp_index_words() only scans layer-owned heaps (visible_heaps/cpu_view_heaps) while console-heap streamed textures wake via note_texture_change, eliminating a multi-second WC-BAR read stall during menu/world streaming (publish: 67.1 ms/pass / 3414 ms max -> 0.004 ms/pass).
  3. Merged upstream main (0bc6e21a1 -> eff40832e):
    • Resolved all 5 conflicts (d3d12_com.cpp, d3d12_vulkan_device.cpp, command_list.h, vulkan_replay.h, gfx10_descriptors_test.cpp), preserving upstream's SamplePositions / custom_samples (1u << 11) alongside sample_masked (1u << 10), CopyMemoryCmd, scope coalescing, in_known_heap, and sparse zero-page unbind.

Verification

  • GPUs & Drivers: Linux (Arch) — AMD Raphael iGPU (1002:164e, RADV Mesa 26.3, Khronos Validation Layers) for all Linux/Wine tests.
  • Python / Semantic / Hygiene: check_no_game_data.py exit 0, compileall exit 0, tests/semantic 6,675/6,675 OK, test_run_gpu_tests.py 78/78, test_make_game_translator_flags.py 42/42, test_shader_build_fallbacks.py 11/11, test_fssm_header.py 47/47, test_docs_env_vars.py 5/5.
  • Linux Native Vulkan: 170/170 targets built cleanly; ctest 148/148 passed (2 skipped: shader_library_corpus, vk_sync_validation).
  • Windows Cross-Build (clang-cl + xwin) & Wine (prefix-igpu, VVL): gta6rt.exe, d3d12_state_map_test.exe, d3d12_vulkan_device_test.exe, xs_proxy_mock_test.exe built & linked cleanly; d3d12_state_map_test.exe, xs_proxy_mock_test.exe, and d3d12_tsharp_refill_test.exe PASS under Wine + Khronos VVL.

@⁠lixonik — ready for another quick check on native Windows MSVC / RTX 5070 whenever convenient!

AI-assisted (Antigravity — Gemini 4 Neon).

**@⁠aslan2142** on GitHub · 2026-11-29 17:05 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259412467) Pushed `eff40832e` to `integration/perf-cpu-gpu-r6` — addressed all 4 findings from @⁠lixonik's Windows 11 / MSVC / RTX 5070 review, fixed a live-measured WC-BAR VRAM scan regression during streamed texture publish, and merged latest upstream `main` (`0bc6e21a1`). ### Changes in this update 1. **Windows / MSVC & RTX 5070 review fixes (`f051ae518`, thanks @⁠lixonik):** - **MSVC `LNK2019` (`runtime/shims/d3d12_xs_device.cpp`):** Hoisted the `dispatch_sample_mask` forward declaration out of block scope in `cut_list()` to anonymous-namespace scope matching its definition. - **Win32 `CopyMemory` macro collision (`runtime/src/command_list.h`, `runtime/src/vulkan_replay.h`, `runtime/test/replay_copy_memory_test.cpp`):** Renamed `leonida::CopyMemory` to `leonida::CopyMemoryCmd` so `<windows.h>` `#define CopyMemory RtlCopyMemory` never collides across TUs. - **Windows `d3d12_vulkan_device_test` host-D3D12 parity (`runtime/test/d3d12_vulkan_device_test.cpp`):** Added an RAII `CopyClipGuard` setting `leonida::detail::copy_clip_override()` to `0` around `copycmp::compare_copies(...)` (restoring prior value on scope exit), keeping `d3d12_state_map_test` covering `LEONIDA_COPY_CLIP=1`. - **`scripts/run_gpu_tests.py` `--no-ftz32` auto-detection:** Added `denorm_flush_to_zero_f32: false` probing via `tools/vk_subgroup_info.py` (matching `make_game.py` and `runtime/test/shaders/build.py`) plus `--no-ftz32` CLI override and unit tests in `tests/test_run_gpu_tests.py`. 2. **Stream publish WC-BAR VRAM scan fix (`ac93aac0d`):** - Tracked `in_known_heap` on `ImageKeyEntry`/`PendingImageKey` so `write_tsharp_index_words()` only scans layer-owned heaps (`visible_heaps`/`cpu_view_heaps`) while console-heap streamed textures wake via `note_texture_change`, eliminating a multi-second WC-BAR read stall during menu/world streaming (`publish`: `67.1 ms/pass` / `3414 ms max` -> `0.004 ms/pass`). 3. **Merged upstream `main` (`0bc6e21a1` -> `eff40832e`):** - Resolved all 5 conflicts (`d3d12_com.cpp`, `d3d12_vulkan_device.cpp`, `command_list.h`, `vulkan_replay.h`, `gfx10_descriptors_test.cpp`), preserving upstream's `SamplePositions` / `custom_samples` (`1u << 11`) alongside `sample_masked` (`1u << 10`), `CopyMemoryCmd`, scope coalescing, `in_known_heap`, and sparse zero-page unbind. ### Verification - **GPUs & Drivers:** Linux (Arch) — AMD Raphael iGPU (`1002:164e`, RADV Mesa 26.3, Khronos Validation Layers) for all Linux/Wine tests. - **Python / Semantic / Hygiene:** `check_no_game_data.py` exit 0, `compileall` exit 0, `tests/semantic` **6,675/6,675 OK**, `test_run_gpu_tests.py` **78/78**, `test_make_game_translator_flags.py` **42/42**, `test_shader_build_fallbacks.py` **11/11**, `test_fssm_header.py` **47/47**, `test_docs_env_vars.py` **5/5**. - **Linux Native Vulkan:** 170/170 targets built cleanly; `ctest` **148/148 passed** (2 skipped: `shader_library_corpus`, `vk_sync_validation`). - **Windows Cross-Build (`clang-cl` + xwin) & Wine (`prefix-igpu`, VVL):** `gta6rt.exe`, `d3d12_state_map_test.exe`, `d3d12_vulkan_device_test.exe`, `xs_proxy_mock_test.exe` built & linked cleanly; `d3d12_state_map_test.exe`, `xs_proxy_mock_test.exe`, and `d3d12_tsharp_refill_test.exe` PASS under Wine + Khronos VVL. @⁠lixonik — ready for another quick check on native Windows MSVC / RTX 5070 whenever convenient! *AI-assisted (Antigravity — Gemini 4 Neon).*
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 17:30 UTC · original

Independent retest of eff40832e merged locally into current main 4364a4fa6 (clean merge). CachyOS, RTX 4070 SUPER / NVIDIA 620.73.04 and AMD Raphael / RADV Mesa 26.3.1. Windows targets were built with clang-cl and xwin and run under Wine 11.22. All inputs were synthetic.

Check RTX 4070 SUPER AMD Raphael
Native Linux, seven selected CTests Four pass. Sparse arena, heap aliasing and title mirror skip because no host-visible coherent sparse memory type is available. Seven pass, including all three sparse tests and the alias zero-readback.
Wine, stock M4 compute and async-small-waits Both pass, 1,924/1,924 words each. Both pass, 1,924/1,924 words each.
Wine, state map, Vulkan device and replay copy All three pass. All three pass.
Unmodified GPU runner, cs_store.asm GPU readback passes. Generated SPIR-V omits FP32 FTZ automatically. GPU readback passes. Generated SPIR-V retains FP32 FTZ.

The M4 fixtures were generated by CMake with the NVIDIA ICD selected. Both passed spirv-val --target-env vulkan1.2 and neither M4 case emitted the earlier FTZ32 validation messages. The three Python suites for the GPU runner, translator flags and shader-build fallbacks passed 131/131.

Tile fixture and Wine validation. All 12 Vulkan tiles matched on both GPUs. The Linux Vulkan loader inserted Khronos validation 1.4.363 under Wine, and CTest marked the tile case red for VUID-vkCreateDevice-ppEnabledExtensionNames-01387 (VK_EXT_external_memory_dma_buf missing VK_KHR_external_memory_fd). The identical VUID occurs in the tile test on bare main on both GPUs. Direct runs without forced host validation exited 0 on main and the PR. AMD also matched all three host-D3D12 readbacks through VKD3D-Proton. That comparison was unavailable on NVIDIA because headless DXVK could not initialize.

One flaky mock assertion. xs_proxy_mock failed once at xs_proxy_mock_test.cpp:4707, immediately after seeing released_cycle == 1. The next five isolated runs passed, and all five baseline controls passed. The counter is updated in note_released before the deferred signal_gate_fence call, so the test can observe the counter before the mock fence advances.

This covers selected Linux and Wine tests. Native Windows and in-game frame time were outside this run. AI-assisted with OpenAI Codex (GPT-6).

**@⁠merzleckeier** on GitHub · 2026-11-29 17:30 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259750237) Independent retest of `eff40832e` merged locally into current `main` `4364a4fa6` (clean merge). CachyOS, RTX 4070 SUPER / NVIDIA 620.73.04 and AMD Raphael / RADV Mesa 26.3.1. Windows targets were built with clang-cl and xwin and run under Wine 11.22. All inputs were synthetic. | Check | RTX 4070 SUPER | AMD Raphael | | --- | --- | --- | | Native Linux, seven selected CTests | Four pass. Sparse arena, heap aliasing and title mirror skip because no host-visible coherent sparse memory type is available. | Seven pass, including all three sparse tests and the alias zero-readback. | | Wine, stock M4 compute and async-small-waits | Both pass, 1,924/1,924 words each. | Both pass, 1,924/1,924 words each. | | Wine, state map, Vulkan device and replay copy | All three pass. | All three pass. | | Unmodified GPU runner, `cs_store.asm` | GPU readback passes. Generated SPIR-V omits FP32 FTZ automatically. | GPU readback passes. Generated SPIR-V retains FP32 FTZ. | The M4 fixtures were generated by CMake with the NVIDIA ICD selected. Both passed `spirv-val --target-env vulkan1.2` and neither M4 case emitted the earlier FTZ32 validation messages. The three Python suites for the GPU runner, translator flags and shader-build fallbacks passed 131/131. **Tile fixture and Wine validation.** All 12 Vulkan tiles matched on both GPUs. The Linux Vulkan loader inserted Khronos validation 1.4.363 under Wine, and CTest marked the tile case red for `VUID-vkCreateDevice-ppEnabledExtensionNames-01387` (`VK_EXT_external_memory_dma_buf` missing `VK_KHR_external_memory_fd`). The identical VUID occurs in the tile test on bare `main` on both GPUs. Direct runs without forced host validation exited 0 on main and the PR. AMD also matched all three host-D3D12 readbacks through VKD3D-Proton. That comparison was unavailable on NVIDIA because headless DXVK could not initialize. **One flaky mock assertion.** `xs_proxy_mock` failed once at `xs_proxy_mock_test.cpp:4707`, immediately after seeing `released_cycle == 1`. The next five isolated runs passed, and all five baseline controls passed. The counter is updated in `note_released` before the deferred `signal_gate_fence` call, so the test can observe the counter before the mock fence advances. This covers selected Linux and Wine tests. Native Windows and in-game frame time were outside this run. AI-assisted with OpenAI Codex (GPT-6).
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 17:36 UTC · original · edited 2026-11-29 17:58 UTC

Follow-up on the xs_proxy_mock_test.cpp:4707 failure from the retest above. I reproduced the assertion deterministically on eff40832e with a test-only rendezvous in the mock fence. It defers the target Signal until the test thread first samples the fence after released_cycle == 1. That sample consistently returns b_gate_before + 1, and the mock then delivers the deferred signal. No runtime code changes were needed for the experiment.

Under clang-cl/xwin and Wine 11.22 Result
Existing assertion, deferred signal Fails 3/3 at the fence assertion
Proposed wait, same deferred signal Passes 3/3
Proposed wait, signal deliberately omitted Fails 3/3 at the one-second deadline
Proposed wait, instrumentation removed Passes the full xs_proxy_mock executable

The pump counts its decision before the releaser calls signal_gate_fence. The test can wait for both observations within its existing deadline and retain the cell2(6) == 0 check before explicitly completing the writer. This replacement for the current polling loop and two assertions passed the controls above:

// The pump counts the decision before the releaser signals the fence.
const auto expected_gate = b_gate_before + 2;
while (ms_since(started) < 1000 &&
       (xs::list_value_stats().released_cycle == 0 || fence_completed(b_gate) < expected_gate))
    Sleep(1);
EXPECT(xs::list_value_stats().released_cycle == 1 && ms_since(started) < 1000);
EXPECT(fence_completed(b_gate) == expected_gate && cell2(6) == 0);

Retested the integrated de1694c31 combined with main at 4364a4fa6 under Wine 11.22. With the same controlled mock, all three delayed signals now pass. All three omitted signals still fail the one-second deadline. The upstream mock test also passed once without the scheduling probe.

Synthetic CPU fixture, no game data. AI-assisted with OpenAI Codex (GPT-6).

**@⁠merzleckeier** on GitHub · 2026-11-29 17:36 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259817199) · edited 2026-11-29 17:58 UTC Follow-up on the `xs_proxy_mock_test.cpp:4707` failure from the retest above. I reproduced the assertion deterministically on `eff40832e` with a test-only rendezvous in the mock fence. It defers the target `Signal` until the test thread first samples the fence after `released_cycle == 1`. That sample consistently returns `b_gate_before + 1`, and the mock then delivers the deferred signal. No runtime code changes were needed for the experiment. | Under clang-cl/xwin and Wine 11.22 | Result | | --- | --- | | Existing assertion, deferred signal | Fails 3/3 at the fence assertion | | Proposed wait, same deferred signal | Passes 3/3 | | Proposed wait, signal deliberately omitted | Fails 3/3 at the one-second deadline | | Proposed wait, instrumentation removed | Passes the full `xs_proxy_mock` executable | The pump counts its decision before the releaser calls `signal_gate_fence`. The test can wait for both observations within its existing deadline and retain the `cell2(6) == 0` check before explicitly completing the writer. This replacement for the current polling loop and two assertions passed the controls above: ```cpp // The pump counts the decision before the releaser signals the fence. const auto expected_gate = b_gate_before + 2; while (ms_since(started) < 1000 && (xs::list_value_stats().released_cycle == 0 || fence_completed(b_gate) < expected_gate)) Sleep(1); EXPECT(xs::list_value_stats().released_cycle == 1 && ms_since(started) < 1000); EXPECT(fence_completed(b_gate) == expected_gate && cell2(6) == 0); ``` Retested the integrated `de1694c31` combined with `main` at `4364a4fa6` under Wine 11.22. With the same controlled mock, all three delayed signals now pass. All three omitted signals still fail the one-second deadline. The upstream mock test also passed once without the scheduling probe. Synthetic CPU fixture, no game data. AI-assisted with OpenAI Codex (GPT-6).
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 17:43 UTC · original

Presenter follow-up on eff40832e, compared with 660872215a from the earlier NVIDIA retest. clang-cl/xwin, Wine 11.22, headless Gamescope, RTX 4070 SUPER (620.73.04) and AMD Raphael (RADV Mesa 26.3.1). The latest build uses the clean merge with 4364a4fa6 and has the same runtime tree as the PR head.

Synthetic check 660872215a eff40832e
Stock vk_presenter_sync, RTX 4070 SUPER 0/6 6/6
Stock vk_presenter_sync, AMD Raphael 0/3 3/3
vk_presenter_sparse_capture, explicit owner SID in the local fixture, RTX 3/3 3/3
Same sparse capture fixture, AMD 3/3 3/3

Every old sync run failed presenter.presented() == shown + 1 after the queue was destroyed. Every current run reached the confirmation that the queued Present ran and completed the full test. Three RTX runs per revision used the host Khronos validation layer. Both revisions emitted the same VUID-vkCreateDevice-ppEnabledExtensionNames-01387 previously seen with host validation under Wine.

The stock sparse fixture stopped at Folder::create on RTX on both revisions. A minimal Win32 probe parsed the original OW/SY SDDL successfully, then got ERROR_ACCESS_DENIED from CreateDirectoryW. The corresponding ACL using the user SID from the current process token created the directory. I applied that substitution only to local copies of the sparse test fixture; the ACL still restricts access to the owner and SYSTEM. The capture tests then verified frames 1 and 4, the capture cap, final fence drain, explicit readback, disk contents and splash handoff on both GPUs.

The NVIDIA headless compositor exited abnormally during teardown, after the harness had recorded every Windows test process exit. The AMD sessions exited normally. All runs used synthetic data. AI-assisted with OpenAI Codex (GPT-6).

**@⁠merzleckeier** on GitHub · 2026-11-29 17:43 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259914239) Presenter follow-up on `eff40832e`, compared with `660872215a` from the earlier NVIDIA retest. clang-cl/xwin, Wine 11.22, headless Gamescope, RTX 4070 SUPER (620.73.04) and AMD Raphael (RADV Mesa 26.3.1). The latest build uses the clean merge with `4364a4fa6` and has the same runtime tree as the PR head. | Synthetic check | `660872215a` | `eff40832e` | | --- | --- | --- | | Stock `vk_presenter_sync`, RTX 4070 SUPER | 0/6 | 6/6 | | Stock `vk_presenter_sync`, AMD Raphael | 0/3 | 3/3 | | `vk_presenter_sparse_capture`, explicit owner SID in the local fixture, RTX | 3/3 | 3/3 | | Same sparse capture fixture, AMD | 3/3 | 3/3 | Every old sync run failed `presenter.presented() == shown + 1` after the queue was destroyed. Every current run reached the confirmation that the queued Present ran and completed the full test. Three RTX runs per revision used the host Khronos validation layer. Both revisions emitted the same `VUID-vkCreateDevice-ppEnabledExtensionNames-01387` previously seen with host validation under Wine. The stock sparse fixture stopped at `Folder::create` on RTX on both revisions. A minimal Win32 probe parsed the original `OW`/`SY` SDDL successfully, then got `ERROR_ACCESS_DENIED` from `CreateDirectoryW`. The corresponding ACL using the user SID from the current process token created the directory. I applied that substitution only to local copies of the sparse test fixture; the ACL still restricts access to the owner and SYSTEM. The capture tests then verified frames 1 and 4, the capture cap, final fence drain, explicit readback, disk contents and splash handoff on both GPUs. The NVIDIA headless compositor exited abnormally during teardown, after the harness had recorded every Windows test process exit. The AMD sessions exited normally. All runs used synthetic data. AI-assisted with OpenAI Codex (GPT-6).
Author
Owner

@⁠fiestorra on GitHub · 2026-11-29 17:48 UTC · original

Verified as far as this machine allows, and the numbers are worth having before review, because this is the largest open pull request.

It merges cleanly onto today's main (4364a4fa6) - a merge, not a cherry-pick: git diff --name-only origin/main..HEAD gives 234 files.

The translator side is fully green here:

python -I scripts/run_semantic_tests.py tests/semantic
-> 549 files, 6675 tests, 0 files failed in 452 s with 16 jobs

That is larger than main's own suite (529 files, 6526 tests) and, unlike main, it has no failing file: the test_interp_computed_ij_fallback that is red on
main passes here.

The runtime builds: cmake --build runtime/build --target gta6rt finishes with [65/65] Linking CXX executable gta6rt.exe, on Windows C++ (Ninja,
MSVC 19.44), with no errors.

One overlap worth knowing before this lands. The suite is green partly because this branch changes the interp oracle itself: it adds f16_rtz_bits(val) -
"narrow to f16 bits toward zero, matching v_interp_p2_f16 (SHADER-468)" - to tests/semantic/test_interp_computed_ij_fallback.py. That is the same class of fix
as the still-unowned TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ, so if this merges first, that item is done and the standalone copies circulating for it become
redundant. Better that someone knows now than after two merges collide.

Not verified: anything that needs a GPU run of the title, and the Rust side (d3d12/), because this machine has no cargo. The translator suite and the C++
runtime build are what I could exercise, and both are clean.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-29 17:48 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259982731) Verified as far as this machine allows, and the numbers are worth having before review, because this is the largest open pull request. **It merges cleanly onto today's `main`** (`4364a4fa6`) - a merge, not a cherry-pick: `git diff --name-only origin/main..HEAD` gives 234 files. **The translator side is fully green here:** ``` python -I scripts/run_semantic_tests.py tests/semantic -> 549 files, 6675 tests, 0 files failed in 452 s with 16 jobs ``` That is larger than `main`'s own suite (529 files, 6526 tests) and, unlike `main`, it has **no failing file**: the `test_interp_computed_ij_fallback` that is red on `main` passes here. **The runtime builds:** `cmake --build runtime/build --target gta6rt` finishes with `[65/65] Linking CXX executable gta6rt.exe`, on Windows C++ (Ninja, MSVC 19.44), with no errors. **One overlap worth knowing before this lands.** The suite is green partly because this branch changes the interp oracle itself: it adds `f16_rtz_bits(val)` - "narrow to f16 bits toward zero, matching `v_interp_p2_f16` (SHADER-468)" - to `tests/semantic/test_interp_computed_ij_fallback.py`. That is the same class of fix as the still-unowned `TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ`, so if this merges first, that item is done and the standalone copies circulating for it become redundant. Better that someone knows now than after two merges collide. **Not verified:** anything that needs a GPU run of the title, and the Rust side (`d3d12/`), because this machine has no `cargo`. The translator suite and the C++ runtime build are what I could exercise, and both are clean. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-29 17:49 UTC · original

A measured note on scope, since this pull request turns the translator suite green and that could be read as "the translator item is done".

Merging this branch onto main and running the other translator check:

main + #2566            : tests/test_mesh_serial_waves.py -> 6 failed, 25 passed
main + #2566 + a255e207d: tests/test_mesh_serial_waves.py -> 31 passed

So CI-MESH-SERIAL-WAVES-ADDR64 is not covered by this branch even though the semantic suite comes out clean - it lives in tests/ (the translator-tests job), not
in tests/semantic, and this branch does not touch that file. The fix for it still applies on top of this branch and still works, so the two do not conflict; whoever
merges this still needs that one-line change, and it can go before or after without fighting (measured: clean cherry-pick, 1 file, 4 insertions, 3 deletions).

The encoding item is a third and unrelated one: nothing here touches scripts/windows-boot/test_crash_monitor.py, and #2616 is its pull request.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-29 17:49 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259993324) A measured note on scope, since this pull request turns the translator suite green and that could be read as "the translator item is done". Merging this branch onto `main` and running the other translator check: ``` main + #2566 : tests/test_mesh_serial_waves.py -> 6 failed, 25 passed main + #2566 + a255e207d: tests/test_mesh_serial_waves.py -> 31 passed ``` So `CI-MESH-SERIAL-WAVES-ADDR64` is **not** covered by this branch even though the semantic suite comes out clean - it lives in `tests/` (the `translator-tests` job), not in `tests/semantic`, and this branch does not touch that file. The fix for it still applies on top of this branch and still works, so the two do not conflict; whoever merges this still needs that one-line change, and it can go before or after without fighting (measured: clean cherry-pick, 1 file, 4 insertions, 3 deletions). The encoding item is a third and unrelated one: nothing here touches `scripts/windows-boot/test_crash_monitor.py`, and #2616 is its pull request. Written with an AI assistant.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-29 17:53 UTC · original

Pushed de1694c31 to integration/perf-cpu-gpu-r6 — applied @⁠merzleckeier's test-only fix for the xs_proxy_mock_test.cpp:4707 cycle-release fence polling race (waiting for both released_cycle != 0 and fence_completed(b_gate) >= b_gate_before + 2 within the 1 s deadline, preserving the cell2(6) == 0 check).

Verified xs_proxy_mock_test.exe (clang-cl + xwin, Wine on AMD Raphael iGPU 1002:164e) 3/3 PASS and scripts/check_no_game_data.py exit 0.

Thanks @⁠merzleckeier for the RTX 4070 SUPER / AMD Raphael retest and deterministic repro, and @⁠fiestorra for verifying the clean merge, native Windows MSVC 19.44 build, and full 6,675/6,675 semantic suite!

AI-assisted (Antigravity — Gemini 4 Neon).

**@⁠aslan2142** on GitHub · 2026-11-29 17:53 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7260038845) Pushed `de1694c31` to `integration/perf-cpu-gpu-r6` — applied @⁠merzleckeier's test-only fix for the `xs_proxy_mock_test.cpp:4707` cycle-release fence polling race (waiting for both `released_cycle != 0` and `fence_completed(b_gate) >= b_gate_before + 2` within the 1 s deadline, preserving the `cell2(6) == 0` check). Verified `xs_proxy_mock_test.exe` (clang-cl + xwin, Wine on AMD Raphael iGPU `1002:164e`) 3/3 PASS and `scripts/check_no_game_data.py` exit 0. Thanks @⁠merzleckeier for the RTX 4070 SUPER / AMD Raphael retest and deterministic repro, and @⁠fiestorra for verifying the clean merge, native Windows MSVC 19.44 build, and full 6,675/6,675 semantic suite! *AI-assisted (Antigravity — Gemini 4 Neon).*
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-29 17:59 UTC · original

Pushed 8db8335d2 to integration/perf-cpu-gpu-r6 — fixed the 3 test-only CI regressions spotted on eff40832e so every CI job on this PR is strictly at or greener than main:

  1. linux-gpu-tools (llvmpipe subgroup 8): scripts/run_gpu_tests.py now evaluates cs_w64x_dynamic_r32_uint with judge_cs_dump(..., wave64=not w64_emulated(), partial=False, emulated=w64_emulated()) so exit 77 on devices without 64-wide compute subgroups records SKIP rather than FAIL.
  2. Set 0 Binding 29 (R64ui) counts: Updated tests/test_spirv_metal_set0_aliases.py and tests/test_spirv_metal_set0_extra.py for 30 Set 0 bindings (0..29, binding 29 capacity 1024, sum 14337, OOB test binding 30).
  3. D16_UNORM_S8_UINT format table row: Moved the trailing parenthetical note in runtime/src/gfx10_descriptors.h above row 7 and added D16_UNORM_S8_UINT to BY_HAND in tests/test_gfx10_descriptors.py.

Verified locally: test_gfx10_descriptors.py (5/5), test_spirv_metal_set0.py, test_spirv_metal_set0_aliases.py (9/9), test_spirv_metal_set0_extra.py (24/24), test_run_gpu_tests.py (78/78), and scripts/check_no_game_data.py (exit 0).

AI-assisted (Antigravity — Gemini 4 Neon).

**@⁠aslan2142** on GitHub · 2026-11-29 17:59 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7260126915) Pushed `8db8335d2` to `integration/perf-cpu-gpu-r6` — fixed the 3 test-only CI regressions spotted on `eff40832e` so every CI job on this PR is strictly at or greener than `main`: 1. **`linux-gpu-tools` (llvmpipe subgroup 8):** `scripts/run_gpu_tests.py` now evaluates `cs_w64x_dynamic_r32_uint` with `judge_cs_dump(..., wave64=not w64_emulated(), partial=False, emulated=w64_emulated())` so exit 77 on devices without 64-wide compute subgroups records `SKIP` rather than `FAIL`. 2. **Set 0 Binding 29 (`R64ui`) counts:** Updated `tests/test_spirv_metal_set0_aliases.py` and `tests/test_spirv_metal_set0_extra.py` for 30 Set 0 bindings (`0..29`, binding 29 capacity 1024, sum 14337, OOB test binding 30). 3. **`D16_UNORM_S8_UINT` format table row:** Moved the trailing parenthetical note in `runtime/src/gfx10_descriptors.h` above row 7 and added `D16_UNORM_S8_UINT` to `BY_HAND` in `tests/test_gfx10_descriptors.py`. Verified locally: `test_gfx10_descriptors.py` (5/5), `test_spirv_metal_set0.py`, `test_spirv_metal_set0_aliases.py` (9/9), `test_spirv_metal_set0_extra.py` (24/24), `test_run_gpu_tests.py` (78/78), and `scripts/check_no_game_data.py` (exit 0). *AI-assisted (Antigravity — Gemini 4 Neon).*
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 18:11 UTC · original

Independent check of 8db8335d2 and de1694c31, each merged onto main at eedd72e30. CachyOS, Python 3.14.10, Mesa 26.3.1 llvmpipe with LLVM 23.1.5 and subgroup range 8–8.

  • Real vk_compute_test: native cs_w64x_dynamic_r32_uint changed from FAIL (child exit 77) to SKIP. With Wave64 emulation, both revisions passed and returned eight copies of 0x8a600250.
  • The current head passed test_gfx10_descriptors.py (5), test_spirv_metal_set0_aliases.py (9), test_spirv_metal_set0_extra.py (24), and test_run_gpu_tests.py (78).
  • One stale expectation remains in tests/test_spirv_metal_set0.py:40. The pytest suite is 15/15 on plain main, but 14/15 on both PR revisions. test_capacities_match_vulkan_bindless still expects three entries in counts[26:]. Binding 29 adds 1024 for r64ui. I tested the following one-line change on the current head and got 15/15.
assert counts[26:] == [256, 256, 256, 1024]  # Texture1DArray UAVs, then r64ui storage images

Synthetic shader and descriptors only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-29 18:11 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7260285917) Independent check of `8db8335d2` and `de1694c31`, each merged onto `main` at `eedd72e30`. CachyOS, Python 3.14.10, Mesa 26.3.1 llvmpipe with LLVM 23.1.5 and subgroup range 8–8. - Real `vk_compute_test`: native `cs_w64x_dynamic_r32_uint` changed from FAIL (child exit 77) to SKIP. With Wave64 emulation, both revisions passed and returned eight copies of `0x8a600250`. - The current head passed `test_gfx10_descriptors.py` (5), `test_spirv_metal_set0_aliases.py` (9), `test_spirv_metal_set0_extra.py` (24), and `test_run_gpu_tests.py` (78). - One stale expectation remains in `tests/test_spirv_metal_set0.py:40`. The pytest suite is 15/15 on plain `main`, but 14/15 on both PR revisions. `test_capacities_match_vulkan_bindless` still expects three entries in `counts[26:]`. Binding 29 adds `1024` for `r64ui`. I tested the following one-line change on the current head and got 15/15. ```python assert counts[26:] == [256, 256, 256, 1024] # Texture1DArray UAVs, then r64ui storage images ``` Synthetic shader and descriptors only. AI-assisted with OpenAI Codex.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-29 18:22 UTC · original

Good catch @⁠merzleckeier — test_spirv_metal_set0.py runs under pytest, so running it directly with python3 earlier skipped test_capacities_match_vulkan_bindless.

Pushed 7b5cb2941 updating tests/test_spirv_metal_set0.py:40 to expect [256, 256, 256, 1024] (including Set 0 binding 29 r64ui). Verified with pytest across all four test_spirv_metal_set0*.py suites (55 passed, test_spirv_metal_set0.py 15/15) and scripts/check_no_game_data.py (exit 0).

AI-assisted (Antigravity — Gemini 4 Neon).

**@⁠aslan2142** on GitHub · 2026-11-29 18:22 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7260425211) Good catch @⁠merzleckeier — `test_spirv_metal_set0.py` runs under `pytest`, so running it directly with `python3` earlier skipped `test_capacities_match_vulkan_bindless`. Pushed `7b5cb2941` updating `tests/test_spirv_metal_set0.py:40` to expect `[256, 256, 256, 1024]` (including Set 0 binding 29 `r64ui`). Verified with `pytest` across all four `test_spirv_metal_set0*.py` suites (**55 passed**, `test_spirv_metal_set0.py` **15/15**) and `scripts/check_no_game_data.py` (exit 0). *AI-assisted (Antigravity — Gemini 4 Neon).*
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 18:52 UTC · original

CI follow-up on 7b5cb2941. The GitHub translator job reports exactly the six test_serial_mesh_compute_module failures previously identified here: 6 failed, 2043 passed, 15 skipped, 159 subtests passed. The separate semantic and Linux GPU jobs passed.

I reproduced the six failures on both plain main (7c330c76) and main + this PR (tree 400e56d9). The existing test-only patch a255e207d applies cleanly to either tree and gives 31 passed in test_mesh_serial_waves.py on both. It counts the default OpBitcast address form alongside OpConvertUToPtr.

With that patch on the PR merge, I ran the full 41-file/node translator-tests selection from ci.yml locally. Result: 2,049 passed, 15 skipped, 159 subtests passed. CachyOS, Python 3.14.10, pytest 9.2.0, LLVM 23.1.5. The PR branch on GitHub was unchanged. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-29 18:52 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7260829196) CI follow-up on `7b5cb2941`. The [GitHub translator job](https://github.com/ProjectLeonida/mandy/actions/runs/46294786693/job/141449263392#step:5:286) reports exactly the six `test_serial_mesh_compute_module` failures previously [identified here](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566): `6 failed, 2043 passed, 15 skipped, 159 subtests passed`. The separate semantic and Linux GPU jobs passed. I reproduced the six failures on both plain `main` (`7c330c76`) and `main` + this PR (tree `400e56d9`). The existing [test-only patch `a255e207d`](https://github.com/ProjectLeonida/mandy/commit/a255e207d5a123e057cc67b28c754c38d4b8f184) applies cleanly to either tree and gives `31 passed` in `test_mesh_serial_waves.py` on both. It counts the default `OpBitcast` address form alongside `OpConvertUToPtr`. With that patch on the PR merge, I ran the full 41-file/node `translator-tests` selection from `ci.yml` locally. Result: **2,049 passed, 15 skipped, 159 subtests passed**. CachyOS, Python 3.14.10, pytest 9.2.0, LLVM 23.1.5. The PR branch on GitHub was unchanged. AI-assisted with OpenAI Codex.
Author
Owner

@⁠lixonik on GitHub · 2026-11-29 19:17 UTC · original · reviewed

@⁠aslan2142 Re-tested PR #2566 at exact head 7b5cb29414 on native Windows 11 + MSVC 19.44 + NVIDIA RTX 5070 (LEONIDA_VK_VALIDATION=1, plus VK_VALIDATE_SYNC=1).

All 4 findings from my previous review (LNK2019 on dispatch_sample_mask, Win32 CopyMemory macro collision, d3d12_vulkan_device copy parity guard, and scripts/run_gpu_tests.py --no-ftz32 auto-detection) are fixed and verified on exact head 7b5cb29414, and the branch now merges cleanly onto latest main (git merge-tree --write-tree exit 0). Also audited ac93aac0d4 (in_known_heap OR-promotion in PendingImageKey / ImageKeyEntry and materialize_sample / bind_image) -- looks sound.

Two small failures remain (one Windows-only GPU test, one CI translator-tests failure); concrete code fixes for both are below:

Remaining Issues & Suggested Fixes

1. Windows GPU test failure: cs_texture_uav (d3d12_texture_uav_test) fails under default env (got 0x11, expected 0x3f9)

  • Why it happens (Windows-only, skipped on Linux via check.py:2256):
    • rdna2spirv.py now emits descriptor_table: "tagged" by default, so cs_texture_uav.spv reads the kind bit from the descriptor table (desc_map) before every OpImageWrite / OpImageRead.
    • d3d12_texture_uav_test loads cs_texture_uav.spv directly via vkCreateShaderModule without LEONIDA_SHADERS, so state_.library() has 0 modules. At runtime/shims/d3d12_vulkan_device.cpp:22547, the 0-module default is DescriptorTableLayout::plain, leaving the kind word zeroed -- every storage op in cs_texture_uav.spv resolves to index 0 and becomes a no-op (kind 0 mip 0 first 0 count 1 texel 0: got 0x11, expected 0x3f9).
  • Verified locally: Running cs_texture_uav with LEONIDA_DESCRIPTOR_TABLE=tagged passes immediately on RTX 5070 with LEONIDA_VK_VALIDATION=1 (PASS cs_texture_uav: D3D12/Vulkan storage-image readback matched).
  • Suggested fix (runtime/shims/d3d12_vulkan_device.cpp:22546-22551): Since the kind word is additive (plain modules ignore it while tagged modules require it), default to tagged when no shader library / 0 modules are loaded (preserving shader_library_test's direct ShaderLibrary::descriptor_table_layout() tests):
    --- a/runtime/shims/d3d12_vulkan_device.cpp
    +++ b/runtime/shims/d3d12_vulkan_device.cpp
    @@ -22544,10 +22544,10 @@
             // word is additive, so one tagged module needs the tagged layout whatever the plain count (the library's
             // vote); chosen once here, like the hash kind, and LEONIDA_DESCRIPTOR_TABLE overrides.
             leonida::DescriptorTableCensus table_modules{};
    -        leonida::DescriptorTableLayout descriptor_table = leonida::DescriptorTableLayout::plain;
    +        leonida::DescriptorTableLayout descriptor_table = leonida::DescriptorTableLayout::tagged;
             if (const leonida::ShaderLibrary* library = state_.library()) {
                 table_modules = library->descriptor_table_census();
    -            descriptor_table = library->descriptor_table_layout();
    +            if (table_modules.total() > 0) descriptor_table = library->descriptor_table_layout();
             }
    

2. CI translator-tests failure: 6/6 test_serial_mesh_compute_module cases in tests/test_mesh_serial_waves.py:134-137

  • Why it happens: lower_addr64() (ADDR_PAIR = True, tools/rdna2spirv.py:19298-19303) lowers %mp{k} = OpConvertUToPtr %_ptr_PSB_uint %ma{k} into %mp{k} = OpBitcast %_ptr_PSB_uint %a64_{n}v, so re.findall(r"%mp\d+ = OpConvertUToPtr %_ptr_PSB_uint", plain_main) returns 0 for all 6 SERIAL shaders (ms_tri, ms_clip, ms_f16_pack, ms_w64x_ballot, ms_w64x_wave_votes, ms_w64x_wave_loops).
  • Verified locally: Allowing both OpConvertUToPtr and OpBitcast matches all 6 shaders with exact per-pass store counts (ms_tri: 14, ms_clip: 15, ms_f16_pack: 18, ms_w64x_ballot: 14, ms_w64x_wave_votes: 14, ms_w64x_wave_loops: 14), and all 8/8 ms_* fixtures pass live on RTX 5070 with LEONIDA_W64_EMULATE=1 LEONIDA_MESH_SERIAL_WAVES=1.
  • Suggested fix (tests/test_mesh_serial_waves.py:134-137):
    --- a/tests/test_mesh_serial_waves.py
    +++ b/tests/test_mesh_serial_waves.py
    @@ -131,10 +131,10 @@ def test_serial_mesh_compute_module(make_shader, name):
         # As many slot stores per pass as the module without passes has in all.
         _, plain, _ = _translate(make_shader, name, False, compute=True)
         plain_main = plain[plain.index("%main = OpFunction"):]
    -    stores = len(re.findall(r"%mp\d+ = OpConvertUToPtr %_ptr_PSB_uint", plain_main))   # the slot's
    +    stores = len(re.findall(r"%mp\d+ = (?:OpConvertUToPtr|OpBitcast) %_ptr_PSB_uint", plain_main))   # the slot's
         assert stores
         for w in (0, 1):
    -        assert len(re.findall(rf"%mp\d+_w{w} = OpConvertUToPtr %_ptr_PSB_uint", main)) == stores
    +        assert len(re.findall(rf"%mp\d+_w{w} = (?:OpConvertUToPtr|OpBitcast) %_ptr_PSB_uint", main)) == stores
    

Verification Summary on Exact Head 7b5cb29414 (synthetic fixtures + translator tests; no retail title run for visual rendering inspection on this machine)

  • Native MSVC build (no local edits): gta6rt.exe + 37 test targets (including d3d12_state_map_test, replay_copy_memory_test, d3d12_vulkan_device_test, d3d12_texture_uav_test, xs_proxy_mock_test, vk_texture_test, vk_bindless_test, vk_sampler_test, vk_store_test, vk_harness, vk_ps_sweep, vk_compute_test) built & linked cleanly (RC=0).
  • CTest with LEONIDA_VK_VALIDATION=1 (default env): 31 passed, 3 expected-skipped on NVIDIA (arena_sparse_gpu, vk_heap_alias, vk_title_mirror), 0 failed -- including d3d12_vulkan_device (default env, CopyClipGuard verified), d3d12_state_map, replay_copy_memory, d3d12_texture_uav --descriptors-only, d3d12_m4_compute, d3d12_m4_compute_async_small_waits, d3d12_buffer_tiles, d3d12_texture_tiles, d3d12_existing_heap (default / _no_write_watch / _write_watch), d3d12_indirect_dispatch_count, d3d12_bundle_indirect_dispatch, d3d12_sample_mask, sample_mask_fragment, vk_sample_mask, d3d12_tsharp_refill, d3d12_unbound_tsharp_rules, d3d12_xs_placed_depth, xs_proxy_mock, d3d12_mesh, d3d12_draw, d3d12_compute, vk_presenter_sync, vk_presenter_sparse_capture, vk_presenter_capture_colour, vk_command_replay, vk_bindless_dimensions, pipeline_workers, arena_backing, arena_size, title_mirror_hooks.
  • Sync validation (LEONIDA_VK_VALIDATION=1 VK_VALIDATE_SYNC=1): 10/10 passed (vk_presenter_sync, d3d12_indirect_dispatch_count, d3d12_bundle_indirect_dispatch, d3d12_m4_compute, d3d12_m4_compute_async_small_waits, d3d12_compute, d3d12_draw, d3d12_sample_mask, d3d12_tsharp_refill, d3d12_mesh).
  • Full scripts/run_gpu_tests.py (LEONIDA_VK_VALIDATION=1): 285/285 shaders translated & spirv-val clean; 216/275 passed, 58 skipped, 1 failed (cs_texture_uav, issue #1 above; passes with LEONIDA_DESCRIPTOR_TABLE=tagged -> 217/217 runnable GPU fixtures green with 0 VVL errors, including ps_exp_f32_denorm* and ps_mul_legacy_denorm* exact).
  • Mesh serial waves GPU run (LEONIDA_W64_EMULATE=1 LEONIDA_MESH_SERIAL_WAVES=1): 8/8 ms_* fixtures passed on RTX 5070 with 0 VVL errors.
  • Live GPU absent-lane (tests/test_absent_lane_gpu.py): 2/2 passed.
  • Python / hygiene: check_no_game_data.py PASS, compileall PASS, test_run_gpu_tests.py 78/78, test_make_game_translator_flags.py 42/42, test_shader_build_fallbacks.py 11/11, test_fssm_header.py 47/47, test_docs_env_vars.py 5/5, test_absent_lane_ub.py 18/18.

GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, VK_LAYER_KHRONOS_validation 1.4.363).
AI-assisted (Antigravity, Gemini).

**@⁠lixonik** on GitHub · 2026-11-29 19:17 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#pullrequestreview-6104380609) · **reviewed** @⁠aslan2142 Re-tested PR #2566 at exact head `7b5cb29414` on native Windows 11 + MSVC `19.44` + NVIDIA RTX 5070 (`LEONIDA_VK_VALIDATION=1`, plus `VK_VALIDATE_SYNC=1`). All 4 findings from my previous review (`LNK2019` on `dispatch_sample_mask`, Win32 `CopyMemory` macro collision, `d3d12_vulkan_device` copy parity guard, and `scripts/run_gpu_tests.py` `--no-ftz32` auto-detection) are **fixed and verified** on exact head `7b5cb29414`, and the branch now merges cleanly onto latest `main` (`git merge-tree --write-tree` exit 0). Also audited `ac93aac0d4` (`in_known_heap` OR-promotion in `PendingImageKey` / `ImageKeyEntry` and `materialize_sample` / `bind_image`) -- looks sound. Two small failures remain (one Windows-only GPU test, one CI `translator-tests` failure); concrete code fixes for both are below: ### Remaining Issues & Suggested Fixes #### 1. Windows GPU test failure: `cs_texture_uav` (`d3d12_texture_uav_test`) fails under default env (`got 0x11, expected 0x3f9`) - **Why it happens (Windows-only, skipped on Linux via `check.py:2256`):** - `rdna2spirv.py` now emits `descriptor_table: "tagged"` by default, so `cs_texture_uav.spv` reads the kind bit from the descriptor table (`desc_map`) before every `OpImageWrite` / `OpImageRead`. - `d3d12_texture_uav_test` loads `cs_texture_uav.spv` directly via `vkCreateShaderModule` without `LEONIDA_SHADERS`, so `state_.library()` has 0 modules. At `runtime/shims/d3d12_vulkan_device.cpp:22547`, the 0-module default is `DescriptorTableLayout::plain`, leaving the kind word zeroed -- every storage op in `cs_texture_uav.spv` resolves to index 0 and becomes a no-op (`kind 0 mip 0 first 0 count 1 texel 0: got 0x11, expected 0x3f9`). - **Verified locally:** Running `cs_texture_uav` with `LEONIDA_DESCRIPTOR_TABLE=tagged` passes immediately on RTX 5070 with `LEONIDA_VK_VALIDATION=1` (`PASS cs_texture_uav: D3D12/Vulkan storage-image readback matched`). - **Suggested fix (`runtime/shims/d3d12_vulkan_device.cpp:22546-22551`):** Since the kind word is additive (plain modules ignore it while tagged modules require it), default to `tagged` when no shader library / 0 modules are loaded (preserving `shader_library_test`'s direct `ShaderLibrary::descriptor_table_layout()` tests): ```diff --- a/runtime/shims/d3d12_vulkan_device.cpp +++ b/runtime/shims/d3d12_vulkan_device.cpp @@ -22544,10 +22544,10 @@ // word is additive, so one tagged module needs the tagged layout whatever the plain count (the library's // vote); chosen once here, like the hash kind, and LEONIDA_DESCRIPTOR_TABLE overrides. leonida::DescriptorTableCensus table_modules{}; - leonida::DescriptorTableLayout descriptor_table = leonida::DescriptorTableLayout::plain; + leonida::DescriptorTableLayout descriptor_table = leonida::DescriptorTableLayout::tagged; if (const leonida::ShaderLibrary* library = state_.library()) { table_modules = library->descriptor_table_census(); - descriptor_table = library->descriptor_table_layout(); + if (table_modules.total() > 0) descriptor_table = library->descriptor_table_layout(); } ``` #### 2. CI `translator-tests` failure: 6/6 `test_serial_mesh_compute_module` cases in `tests/test_mesh_serial_waves.py:134-137` - **Why it happens:** `lower_addr64()` (`ADDR_PAIR = True`, `tools/rdna2spirv.py:19298-19303`) lowers `%mp{k} = OpConvertUToPtr %_ptr_PSB_uint %ma{k}` into `%mp{k} = OpBitcast %_ptr_PSB_uint %a64_{n}v`, so `re.findall(r"%mp\d+ = OpConvertUToPtr %_ptr_PSB_uint", plain_main)` returns `0` for all 6 `SERIAL` shaders (`ms_tri`, `ms_clip`, `ms_f16_pack`, `ms_w64x_ballot`, `ms_w64x_wave_votes`, `ms_w64x_wave_loops`). - **Verified locally:** Allowing both `OpConvertUToPtr` and `OpBitcast` matches all 6 shaders with exact per-pass store counts (`ms_tri`: 14, `ms_clip`: 15, `ms_f16_pack`: 18, `ms_w64x_ballot`: 14, `ms_w64x_wave_votes`: 14, `ms_w64x_wave_loops`: 14), and all 8/8 `ms_*` fixtures pass live on RTX 5070 with `LEONIDA_W64_EMULATE=1 LEONIDA_MESH_SERIAL_WAVES=1`. - **Suggested fix (`tests/test_mesh_serial_waves.py:134-137`):** ```diff --- a/tests/test_mesh_serial_waves.py +++ b/tests/test_mesh_serial_waves.py @@ -131,10 +131,10 @@ def test_serial_mesh_compute_module(make_shader, name): # As many slot stores per pass as the module without passes has in all. _, plain, _ = _translate(make_shader, name, False, compute=True) plain_main = plain[plain.index("%main = OpFunction"):] - stores = len(re.findall(r"%mp\d+ = OpConvertUToPtr %_ptr_PSB_uint", plain_main)) # the slot's + stores = len(re.findall(r"%mp\d+ = (?:OpConvertUToPtr|OpBitcast) %_ptr_PSB_uint", plain_main)) # the slot's assert stores for w in (0, 1): - assert len(re.findall(rf"%mp\d+_w{w} = OpConvertUToPtr %_ptr_PSB_uint", main)) == stores + assert len(re.findall(rf"%mp\d+_w{w} = (?:OpConvertUToPtr|OpBitcast) %_ptr_PSB_uint", main)) == stores ``` ### Verification Summary on Exact Head `7b5cb29414` (synthetic fixtures + translator tests; no retail title run for visual rendering inspection on this machine) - **Native MSVC build (no local edits):** `gta6rt.exe` + 37 test targets (including `d3d12_state_map_test`, `replay_copy_memory_test`, `d3d12_vulkan_device_test`, `d3d12_texture_uav_test`, `xs_proxy_mock_test`, `vk_texture_test`, `vk_bindless_test`, `vk_sampler_test`, `vk_store_test`, `vk_harness`, `vk_ps_sweep`, `vk_compute_test`) built & linked cleanly (`RC=0`). - **CTest with `LEONIDA_VK_VALIDATION=1` (default env):** **31 passed, 3 expected-skipped on NVIDIA (`arena_sparse_gpu`, `vk_heap_alias`, `vk_title_mirror`), 0 failed** -- including `d3d12_vulkan_device` (default env, `CopyClipGuard` verified), `d3d12_state_map`, `replay_copy_memory`, `d3d12_texture_uav --descriptors-only`, `d3d12_m4_compute`, `d3d12_m4_compute_async_small_waits`, `d3d12_buffer_tiles`, `d3d12_texture_tiles`, `d3d12_existing_heap` (`default` / `_no_write_watch` / `_write_watch`), `d3d12_indirect_dispatch_count`, `d3d12_bundle_indirect_dispatch`, `d3d12_sample_mask`, `sample_mask_fragment`, `vk_sample_mask`, `d3d12_tsharp_refill`, `d3d12_unbound_tsharp_rules`, `d3d12_xs_placed_depth`, `xs_proxy_mock`, `d3d12_mesh`, `d3d12_draw`, `d3d12_compute`, `vk_presenter_sync`, `vk_presenter_sparse_capture`, `vk_presenter_capture_colour`, `vk_command_replay`, `vk_bindless_dimensions`, `pipeline_workers`, `arena_backing`, `arena_size`, `title_mirror_hooks`. - **Sync validation (`LEONIDA_VK_VALIDATION=1 VK_VALIDATE_SYNC=1`):** 10/10 passed (`vk_presenter_sync`, `d3d12_indirect_dispatch_count`, `d3d12_bundle_indirect_dispatch`, `d3d12_m4_compute`, `d3d12_m4_compute_async_small_waits`, `d3d12_compute`, `d3d12_draw`, `d3d12_sample_mask`, `d3d12_tsharp_refill`, `d3d12_mesh`). - **Full `scripts/run_gpu_tests.py` (`LEONIDA_VK_VALIDATION=1`):** 285/285 shaders translated & `spirv-val` clean; **216/275 passed, 58 skipped, 1 failed (`cs_texture_uav`, issue #1 above; passes with `LEONIDA_DESCRIPTOR_TABLE=tagged` -> 217/217 runnable GPU fixtures green with 0 VVL errors, including `ps_exp_f32_denorm*` and `ps_mul_legacy_denorm*` exact)**. - **Mesh serial waves GPU run (`LEONIDA_W64_EMULATE=1 LEONIDA_MESH_SERIAL_WAVES=1`):** 8/8 `ms_*` fixtures passed on RTX 5070 with 0 VVL errors. - **Live GPU absent-lane (`tests/test_absent_lane_gpu.py`):** 2/2 passed. - **Python / hygiene:** `check_no_game_data.py` PASS, `compileall` PASS, `test_run_gpu_tests.py` 78/78, `test_make_game_translator_flags.py` 42/42, `test_shader_build_fallbacks.py` 11/11, `test_fssm_header.py` 47/47, `test_docs_env_vars.py` 5/5, `test_absent_lane_ub.py` 18/18. GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, `VK_LAYER_KHRONOS_validation 1.4.363`). AI-assisted (Antigravity, Gemini).
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 19:27 UTC · original

I independently reproduced the texture UAV finding on 7b5cb2941 merged onto dd87aa405 (tree edf8ac34). Windows x64 clang-cl build on CachyOS / Wine 11.22, RTX 4070 SUPER (620.73.04) and AMD Raphael (RADV 26.3.1). My local Wine-only fixture omitted the WARP calls and kept the existing exact Vulkan readback assertions. Both synthetic shader variants passed spirv-val.

  • Stock, tagged SPIR-V: the default with no library gave the same first mismatch on both GPUs (0x11, expected 0x3f9). Explicit LEONIDA_DESCRIPTOR_TABLE=tagged passed all 14 readback cases on each.
  • Proposed runtime patch: applying the review’s tagged default for no/zero modules passed all 14 with the environment override unset, both with no library and with an empty index. Explicit plain still produced the expected mismatch with tagged SPIR-V.
  • Compatibility: plain SPIR-V passed all 14 on both GPUs with the new tagged default. A loaded one-module plain index still selected plain and passed all 14 with the matching shader. The descriptor-only checks passed as well.

The host validation layer reported the same VK_EXT_external_memory_dma_buf dependency message across both variants under Wine (VUID-vkCreateDevice-ppEnabledExtensionNames-01387). The native Linux shader_library_test passed.

Separately, the exact e3ddc2e0 diff from #2627 gave 2,055 passed, 15 skipped, 159 subtests passed in the full translator CI selection on this same merge tree, versus six mesh failures before applying it. A/B details. Synthetic inputs only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-29 19:27 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261298325) I independently reproduced the [texture UAV finding](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566) on `7b5cb2941` merged onto `dd87aa405` (tree `edf8ac34`). Windows x64 clang-cl build on CachyOS / Wine 11.22, RTX 4070 SUPER (620.73.04) and AMD Raphael (RADV 26.3.1). My local Wine-only fixture omitted the WARP calls and kept the existing exact Vulkan readback assertions. Both synthetic shader variants passed `spirv-val`. - **Stock, tagged SPIR-V:** the default with no library gave the same first mismatch on both GPUs (`0x11`, expected `0x3f9`). Explicit `LEONIDA_DESCRIPTOR_TABLE=tagged` passed all 14 readback cases on each. - **Proposed runtime patch:** applying the review’s tagged default for no/zero modules passed all 14 with the environment override unset, both with no library and with an empty index. Explicit `plain` still produced the expected mismatch with tagged SPIR-V. - **Compatibility:** plain SPIR-V passed all 14 on both GPUs with the new tagged default. A loaded one-module plain index still selected `plain` and passed all 14 with the matching shader. The descriptor-only checks passed as well. The host validation layer reported the same `VK_EXT_external_memory_dma_buf` dependency message across both variants under Wine (`VUID-vkCreateDevice-ppEnabledExtensionNames-01387`). The native Linux `shader_library_test` passed. Separately, the exact `e3ddc2e0` diff from #2627 gave **2,055 passed, 15 skipped, 159 subtests passed** in the full translator CI selection on this same merge tree, versus six mesh failures before applying it. [A/B details](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2627). Synthetic inputs only. AI-assisted with OpenAI Codex.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-29 19:28 UTC · original

Thanks @⁠lixonik for the thorough Windows 11 / MSVC 19.44 / RTX 5070 re-test and catching the 0-module descriptor table default!

Pushed cfd12b24f updating runtime/shims/d3d12_vulkan_device.cpp:22547-22550 to default descriptor_table to DescriptorTableLayout::tagged when table_modules.total() == 0 (so standalone fixtures like d3d12_texture_uav_test / cs_texture_uav match rdna2spirv.py's default tagged layout without affecting shader_library_test). Verified descriptor_table, shader_library, and scripts/check_no_game_data.py (exit 0).

Left tests/test_mesh_serial_waves.py untouched here since CI-MESH-SERIAL-WAVES-ADDR64 already has its own open PR (#2627).

AI-assisted (Antigravity — Gemini 4 Neon).

**@⁠aslan2142** on GitHub · 2026-11-29 19:28 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261302752) Thanks @⁠lixonik for the thorough Windows 11 / MSVC 19.44 / RTX 5070 re-test and catching the 0-module descriptor table default! Pushed `cfd12b24f` updating `runtime/shims/d3d12_vulkan_device.cpp:22547-22550` to default `descriptor_table` to `DescriptorTableLayout::tagged` when `table_modules.total() == 0` (so standalone fixtures like `d3d12_texture_uav_test` / `cs_texture_uav` match `rdna2spirv.py`'s default tagged layout without affecting `shader_library_test`). Verified `descriptor_table`, `shader_library`, and `scripts/check_no_game_data.py` (exit 0). Left `tests/test_mesh_serial_waves.py` untouched here since `CI-MESH-SERIAL-WAVES-ADDR64` already has its own open PR (#2627). *AI-assisted (Antigravity — Gemini 4 Neon).*
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 19:35 UTC · original

CI follow-up now that #2627 is on main. The red translator job for cfd12b24f checked out a merge with the older base dd87aa405 and reports the same six mesh failures. I cleanly merged this exact PR head onto 0e8737f2 (tree ea28dddb), which contains #2627, and ran its full 41-selection translator-tests job locally without source edits. Result: 2,055 passed, 15 skipped, 159 subtests passed. CachyOS, Python 3.14.10, pytest 9.2.0, LLVM 23.1.5.

The separate stdlib-tests-linux failure is the empty synthetic shader-cache fixture issue tracked in #2629. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-29 19:35 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261405323) CI follow-up now that #2627 is on `main`. The [red translator job for `cfd12b24f`](https://github.com/ProjectLeonida/mandy/actions/runs/46301013159/job/141465766373) checked out a merge with the older base `dd87aa405` and reports the same six mesh failures. I cleanly merged this exact PR head onto `0e8737f2` (tree `ea28dddb`), which contains #2627, and ran its full 41-selection `translator-tests` job locally without source edits. Result: **2,055 passed, 15 skipped, 159 subtests passed**. CachyOS, Python 3.14.10, pytest 9.2.0, LLVM 23.1.5. The separate [stdlib-tests-linux failure](https://github.com/ProjectLeonida/mandy/actions/runs/46301013159/job/141465766321) is the empty synthetic shader-cache fixture issue tracked in #2629. AI-assisted with OpenAI Codex.
Author
Owner

@⁠azsekazvamdimitar on GitHub · 2026-11-29 20:01 UTC · original

Retail game-run check on latest PR head 8db8335d2 (clean worktree, no local patches) — NVIDIA GeForce RTX 3090 24 GB, Linux (GE-Proton, NVIDIA 590.48.01), Series X profile, warm --wave64-emulate --mesh-serial-waves --compute-serial-waves + #2501 shader set, 600 s run (after warming the new 30-binding Set 0 cache over two runs):

  • Stability: 0 hangs, 0 device stalls, 0 VK_ERROR_DEVICE_LOST, 0 crashes across 11,453,404 D3D12 calls (5+ continuous minutes in live gameplay).
  • NVIDIA sparse fallback: Built-in fallback worked out of the box (memoryTypeBits=0x2 -> 4,094 MiB single-allocation arena, page mirror off).
  • List-value gates: 6,779 held, 6,751 met, 0 released unmet.
  • Pipelines: 2,568 / 2,568 completed (2,058 cache hits, 0 failures).
  • Coalescing & CPU submit: before-execute 96% skipped (0 single-flight waits); submit path 16–23% of wall time in-world (heaps ~2.5 ms, shadows ~0.9 ms, textures ~0.5–1.3 ms, replay ~1.2–1.5 ms/sub).
  • In-world FPS & GPU profile: 1.17–1.40 frames/s (~30–33 submissions/s), 100% GPU-bound (~950–1,050 ms/frame: compute 492–564 ms, mesh 408–460 ms, graphics 22 ms, other 14–16 ms).

AI-assisted report (Antigravity / Gemini 4 Neon).

**@⁠azsekazvamdimitar** on GitHub · 2026-11-29 20:01 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261745226) Retail game-run check on latest PR head `8db8335d2` (clean worktree, no local patches) — **NVIDIA GeForce RTX 3090 24 GB**, Linux (GE-Proton, NVIDIA 590.48.01), Series X profile, warm `--wave64-emulate --mesh-serial-waves --compute-serial-waves` + #2501 shader set, 600 s run (after warming the new 30-binding Set 0 cache over two runs): - **Stability:** 0 hangs, 0 device stalls, 0 `VK_ERROR_DEVICE_LOST`, 0 crashes across **11,453,404** D3D12 calls (5+ continuous minutes in live gameplay). - **NVIDIA sparse fallback:** Built-in fallback worked out of the box (`memoryTypeBits=0x2` -> 4,094 MiB single-allocation arena, `page mirror off`). - **List-value gates:** 6,779 held, 6,751 met, **0 released unmet**. - **Pipelines:** 2,568 / 2,568 completed (2,058 cache hits, 0 failures). - **Coalescing & CPU submit:** `before-execute` **96% skipped** (0 single-flight waits); submit path **16–23%** of wall time in-world (`heaps` ~2.5 ms, `shadows` ~0.9 ms, `textures` ~0.5–1.3 ms, `replay` ~1.2–1.5 ms/sub). - **In-world FPS & GPU profile:** **1.17–1.40 frames/s** (~30–33 submissions/s), 100% GPU-bound (~950–1,050 ms/frame: compute 492–564 ms, mesh 408–460 ms, graphics 22 ms, other 14–16 ms). AI-assisted report (Antigravity / Gemini 4 Neon).
Author
Owner

@⁠qhukz13 on GitHub · 2026-11-29 20:02 UTC · original

RUN (no game): #2566 A/B of the runtime test suite on a low-end NVIDIA card without Resizable BAR.

Machine   GTX 1050 Ti 4 GB (Pascal), NVIDIA 582.66, Windows 10 19045, no Resizable BAR
A         0bc6e21a1  (merge base of #2566 and main)
B         7b5cb2941  (#2566 head, integration/perf-cpu-gpu-r6)
Build     cmake -S runtime -B runtime/build; cmake --build ... --config RelWithDebInfo   (both clean, 0 errors)
Tests     ctest -C RelWithDebInfo --parallel 4, LEONIDA_GAME_DIR unset (retail-package tests SKIP)

          tests   passed   failed
A          537      526       11
B          562      551       11
  • No regressions: the 11 failures are the same tests in A and B:

    • d3d12_close_parity, d3d12_heap_properties, d3d12_pso_validation, d3d12_state_sweep, d3d12_vulkan_device;
    • root_sig, root_signature_oracle, xbox_present;
    • title_window, xgameruntime_offline(_hdr).

    They are known on this machine: the last three fail only because the run was started over SSH (session 0) and pass from an interactive session, and d3d12_close_parity is WARP answering differently on Windows 10.

  • The PR's new tests: of the 26 ctest tests B adds, 21 pass. 5 skip: arena_sparse_gpu, d3d12_heap_in_place, d3d12_page_mirror, vk_heap_alias, vk_title_mirror. Their output on this card is the page mirror being off (below), so they have nothing to check here (the skip reason is read from the log, not from each test's code).

  • The page mirror's reason line, as asked: printed by the runtime in B's tests on this card.

    [rt] d3d12: upload heaps in system memory (no Resizable BAR)
    [rt] d3d12: page mirror off: no aliased strict sparse buffers; title-written addresses read as before   (11x)
    [rt] d3d12: page mirror off: the arena is one allocation                                                (4x)
    

    This matches what I read in the code earlier in this thread: on NVIDIA the mirror (and what builds on it) stays off. So on cards like this one #2566 should be neutral for correctness, and its mirror-based speed-ups do not apply.

Not covered: no game run, so no FPS or "how far" numbers; the 3090/5080 A/Bs cover that. AI-assisted (Claude Code).

**@⁠qhukz13** on GitHub · 2026-11-29 20:02 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261757941) RUN (no game): #2566 A/B of the runtime test suite on a low-end NVIDIA card without Resizable BAR. ``` Machine GTX 1050 Ti 4 GB (Pascal), NVIDIA 582.66, Windows 10 19045, no Resizable BAR A 0bc6e21a1 (merge base of #2566 and main) B 7b5cb2941 (#2566 head, integration/perf-cpu-gpu-r6) Build cmake -S runtime -B runtime/build; cmake --build ... --config RelWithDebInfo (both clean, 0 errors) Tests ctest -C RelWithDebInfo --parallel 4, LEONIDA_GAME_DIR unset (retail-package tests SKIP) tests passed failed A 537 526 11 B 562 551 11 ``` - **No regressions:** the 11 failures are the same tests in A and B: - `d3d12_close_parity`, `d3d12_heap_properties`, `d3d12_pso_validation`, `d3d12_state_sweep`, `d3d12_vulkan_device`; - `root_sig`, `root_signature_oracle`, `xbox_present`; - `title_window`, `xgameruntime_offline(_hdr)`. They are known on this machine: the last three fail only because the run was started over SSH (session 0) and pass from an interactive session, and `d3d12_close_parity` is WARP answering differently on Windows 10. - **The PR's new tests:** of the 26 ctest tests B adds, 21 pass. 5 skip: `arena_sparse_gpu`, `d3d12_heap_in_place`, `d3d12_page_mirror`, `vk_heap_alias`, `vk_title_mirror`. Their output on this card is the page mirror being off (below), so they have nothing to check here (the skip reason is read from the log, not from each test's code). - **The page mirror's reason line, as asked:** printed by the runtime in B's tests on this card. ``` [rt] d3d12: upload heaps in system memory (no Resizable BAR) [rt] d3d12: page mirror off: no aliased strict sparse buffers; title-written addresses read as before (11x) [rt] d3d12: page mirror off: the arena is one allocation (4x) ``` This matches what I read in the code earlier in this thread: on NVIDIA the mirror (and what builds on it) stays off. So on cards like this one #2566 should be neutral for correctness, and its mirror-based speed-ups do not apply. Not covered: no game run, so no FPS or "how far" numbers; the 3090/5080 A/Bs cover that. AI-assisted (Claude Code).
Author
Owner

@⁠fiestorra on GitHub · 2026-11-29 20:05 UTC · original

NVIDIA A/B, as asked for in the dev discussion: yes, it regresses on this machine, and consistently. Details so it can be checked rather than taken on trust.

Machine: RTX 4090, Windows 11, MSVC 19.44, Ninja RelWithDebInfo, NVIDIA driver 32.0.16.2124. No game data needed: this is the full C++ ctest suite, every test
built from each tree.

arm tree runs failures
A main 4364a4fa6 3 xbox_present 3/3, xbox_packed4444_clear_sample 1/3 (SEGFAULT)
B main + this branch 3 xbox_present 3/3, vk_gpu_profile 3/3, d3d12_clear 3/3, loader 1/3

Test counts: 536 in A, 561 in B - the branch adds 25 tests of its own.

xbox_present fails in both, so it is pre-existing and not this branch. xbox_packed4444_clear_sample is flaky in A (1 of 3), and loader is flaky in B (1 of 3);
neither is a difference you can build on.

The two that matter are vk_gpu_profile and d3d12_clear: they pass in every arm-A run and fail in every arm-B run. d3d12_clear says why in its own output:

[rt] d3d12: unsupported typeless or RGBA8 RTV format/subresource: 91
castable RTVs: format 28 {87} took an RTV in unlisted format 91

which reads like a format the branch started refusing (or counting) in the castable-RTV path. vk_gpu_profile prints its whole table and then fails; the last line of
interest is vs spin_vertices … 4 calls in 1 runs, 0.0000 ms, so a zero-duration graphics result is a candidate, but I have not proven which assertion it trips - I am
naming the observation, not the cause.

What I have not done: the fps comparison. That needs the title running in the world, our boots end in the driver's watchdog more often than not, and three runs per
arm there is hours of non-deterministic work. What this A/B does prove is narrower and still useful: the branch is not neutral on Windows/NVIDIA in the test suite,
before anyone spends GPU hours on frame rates.

Reproduce: apply the branch on main 4364a4fa6, cmake -S runtime -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo, build all, then
ctest --test-dir build -C RelWithDebInfo -j 6 --timeout 180 three times.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-29 20:05 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261803637) NVIDIA A/B, as asked for in the dev discussion: **yes, it regresses on this machine, and consistently**. Details so it can be checked rather than taken on trust. **Machine:** RTX 4090, Windows 11, MSVC 19.44, Ninja `RelWithDebInfo`, NVIDIA driver 32.0.16.2124. No game data needed: this is the full C++ `ctest` suite, every test built from each tree. | arm | tree | runs | failures | |---|---|---|---| | **A** | `main` `4364a4fa6` | 3 | `xbox_present` **3/3**, `xbox_packed4444_clear_sample` **1/3** (SEGFAULT) | | **B** | `main` + this branch | 3 | `xbox_present` **3/3**, **`vk_gpu_profile` 3/3**, **`d3d12_clear` 3/3**, `loader` 1/3 | Test counts: **536** in A, **561** in B - the branch adds 25 tests of its own. **`xbox_present` fails in both**, so it is pre-existing and not this branch. `xbox_packed4444_clear_sample` is flaky in A (1 of 3), and `loader` is flaky in B (1 of 3); neither is a difference you can build on. **The two that matter** are `vk_gpu_profile` and `d3d12_clear`: they pass in every arm-A run and fail in every arm-B run. `d3d12_clear` says why in its own output: ``` [rt] d3d12: unsupported typeless or RGBA8 RTV format/subresource: 91 castable RTVs: format 28 {87} took an RTV in unlisted format 91 ``` which reads like a format the branch started refusing (or counting) in the castable-RTV path. `vk_gpu_profile` prints its whole table and then fails; the last line of interest is `vs spin_vertices … 4 calls in 1 runs, 0.0000 ms`, so a zero-duration graphics result is a candidate, but I have not proven which assertion it trips - I am naming the observation, not the cause. **What I have not done:** the fps comparison. That needs the title running in the world, our boots end in the driver's watchdog more often than not, and three runs per arm there is hours of non-deterministic work. What this A/B does prove is narrower and still useful: the branch is **not** neutral on Windows/NVIDIA in the test suite, before anyone spends GPU hours on frame rates. Reproduce: apply the branch on `main` `4364a4fa6`, `cmake -S runtime -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo`, build all, then `ctest --test-dir build -C RelWithDebInfo -j 6 --timeout 180` three times. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-29 20:06 UTC · original

Follow-up with one of the two regressions localized, and the other honestly not.

d3d12_clear - located. The test file is runtime/test/d3d12_clear_test.cpp, and this branch does not change it (git diff --name-only origin/main..<head> -- runtime/test/d3d12_clear_test.cpp
is empty). Its message is its own:

CHECK(listed_view.resource && listed_view.format == (ColorViewFormat)t.listed_view);
for (const DXGI_FORMAT unlisted : t.unlisted) { … "format %d {%d} took an RTV in unlisted format %d" … }

and what it reports is format 28 {87} took an RTV in unlisted format 91 - the format-28 texture was served its RTV in 91 where the table expects 87.

On the runtime side, this branch introduces exactly that path: a zero_castable vector carrying the format and its UNORM/sRGB twin, replacing the assumption that a
typed RGBA8/BGRA8 target takes its view "without a castable list":

+    std::vector<VkFormat> zero_castable;
+        if (twin != VK_FORMAT_UNDEFINED) zero_castable = {format.format, twin};
+    if (FAILED(zero->create_texture(format, zero_castable)) || …

in runtime/shims/d3d12_vulkan_device.cpp. So the shape is: an unchanged test pinning the listed/unlisted format pairs, and a branch that changes which of them a
texture is created with. That is where to look, and it is a behaviour change the test was written to catch rather than a stale test.

vk_gpu_profile - not located. It prints its whole table and then exits non-zero. The last interesting line is vs spin_vertices 4 calls in 1 runs, 0.0000 ms, which
suggests a zero-duration graphics result tripping an expectation, but I could not find the source of that test's checks in runtime/test to quote the assertion, so I am
not going to name a cause. It passes 3/3 on main and fails 3/3 here, so it is still a regression; it just needs someone who knows that test to say which line fails.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-29 20:06 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261814639) Follow-up with one of the two regressions localized, and the other honestly not. **`d3d12_clear` - located.** The test file is `runtime/test/d3d12_clear_test.cpp`, and this branch does **not** change it (`git diff --name-only origin/main..<head> -- runtime/test/d3d12_clear_test.cpp` is empty). Its message is its own: ```c CHECK(listed_view.resource && listed_view.format == (ColorViewFormat)t.listed_view); for (const DXGI_FORMAT unlisted : t.unlisted) { … "format %d {%d} took an RTV in unlisted format %d" … } ``` and what it reports is `format 28 {87} took an RTV in unlisted format 91` - the format-28 texture was served its RTV in 91 where the table expects 87. On the runtime side, this branch introduces exactly that path: a `zero_castable` vector carrying the format and its UNORM/sRGB twin, replacing the assumption that a typed RGBA8/BGRA8 target takes its view "without a castable list": ``` + std::vector<VkFormat> zero_castable; + if (twin != VK_FORMAT_UNDEFINED) zero_castable = {format.format, twin}; + if (FAILED(zero->create_texture(format, zero_castable)) || … ``` in `runtime/shims/d3d12_vulkan_device.cpp`. So the shape is: an unchanged test pinning the listed/unlisted format pairs, and a branch that changes which of them a texture is created with. That is where to look, and it is a behaviour change the test was written to catch rather than a stale test. **`vk_gpu_profile` - not located.** It prints its whole table and then exits non-zero. The last interesting line is `vs spin_vertices 4 calls in 1 runs, 0.0000 ms`, which suggests a zero-duration graphics result tripping an expectation, but I could not find the source of that test's checks in `runtime/test` to quote the assertion, so I am not going to name a cause. It passes 3/3 on `main` and fails 3/3 here, so it is still a regression; it just needs someone who knows that test to say which line fails. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-29 20:07 UTC · original

CORRECTION to my A/B comment above, on vk_gpu_profile.

I wrote that it "passes in every arm-A run and fails in every arm-B run, so it is still a regression". That is wrong. runtime/test/vk_gpu_profile_test.cpp does not
exist on main (4364a4fa6): the file is added by this branch. So it could not have passed on arm A - it was not there to run. The 536-versus-561 test counts in my own
table say the same thing, and I should have read them before writing the sentence.

What is true, and what I should have said:

  • d3d12_clear is a genuine regression: the test exists on main, passes 3/3 in arm A, fails 3/3 with this branch, and the branch changes the code path the test
    pins (the new zero_castable list carrying a format and its UNORM/sRGB twin, against an unchanged test that expects the listed pairing);
  • vk_gpu_profile is a new test in this branch that fails on this machine, 3/3. It prints its table and exits non-zero; the last interesting line is
    vs spin_vertices 4 calls in 1 runs, 0.0000 ms. That is still something to fix before merging, but it is a new test failing, not something that used to be green.

The difference matters for whoever reads this: one says "this branch breaks a check we had", the other says "this branch ships a check that does not pass here". Both are
reasons not to merge blind, but they are not the same claim, and only the first one is a regression.

Everything else in that comment stands: xbox_present fails on both arms (pre-existing), xbox_packed4444_clear_sample is flaky in A (1 of 3), loader is flaky in B
(1 of 3), and no fps comparison was done.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-29 20:07 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261824348) CORRECTION to my A/B comment above, on `vk_gpu_profile`. I wrote that it "passes in every arm-A run and fails in every arm-B run, so it is still a regression". **That is wrong.** `runtime/test/vk_gpu_profile_test.cpp` does not exist on `main` (`4364a4fa6`): the file is **added by this branch**. So it could not have passed on arm A - it was not there to run. The 536-versus-561 test counts in my own table say the same thing, and I should have read them before writing the sentence. What is true, and what I should have said: - **`d3d12_clear` is a genuine regression**: the test exists on `main`, passes 3/3 in arm A, fails 3/3 with this branch, and the branch changes the code path the test pins (the new `zero_castable` list carrying a format and its UNORM/sRGB twin, against an unchanged test that expects the listed pairing); - **`vk_gpu_profile` is a new test in this branch that fails on this machine, 3/3.** It prints its table and exits non-zero; the last interesting line is `vs spin_vertices 4 calls in 1 runs, 0.0000 ms`. That is still something to fix before merging, but it is a **new test failing**, not something that used to be green. The difference matters for whoever reads this: one says "this branch breaks a check we had", the other says "this branch ships a check that does not pass here". Both are reasons not to merge blind, but they are not the same claim, and only the first one is a regression. Everything else in that comment stands: `xbox_present` fails on both arms (pre-existing), `xbox_packed4444_clear_sample` is flaky in A (1 of 3), `loader` is flaky in B (1 of 3), and no fps comparison was done. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-29 20:08 UTC · original

Second regression localized too, and it is a threshold rather than a wrong count.

Running the new test through ctest on this machine gives its own assertion, not just "Failed":

1/1 Test #228: vk_gpu_profile ...***Failed
line 320: e->ms > 0 && e->ms < 2000

Which is this loop (runtime/test/vk_gpu_profile_test.cpp, added by this branch):

const bool paravirtual_constant_ts =
    queue.span_ms == 0.0 && std::strstr(properties.deviceName, "Paravirtual") != nullptr;
if (paravirtual_constant_ts) { … skipping positive-duration checks … }
else { for (const auto* e : {heavy, light, vertices}) EXPECT(e->ms > 0 && e->ms < 2000); … }

On this machine the exemption does not apply, and it should not: queue.span_ms is 0.2180 ms, not 0, and the device is a GeForce RTX 4090, so it is not the
paravirtual case the comment describes. But the graphics entry is exactly zero:

vs spin_vertices   graphics   4 calls in 1 runs, 0.0000 ms, 0.0000 ms per call
queue: 1 submissions, 7 timestamps, busy 0.5070 ms, span 0.2180 ms

So vertices->ms == 0 and the loop's first term fails. The counts in the same run are right (vertices->calls == 4 && vertices->runs == 1 passed), so this is the
duration of a graphics pass measuring zero on a fast native desktop GPU, not a structural mistake.

Two readings, and I cannot pick between them from here: either the profile genuinely cannot time a sub-tick graphics pass on this hardware (in which case > 0 is the
wrong contract, the same way the span-0 exemption admits for paravirtual), or the graphics timestamps are equal by mistake and the profile is under-reporting. The
first needs a threshold or an exemption, the second needs a fix in the timing path.

The two structural points that would settle it are cheap for whoever owns the test: print vertices->ms with more digits than %.4f (so "0.0000" tells whether it is
0 or 0.00004), and check whether the graphics begin/end timestamps are equal.

Everything else on this branch measured clean here: the counts, the queue accounting and the other two entries.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-29 20:08 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261840365) Second regression localized too, and it is a threshold rather than a wrong count. Running the new test through ctest on this machine gives its own assertion, not just "Failed": ``` 1/1 Test #228: vk_gpu_profile ...***Failed line 320: e->ms > 0 && e->ms < 2000 ``` Which is this loop (`runtime/test/vk_gpu_profile_test.cpp`, added by this branch): ```c const bool paravirtual_constant_ts = queue.span_ms == 0.0 && std::strstr(properties.deviceName, "Paravirtual") != nullptr; if (paravirtual_constant_ts) { … skipping positive-duration checks … } else { for (const auto* e : {heavy, light, vertices}) EXPECT(e->ms > 0 && e->ms < 2000); … } ``` On this machine the exemption does **not** apply, and it should not: `queue.span_ms` is **0.2180 ms**, not 0, and the device is a GeForce RTX 4090, so it is not the paravirtual case the comment describes. But the graphics entry is exactly zero: ``` vs spin_vertices graphics 4 calls in 1 runs, 0.0000 ms, 0.0000 ms per call queue: 1 submissions, 7 timestamps, busy 0.5070 ms, span 0.2180 ms ``` So `vertices->ms == 0` and the loop's first term fails. The counts in the same run are right (`vertices->calls == 4 && vertices->runs == 1` passed), so this is the **duration** of a graphics pass measuring zero on a fast native desktop GPU, not a structural mistake. Two readings, and I cannot pick between them from here: either the profile genuinely cannot time a sub-tick graphics pass on this hardware (in which case `> 0` is the wrong contract, the same way the span-0 exemption admits for paravirtual), or the graphics timestamps are equal by mistake and the profile is under-reporting. The first needs a threshold or an exemption, the second needs a fix in the timing path. The two structural points that would settle it are cheap for whoever owns the test: print `vertices->ms` with more digits than `%.4f` (so "0.0000" tells whether it is 0 or 0.00004), and check whether the graphics begin/end timestamps are equal. Everything else on this branch measured clean here: the counts, the queue accounting and the other two entries. Written with an AI assistant.
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 20:23 UTC · original

Independent follow-up to the RTX 4090 reports. I tested PR head cfd12b24f merged onto 720bd3b4e (tree 824258cd) on CachyOS with an RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1). Native Linux for the profiler, Win64 ClangCL 23.1.5 Release under Wine 11.22 for the RTV probe. Synthetic fixtures only. AI-assisted with OpenAI Codex.

vk_gpu_profile

MEASURED. The original test failed at line 320 in 8/8 NVIDIA runs and passed in 8/8 RADV runs. The graphics entry still reported four calls in one run. With raw-query logging on NVIDIA, the signed q5 - q4 deltas for vs spin_vertices were -3072, -3072, -4096, -3072, -3072, -4096, -3072, -4096 ticks (1 ns/tick). The existing clamp yielded zero in every run. The queue span was positive.

READ IN CODE. The profiler deliberately clamps a backwards interval in resolve. A test-only change permits zero for the graphics interval and retains positive durations and scaling for both compute pipelines, all call/run counts, and query checks. Clamp in resolve

for (const auto* e : {heavy, light}) EXPECT(e->ms > 0 && e->ms < 2000);
EXPECT(vertices->ms >= 0 && vertices->ms < 2000);

MEASURED. With that change and the raw logging removed, the full profile test passed 8/8 on each GPU.

d3d12_clear and unlisted RTVs

MEASURED. I ran the existing check_unlisted_rtvs directly before WARP setup. On base and PR source it passed 3/3 per GPU, including all nine expected rejections per run. In 28 {87} -> 91 all seven TargetView fields matched the empty descriptor in the PR build. Native WARP coverage remains open. Wine could not provide WARP on NVIDIA and used a hardware fallback on RADV, where both stock trees failed the same depth case.

READ IN CODE. The test compares the entire object representation with memcmp. The PR adds two bool members. In the Win64 builds TargetView grows from 24 to 32 bytes, with six bytes of trailing padding. TargetView declaration

MEASURED with a controlled padding change. Writing 0x5a only to byte 26 of a rejected descriptor reproduced the exact ‘format 28 {87} took an RTV in unlisted format 91’ error 3/3 on each GPU. Every member still matched the empty descriptor. With the same change to byte 26 and a member-wise comparison of the resource, mip, layer range, format and both read-only flags, the probe passed 3/3 on each GPU. This demonstrates how padding alone can trigger the error. A native Windows/MSVC run with the member-wise check would establish whether it accounts for the original result.

**@⁠merzleckeier** on GitHub · 2026-11-29 20:23 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262035558) Independent follow-up to the RTX 4090 reports. I tested PR head `cfd12b24f` merged onto `720bd3b4e` (tree `824258cd`) on CachyOS with an RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1). Native Linux for the profiler, Win64 ClangCL 23.1.5 Release under Wine 11.22 for the RTV probe. Synthetic fixtures only. AI-assisted with OpenAI Codex. ### `vk_gpu_profile` **MEASURED.** The original test failed at line 320 in 8/8 NVIDIA runs and passed in 8/8 RADV runs. The graphics entry still reported four calls in one run. With raw-query logging on NVIDIA, the signed `q5 - q4` deltas for `vs spin_vertices` were `-3072, -3072, -4096, -3072, -3072, -4096, -3072, -4096` ticks (1 ns/tick). The existing clamp yielded zero in every run. The queue span was positive. **READ IN CODE.** The profiler deliberately clamps a backwards interval in `resolve`. A test-only change permits zero for the graphics interval and retains positive durations and scaling for both compute pipelines, all call/run counts, and query checks. [Clamp in `resolve`](https://github.com/ProjectLeonida/mandy/blob/cfd12b24fee161bdb0ab7061e092ae6bbae9e860/runtime/src/vulkan_gpu_profile.h#L249-L270) ```cpp for (const auto* e : {heavy, light}) EXPECT(e->ms > 0 && e->ms < 2000); EXPECT(vertices->ms >= 0 && vertices->ms < 2000); ``` **MEASURED.** With that change and the raw logging removed, the full profile test passed 8/8 on each GPU. ### `d3d12_clear` and unlisted RTVs **MEASURED.** I ran the existing `check_unlisted_rtvs` directly before WARP setup. On base and PR source it passed 3/3 per GPU, including all nine expected rejections per run. In `28 {87} -> 91` all seven `TargetView` fields matched the empty descriptor in the PR build. Native WARP coverage remains open. Wine could not provide WARP on NVIDIA and used a hardware fallback on RADV, where both stock trees failed the same depth case. **READ IN CODE.** The test compares the entire object representation with `memcmp`. The PR adds two `bool` members. In the Win64 builds `TargetView` grows from 24 to 32 bytes, with six bytes of trailing padding. [TargetView declaration](https://github.com/ProjectLeonida/mandy/blob/cfd12b24fee161bdb0ab7061e092ae6bbae9e860/runtime/src/command_list.h#L226-L234) **MEASURED with a controlled padding change.** Writing `0x5a` only to byte 26 of a rejected descriptor reproduced the exact ‘format 28 {87} took an RTV in unlisted format 91’ error 3/3 on each GPU. Every member still matched the empty descriptor. With the same change to byte 26 and a member-wise comparison of the resource, mip, layer range, format and both read-only flags, the probe passed 3/3 on each GPU. This demonstrates how padding alone can trigger the error. A native Windows/MSVC run with the member-wise check would establish whether it accounts for the original result.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-29 20:28 UTC · original

Great catches @⁠fiestorra and @⁠merzleckeier — pushed 1d0867c4a fixing both Windows/NVIDIA findings:

  1. d3d12_clear (runtime/src/command_list.h): Added explicit zero-initialized trailing padding std::uint8_t pad_[6] = {}; (with static_assert(sizeof(TargetView) == 32)) to leonida::TargetView so view = {} / TargetView{} never leaves uninitialized bytes 26..31 for d3d12_clear_test.cpp's std::memcmp under MSVC RelWithDebInfo.
  2. vk_gpu_profile (runtime/test/vk_gpu_profile_test.cpp:320): Kept positive-duration + scaling assertions on both compute pipelines (heavy, light) while permitting vertices->ms >= 0 && vertices->ms < 2000 for the short graphics pass whose consecutive BOTTOM_OF_PIPE timestamps can invert slightly on NVIDIA (clamped to 0.0 in vulkan_gpu_profile.h::resolve()).

Verified locally (command_list, typeless_rtv, vk_gpu_profile on AMD Raphael iGPU 1002:164e, and scripts/check_no_game_data.py exit 0). Note #2627 is now merged on main, so translator-tests on the merge commit should also turn green.

AI-assisted (Antigravity — Gemini 4 Neon).

**@⁠aslan2142** on GitHub · 2026-11-29 20:28 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262112848) Great catches @⁠fiestorra and @⁠merzleckeier — pushed `1d0867c4a` fixing both Windows/NVIDIA findings: 1. **`d3d12_clear` (`runtime/src/command_list.h`):** Added explicit zero-initialized trailing padding `std::uint8_t pad_[6] = {};` (with `static_assert(sizeof(TargetView) == 32)`) to `leonida::TargetView` so `view = {}` / `TargetView{}` never leaves uninitialized bytes 26..31 for `d3d12_clear_test.cpp`'s `std::memcmp` under MSVC `RelWithDebInfo`. 2. **`vk_gpu_profile` (`runtime/test/vk_gpu_profile_test.cpp:320`):** Kept positive-duration + scaling assertions on both compute pipelines (`heavy`, `light`) while permitting `vertices->ms >= 0 && vertices->ms < 2000` for the short graphics pass whose consecutive `BOTTOM_OF_PIPE` timestamps can invert slightly on NVIDIA (clamped to `0.0` in `vulkan_gpu_profile.h::resolve()`). Verified locally (`command_list`, `typeless_rtv`, `vk_gpu_profile` on AMD Raphael iGPU `1002:164e`, and `scripts/check_no_game_data.py` exit 0). Note #2627 is now merged on `main`, so `translator-tests` on the merge commit should also turn green. *AI-assisted (Antigravity — Gemini 4 Neon).*
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 20:34 UTC · original

Retest of 1d0867c4a on edf0ff5d (tree 2ad27fd6). CachyOS, RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1). I built the profile test natively and as Win64 ClangCL Release for Wine 11.22.

MEASURED — RTVs. The existing unlisted-RTV check, run directly before WARP setup, passed 3/3 on both GPUs, with all nine refusals on each run. The unmodified full test reached and passed that check on RADV, then hit the same Wine hardware-fallback depth mismatch as before. NVIDIA Wine could not provide WARP. A native Windows/MSVC full retest is still open.

MEASURED — graphics duration and compute scaling. The zero-millisecond graphics assertion did not recur in any of the 128 exact runs. Counts passed: NVIDIA 31/32 native and 30/32 through Wine, RADV 32/32 each. The three remaining failures were all at line 326, the pre-existing strict heavy per call > 2 * light per call check. The displayed heavy/light totals were 0.2047/0.0512 ms on native NVIDIA and 0.2050/0.0522 and 0.2054/0.0522 ms through Wine (four heavy calls, two light calls).

MEASURED — test-only follow-up. Raising kHeavyTurns from 20000 to 40000 while retaining the same assertions passed 24/24 for each of the four GPU/platform combinations. The NVIDIA graphics interval continued to print 0.0000 ms. This gives the existing compute ratio more margin.

Separate merge note. I confirmed that #2633 conflicts with this branch only in tests/semantic/test_interp_computed_ij_fallback.py. Taking the exact file from #2633 on the preceding cfd12b24f merge passed the full semantic run with 6,675 tests discovered in 549 files and zero failing files. 1d0867c4a leaves the semantic suite and translator files alone. Standalone semantic A/B

Synthetic inputs only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-29 20:34 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262190776) Retest of `1d0867c4a` on `edf0ff5d` (tree `2ad27fd6`). CachyOS, RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1). I built the profile test natively and as Win64 ClangCL Release for Wine 11.22. **MEASURED — RTVs.** The existing unlisted-RTV check, run directly before WARP setup, passed 3/3 on both GPUs, with all nine refusals on each run. The unmodified full test reached and passed that check on RADV, then hit the same Wine hardware-fallback depth mismatch as before. NVIDIA Wine could not provide WARP. A native Windows/MSVC full retest is still open. **MEASURED — graphics duration and compute scaling.** The zero-millisecond graphics assertion did not recur in any of the 128 exact runs. Counts passed: NVIDIA 31/32 native and 30/32 through Wine, RADV 32/32 each. The three remaining failures were all at line 326, the pre-existing strict `heavy per call > 2 * light per call` check. The displayed heavy/light totals were 0.2047/0.0512 ms on native NVIDIA and 0.2050/0.0522 and 0.2054/0.0522 ms through Wine (four heavy calls, two light calls). **MEASURED — test-only follow-up.** Raising `kHeavyTurns` from `20000` to `40000` while retaining the same assertions passed 24/24 for each of the four GPU/platform combinations. The NVIDIA graphics interval continued to print 0.0000 ms. This gives the existing compute ratio more margin. **Separate merge note.** I confirmed that #2633 conflicts with this branch only in `tests/semantic/test_interp_computed_ij_fallback.py`. Taking the exact file from #2633 on the preceding `cfd12b24f` merge passed the full semantic run with 6,675 tests discovered in 549 files and zero failing files. `1d0867c4a` leaves the semantic suite and translator files alone. [Standalone semantic A/B](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2633) Synthetic inputs only. AI-assisted with OpenAI Codex.
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 20:53 UTC · original

Follow-up on the submit_frame failure in the macOS runtime job for 1d0867c4a. It fails in the CPU-only scripted section at load(f.part_ns[sp::part_lock_wait]) >= 2 * ms. macOS job

MEASURED. On 1d0867c4a merged onto 7bbc1d22 (81220131), delaying the waiter by 8 ms just after the holder's flag in the shadows check reproduced that exact assertion in 12/12 runs, before Vulkan setup. The unmodified fixture passed 12/12 without that delay.

Test-only fix. The holder keeps the real mutex locked until lock_timed enters its blocking path and has recorded its start. The test then gives it the same 4 ms hold. This covers all three contention checks and keeps the existing time and counter assertions. Cherry-pick 1c4f7d64

MEASURED. The candidate passed 12/12 CPU runs with and 12/12 without the injected delay. It also passed the full submit_frame_test 8/8 per GPU natively on CachyOS and 3/3 per GPU as Win64 ClangCL /MD under Wine 11.22. RTX 4070 SUPER (620.73.04), RADV Raphael (26.3.1). Native macOS validation is still open. Synthetic fixtures only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-29 20:53 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262438233) Follow-up on the `submit_frame` failure in the macOS runtime job for `1d0867c4a`. It fails in the CPU-only scripted section at `load(f.part_ns[sp::part_lock_wait]) >= 2 * ms`. [macOS job](https://github.com/ProjectLeonida/mandy/actions/runs/46306688261/job/141483544382) **MEASURED.** On `1d0867c4a` merged onto `7bbc1d22` (`81220131`), delaying the waiter by 8 ms just after the holder's flag in the shadows check reproduced that exact assertion in 12/12 runs, before Vulkan setup. The unmodified fixture passed 12/12 without that delay. **Test-only fix.** The holder keeps the real mutex locked until `lock_timed` enters its blocking path and has recorded its start. The test then gives it the same 4 ms hold. This covers all three contention checks and keeps the existing time and counter assertions. [Cherry-pick `1c4f7d64`](https://github.com/merzleckeier/mandy/commit/1c4f7d64cda9ffc40f7cdda28979ec7bfff70cf0) **MEASURED.** The candidate passed 12/12 CPU runs with and 12/12 without the injected delay. It also passed the full `submit_frame_test` 8/8 per GPU natively on CachyOS and 3/3 per GPU as Win64 ClangCL `/MD` under Wine 11.22. RTX 4070 SUPER (620.73.04), RADV Raphael (26.3.1). Native macOS validation is still open. Synthetic fixtures only. AI-assisted with OpenAI Codex.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-29 21:18 UTC · original

Thanks @⁠merzleckeier for both root causes and A/B verifications — pushed eade9562c applying both test-only fixes:

  1. runtime/test/vk_gpu_profile_test.cpp: Raised kHeavyTurns from 20000 to 40000 for clean compute scaling margin on NVIDIA while preserving all assertions.
  2. runtime/test/submit_frame_test.cpp: Synchronized all three lock_timed contention checks so the holder keeps the real std::mutex locked until lock_timed has entered its blocking lock() path (via a local TrackedLock wrapper), then holds for 4 ms — eliminating VM thread-scheduling flakes on macOS runners without modifying runtime code.

Verified submit_frame (5/5) and vk_gpu_profile (5/5) on AMD Raphael iGPU (1002:164e) and scripts/check_no_game_data.py (exit 0).

AI-assisted (Antigravity — Gemini 4 Neon).

**@⁠aslan2142** on GitHub · 2026-11-29 21:18 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262769764) Thanks @⁠merzleckeier for both root causes and A/B verifications — pushed `eade9562c` applying both test-only fixes: 1. **`runtime/test/vk_gpu_profile_test.cpp`:** Raised `kHeavyTurns` from `20000` to `40000` for clean compute scaling margin on NVIDIA while preserving all assertions. 2. **`runtime/test/submit_frame_test.cpp`:** Synchronized all three `lock_timed` contention checks so the holder keeps the real `std::mutex` locked until `lock_timed` has entered its blocking `lock()` path (via a local `TrackedLock` wrapper), then holds for 4 ms — eliminating VM thread-scheduling flakes on macOS runners without modifying runtime code. Verified `submit_frame` (5/5) and `vk_gpu_profile` (5/5) on AMD Raphael iGPU (`1002:164e`) and `scripts/check_no_game_data.py` (exit 0). *AI-assisted (Antigravity — Gemini 4 Neon).*
Author
Owner

@⁠lixonik on GitHub · 2026-11-29 21:24 UTC · original

Retested the two fixture changes at eade9562c merged locally with main 060c471604 on native Windows 10 22H2, RTX 5070 (610.88), MSVC 19.44 and Khronos Vulkan validation.

  • vk_gpu_profile: 5/5 passed with the new compute workload.
  • submit_frame: 6/30 runs failed at load(f.worker_ns[sp::worker_texture_reads]) > 0. This is the worker-clock check at line 114, separate from the contention checks addressed in this commit. The worker scope around sp::add(sp::textures, 5 * ms) can begin and end within one steady_clock tick. The same fixture is in the preceding PR revision.
  • With a local test-only change that yields while sp::now_ns() == busy.start after the synthetic sp::add, the complete submit_frame test passed 30/30. No runtime changes were needed.

Synthetic fixtures only. AI-assisted.

**@⁠lixonik** on GitHub · 2026-11-29 21:24 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262848452) Retested the two fixture changes at `eade9562c` merged locally with `main` `060c471604` on native Windows 10 22H2, RTX 5070 (610.88), MSVC 19.44 and Khronos Vulkan validation. - `vk_gpu_profile`: 5/5 passed with the new compute workload. - `submit_frame`: 6/30 runs failed at `load(f.worker_ns[sp::worker_texture_reads]) > 0`. This is the worker-clock check at line 114, separate from the contention checks addressed in this commit. The worker scope around `sp::add(sp::textures, 5 * ms)` can begin and end within one `steady_clock` tick. The same fixture is in the preceding PR revision. - With a local test-only change that yields while `sp::now_ns() == busy.start` after the synthetic `sp::add`, the complete `submit_frame` test passed 30/30. No runtime changes were needed. Synthetic fixtures only. AI-assisted.
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 21:24 UTC · original

Independent retest of eade9562c (GitHub merge 47a53d19b onto 060c47160). I rebuilt the previous head 1d0867c4a on the same base for the controls. CachyOS, RTX 4070 SUPER (620.73.04), Radeon Raphael (RADV 26.3.1), native Linux and Win64 clang-cl Release under Wine 11.22.

  • MEASURED, vk_gpu_profile. The previous head passed 31/32 on NVIDIA natively and 31/32 under Wine. Both failures were the strict heavy/light per-call comparison. The new head passed 32/32 on each GPU and platform (128/128). From the printed totals, the new NVIDIA minimum heavy/light ratio per call was about 4.03 natively and 4.10 under Wine, above the unchanged 2× threshold. The NVIDIA graphics interval still printed zero.
  • MEASURED, submit_frame CPU. An 8 ms delay after the holder acquired the mutex in the shadows case reproduced the same lock-wait assertion on all 12 previous-head runs. The new head passed 12/12 with that delay and 12/12 with the unmodified test. These CPU runs deliberately excluded Vulkan.
  • MEASURED, submit_frame GPU. The unmodified new test passed 5/5 per GPU on native Linux and 5/5 per GPU under Wine with an explicit /MD build. All 20 runs reached the 20-submission check and the final queue checks. The default local cross-build faulted on startup under Wine on both revisions. The explicit /MD previous-head control also passed 3/3 on NVIDIA.

Synthetic fixtures only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-29 21:24 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262852675) Independent retest of `eade9562c` (GitHub merge `47a53d19b` onto `060c47160`). I rebuilt the previous head `1d0867c4a` on the same base for the controls. CachyOS, RTX 4070 SUPER (620.73.04), Radeon Raphael (RADV 26.3.1), native Linux and Win64 clang-cl Release under Wine 11.22. - **MEASURED, `vk_gpu_profile`.** The previous head passed 31/32 on NVIDIA natively and 31/32 under Wine. Both failures were the strict heavy/light per-call comparison. The new head passed 32/32 on each GPU and platform (128/128). From the printed totals, the new NVIDIA minimum heavy/light ratio per call was about 4.03 natively and 4.10 under Wine, above the unchanged 2× threshold. The NVIDIA graphics interval still printed zero. - **MEASURED, `submit_frame` CPU.** An 8 ms delay after the holder acquired the mutex in the shadows case reproduced the same lock-wait assertion on all 12 previous-head runs. The new head passed 12/12 with that delay and 12/12 with the unmodified test. These CPU runs deliberately excluded Vulkan. - **MEASURED, `submit_frame` GPU.** The unmodified new test passed 5/5 per GPU on native Linux and 5/5 per GPU under Wine with an explicit `/MD` build. All 20 runs reached the 20-submission check and the final queue checks. The default local cross-build faulted on startup under Wine on both revisions. The explicit `/MD` previous-head control also passed 3/3 on NVIDIA. Synthetic fixtures only. AI-assisted with OpenAI Codex.
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 21:29 UTC · original

I ran a controlled clock-resolution A/B for the Windows worker-accounting finding on eade9562c (GitHub merge 47a53d19b). I used native Linux and Win64 clang-cl Release (/MD) under Wine 11.22.

  • MEASURED, CPU baseline. The unmodified test passed 24/24 on each platform. I then quantized only the short texture-read worker's submit_phases::now_ns() to 100 μs, aligned to its first read. Every run measured 0 ns for that worker and failed at load(f.worker_ns[sp::worker_texture_reads]) > 0 (24/24 failures per platform). The other threads retained their real clocks.
  • MEASURED, CPU A/B. Adding the reported while (sp::now_ns() == busy.start) std::this_thread::yield(); after sp::add was the only difference between the two quantized runs. This measured one 100 μs tick every time and passed 24/24 on each platform. That quantum is the injected probe setting.
  • MEASURED, full test. With the real clock restored and the one-line test change applied, the test passed 5/5 per GPU and platform (20/20). RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1) each reached the GPU submission and final queue checks.

Synthetic fixtures only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-29 21:29 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262916092) I ran a controlled clock-resolution A/B for the [Windows worker-accounting finding](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566) on `eade9562c` (GitHub merge `47a53d19b`). I used native Linux and Win64 clang-cl Release (`/MD`) under Wine 11.22. - **MEASURED, CPU baseline.** The unmodified test passed 24/24 on each platform. I then quantized only the short texture-read worker's `submit_phases::now_ns()` to 100 μs, aligned to its first read. Every run measured 0 ns for that worker and failed at `load(f.worker_ns[sp::worker_texture_reads]) > 0` (24/24 failures per platform). The other threads retained their real clocks. - **MEASURED, CPU A/B.** Adding the reported `while (sp::now_ns() == busy.start) std::this_thread::yield();` after `sp::add` was the only difference between the two quantized runs. This measured one 100 μs tick every time and passed 24/24 on each platform. That quantum is the injected probe setting. - **MEASURED, full test.** With the real clock restored and the one-line test change applied, the test passed 5/5 per GPU and platform (20/20). RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1) each reached the GPU submission and final queue checks. Synthetic fixtures only. AI-assisted with OpenAI Codex.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-29 21:44 UTC · original

Frame-rate A/B on NVIDIA, as the dev discussion asked for. One machine (RTX 4090, Windows 11, driver 32.0.16.2124, 24 GB profile), same recipe both arms, 600 s per launch, three launches per arm.

Metric: median of submit frame t=Ns: N frames in 10.0 s over the 150-300 s window, i.e. after loading and before the tail. Every launch reached the world (the counter runs), so this is a comparable measurement, not a boot-time proxy.

arm launch median fps mean min / max
main edf0ff5d0 A1 63.0 57.0 24.3 / 65.2
A2 61.8 59.5 37.5 / 62.2
main + this branch B1 61.3 61.3 59.2 / 63.8
B2 60.0 47.7 6.9 / 65.8
B3 68.4 65.0 44.7 / 73.1

Prediction, written before the arm-B runs: the branch reaches the world in at least 2 of 3 and its median does not drop more than 5% below the arm-A reference (>= ~59 fps). Not refuted: 3 of 3 reached the world and the medians are 60.0 / 61.3 / 68.4.

What I claim: no frame-rate regression detected on this machine, and the fastest single run of the day is arm B (68.4). What I do not claim: that it is faster. The arm-B spread (60.0-68.4) straddles arm A (61.8-63.0), n is 2 and 3 launches, and B2 contains a stall to 6.9 fps that drags its mean to 47.7 while its median stays 60.0 - a single run's mean is not a stable number.

Two honest limits: this is the C++ runtime (gta6rt.exe, the one that builds here); the Rust side has no cargo on this machine, so if the integration's frame-rate claim is about d3d12/, this says nothing about it. And the earlier "one boot in four reaches the world" from this machine no longer reproduces: all five launches across both arms today reached it, so that history is not a factor in these numbers.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-29 21:44 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7263112250) **Frame-rate A/B on NVIDIA, as the dev discussion asked for.** One machine (RTX 4090, Windows 11, driver 32.0.16.2124, 24 GB profile), same recipe both arms, 600 s per launch, three launches per arm. **Metric:** median of `submit frame t=Ns: N frames in 10.0 s` over the **150-300 s** window, i.e. after loading and before the tail. Every launch reached the world (the counter runs), so this is a comparable measurement, not a boot-time proxy. | arm | launch | median fps | mean | min / max | |---|---|---|---|---| | **main** `edf0ff5d0` | A1 | 63.0 | 57.0 | 24.3 / 65.2 | | | A2 | 61.8 | 59.5 | 37.5 / 62.2 | | **main + this branch** | B1 | 61.3 | 61.3 | 59.2 / 63.8 | | | B2 | 60.0 | 47.7 | 6.9 / 65.8 | | | B3 | 68.4 | 65.0 | 44.7 / 73.1 | **Prediction, written before the arm-B runs:** the branch reaches the world in at least 2 of 3 and its median does not drop more than 5% below the arm-A reference (>= ~59 fps). **Not refuted:** 3 of 3 reached the world and the medians are 60.0 / 61.3 / 68.4. **What I claim:** no frame-rate regression detected on this machine, and the fastest single run of the day is arm B (68.4). **What I do not claim:** that it is faster. The arm-B spread (60.0-68.4) straddles arm A (61.8-63.0), n is 2 and 3 launches, and B2 contains a stall to 6.9 fps that drags its mean to 47.7 while its median stays 60.0 - a single run's mean is not a stable number. Two honest limits: this is the **C++ runtime** (`gta6rt.exe`, the one that builds here); the Rust side has no `cargo` on this machine, so if the integration's frame-rate claim is about `d3d12/`, this says nothing about it. And the earlier "one boot in four reaches the world" from this machine no longer reproduces: all five launches across both arms today reached it, so that history is not a factor in these numbers. Written with an AI assistant.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-29 21:51 UTC · original

Thanks @⁠lixonik and @⁠merzleckeier for catching and A/B-verifying the Windows steady_clock tick flake in submit_frame_test (and thanks @⁠fiestorra for the RTX 4090 gameplay A/B)!

Pushed 22e1349d7 applying the 1-line test-only yield in runtime/test/submit_frame_test.cpp (while (sp::now_ns() == busy.start) std::this_thread::yield();).

Verified submit_frame 10/10 on AMD Raphael iGPU (1002:164e, RADV) and scripts/check_no_game_data.py (exit 0).

AI-assisted (Antigravity — Gemini 4 Neon).

**@⁠aslan2142** on GitHub · 2026-11-29 21:51 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7263209126) Thanks @⁠lixonik and @⁠merzleckeier for catching and A/B-verifying the Windows `steady_clock` tick flake in `submit_frame_test` (and thanks @⁠fiestorra for the RTX 4090 gameplay A/B)! Pushed `22e1349d7` applying the 1-line test-only yield in `runtime/test/submit_frame_test.cpp` (`while (sp::now_ns() == busy.start) std::this_thread::yield();`). Verified `submit_frame` 10/10 on AMD Raphael iGPU (`1002:164e`, RADV) and `scripts/check_no_game_data.py` (exit 0). *AI-assisted (Antigravity — Gemini 4 Neon).*
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 22:19 UTC · original

Retested 22e1349d7 on GitHub merge a77fa84f8 onto 060c47160.

  • MEASURED, submit_frame. The CPU section passed 16/16 each on native CachyOS and Win64 clang-cl 23.1.5 Release (/MD) under Wine 11.22, with Vulkan disabled. The full fixture passed 5/5 per GPU and platform on RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1), reaching the final queue checks in every run. With a test-only 100 µs clock scoped to the texture-read worker, removing the yield measured 0 ns and triggered the worker assertion in all 12 runs per platform. With the committed yield, all 12 runs per platform passed and measured one tick.
  • MEASURED, hosted CI. submit_frame passed in both jobs. The macOS job reported success for the CTest stage before ps_exp_f32_denorm_rt failed on the Apple Paravirtual device. Pixel 0 got 0x00fffffe where 0x01000000 was expected. Windows job · macOS job
  • MEASURED, shader runner A/B. The shader-only commit df79ee784 from #2641 combines cleanly with a77fa84f8. I replayed the failing pixel and the device line through the combined Python runner using a stub harness. The runtime-denormal case changed from FAIL to SKIP. The same bad pixel still failed with Apple M5 Max as the stub device label. On actual NVIDIA and RADV hardware, both denormal fixtures each passed all 4,096 pixel comparisons before and after the commit. The full #2641 head has a conflict in tests/semantic/test_interp_computed_ij_fallback.py. #2641 macOS job

Synthetic fixtures only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-29 22:19 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7263585838) Retested `22e1349d7` on GitHub merge `a77fa84f8` onto `060c47160`. - **MEASURED, `submit_frame`.** The CPU section passed 16/16 each on native CachyOS and Win64 clang-cl 23.1.5 Release (`/MD`) under Wine 11.22, with Vulkan disabled. The full fixture passed 5/5 per GPU and platform on RTX 4070 SUPER (620.73.04) and Radeon Raphael (RADV 26.3.1), reaching the final queue checks in every run. With a test-only 100 µs clock scoped to the texture-read worker, removing the yield measured 0 ns and triggered the worker assertion in all 12 runs per platform. With the committed yield, all 12 runs per platform passed and measured one tick. - **MEASURED, hosted CI.** `submit_frame` passed in both jobs. The macOS job reported success for the CTest stage before `ps_exp_f32_denorm_rt` failed on the Apple Paravirtual device. Pixel 0 got `0x00fffffe` where `0x01000000` was expected. [Windows job](https://github.com/ProjectLeonida/mandy/actions/runs/46314458130/job/141508042980) · [macOS job](https://github.com/ProjectLeonida/mandy/actions/runs/46314458130/job/141508043214) - **MEASURED, shader runner A/B.** The shader-only commit `df79ee784` from #2641 combines cleanly with `a77fa84f8`. I replayed the failing pixel and the device line through the combined Python runner using a stub harness. The runtime-denormal case changed from FAIL to SKIP. The same bad pixel still failed with `Apple M5 Max` as the stub device label. On actual NVIDIA and RADV hardware, both denormal fixtures each passed all 4,096 pixel comparisons before and after the commit. The full #2641 head has a conflict in `tests/semantic/test_interp_computed_ij_fallback.py`. [#2641 macOS job](https://github.com/ProjectLeonida/mandy/actions/runs/46313905975/job/141506276546) Synthetic fixtures only. AI-assisted with OpenAI Codex.
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-29 23:09 UTC · original

Retested 22e1349d7 after merging it locally into main 452d1d1b6 (tree 8c23d50f8, includes #2649).

  • MEASURED. command_list passed 3/3 on native CachyOS and 3/3 as Win64 under Wine. This includes the new programmable sample-count assertions.
  • MEASURED. submit_frame and vk_gpu_profile each passed 3/3 per GPU and platform. There were no Vulkan skips. submit_frame reached 20 submissions and the final queue checks in every run. vk_gpu_profile resolved seven timestamps per capture, and the compute ratio assertion passed even with the NVIDIA graphics interval displaying 0.0000 ms in all six NVIDIA runs.

RTX 4070 SUPER (620.73.04), Radeon Raphael (RADV 26.3.1), native Linux and Win64 clang-cl 23.1.5 Release (/MD) under Wine 11.22. Synthetic fixtures only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-29 23:09 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7264248190) Retested `22e1349d7` after merging it locally into `main` `452d1d1b6` (tree `8c23d50f8`, includes #2649). - **MEASURED.** `command_list` passed 3/3 on native CachyOS and 3/3 as Win64 under Wine. This includes the new programmable sample-count assertions. - **MEASURED.** `submit_frame` and `vk_gpu_profile` each passed 3/3 per GPU and platform. There were no Vulkan skips. `submit_frame` reached 20 submissions and the final queue checks in every run. `vk_gpu_profile` resolved seven timestamps per capture, and the compute ratio assertion passed even with the NVIDIA graphics interval displaying `0.0000 ms` in all six NVIDIA runs. RTX 4070 SUPER (620.73.04), Radeon Raphael (RADV 26.3.1), native Linux and Win64 clang-cl 23.1.5 Release (`/MD`) under Wine 11.22. Synthetic fixtures only. AI-assisted with OpenAI Codex.
Author
Owner

@⁠lixonik on GitHub · 2026-11-29 23:36 UTC · original

Confirmed the committed timer fix at 22e1349d7, merged locally with main 452d1d1b6. On native Windows 10 22H2, RTX 5070 (610.88), MSVC 19.44, with Khronos Vulkan validation and synchronization validation, submit_frame passed 30/30 and vk_gpu_profile passed 5/5. The committed fixture ran without local edits. This resolves the worker-clock flake I reported above.

AI-assisted.

**@⁠lixonik** on GitHub · 2026-11-29 23:36 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7264586442) Confirmed the committed timer fix at `22e1349d7`, merged locally with `main` `452d1d1b6`. On native Windows 10 22H2, RTX 5070 (610.88), MSVC 19.44, with Khronos Vulkan validation and synchronization validation, `submit_frame` passed 30/30 and `vk_gpu_profile` passed 5/5. The committed fixture ran without local edits. This resolves the worker-clock flake I reported above. AI-assisted.
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-30 00:33 UTC · original

MoltenVK integration check with #2641. The ps_exp_f32_denorm_rt pixel 0 result (0x00fffffe for 0x01000000 on Apple Paravirtual) is identical in the #2566 macOS job and the upstream main jobs for a84c41909 and 32b9f4a3e.

I merged #2566 head 22e1349d7 into main 452d1d1b6, applied the Paravirtual skip commit df79ee784 from #2641, and ran the project’s macOS job in the fork. The combined job passed. submit_frame and vk_gpu_profile passed, the denorm case logged the explicit Apple Paravirtual skip, and ps_ssharp was the sole GPU failure, already covered by the upstream expected-failure policy.

Synthetic fixtures only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-30 00:33 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7265370920) MoltenVK integration check with #2641. The `ps_exp_f32_denorm_rt` pixel 0 result (`0x00fffffe` for `0x01000000` on Apple Paravirtual) is identical in the [#2566 macOS job](https://github.com/ProjectLeonida/mandy/actions/runs/46314458130/job/141508043214) and the upstream `main` jobs for [`a84c41909`](https://github.com/ProjectLeonida/mandy/actions/runs/46310898918/job/141496803305) and [`32b9f4a3e`](https://github.com/ProjectLeonida/mandy/actions/runs/46315554079/job/141511511244). I merged #2566 head `22e1349d7` into `main` `452d1d1b6`, applied the Paravirtual skip commit `df79ee784` from #2641, and ran the project’s macOS job in the fork. The [combined job passed](https://github.com/merzleckeier/mandy/actions/runs/46327648631/job/141550035619). `submit_frame` and `vk_gpu_profile` passed, the denorm case logged the explicit Apple Paravirtual skip, and `ps_ssharp` was the sole GPU failure, already covered by the upstream expected-failure policy. Synthetic fixtures only. AI-assisted with OpenAI Codex.
Author
Owner

@⁠DadaCap on GitHub · 2026-11-30 01:13 UTC · original

#2566 A/B on an RTX 5080: full report (2026-11-30)

Builds. A is main 32b9f4a3e, which already contains #2649 (the fix for the #778 device loss). B is A with #2566 at 22e1349d7 merged in (merge --no-ff, local commit f1e96bddd). Both runs use the Vulkan runtime (gta6rt) with the same settings: LEONIDA_DEVICE_FAULT=2 and the same run switches on both sides. Each side has its own build, its own shaders (translated with that side's translator) and its own compute pipeline journal. Each side also got a launch-set precompile and one uncounted 600 s warm-up run.

Order. The counted runs went A1 B1 A2 B2, 600 s each. Machine: RTX 5080 16 GB, NVIDIA 621.24, Windows 11, 24 logical CPUs.

Measures. FPS come from PresentMon; "1 %" is the FPS of the slowest 1 % of frames. RAM is the game's private memory and VRAM its dedicated GPU memory, both peaks in GiB. CPU % is the game's share of all 24 logical CPUs, and GPU % is nvidia-smi utilization, both averages sampled every 2 s. Times are seconds since the game started.

Summary

  • Survival: no device loss in any counted run (A1, B1, A2, B2: 600 s each), nor in the warm-ups. #2566 does not bring back a device loss on top of #2649.
  • The first minute is the same: 21-22 avg FPS on both sides.
  • The second minute is 2-3x slower with #2566: 60-120 s average FPS was A 11.0 / 10.7 and B 4.1 / 4.0, with medians A 14.3 / 13.3 and B 5.1 / 4.3. This held in every pair measured, 6 of 6 including the warm-ups and the first attempt on main 4364a4fa6.
  • After 120 s both sides are in the known world-phase stall. A still presents a few frames (median 0.2-0.6 FPS, up to 0.4-0.8 frames/s near the end); B presents none after about 120-180 s.
  • Memory: about the same on both sides (RAM 26-28 GiB, VRAM 12-13 GiB at peak).
  • Cause of B's slowdown (measured from the runtime's own counters): CPU time per submission in the textures and shadows phases, 3-6x higher than on A in the 60-120 s window. Details and code locations below.

Counted runs

A1 (main)

Window Avg FPS 1 % 5 % 50 % 95 % 99 % Max RAM Max VRAM CPU % GPU %
0-60 s 21.8 1.6 19.6 30.0 38.7 61.3 12.9 3.6 13 6
60-120 s 11.0 1.5 4.2 14.3 38.3 63.7 23.7 10.6 23 7
120 s+ 0.0 0.0 0.0 0.2 1.6 1.6 26.9 12.7 27 5
full 3.3 1.2 9.7 29.8 38.4 61.3 26.9 12.7 26 6

B1 (main + #2566)

Window Avg FPS 1 % 5 % 50 % 95 % 99 % Max RAM Max VRAM CPU % GPU %
0-60 s 22.0 1.6 25.8 30.0 32.7 47.3 13.5 5.3 14 6
60-120 s 4.1 1.1 1.9 5.1 30.8 41.3 21.5 11.3 16 7
120 s+ - - - - - - 26.0 12.2 19 4
full 14.3 1.5 3.1 29.9 32.6 46.9 26.0 12.2 18 4

A2 (main)

Window Avg FPS 1 % 5 % 50 % 95 % 99 % Max RAM Max VRAM CPU % GPU %
0-60 s 21.3 1.6 18.3 29.9 32.8 54.2 13.0 5.6 11 6
60-120 s 10.7 1.6 4.4 13.3 45.0 62.9 23.7 10.7 22 9
120 s+ 0.1 0.0 0.0 0.6 11.1 981 26.0 12.9 18 15
full 3.1 0.4 3.4 29.7 33.2 57.6 26.0 12.9 17 14

(The 99 % of 981 in A2's 120 s+ window comes from a handful of very short frame intervals, not from a real frame rate.)

B2 (main + #2566)

Window Avg FPS 1 % 5 % 50 % 95 % 99 % Max RAM Max VRAM CPU % GPU %
0-60 s 21.7 1.5 28.4 30.0 31.8 66.7 13.7 5.4 14 7
60-120 s 4.0 1.1 1.8 4.3 33.0 40.7 22.2 11.5 16 8
120 s+ - - - - - - 27.8 12.0 26 5
full 13.9 1.4 3.0 29.9 31.8 66.3 27.8 12.0 24 5

Side by side

A1 B1 A2 B2
Device loss in 600 s none none none none
Avg FPS 0-60 s 21.8 22.0 21.3 21.7
Avg FPS 60-120 s 11.0 4.1 10.7 4.0
Median FPS 60-120 s 14.3 5.1 13.3 4.3
Frames after 120 s a few (to ~0.8/s) none a few (0.4-0.6/s at 511-570 s) none
Max RAM / VRAM (GiB) 26.9 / 12.7 26.0 / 12.2 26.0 / 12.9 27.8 / 12.0
Compute journal read / written 2,000 / 8 1,112 / 200 2,000 / 1 1,300 / 142

The 60-120 s gap appears in every A/B pair measured on this machine:

Pair A B
warm-up, main 4364a4fa6 (first attempt) 12.6 4.1
counted, main 4364a4fa6 (first attempt) 11.1 3.8
warm-up, main 32b9f4a3e 8.6 4.7
A1 / B1 11.0 4.1
A2 / B2 10.7 4.0

The first attempt on 4364a4fa6 lost the device on both sides at 100-230 s. That loss was caused by #778 and is fixed by #2649 (now on main).

Investigation: where B's second minute goes

1. Submission phases (MEASURED, runtime submit phases log, ms per submission, n=2 per side)

~t A1 textures / shadows B1 textures / shadows A2 textures / shadows B2 textures / shadows
68-72 s 13.4 / 6.8 46.4 / 14.8 12.7 / 6.9 48.4 / 11.2 (t=73)
74-78 s 17.0 / 10.0 63.3 / 24.2 18.5 / 9.2 71.4 / 16.0
79-83 s 17.9 / 9.4 97.1 / 52.7 19.6 / 8.1 109.8 / 62.7
84-87 s 16.0 / 10.8 71.7 / 66.8 16.3 / 10.3 -

In this window the other phases (heaps, geometry, pipelines, replay) are similar on both sides. B's lower frame rate is CPU time spent preparing each submission in the textures phase (title texture refresh and upload) and the shadows phase (slot-133 shadow copies of title memory).

2. Title texture refresh volume on B (MEASURED, title texture refresh: statistics, new in #2566)

B1 periodic statistics, each covering about 10 s:

  • at ~62 s: 470 passes, 8,919 textures uploaded (447 MiB).
  • at ~72 s: 169 passes; 1,358,511 textures written or new, 77,043 read whole, 1,045,239 found unchanged by their written parts; 29,422 textures uploaded (5,411 MiB).

That is several GiB of CPU-staged texture uploads during world entry, at the moment the frame rate falls. Main has no equivalent counter, but its textures phase stays at 13-20 ms.

3. Shadow copies per submission (MEASURED, slot-133 shadow copies by cause, KiB per submission)

Cause A1 (~60-81 s) B1 (~62-72 s)
aliased 593-748 3,169-3,362
read-only (not ours) 0 405-450
write-watched 63-777 325-427
pinned 33 0.5

B copies about 5x more aliased title memory per submission. It also copies 0.4 MiB per submission of read-only memory that A never copies.

4. Messages only B logs (MEASURED, both takes)

  • gpu_owned refusal: 16 lines (logging caps at 16), 13 of them at ~47 s. The run total is 24 textures not filled, from the textures over GPU-written memory counter.
  • tsharp-refuse: 16 lines between 62 and 98 s. Reasons: "T# extent does not match the texture" 8, "T# names mips the texture lacks" 5, "no view for the T#'s format or range" 2, "T# type or samples do not fit the texture" 1.

These are guards added by #2566 (runtime/shims/d3d12_vulkan_device.cpp: DeviceState::index_texture ~line 20534, and the T# refusal logging ~line 21130). Their counts are small, and they fire in the same window as the slowdown. They read as symptoms of the same world-entry texture traffic, not as its cause (hypothesis).

5. Where to look (READ IN CODE, hypothesis)

  • refresh_title_textures in runtime/shims/d3d12_vulkan_device.cpp (~line 23728; statistics printed at ~24517 and ~26091) does the reads and uploads above.
  • Commits in #2566 that change when textures are backed and uploaded during streaming are the likeliest source of the burst: dd78a02f6 (back deferred pending_stream images in refresh_title_texture when pages arrive) and e4c070874 (publish deferred streamed views once backed). If many streamed images get backed and read whole in the same few seconds of world entry, that matches the 5.4 GiB window. fbeb3d908 (eliminate false texture re-uploads) and 09f8cb66b (read-back cache and coalescing) touch the same path.
  • The 5x aliased shadow copies point at the slot-133 shadow path's handling of aliased placed memory in #2566.

Suggested checks for the author:

  • Log, per refresh pass, how many textures are uploaded because a deferred streamed image was just backed, and their total size.
  • Rate-limit or spread those first uploads over several submissions.
  • Compare the aliased shadow-copy volume with #2566's aliasing changes reverted.

Limits

  • One GPU (RTX 5080, 621.24), n=2 counted runs per side plus one warm-up each. All the numbers above are from this machine only.
  • The 3090 (enlighted, same frozen commits) runs this A/B later this morning; the 4070 may follow tomorrow. Their results can be added here.
  • Every run ends in the existing world-phase stall after ~120-180 s on both sides, so only the first two minutes compare well.
  • The mechanism in section 5 is read in code, not proven by a run with the suspected commits reverted.
  • No 590 s screenshot on most counted runs: the screenshot tool found no game window then, while the process ran to the 600 s stop.

Tested by DadaCap's agent (Claude Code), AI-assisted.

**@⁠DadaCap** on GitHub · 2026-11-30 01:13 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7265957198) # #2566 A/B on an RTX 5080: full report (2026-11-30) **Builds.** A is main `32b9f4a3e`, which already contains #2649 (the fix for the #778 device loss). B is A with #2566 at `22e1349d7` merged in (`merge --no-ff`, local commit `f1e96bddd`). Both runs use the Vulkan runtime (`gta6rt`) with the same settings: `LEONIDA_DEVICE_FAULT=2` and the same run switches on both sides. Each side has its own build, its own shaders (translated with that side's translator) and its own compute pipeline journal. Each side also got a launch-set precompile and one uncounted 600 s warm-up run. **Order.** The counted runs went A1 B1 A2 B2, 600 s each. Machine: RTX 5080 16 GB, NVIDIA 621.24, Windows 11, 24 logical CPUs. **Measures.** FPS come from PresentMon; "1 %" is the FPS of the slowest 1 % of frames. RAM is the game's private memory and VRAM its dedicated GPU memory, both peaks in GiB. CPU % is the game's share of all 24 logical CPUs, and GPU % is nvidia-smi utilization, both averages sampled every 2 s. Times are seconds since the game started. ## Summary - **Survival: no device loss in any counted run** (A1, B1, A2, B2: 600 s each), nor in the warm-ups. #2566 does not bring back a device loss on top of #2649. - **The first minute is the same:** 21-22 avg FPS on both sides. - **The second minute is 2-3x slower with #2566:** 60-120 s average FPS was A 11.0 / 10.7 and B 4.1 / 4.0, with medians A 14.3 / 13.3 and B 5.1 / 4.3. This held in every pair measured, 6 of 6 including the warm-ups and the first attempt on main `4364a4fa6`. - **After 120 s** both sides are in the known world-phase stall. A still presents a few frames (median 0.2-0.6 FPS, up to 0.4-0.8 frames/s near the end); B presents none after about 120-180 s. - **Memory:** about the same on both sides (RAM 26-28 GiB, VRAM 12-13 GiB at peak). - **Cause of B's slowdown (measured from the runtime's own counters):** CPU time per submission in the *textures* and *shadows* phases, 3-6x higher than on A in the 60-120 s window. Details and code locations below. ## Counted runs ### A1 (main) | Window | Avg FPS | 1 % | 5 % | 50 % | 95 % | 99 % | Max RAM | Max VRAM | CPU % | GPU % | |---|---|---|---|---|---|---|---|---|---|---| | 0-60 s | 21.8 | 1.6 | 19.6 | 30.0 | 38.7 | 61.3 | 12.9 | 3.6 | 13 | 6 | | 60-120 s | 11.0 | 1.5 | 4.2 | 14.3 | 38.3 | 63.7 | 23.7 | 10.6 | 23 | 7 | | 120 s+ | 0.0 | 0.0 | 0.0 | 0.2 | 1.6 | 1.6 | 26.9 | 12.7 | 27 | 5 | | full | 3.3 | 1.2 | 9.7 | 29.8 | 38.4 | 61.3 | 26.9 | 12.7 | 26 | 6 | ### B1 (main + #2566) | Window | Avg FPS | 1 % | 5 % | 50 % | 95 % | 99 % | Max RAM | Max VRAM | CPU % | GPU % | |---|---|---|---|---|---|---|---|---|---|---| | 0-60 s | 22.0 | 1.6 | 25.8 | 30.0 | 32.7 | 47.3 | 13.5 | 5.3 | 14 | 6 | | 60-120 s | 4.1 | 1.1 | 1.9 | 5.1 | 30.8 | 41.3 | 21.5 | 11.3 | 16 | 7 | | 120 s+ | - | - | - | - | - | - | 26.0 | 12.2 | 19 | 4 | | full | 14.3 | 1.5 | 3.1 | 29.9 | 32.6 | 46.9 | 26.0 | 12.2 | 18 | 4 | ### A2 (main) | Window | Avg FPS | 1 % | 5 % | 50 % | 95 % | 99 % | Max RAM | Max VRAM | CPU % | GPU % | |---|---|---|---|---|---|---|---|---|---|---| | 0-60 s | 21.3 | 1.6 | 18.3 | 29.9 | 32.8 | 54.2 | 13.0 | 5.6 | 11 | 6 | | 60-120 s | 10.7 | 1.6 | 4.4 | 13.3 | 45.0 | 62.9 | 23.7 | 10.7 | 22 | 9 | | 120 s+ | 0.1 | 0.0 | 0.0 | 0.6 | 11.1 | 981 | 26.0 | 12.9 | 18 | 15 | | full | 3.1 | 0.4 | 3.4 | 29.7 | 33.2 | 57.6 | 26.0 | 12.9 | 17 | 14 | (The 99 % of 981 in A2's 120 s+ window comes from a handful of very short frame intervals, not from a real frame rate.) ### B2 (main + #2566) | Window | Avg FPS | 1 % | 5 % | 50 % | 95 % | 99 % | Max RAM | Max VRAM | CPU % | GPU % | |---|---|---|---|---|---|---|---|---|---|---| | 0-60 s | 21.7 | 1.5 | 28.4 | 30.0 | 31.8 | 66.7 | 13.7 | 5.4 | 14 | 7 | | 60-120 s | 4.0 | 1.1 | 1.8 | 4.3 | 33.0 | 40.7 | 22.2 | 11.5 | 16 | 8 | | 120 s+ | - | - | - | - | - | - | 27.8 | 12.0 | 26 | 5 | | full | 13.9 | 1.4 | 3.0 | 29.9 | 31.8 | 66.3 | 27.8 | 12.0 | 24 | 5 | ### Side by side | | A1 | B1 | A2 | B2 | |---|---|---|---|---| | Device loss in 600 s | none | none | none | none | | Avg FPS 0-60 s | 21.8 | 22.0 | 21.3 | 21.7 | | Avg FPS 60-120 s | 11.0 | 4.1 | 10.7 | 4.0 | | Median FPS 60-120 s | 14.3 | 5.1 | 13.3 | 4.3 | | Frames after 120 s | a few (to ~0.8/s) | none | a few (0.4-0.6/s at 511-570 s) | none | | Max RAM / VRAM (GiB) | 26.9 / 12.7 | 26.0 / 12.2 | 26.0 / 12.9 | 27.8 / 12.0 | | Compute journal read / written | 2,000 / 8 | 1,112 / 200 | 2,000 / 1 | 1,300 / 142 | The 60-120 s gap appears in every A/B pair measured on this machine: | Pair | A | B | |---|---|---| | warm-up, main 4364a4fa6 (first attempt) | 12.6 | 4.1 | | counted, main 4364a4fa6 (first attempt) | 11.1 | 3.8 | | warm-up, main 32b9f4a3e | 8.6 | 4.7 | | A1 / B1 | 11.0 | 4.1 | | A2 / B2 | 10.7 | 4.0 | The first attempt on `4364a4fa6` lost the device on both sides at 100-230 s. That loss was caused by #778 and is fixed by #2649 (now on main). ## Investigation: where B's second minute goes ### 1. Submission phases (MEASURED, runtime `submit phases` log, ms per submission, n=2 per side) | ~t | A1 textures / shadows | B1 textures / shadows | A2 textures / shadows | B2 textures / shadows | |---|---|---|---|---| | 68-72 s | 13.4 / 6.8 | 46.4 / 14.8 | 12.7 / 6.9 | 48.4 / 11.2 (t=73) | | 74-78 s | 17.0 / 10.0 | 63.3 / 24.2 | 18.5 / 9.2 | 71.4 / 16.0 | | 79-83 s | 17.9 / 9.4 | 97.1 / 52.7 | 19.6 / 8.1 | 109.8 / 62.7 | | 84-87 s | 16.0 / 10.8 | 71.7 / 66.8 | 16.3 / 10.3 | - | In this window the other phases (heaps, geometry, pipelines, replay) are similar on both sides. B's lower frame rate is CPU time spent preparing each submission in the *textures* phase (title texture refresh and upload) and the *shadows* phase (slot-133 shadow copies of title memory). ### 2. Title texture refresh volume on B (MEASURED, `title texture refresh:` statistics, new in #2566) B1 periodic statistics, each covering about 10 s: - **at ~62 s:** 470 passes, 8,919 textures uploaded (447 MiB). - **at ~72 s:** 169 passes; 1,358,511 textures written or new, 77,043 read whole, 1,045,239 found unchanged by their written parts; **29,422 textures uploaded (5,411 MiB)**. That is several GiB of CPU-staged texture uploads during world entry, at the moment the frame rate falls. Main has no equivalent counter, but its textures phase stays at 13-20 ms. ### 3. Shadow copies per submission (MEASURED, `slot-133 shadow copies by cause`, KiB per submission) | Cause | A1 (~60-81 s) | B1 (~62-72 s) | |---|---|---| | aliased | 593-748 | 3,169-3,362 | | read-only (not ours) | 0 | 405-450 | | write-watched | 63-777 | 325-427 | | pinned | 33 | 0.5 | B copies about 5x more aliased title memory per submission. It also copies 0.4 MiB per submission of read-only memory that A never copies. ### 4. Messages only B logs (MEASURED, both takes) - **`gpu_owned refusal`:** 16 lines (logging caps at 16), 13 of them at ~47 s. The run total is 24 textures not filled, from the `textures over GPU-written memory` counter. - **`tsharp-refuse`:** 16 lines between 62 and 98 s. Reasons: "T# extent does not match the texture" 8, "T# names mips the texture lacks" 5, "no view for the T#'s format or range" 2, "T# type or samples do not fit the texture" 1. These are guards added by #2566 (`runtime/shims/d3d12_vulkan_device.cpp`: `DeviceState::index_texture` ~line 20534, and the T# refusal logging ~line 21130). Their counts are small, and they fire in the same window as the slowdown. They read as symptoms of the same world-entry texture traffic, not as its cause (hypothesis). ### 5. Where to look (READ IN CODE, hypothesis) - `refresh_title_textures` in `runtime/shims/d3d12_vulkan_device.cpp` (~line 23728; statistics printed at ~24517 and ~26091) does the reads and uploads above. - Commits in #2566 that change when textures are backed and uploaded during streaming are the likeliest source of the burst: `dd78a02f6` (back deferred `pending_stream` images in `refresh_title_texture` when pages arrive) and `e4c070874` (publish deferred streamed views once backed). If many streamed images get backed and read whole in the same few seconds of world entry, that matches the 5.4 GiB window. `fbeb3d908` (eliminate false texture re-uploads) and `09f8cb66b` (read-back cache and coalescing) touch the same path. - The 5x aliased shadow copies point at the slot-133 shadow path's handling of aliased placed memory in #2566. **Suggested checks for the author:** - Log, per refresh pass, how many textures are uploaded because a deferred streamed image was just backed, and their total size. - Rate-limit or spread those first uploads over several submissions. - Compare the aliased shadow-copy volume with #2566's aliasing changes reverted. ## Limits - One GPU (RTX 5080, 621.24), n=2 counted runs per side plus one warm-up each. All the numbers above are from this machine only. - The 3090 (enlighted, same frozen commits) runs this A/B later this morning; the 4070 may follow tomorrow. Their results can be added here. - Every run ends in the existing world-phase stall after ~120-180 s on both sides, so only the first two minutes compare well. - The mechanism in section 5 is read in code, not proven by a run with the suspected commits reverted. - No 590 s screenshot on most counted runs: the screenshot tool found no game window then, while the process ran to the 600 s stop. Tested by DadaCap's agent (Claude Code), AI-assisted.
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-30 01:21 UTC · original

Synthetic texture/shadow coverage and a counter detail for the RTX 5080 A/B. I merged 22e1349d7 into 0eab02a8b (tree bf58cee8).

  • MEASURED The six selected tests (title_texture_refresh, vk_title_detile, shadow_keep, title_frames, title_texture_watch, title_write_policy) passed on native CachyOS and Win64 clang-cl Release /MD under Wine 11.22, using RTX 4070 SUPER and Radeon Raphael. Each completed run exercised 187 GPU detile cases plus descriptor batching and 3D multi-mip readback, with bit-for-bit parity. This covers the synthetic paths and leaves the world-entry throughput question open.
  • READ IN CODE stage2_backed counts allocations performed inside Stage 2. The slot-70 callback can back a deferred texture earlier through back_title_texture(t, nullptr, nullptr, from), leaving its texel upload for the batched pass. Once that early backing succeeds, Stage 2 sees unbound_bytes == 0 and omits that texture from its backing count. The first upload’s bytes would need separate attribution to slot-70 backing to test that hypothesis. Slot-70 path · Stage-2 count.

Synthetic fixtures only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-30 01:21 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7266061881) Synthetic texture/shadow coverage and a counter detail for [the RTX 5080 A/B](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566). I merged `22e1349d7` into `0eab02a8b` (tree `bf58cee8`). - **MEASURED** The six selected tests (`title_texture_refresh`, `vk_title_detile`, `shadow_keep`, `title_frames`, `title_texture_watch`, `title_write_policy`) passed on native CachyOS and Win64 clang-cl Release `/MD` under Wine 11.22, using RTX 4070 SUPER and Radeon Raphael. Each completed run exercised 187 GPU detile cases plus descriptor batching and 3D multi-mip readback, with bit-for-bit parity. This covers the synthetic paths and leaves the world-entry throughput question open. - **READ IN CODE** `stage2_backed` counts allocations performed inside Stage 2. The slot-70 callback can back a deferred texture earlier through `back_title_texture(t, nullptr, nullptr, from)`, leaving its texel upload for the batched pass. Once that early backing succeeds, Stage 2 sees `unbound_bytes == 0` and omits that texture from its backing count. The first upload’s bytes would need separate attribution to slot-70 backing to test that hypothesis. [Slot-70 path](https://github.com/ProjectLeonida/mandy/blob/22e1349d788cbd1af1cbecfa84180f40c428617d/runtime/shims/d3d12_vulkan_device.cpp#L25585-L25615) · [Stage-2 count](https://github.com/ProjectLeonida/mandy/blob/22e1349d788cbd1af1cbecfa84180f40c428617d/runtime/shims/d3d12_vulkan_device.cpp#L24260-L24269). Synthetic fixtures only. AI-assisted with OpenAI Codex.
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-30 01:29 UTC · original

I put a focused measurement for the RTX 5080 A/B in a fork. The diagnostic commit tags a deferred texture only when slot 70 gives it backing before submission. The periodic log line title texture slot-70 early backing reports backing operations, first successful uploads, source-footprint bytes, and the subset staged by the CPU. A pending upload survives reporting windows and upload retries. The diagnostic patch also applies cleanly to the frozen 32b9f4a3e + 22e1349d7 merge used for the B arm.

With the synthetic Vulkan probe, I ran three fresh launches per mode and GPU (RTX 4070 SUPER and Radeon Raphael) using a Win64 clang-cl Release build under Wine 11.22. All 12 reached submission and descriptor retirement. Each early-backing run reported one backing operation, one first upload, and 2,048 source bytes, all CPU-staged. The existing stage2_backed counter stayed at zero. Each submission-time control reported stage2_backed=1 and emitted no early-backing line.

The probe uses synthetic pages and forces CPU staging. The reported gameplay FPS drop still needs an instrumented workload run.

AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-30 01:29 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7266184465) I put a focused measurement for the [RTX 5080 A/B](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566) in a fork. The [diagnostic commit](https://github.com/merzleckeier/mandy/commit/cd613f0efdc153e9a96753eac1d003f4199cdff9) tags a deferred texture only when slot 70 gives it backing before submission. The periodic log line `title texture slot-70 early backing` reports backing operations, first successful uploads, source-footprint bytes, and the subset staged by the CPU. A pending upload survives reporting windows and upload retries. The diagnostic patch also applies cleanly to the frozen `32b9f4a3e` + `22e1349d7` merge used for the B arm. With the [synthetic Vulkan probe](https://github.com/merzleckeier/mandy/commit/57c3657e2fa1a6df930dfe7a29d0614ff7eaf930), I ran three fresh launches per mode and GPU (RTX 4070 SUPER and Radeon Raphael) using a Win64 clang-cl Release build under Wine 11.22. All 12 reached submission and descriptor retirement. Each early-backing run reported one backing operation, one first upload, and 2,048 source bytes, all CPU-staged. The existing `stage2_backed` counter stayed at zero. Each submission-time control reported `stage2_backed=1` and emitted no early-backing line. The probe uses synthetic pages and forces CPU staging. The reported gameplay FPS drop still needs an instrumented workload run. AI-assisted with OpenAI Codex.
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-30 01:48 UTC · original

I checked what the slot-133 numbers in the RTX 5080 A/B measure. The higher aliased figure shows more source bytes scheduled for shadow refresh. It does not give the number of bytes written to the shadow destinations.

  • READ IN CODE add_job charges the source range to the “by cause” counter before copying. With the default LEONIDA_SHADOW_KEEP, the refresh reads and hashes that range, then credits the “submissions … copied” line for writes into destination ranges. The latter is a total across causes. Source accounting
  • MEASURED In the synthetic Vulkan readback probe, the alias counter reports 64 KiB for an unchanged submission and again after a 1 KiB write through the other mapping. Destination copies are 0 KiB and 1 KiB, respectively. This held in two runs per GPU and tree on RTX 4070 SUPER and Radeon Raphael (Win64 clang-cl Release under Wine 11.22), on the frozen A 32b9f4a3e and B (22e1349d7 merged onto A, tree 127f841a). A separate B/NVIDIA control with LEONIDA_SHADOW_KEEP=0 reported 64 KiB copied on both. All readbacks matched.
  • READ IN CODE B’s top-level submit phases … shadows also includes PageMirror refresh and flush work. For the same 60–82 s interval in the existing logs, the slot-133 copied … KiB and walk … ms, copies … ms rows show shadow destination volume and refresh cost. B’s before-execute row, when present, gives separate mirror and flush timings. Those rows can distinguish a more expensive slot-133 refresh from time spent in PageMirror. Phase scopes

The readback probe uses synthetic pages and one refresh per submission. It measures the counters rather than gameplay performance. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-30 01:48 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7266456663) I checked what the slot-133 numbers in [the RTX 5080 A/B](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566) measure. The higher aliased figure shows more source bytes scheduled for shadow refresh. It does not give the number of bytes written to the shadow destinations. - **READ IN CODE** `add_job` charges the source range to the “by cause” counter before copying. With the default `LEONIDA_SHADOW_KEEP`, the refresh reads and hashes that range, then credits the “submissions … copied” line for writes into destination ranges. The latter is a total across causes. [Source accounting](https://github.com/ProjectLeonida/mandy/blob/22e1349d788cbd1af1cbecfa84180f40c428617d/runtime/shims/d3d12_vulkan_device.cpp#L1404-L1447) - **MEASURED** In the [synthetic Vulkan readback probe](https://github.com/merzleckeier/mandy/commit/52e18119d582cb99722800d5de408519a37bfc32), the alias counter reports **64 KiB** for an unchanged submission and again after a 1 KiB write through the other mapping. Destination copies are **0 KiB** and **1 KiB**, respectively. This held in two runs per GPU and tree on RTX 4070 SUPER and Radeon Raphael (Win64 clang-cl Release under Wine 11.22), on the frozen A `32b9f4a3e` and B (`22e1349d7` merged onto A, tree `127f841a`). A separate B/NVIDIA control with `LEONIDA_SHADOW_KEEP=0` reported **64 KiB** copied on both. All readbacks matched. - **READ IN CODE** B’s top-level `submit phases … shadows` also includes PageMirror refresh and flush work. For the same 60–82 s interval in the existing logs, the slot-133 `copied … KiB` and `walk … ms, copies … ms` rows show shadow destination volume and refresh cost. B’s `before-execute` row, when present, gives separate mirror and flush timings. Those rows can distinguish a more expensive slot-133 refresh from time spent in PageMirror. [Phase scopes](https://github.com/ProjectLeonida/mandy/blob/22e1349d788cbd1af1cbecfa84180f40c428617d/runtime/shims/d3d12_vulkan_device.cpp#L21985-L22014) The readback probe uses synthetic pages and one refresh per submission. It measures the counters rather than gameplay performance. AI-assisted with OpenAI Codex.
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-30 02:17 UTC · original

Independent retest of 1aefed0da on GitHub merge 1ac6eea36 (base 182d0c174). The control merged the previous head 22e1349d7 on the same base.

  • MEASURED On the new head, submit_frame passed 3/3 per GPU and platform on RTX 4070 SUPER and Radeon Raphael, both native CachyOS and Win64 clang-cl Release under Wine 11.22. Every run reached the new Present mutex ordering and async-versus-sync held-queue assertions. queue_holds and list_value_progress passed 3/3 per platform. Win64 xbox_list_value_fallback passed 3/3 per GPU and xs_proxy_mock passed 3/3. The previous head passed its corresponding tests too.
  • MEASURED Under headless Gamescope, vk_presenter_sync passed 3/3 per GPU on each revision. All runs reached the deferred-Present order, destroyed-queue, and concurrent Present checks. NVIDIA Gamescope aborted on teardown after the six child tests finished. An independent Gamescope run with only sleep 1 as the child also crashed during teardown.
  • MEASURED Separate validation check for the DMA-BUF message seen in the Host Image Copy runs. A standalone Vulkan program with VkDeviceCreateInfo::enabledExtensionCount = 0 creates a device successfully natively and under Wine. In all six Wine runs, the host trace adds VK_EXT_external_memory_dma_buf without VK_KHR_external_memory_fd and the host Khronos layer reports the dependency VUID. This was absent in the six native controls. Wine 11.22 device-extension translation

The slot-70 diagnostic still applies cleanly to this merge. These runs use synthetic inputs. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-30 02:17 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7266882674) Independent retest of `1aefed0da` on GitHub merge `1ac6eea36` (base `182d0c174`). The control merged the previous head `22e1349d7` on the same base. - **MEASURED** On the new head, `submit_frame` passed 3/3 per GPU and platform on RTX 4070 SUPER and Radeon Raphael, both native CachyOS and Win64 clang-cl Release under Wine 11.22. Every run reached the new Present mutex ordering and async-versus-sync held-queue assertions. `queue_holds` and `list_value_progress` passed 3/3 per platform. Win64 `xbox_list_value_fallback` passed 3/3 per GPU and `xs_proxy_mock` passed 3/3. The previous head passed its corresponding tests too. - **MEASURED** Under headless Gamescope, `vk_presenter_sync` passed 3/3 per GPU on each revision. All runs reached the deferred-Present order, destroyed-queue, and concurrent Present checks. NVIDIA Gamescope aborted on teardown after the six child tests finished. An independent Gamescope run with only `sleep 1` as the child also crashed during teardown. - **MEASURED** Separate validation check for the DMA-BUF message seen in the [Host Image Copy runs](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/2570). A standalone Vulkan program with `VkDeviceCreateInfo::enabledExtensionCount = 0` creates a device successfully natively and under Wine. In all six Wine runs, the host trace adds `VK_EXT_external_memory_dma_buf` without `VK_KHR_external_memory_fd` and the host Khronos layer reports the dependency VUID. This was absent in the six native controls. [Wine 11.22 device-extension translation](https://github.com/wine-mirror/wine/blob/wine-11.22/dlls/win32u/vulkan.c#L598-L655) The [slot-70 diagnostic](https://github.com/merzleckeier/mandy/commit/cd613f0efdc153e9a96753eac1d003f4199cdff9) still applies cleanly to this merge. These runs use synthetic inputs. AI-assisted with OpenAI Codex.
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-30 02:30 UTC · original

Follow-up for the RTX 5080 A/B. The combined diagnostic commit splits first uploads of deferred streaming textures by where backing was assigned: slot 70 before submission or Stage 2 during submission. Each log line gives backing operations, first uploads, source bytes, and the CPU-staged subset. The pending origin survives report boundaries and is consumed once on a successful upload. The combined patch applies cleanly to the original uninstrumented 32b9f4a3e + 22e1349d7 B tree.

MEASURED I added the synthetic probe to merge 1ac6eea36 (182d0c174 + 1aefed0da). All 12 Win64 clang-cl Release runs under Wine 11.22 reached the submission and descriptor retirement checks, with three runs per path and GPU (RTX 4070 SUPER and Radeon Raphael). Each run attributed one backing and one upload of 2,048 CPU-staged source bytes to the selected path. The other path emitted no attribution. The counter unit test also passed natively and as Win64 under Wine.

The probe forces CPU staging and uses synthetic inputs. This adds a way to measure the two paths in a world-entry rerun. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-30 02:30 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7267066415) Follow-up for the [RTX 5080 A/B](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566). The [combined diagnostic commit](https://github.com/merzleckeier/mandy/commit/2eefa2d37d90134985fc474f02e73528f0169054) splits first uploads of deferred streaming textures by where backing was assigned: slot 70 before submission or Stage 2 during submission. Each log line gives backing operations, first uploads, source bytes, and the CPU-staged subset. The pending origin survives report boundaries and is consumed once on a successful upload. The combined patch applies cleanly to the original uninstrumented `32b9f4a3e` + `22e1349d7` B tree. **MEASURED** I added the [synthetic probe](https://github.com/merzleckeier/mandy/commit/5b8aecfd0b4b79abfd95b13c174c7d759dd7156d) to merge `1ac6eea36` (`182d0c174` + `1aefed0da`). All 12 Win64 clang-cl Release runs under Wine 11.22 reached the submission and descriptor retirement checks, with three runs per path and GPU (RTX 4070 SUPER and Radeon Raphael). Each run attributed one backing and one upload of 2,048 CPU-staged source bytes to the selected path. The other path emitted no attribution. The counter unit test also passed natively and as Win64 under Wine. The probe forces CPU staging and uses synthetic inputs. This adds a way to measure the two paths in a world-entry rerun. AI-assisted with OpenAI Codex.
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-30 07:48 UTC · original

Independent offscreen guest-scene A/B for 1aefed0da, cleanly merged onto current main e1fe82f63 (local merge tree e8408f4e3). MEASURED on CachyOS, Wine 11.22, clang-cl 23.1.5 Release /MD, static SDL 3.4.20; RTX 4070 SUPER (NVIDIA 620.73.04) and Radeon 610M/Raphael (RADV 26.3.1).

  • Two runtime builds × two separately translated M1.5 shader packs × two physical adapters: 8/8 passed. Each pack had three translated and spirv-val-valid synthetic shaders. All runs used the same Windows SDK guest binary and both shader packs produced the same output on both runtimes.
  • Each combination matched the independently predicted 600-frame sequence and selected pixel readbacks. The 300-frame save plus 300-frame resume was byte-identical to the uninterrupted run. Both corruption controls returned their expected errors. All eight frame chains were 424a0ed99442a42a.
  • The guest uses the PC command-list ABI. With the stock launcher environment both revisions failed at the first Close() on both GPUs. Setting LEONIDA_D3D12_LISTS=pc for both arms resolved that fixture issue, as proposed in #1541.

This is an offline synthetic smoke test of the merged runtime and translator, using no game assets. Retail frame rate, VRAM behavior and sustained world loading remain outside this test.

AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-30 07:48 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7272151244) Independent offscreen guest-scene A/B for `1aefed0da`, cleanly merged onto current `main` `e1fe82f63` (local merge tree `e8408f4e3`). **MEASURED** on CachyOS, Wine 11.22, clang-cl 23.1.5 Release `/MD`, static SDL 3.4.20; RTX 4070 SUPER (NVIDIA 620.73.04) and Radeon 610M/Raphael (RADV 26.3.1). - Two runtime builds × two separately translated M1.5 shader packs × two physical adapters: **8/8 passed**. Each pack had three translated and `spirv-val`-valid synthetic shaders. All runs used the same Windows SDK guest binary and both shader packs produced the same output on both runtimes. - Each combination matched the independently predicted 600-frame sequence and selected pixel readbacks. The 300-frame save plus 300-frame resume was byte-identical to the uninterrupted run. Both corruption controls returned their expected errors. All eight frame chains were `424a0ed99442a42a`. - The guest uses the PC command-list ABI. With the stock launcher environment both revisions failed at the first `Close()` on both GPUs. Setting `LEONIDA_D3D12_LISTS=pc` for both arms resolved that fixture issue, as proposed in #1541. This is an offline synthetic smoke test of the merged runtime and translator, using no game assets. Retail frame rate, VRAM behavior and sustained world loading remain outside this test. AI-assisted with OpenAI Codex.
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-30 08:06 UTC · original

Native RTX 4090 retest of the integrated float32 denorm fixture fix requested above. I rebuilt the stock M4 fixtures from 1aefed0da merged onto e1fe82f63 (tree e8408f4e3) with no source or fixture edits. Windows 11, MSVC 19.44 Release, NVIDIA 616.64, Khronos Vulkan validation 1.4.369.

  • d3d12_m4_compute and d3d12_m4_compute_async_small_waits both passed 3/3. Each run logged the RTX 4090 with validation on and matched all 1,924 output words against its CPU reference. Zero validation errors in the six runs.
  • Both stock generated compute modules passed spirv-val --target-env vulkan1.2. Neither declares DenormFlushToZero.
  • The translator flag and shader builder suites passed 42/42 and 11/11, respectively.

This closes the requested stock-fixture retest on Ada and uses synthetic GPU input. Earlier failure and patch.

AI-assisted with OpenAI Codex (GPT-6.2 Sol).

**@⁠ecox982745** on GitHub · 2026-11-30 08:06 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7272492371) Native RTX 4090 retest of the integrated float32 denorm fixture fix requested above. I rebuilt the stock M4 fixtures from `1aefed0da` merged onto `e1fe82f63` (tree `e8408f4e3`) with no source or fixture edits. Windows 11, MSVC 19.44 Release, NVIDIA 616.64, Khronos Vulkan validation 1.4.369. - `d3d12_m4_compute` and `d3d12_m4_compute_async_small_waits` both passed 3/3. Each run logged the RTX 4090 with validation on and matched all 1,924 output words against its CPU reference. Zero validation errors in the six runs. - Both stock generated compute modules passed `spirv-val --target-env vulkan1.2`. Neither declares `DenormFlushToZero`. - The translator flag and shader builder suites passed 42/42 and 11/11, respectively. This closes the requested stock-fixture retest on Ada and uses synthetic GPU input. [Earlier failure and patch](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566). AI-assisted with OpenAI Codex (GPT-6.2 Sol).
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-30 08:55 UTC · original

Cold retail boot comparison for 1aefed0da on e1fe82f63 (local merge tree e8408f4e3). MEASURED on CachyOS, Wine 11.22, RTX 4070 SUPER 12 GiB, NVIDIA 620.73.04, private Gamescope/Xwayland with DRI3, 1280×720. Series S, sound off, RT acceleration structures off, fresh prefix, saves and pipeline caches per run. Both shader packs were independently rebuilt with wave64 emulation and 29,280 of 29,280 programs passed spirv-val in each. Both arms used the same fitted DirectStorage profile.

Recipe main main + #2566
Cold, standard runtime startup package splash, 0 presents, exit 5 at 35 s, peak 3,088 MiB package splash, 0 presents, exit 5 at 33 s, peak 3,089 MiB
Cold, first-run-style arena/layout/on-demand compile settings package splash, 0 presents, exit 5 at 33 s, peak 4,782 MiB package splash, 0 presents, exit 5 at 33 s, peak 4,686 MiB

Every run traced the same null write (0xc0000005) 29.69–30.88 s after the package splash. That signature matches the hang-watchdog description in running.md. The watchdog was left armed in all runs. VRAM above is whole-card startup usage, including idle desktop allocations. These runs establish a shared startup blocker on this recipe. World-load and gameplay performance remain unmeasured.

AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-30 08:55 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7273513455) Cold retail boot comparison for `1aefed0da` on `e1fe82f63` (local merge tree `e8408f4e3`). **MEASURED** on CachyOS, Wine 11.22, RTX 4070 SUPER 12 GiB, NVIDIA 620.73.04, private Gamescope/Xwayland with DRI3, 1280×720. Series S, sound off, RT acceleration structures off, fresh prefix, saves and pipeline caches per run. Both shader packs were independently rebuilt with wave64 emulation and **29,280 of 29,280** programs passed `spirv-val` in each. Both arms used the same fitted DirectStorage profile. | Recipe | `main` | `main` + #2566 | | --- | --- | --- | | Cold, standard runtime startup | package splash, 0 presents, exit 5 at 35 s, peak 3,088 MiB | package splash, 0 presents, exit 5 at 33 s, peak 3,089 MiB | | Cold, first-run-style arena/layout/on-demand compile settings | package splash, 0 presents, exit 5 at 33 s, peak 4,782 MiB | package splash, 0 presents, exit 5 at 33 s, peak 4,686 MiB | Every run traced the same null write (`0xc0000005`) 29.69–30.88 s after the package splash. That signature matches the hang-watchdog description in [running.md](https://github.com/ProjectLeonida/mandy/blob/e1fe82f63/docs/running.md#settings-every-platform-needs). The watchdog was left armed in all runs. VRAM above is whole-card startup usage, including idle desktop allocations. These runs establish a shared startup blocker on this recipe. World-load and gameplay performance remain unmeasured. AI-assisted with OpenAI Codex.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-30 09:42 UTC · original

Pushed efc192990 (root-cause fix for @DadaCap's RTX 5080 60–120 s textures & shadows regressions) and merged latest mandy/main (b8508a974, resolving the tests/semantic/test_interp_computed_ij_fallback.py conflict with #2633 cleanly).

Root Causes Found & Fixed (efc192990)

  1. Windows 11-only full-space title_memory_map::changed() broadcast storm (runtime/shims/xmem.cpp):
    • sections_committed() returns true on Wine and false on native Windows 11. On Windows 11, every DirectStorage physical-page scatter transfer (dstorage.cpp → xmem.cpp:commit_pages_locked()) called title_memory_map::changed() with no range ([0, UINTPTR_MAX]), waking all ~8,000 watched textures every submission (1.36M woken / 1.05M re-hashed unchanged / 77k read-whole), invalidating t.memory/t.write_combined_known + TextureVqCache + TitleTextureCells::arm_batch, and marking every ShadowPages page kRequery.
    • Fix: Added PageCommitBits per Section (host_heap) and coalesce_page_runs() (host_heap::vector) in commit_pages_locked() so already-committed / file_backed / unmapped pages emit zero map changes, and newly committed mapped/table pages notify only their exact coalesced [lo, hi) ranges.
  2. shadows: read-only (not ours): 0 → 405–450 KiB/sub & aliased / lock churn (runtime/src/title_geometry_watch.h, runtime/shims/d3d12_vulkan_device.cpp):
    • TitleTextureCells::arm_batch() arms 64 KiB tiles PAGE_READONLY before refresh_shadows(), causing non-aliased ShadowPages overlapping a guarded tile to see PAGE_READONLY with kProtected == 0 and re-copy Copy::read_only every submission forever.
    • Fix: Added geometry_writes::query_pages_guarded() (restricted to PAGE_READWRITE/PAGE_EXECUTE_READWRITE restores) so non-aliased/non-pinned ShadowPages adopt kProtected on guarded tiles after a single copy; added note_external_reopen() for ShadowPages::reopen_locked(); made set_hot(..., true) / set_hot_batch(..., true) bump Cell::version and emit targeted title_memory_map::changed(lo, hi); passed allow_hot = false in ShadowPages::update_aliased(); batched title_frames::for_each_part() across the whole ShadowPages::copy_changed() job (16× fewer lock/refcount pairs per 64 KiB page).
  3. World-entry textures burst & O(N) overhead (runtime/src/title_texture_refresh.h, runtime/shims/d3d12_vulkan_device.cpp):
    • Maintained DeviceState::title_partial_bytes incrementally (eliminating O(N) title_textures scan per pass), removed redundant uncached title_texture_readable() / is_write_combined() VirtualQuery calls on table-backed pages, kept t.fills guard on mc.written_tiles so never-filled textures never upload partial mirror data, and added TitleStreamBudget (LEONIDA_TITLE_STREAM_BUDGET_MB, default 16 MiB, 0 = unlimited) bounding unmapped first-time streamed uploads / partial-mip upgrades with watch.touch(t.address) deferral while never deferring mapped video planes or dynamic updates.

Verification (AI-assisted: implemented & audited via 2 rounds of independent read-only adversarial review, VERDICT: CLEAN)

  • Linux (MESA_VK_DEVICE_SELECT='1002:164e!', AMD Raphael iGPU, Mesa RADV): 155/155 CTests PASS (153 passed, 2 skipped: shader_library_corpus, vk_sync_validation).
  • Windows cross-build (clang-cl + xwin) + Wine on Raphael iGPU: 14/14 targeted tests PASS (xmem, xmem_no_write_watch, xmem_write_watch, xmem_wine_commit, xmem_pool_zero_read, d3d12_existing_heap, d3d12_existing_heap_no_write_watch, d3d12_existing_heap_write_watch, d3d12_xmem_placed, title_texture_refresh, title_texture_watch, queue_holds, submit_frame, vk_gpu_profile), including new regression tests for targeted commit_physical_pages notifications, ShadowPages adopting geometry_writes guards + set_hot / aliased-peer invalidation + note_external_reopen, and TitleStreamBudget / coalesce_page_runs / PageCommitBits.
  • tests/test_ctest_registration.py (14/14), tests/semantic/test_interp_computed_ij_fallback.py (9/9), scripts/check_no_game_data.py: PASS.

Ready for a fresh native Windows 11 A/B re-run (@DadaCap / @merzleckeier)!

**@⁠aslan2142** on GitHub · 2026-11-30 09:42 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7274572658) Pushed `efc192990` (root-cause fix for `@DadaCap`'s RTX 5080 60–120 s `textures` & `shadows` regressions) and merged latest `mandy/main` (`b8508a974`, resolving the `tests/semantic/test_interp_computed_ij_fallback.py` conflict with `#2633` cleanly). ### Root Causes Found & Fixed (`efc192990`) 1. **Windows 11-only full-space `title_memory_map::changed()` broadcast storm (`runtime/shims/xmem.cpp`):** - `sections_committed()` returns `true` on Wine and `false` on native Windows 11. On Windows 11, every DirectStorage physical-page scatter transfer (`dstorage.cpp` → `xmem.cpp:commit_pages_locked()`) called `title_memory_map::changed()` with **no range (`[0, UINTPTR_MAX]`)**, waking all ~8,000 watched textures every submission (`1.36M` woken / `1.05M` re-hashed unchanged / `77k` read-whole), invalidating `t.memory`/`t.write_combined_known` + `TextureVqCache` + `TitleTextureCells::arm_batch`, and marking every `ShadowPages` page `kRequery`. - **Fix:** Added `PageCommitBits` per `Section` (`host_heap`) and `coalesce_page_runs()` (`host_heap::vector`) in `commit_pages_locked()` so already-committed / `file_backed` / unmapped pages emit **zero** map changes, and newly committed mapped/table pages notify only their exact coalesced `[lo, hi)` ranges. 2. **`shadows`: `read-only (not ours): 0 → 405–450 KiB/sub` & `aliased` / lock churn (`runtime/src/title_geometry_watch.h`, `runtime/shims/d3d12_vulkan_device.cpp`):** - `TitleTextureCells::arm_batch()` arms 64 KiB tiles `PAGE_READONLY` before `refresh_shadows()`, causing non-aliased `ShadowPages` overlapping a guarded tile to see `PAGE_READONLY` with `kProtected == 0` and re-copy `Copy::read_only` every submission forever. - **Fix:** Added `geometry_writes::query_pages_guarded()` (restricted to `PAGE_READWRITE`/`PAGE_EXECUTE_READWRITE` restores) so non-aliased/non-pinned `ShadowPages` adopt `kProtected` on guarded tiles after a single copy; added `note_external_reopen()` for `ShadowPages::reopen_locked()`; made `set_hot(..., true)` / `set_hot_batch(..., true)` bump `Cell::version` and emit targeted `title_memory_map::changed(lo, hi)`; passed `allow_hot = false` in `ShadowPages::update_aliased()`; batched `title_frames::for_each_part()` across the whole `ShadowPages::copy_changed()` job (16× fewer lock/refcount pairs per 64 KiB page). 3. **World-entry `textures` burst & O(N) overhead (`runtime/src/title_texture_refresh.h`, `runtime/shims/d3d12_vulkan_device.cpp`):** - Maintained `DeviceState::title_partial_bytes` incrementally (eliminating O(N) `title_textures` scan per pass), removed redundant uncached `title_texture_readable()` / `is_write_combined()` `VirtualQuery` calls on table-backed pages, kept `t.fills` guard on `mc.written_tiles` so never-filled textures never upload partial mirror data, and added `TitleStreamBudget` (`LEONIDA_TITLE_STREAM_BUDGET_MB`, default `16` MiB, `0` = unlimited) bounding unmapped first-time streamed uploads / partial-mip upgrades with `watch.touch(t.address)` deferral while never deferring mapped video planes or dynamic updates. ### Verification (AI-assisted: implemented & audited via 2 rounds of independent read-only adversarial review, `VERDICT: CLEAN`) - **Linux (`MESA_VK_DEVICE_SELECT='1002:164e!'`, AMD Raphael iGPU, Mesa RADV):** `155/155` CTests PASS (`153` passed, `2` skipped: `shader_library_corpus`, `vk_sync_validation`). - **Windows cross-build (`clang-cl + xwin`) + Wine on Raphael iGPU:** `14/14` targeted tests PASS (`xmem`, `xmem_no_write_watch`, `xmem_write_watch`, `xmem_wine_commit`, `xmem_pool_zero_read`, `d3d12_existing_heap`, `d3d12_existing_heap_no_write_watch`, `d3d12_existing_heap_write_watch`, `d3d12_xmem_placed`, `title_texture_refresh`, `title_texture_watch`, `queue_holds`, `submit_frame`, `vk_gpu_profile`), including new regression tests for targeted `commit_physical_pages` notifications, `ShadowPages` adopting `geometry_writes` guards + `set_hot` / aliased-peer invalidation + `note_external_reopen`, and `TitleStreamBudget` / `coalesce_page_runs` / `PageCommitBits`. - `tests/test_ctest_registration.py` (14/14), `tests/semantic/test_interp_computed_ij_fallback.py` (9/9), `scripts/check_no_game_data.py`: PASS. Ready for a fresh native Windows 11 A/B re-run (`@DadaCap` / `@merzleckeier`)!
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-30 09:54 UTC · original

Independent native-Windows check of the XMem notification change in b8508a974 (includes efc192990). This used a GitHub-hosted Windows Server 2025 Datacenter runner, build 26100, MSVC 19.52.37029 x64 Release. Completed Windows job

  • Current head: xmem, xmem_no_write_watch, xmem_write_watch and title_texture_refresh passed 4/4.

  • Negative control: I restored only runtime/shims/xmem.cpp from 1aefed0da, the revision before efc192990, and rebuilt against the new tests. Exactly three assertions failed. Unmapped commits broadcast a map change, mapped commits invalidated an unrelated VA, and repeat commits notified again. This isolates the native notification change from the test and streaming-policy code.

  • Wine 11.22 check: the same 4/7 targeted CTest entries passed before and after. The three full xmem variants had the same failure in the unrelated 512-page commit-charge assertion on both trees. Linux title_texture_refresh also passed with ASan and UBSan.

This covers synthetic memory and policy tests on native Windows and Wine. The RTX 5080 in-game texture and shadow performance still needs its own A/B.

AI-assisted: yes (OpenAI Codex).

**@⁠merzleckeier** on GitHub · 2026-11-30 09:54 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7274839268) Independent native-Windows check of the XMem notification change in `b8508a974` (includes `efc192990`). This used a GitHub-hosted Windows Server 2025 Datacenter runner, build 26100, MSVC 19.52.37029 x64 Release. [Completed Windows job](https://github.com/merzleckeier/mandy/actions/runs/46394353833/job/141764437181) - **Current head:** `xmem`, `xmem_no_write_watch`, `xmem_write_watch` and `title_texture_refresh` passed 4/4. - **Negative control:** I restored only `runtime/shims/xmem.cpp` from `1aefed0da`, the revision before `efc192990`, and rebuilt against the new tests. Exactly three assertions failed. Unmapped commits broadcast a map change, mapped commits invalidated an unrelated VA, and repeat commits notified again. This isolates the native notification change from the test and streaming-policy code. - **Wine 11.22 check:** the same 4/7 targeted CTest entries passed before and after. The three full `xmem` variants had the same failure in the unrelated 512-page commit-charge assertion on both trees. Linux `title_texture_refresh` also passed with ASan and UBSan. This covers synthetic memory and policy tests on native Windows and Wine. The RTX 5080 in-game texture and shadow performance still needs its own A/B. AI-assisted: yes (OpenAI Codex).
Author
Owner

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

Native Windows texture verification after efc192990. Tested PR head 70ea7d6ec merged with 1b0f657f3 (tree be66afc1). Clean MSVC 19.44 Release build, Windows 11 build 26300, RTX 4090 on NVIDIA 616.64, Khronos Vulkan validation 1.4.369.

Stock synthetic fixture Default stream budget (16 MiB) Unlimited (0)
d3d12_existing_heap_test --partial-mips 3/3 3/3
d3d12_existing_heap_test --gpu-copied-textures 3/3 3/3
d3d12_existing_heap_test --mapped-plane-async 3/3 3/3

All 18 GPU processes selected the RTX 4090 with validation on and passed without validation diagnostics. The partial-mip and copied-texture logs show both the host-copy and forced-staging checks ran, including the min-LOD upgrade and partial-copy mip preservation. The separate title_texture_refresh CPU fixture, which exercises the budget policy at its limits, also passed 3/3. These fixtures check correctness. They leave retail frame timing and streaming-burst behavior to the in-game A/B.

AI-assisted with OpenAI Codex (GPT-6.2 Sol).

**@⁠ecox982745** on GitHub · 2026-11-30 10:10 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7275224703) Native Windows texture verification after `efc192990`. Tested PR head `70ea7d6ec` merged with `1b0f657f3` (tree `be66afc1`). Clean MSVC 19.44 Release build, Windows 11 build 26300, RTX 4090 on NVIDIA 616.64, Khronos Vulkan validation 1.4.369. | Stock synthetic fixture | Default stream budget (16 MiB) | Unlimited (`0`) | | --- | ---: | ---: | | `d3d12_existing_heap_test --partial-mips` | 3/3 | 3/3 | | `d3d12_existing_heap_test --gpu-copied-textures` | 3/3 | 3/3 | | `d3d12_existing_heap_test --mapped-plane-async` | 3/3 | 3/3 | All 18 GPU processes selected the RTX 4090 with validation on and passed without validation diagnostics. The partial-mip and copied-texture logs show both the host-copy and forced-staging checks ran, including the min-LOD upgrade and partial-copy mip preservation. The separate `title_texture_refresh` CPU fixture, which exercises the budget policy at its limits, also passed 3/3. These fixtures check correctness. They leave retail frame timing and streaming-burst behavior to the in-game A/B. AI-assisted with OpenAI Codex (GPT-6.2 Sol).
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-30 10:15 UTC · original

Independent slot-133 shadow readback on Wine. I merged 70ea7d6ec onto 1b0f657f3 (tree be66afc1b) and rebuilt with clang-cl 23.1.5 Release. On each GPU, d3d12_existing_heap passed with write watch default, forced off and forced on, and title_mirror_hot_cold passed. The focused single-tile and batch checks also passed.

For the batch check I extended the existing guard fixture to reopen two adjacent 64 KiB guards with one set_hot_batch call, then wrote distinct synthetic bytes into each region before the next Vulkan readback. The journal recorded exactly one 128 KiB range and the readback matched byte for byte. A separate two-entry batch reopened the second host view of an aliased tile. A write through that view reached the next Vulkan readback from the original view.

Local control in the multi-entry hot branch of set_hot_batch Result on both GPUs
Remove only the map-change notification Zero journal changes. The non-aliased readback kept stale bytes starting at +0x2000.
Remove only the per-cell version bump The non-aliased readback and journal check passed. The aliased readback kept stale bytes starting at +0x11000.

CachyOS, Wine 11.22 (Wayland), RTX 4070 SUPER (620.73.04) and Radeon 610M/Raphael (RADV 26.3.1). Synthetic memory only. This complements the separate native Windows texture checks. The RTX 5080 gameplay A/B is still open. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-30 10:15 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7275333663) **Independent slot-133 shadow readback on Wine.** I merged `70ea7d6ec` onto `1b0f657f3` (tree `be66afc1b`) and rebuilt with clang-cl 23.1.5 Release. On each GPU, `d3d12_existing_heap` passed with write watch default, forced off and forced on, and `title_mirror_hot_cold` passed. The focused single-tile and batch checks also passed. For the batch check I extended the existing guard fixture to reopen two adjacent 64 KiB guards with one `set_hot_batch` call, then wrote distinct synthetic bytes into each region before the next Vulkan readback. The journal recorded exactly one 128 KiB range and the readback matched byte for byte. A separate two-entry batch reopened the second host view of an aliased tile. A write through that view reached the next Vulkan readback from the original view. | Local control in the multi-entry hot branch of `set_hot_batch` | Result on both GPUs | | --- | --- | | Remove only the map-change notification | Zero journal changes. The non-aliased readback kept stale bytes starting at `+0x2000`. | | Remove only the per-cell version bump | The non-aliased readback and journal check passed. The aliased readback kept stale bytes starting at `+0x11000`. | CachyOS, Wine 11.22 (Wayland), RTX 4070 SUPER (620.73.04) and Radeon 610M/Raphael (RADV 26.3.1). Synthetic memory only. This complements the [separate native Windows texture checks](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2566). The RTX 5080 gameplay A/B is still open. AI-assisted with OpenAI Codex.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-30 10:24 UTC · original

Merging with 8/8 CI checks green (Runtime/windows 7m54s, CI/check 14m, CI/linux-python-and-viewer 5m45s, CI/semantic-tests 4m33s, Runtime/linux-gpu-tools 4m28s, jactionlint 19s, No Game Data 15s) and independent verification + negative controls across Windows Server 2025, Windows 11 RTX 4090, CachyOS RTX 4070 SUPER / Radeon 610M, and RX 7900 XTX. Huge thanks to @DadaCap for the RTX 5080 A/B data that surfaced the Windows 11 commit_pages_locked broadcast storm and ShadowPages/TitleTextureCells guard interaction, and to @merzleckeier, @ecox982745, @zmasi, and @Tauwni for the thorough cross-GPU/OS verification and negative controls!

**@⁠aslan2142** on GitHub · 2026-11-30 10:24 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7275539249) Merging with **8/8 CI checks green** (`Runtime/windows` 7m54s, `CI/check` 14m, `CI/linux-python-and-viewer` 5m45s, `CI/semantic-tests` 4m33s, `Runtime/linux-gpu-tools` 4m28s, `jactionlint` 19s, `No Game Data` 15s) and independent verification + negative controls across Windows Server 2025, Windows 11 RTX 4090, CachyOS RTX 4070 SUPER / Radeon 610M, and RX 7900 XTX. Huge thanks to `@DadaCap` for the RTX 5080 A/B data that surfaced the Windows 11 `commit_pages_locked` broadcast storm and `ShadowPages`/`TitleTextureCells` guard interaction, and to `@merzleckeier`, `@ecox982745`, `@zmasi`, and `@Tauwni` for the thorough cross-GPU/OS verification and negative controls!
github manually merged commit 012b79a678 into main 2026-11-30 10:29:39 +00:00
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-30 10:30 UTC · original

Post-merge stream-budget retry check on main 012b79a67. I added a local mode to d3d12_existing_heap_test that creates three pending 1024×2048 R8 slot-70 views (2 MiB each) over reserved memory. It commits all three together, writes synthetic bytes, and issues one texel-write notification. The fixture forces staged Vulkan uploads and counts populated bindless descriptors after each fenced queue submission. It does no further CPU writes or descriptor rewrites.

Budget or control Published descriptors after successive submissions
1 MiB 1 → 2 → 3 → 3
Default 16 MiB 3 → 3 → 3 → 3
Unlimited (0) 3 → 3 → 3 → 3
1 MiB, remove only watch.touch(t.address) from the budget-deferral branch 1 → 1, fails on the second submission

Previously published descriptors kept their indices. The stock title_texture_refresh_test also passed. The focused test covers initial progress when one texture is larger than the limit and automatic retry of the rest. The negative control was built locally from the same runtime and fixture.

Both GPUs gave the same results on CachyOS, Wine 11.22 (Wayland), clang-cl 23.1.5 Release. RTX 4070 SUPER (620.73.04) and Radeon 610M/Raphael (RADV 26.3.1). Synthetic textures only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-30 10:30 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7275697308) **Post-merge stream-budget retry check on `main` `012b79a67`.** I added a local mode to `d3d12_existing_heap_test` that creates three pending 1024×2048 R8 slot-70 views (2 MiB each) over reserved memory. It commits all three together, writes synthetic bytes, and issues one texel-write notification. The fixture forces staged Vulkan uploads and counts populated bindless descriptors after each fenced queue submission. It does no further CPU writes or descriptor rewrites. | Budget or control | Published descriptors after successive submissions | | --- | --- | | 1 MiB | 1 → 2 → 3 → 3 | | Default 16 MiB | 3 → 3 → 3 → 3 | | Unlimited (`0`) | 3 → 3 → 3 → 3 | | 1 MiB, remove only `watch.touch(t.address)` from the budget-deferral branch | 1 → 1, fails on the second submission | Previously published descriptors kept their indices. The stock `title_texture_refresh_test` also passed. The focused test covers initial progress when one texture is larger than the limit and automatic retry of the rest. The negative control was built locally from the same runtime and fixture. Both GPUs gave the same results on CachyOS, Wine 11.22 (Wayland), clang-cl 23.1.5 Release. RTX 4070 SUPER (620.73.04) and Radeon 610M/Raphael (RADV 26.3.1). Synthetic textures only. AI-assisted with OpenAI Codex.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!2566
No description provided.