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

Merged
aslan2142 merged 238 commits from upstream-pr/2566 into main 2026-11-30 10:24:25 +00:00
aslan2142 commented 2026-11-28 06:24:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-28T06:24:16Z.


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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5537430292 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-28T06:24:16Z. --- Claimed in the coordination issue as: [INTEGRATION-PERF-CPU-GPU-R6](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7235257421) ### 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.
zmasi commented 2026-11-28 10:00:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T10:00:55Z.


@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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237612777 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7237612777). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T10:00:55Z. --- @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 commented 2026-11-28 10:11:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T10:11:50Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237736765 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7237736765). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T10:11:50Z. --- 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.
ecox982745 commented 2026-11-28 11:36:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-28T11:36:01Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238658542 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7238658542). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-28T11:36:01Z. --- **Resolved on the integration branch.** The [test change in this PR](https://github.com/ProjectLeonida/mandy/pull/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://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7237612777) 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).
aslan2142 commented 2026-11-28 12:19:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-28T12:19:45Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7239151055 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7239151055). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-28T12:19:45Z. --- 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).
azsekazvamdimitar commented 2026-11-28 13:36:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by azsekazvamdimitar on 2026-11-28T13:36:11Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7240052214 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7240052214). Originally posted by [azsekazvamdimitar](https://github.com/azsekazvamdimitar) on 2026-11-28T13:36:11Z. --- 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.
timbot103 commented 2026-11-28 13:57:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T13:57:03Z.

Review: COMMENTED


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*).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6098201240 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#pullrequestreview-6098201240). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T13:57:03Z. **Review:** COMMENTED --- 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*`).
Tauwni commented 2026-11-28 14:22:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-28T14:22:45Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7240623909 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7240623909). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-28T14:22:45Z. --- 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).
ecox982745 commented 2026-11-28 14:44:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-28T14:44:01Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7240890407 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7240890407). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-28T14:44:01Z. --- The [cross-thread written-pages mismatch reported on Mac/Wine](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7240623909) 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://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7240859360). AI-assisted with OpenAI Codex (GPT-6).
Tauwni commented 2026-11-28 14:55:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-28T14:55:41Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7241044362 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7241044362). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-28T14:55:41Z. --- 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).
ecox982745 commented 2026-11-28 15:01:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-28T15:01:31Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7241138562 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7241138562). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-28T15:01:31Z. --- The [Mac result at byte 16](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7241044362) 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).
OreoFR commented 2026-11-28 15:43:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T15:43:37Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7241687969 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7241687969). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T15:43:37Z. --- ## 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).
Tauwni commented 2026-11-28 16:00:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-28T16:00:00Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7241895744 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7241895744). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-28T16:00:00Z. --- 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).
DadaCap commented 2026-11-28 19:01:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T19:01:51Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7244235880 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7244235880). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T19:01:51Z. --- # 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.
Maticcm commented 2026-11-28 20:38:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Maticcm on 2026-11-28T20:38:37Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245435238 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7245435238). Originally posted by [Maticcm](https://github.com/Maticcm) on 2026-11-28T20:38:37Z. --- **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 commented 2026-11-28 21:23:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Maticcm on 2026-11-28T21:23:45Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245988053 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7245988053). Originally posted by [Maticcm](https://github.com/Maticcm) on 2026-11-28T21:23:45Z. --- 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).
ecox982745 commented 2026-11-28 22:03:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-28T22:03:20Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246463873 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7246463873). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-28T22:03:20Z. --- 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://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7246419149). AI-assisted verification with OpenAI Codex (GPT-6).
aslan2142 commented 2026-11-28 22:13:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-28T22:13:05Z.


Pushed new changes, please retest on NVIDIA

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246578910 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7246578910). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-28T22:13:05Z. --- Pushed new changes, please retest on NVIDIA
ecox982745 commented 2026-11-28 22:33:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-28T22:33:32Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246820239 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7246820239). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-28T22:33:32Z. --- I retested the queue and presenter changes on a desktop **RTX 4090, driver 616.64**, in response to the [NVIDIA retest request](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7246578910). 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://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7246769939). AI-assisted verification with OpenAI Codex (GPT-6).
ecox982745 commented 2026-11-29 00:07:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-29T00:07:14Z.


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
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247889031 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7247889031). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-29T00:07:14Z. --- 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://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7246820239) 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>
Tauwni commented 2026-11-29 05:11:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-29T05:11:55Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7251109193 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7251109193). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-29T05:11:55Z. --- 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).
bobcatchris commented 2026-11-29 06:02:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-29T06:02:50Z.


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)
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7251613650 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7251613650). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-11-29T06:02:50Z. --- 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) ```
qhukz13 commented 2026-11-29 10:42:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-29T10:42:17Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7254612413 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7254612413). Originally posted by [qhukz13](https://github.com/qhukz13) on 2026-11-29T10:42:17Z. --- **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).
merzleckeier commented 2026-11-29 14:42:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T14:42:31Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257513770 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7257513770). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T14:42:31Z. --- 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://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7247889031). 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.
aslan2142 commented 2026-11-29 15:44:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-29T15:44:25Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7258328192 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7258328192). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-29T15:44:25Z. --- 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).*
lixonik commented 2026-11-29 16:12:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T16:12:00Z.

Review: COMMENTED


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6103690714 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#pullrequestreview-6103690714). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-29T16:12:00Z. **Review:** COMMENTED --- 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).
aslan2142 commented 2026-11-29 17:05:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-29T17:05:22Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259412467 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259412467). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-29T17:05:22Z. --- 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).*
merzleckeier commented 2026-11-29 17:30:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T17:30:49Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259750237 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259750237). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T17:30:49Z. --- 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 commented 2026-11-29 17:36:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T17:36:00Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259817199 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259817199). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T17:36:00Z. --- 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).
merzleckeier commented 2026-11-29 17:43:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T17:43:26Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259914239 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259914239). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T17:43:26Z. --- 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).
fiestorra commented 2026-11-29 17:48:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T17:48:43Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259982731 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259982731). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T17:48:43Z. --- 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 commented 2026-11-29 17:49:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T17:49:34Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259993324 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259993324). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T17:49:34Z. --- 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.
aslan2142 commented 2026-11-29 17:53:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-29T17:53:06Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260038845 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7260038845). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-29T17:53:06Z. --- 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 commented 2026-11-29 17:59:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-29T17:59:55Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260126915 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7260126915). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-29T17:59:55Z. --- 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).*
merzleckeier commented 2026-11-29 18:11:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T18:11:35Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260285917 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7260285917). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T18:11:35Z. --- 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.
aslan2142 commented 2026-11-29 18:22:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-29T18:22:02Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260425211 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7260425211). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-29T18:22:02Z. --- 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).*
merzleckeier commented 2026-11-29 18:52:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T18:52:38Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260829196 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7260829196). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T18:52:38Z. --- 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://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7259993324): `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.
lixonik commented 2026-11-29 19:17:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T19:17:16Z.

Review: COMMENTED


@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).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6104380609 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#pullrequestreview-6104380609). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-29T19:17:16Z. **Review:** COMMENTED --- @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).
merzleckeier commented 2026-11-29 19:27:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T19:27:44Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261298325 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261298325). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T19:27:44Z. --- I independently reproduced the [texture UAV finding](https://github.com/ProjectLeonida/mandy/pull/2566#pullrequestreview-6104380609) 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://github.com/ProjectLeonida/mandy/pull/2627#issuecomment-7261241297). Synthetic inputs only. AI-assisted with OpenAI Codex.
aslan2142 commented 2026-11-29 19:28:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-29T19:28:04Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261302752 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261302752). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-29T19:28:04Z. --- 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).*
merzleckeier commented 2026-11-29 19:35:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T19:35:50Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261405323 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261405323). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T19:35:50Z. --- 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.
azsekazvamdimitar commented 2026-11-29 20:01:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by azsekazvamdimitar on 2026-11-29T20:01:32Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261745226 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261745226). Originally posted by [azsekazvamdimitar](https://github.com/azsekazvamdimitar) on 2026-11-29T20:01:32Z. --- 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).
qhukz13 commented 2026-11-29 20:02:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-29T20:02:28Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261757941 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261757941). Originally posted by [qhukz13](https://github.com/qhukz13) on 2026-11-29T20:02:28Z. --- 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).
fiestorra commented 2026-11-29 20:05:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T20:05:51Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261803637 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261803637). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T20:05:51Z. --- 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 commented 2026-11-29 20:06:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T20:06:40Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261814639 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261814639). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T20:06:40Z. --- 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.
fiestorra commented 2026-11-29 20:07:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T20:07:21Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261824348 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261824348). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T20:07:21Z. --- 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 commented 2026-11-29 20:08:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T20:08:30Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261840365 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7261840365). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T20:08:30Z. --- 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.
merzleckeier commented 2026-11-29 20:23:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T20:23:02Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262035558 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262035558). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T20:23:02Z. --- 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.
aslan2142 commented 2026-11-29 20:28:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-29T20:28:47Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262112848 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262112848). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-29T20:28:47Z. --- 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).*
merzleckeier commented 2026-11-29 20:34:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T20:34:37Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262190776 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262190776). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T20:34:37Z. --- 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://github.com/ProjectLeonida/mandy/pull/2633#issuecomment-7262108583) Synthetic inputs only. AI-assisted with OpenAI Codex.
merzleckeier commented 2026-11-29 20:53:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T20:53:27Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262438233 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262438233). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T20:53:27Z. --- 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.
aslan2142 commented 2026-11-29 21:18:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-29T21:18:22Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262769764 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262769764). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-29T21:18:22Z. --- 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).*
lixonik commented 2026-11-29 21:24:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T21:24:18Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262848452 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262848452). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-29T21:24:18Z. --- 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.
merzleckeier commented 2026-11-29 21:24:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T21:24:37Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262852675 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262852675). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T21:24:37Z. --- 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 commented 2026-11-29 21:29:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T21:29:27Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262916092 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262916092). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T21:29:27Z. --- I ran a controlled clock-resolution A/B for the [Windows worker-accounting finding](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7262848452) 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.
fiestorra commented 2026-11-29 21:44:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T21:44:23Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7263112250 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7263112250). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T21:44:23Z. --- **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.
aslan2142 commented 2026-11-29 21:51:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-29T21:51:40Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7263209126 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7263209126). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-29T21:51:40Z. --- 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).*
merzleckeier commented 2026-11-29 22:19:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T22:19:41Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7263585838 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7263585838). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T22:19:41Z. --- 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.
merzleckeier commented 2026-11-29 23:09:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T23:09:59Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7264248190 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7264248190). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T23:09:59Z. --- 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.
lixonik commented 2026-11-29 23:36:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T23:36:19Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7264586442 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7264586442). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-29T23:36:19Z. --- 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.
merzleckeier commented 2026-11-30 00:33:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T00:33:14Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7265370920 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7265370920). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T00:33:14Z. --- 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.
DadaCap commented 2026-11-30 01:13:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-30T01:13:51Z.


#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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7265957198 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7265957198). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-30T01:13:51Z. --- # #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.
merzleckeier commented 2026-11-30 01:21:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T01:21:01Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7266061881 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7266061881). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T01:21:01Z. --- Synthetic texture/shadow coverage and a counter detail for [the RTX 5080 A/B](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7265957198). 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.
merzleckeier commented 2026-11-30 01:29:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T01:29:47Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7266184465 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7266184465). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T01:29:47Z. --- I put a focused measurement for the [RTX 5080 A/B](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7265957198) 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.
merzleckeier commented 2026-11-30 01:48:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T01:48:25Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7266456663 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7266456663). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T01:48:25Z. --- I checked what the slot-133 numbers in [the RTX 5080 A/B](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7265957198) 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.
merzleckeier commented 2026-11-30 02:17:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T02:17:57Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7266882674 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7266882674). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T02:17:57Z. --- 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://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7266614043). 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.
merzleckeier commented 2026-11-30 02:30:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T02:30:27Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7267066415 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7267066415). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T02:30:27Z. --- Follow-up for the [RTX 5080 A/B](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7265957198). 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.
merzleckeier commented 2026-11-30 07:48:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T07:48:46Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7272151244 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7272151244). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T07:48:46Z. --- 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.
ecox982745 commented 2026-11-30 08:06:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-30T08:06:36Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7272492371 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7272492371). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-30T08:06:36Z. --- 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://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7247889031). AI-assisted with OpenAI Codex (GPT-6.2 Sol).
merzleckeier commented 2026-11-30 08:55:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T08:55:32Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7273513455 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7273513455). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T08:55:32Z. --- 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.
aslan2142 commented 2026-11-30 09:42:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-30T09:42:19Z.


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)!

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7274572658 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7274572658). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-30T09:42:19Z. --- 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`)!
merzleckeier commented 2026-11-30 09:54:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T09:54:05Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7274839268 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7274839268). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T09:54:05Z. --- 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).
ecox982745 commented 2026-11-30 10:10:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-30T10:10:15Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7275224703 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7275224703). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-30T10:10:15Z. --- 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).
merzleckeier commented 2026-11-30 10:15:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T10:15:01Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7275333663 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7275333663). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T10:15:01Z. --- **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://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7275224703). The RTX 5080 gameplay A/B is still open. AI-assisted with OpenAI Codex.
aslan2142 commented 2026-11-30 10:24:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-30T10:24:07Z.


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!

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7275539249 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7275539249). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-30T10:24:07Z. --- 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!
merzleckeier commented 2026-11-30 10:30:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T10:30:38Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7275697308 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2566#issuecomment-7275697308). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T10:30:38Z. --- **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.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
ProjectLeonida/mandy!2566
No description provided.