d3d12/vulkan: add 4 GB low-VRAM budget steering, priority/pageable memory, and LEONIDA_RT_AS=off (VK-LOW-VRAM-BUDGET) #443

Closed
jujumoneylol wants to merge 2 commits from upstream-pr/443 into main
jujumoneylol commented 2026-11-24 05:25:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by jujumoneylol on 2026-11-24T05:25:59Z.


Claimed in the coordination issue as: VK-LOW-VRAM-BUDGET (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7122816234)

What and why

Adds an automatic low-VRAM survival layer in the Vulkan D3D12 shim for discrete GPUs with <= 4.5 GiB dedicated VRAM (e.g., 4 GB GTX 1650 / RTX 3050 4 GB) while leaving larger GPUs (>= 6 GB) and UMA iGPUs untouched by default.

  • Vulkan memory management extensions: opportunistically enables VK_EXT_memory_budget, VK_EXT_memory_priority, and VK_EXT_pageable_device_local_memory when advertised by the driver, chaining VkMemoryPriorityAllocateInfoEXT (1.0 for critical render targets / depth-stencil / arena allocations vs 0.25 for spillable textures/buffers).
  • Proactive VRAM budget steering (runtime/src/vulkan_memory.h, runtime/shims/d3d12_vulkan_device.cpp):
    • Auto-enables on discrete GPUs with <= 4.5 GiB DEVICE_LOCAL VRAM (overridable via LEONIDA_LOW_VRAM=on|off|auto, LEONIDA_VRAM_RESERVE_MB, LEONIDA_VRAM_CAP_MB, LEONIDA_VRAM_LOG=1).
    • Preserves a default 512 MiB DEVICE_LOCAL headroom reserve for critical RT/DS targets; once live VK_EXT_memory_budget headroom drops below the reserve, spillable allocations are proactively routed to system RAM (HOST_VISIBLE) instead of evicting render targets or causing VK_ERROR_OUT_OF_DEVICE_MEMORY.
    • Allows sparse tile heaps (Heap::tiles) to fall back to system memory when VRAM is exhausted instead of returning E_OUTOFMEMORY.
    • Leaves pipeline cache persistence untouched so this does not overlap #218.
  • Ray-tracing opt-out (LEONIDA_RT_AS=off): cleanly disables RT acceleration structures on non-RT / low-VRAM GPUs and answers GetRaytracingAccelerationStructurePrebuildInfo with minimal 256-byte aligned sizes so callers do not allocate or divide by zero.
  • Tests: adds unit tests for the budget/placement policy in runtime/test/d3d12_state_map_test.cpp and a live GPU stress test (runtime/test/d3d12_low_vram_test.cpp) that oversubscribes VRAM past 100% and verifies critical RT/DS pinning + spillable steering + LEONIDA_RT_AS=off.

Tested

  • Built d3d12_state_map_test, d3d12_low_vram_test, and d3d12_vulkan_device_test with MSVC 19.44 (vcvars64) + Ninja on top of main 8f481cf16.
  • d3d12_state_map_test: PASSED (including new low-VRAM policy & placement unit tests).
  • d3d12_low_vram_test: ALL CHECKS PASSED on GTX 1650 (3,935 MiB VRAM, budget=1 priority=1 pageable=1, 512 MiB reserve):
    • Oversubscribed 277 × 16 MiB (4,432 MiB) spillable textures + 6 critical RT/DS targets: 173 textures in VRAM, 104 (1,664 MiB) proactively steered to system RAM, 0 forced spills, 6/6 critical RT/DS pinned in VRAM.
    • Verified LEONIDA_RT_AS=off disables RT and returns 256-byte prebuild sizes.
  • d3d12_vulkan_device_test: PASSED (60/60 resolves matched, 20/20 ID3D12Heap::GetDesc matched, host-image/staging copies, castable formats, and Xbox-ABI proxy checks matched).
  • py -3.13 -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/shims/d3d12_com.h runtime/shims/d3d12_vulkan_device.cpp runtime/src/vulkan_memory.h runtime/test/d3d12_low_vram_test.cpp runtime/test/d3d12_state_map_test.cpp: clean.

GPUs tested: NVIDIA GeForce GTX 1650 Mobile 4 GB (driver 592.00, Vulkan 1.4.325, Windows 11 26200)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • 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. (n/a — Vulkan D3D12 runtime only)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5466648557 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/443). Originally posted by [jujumoneylol](https://github.com/jujumoneylol) on 2026-11-24T05:25:59Z. --- Claimed in the coordination issue as: VK-LOW-VRAM-BUDGET (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7122816234) ### What and why Adds an automatic low-VRAM survival layer in the Vulkan D3D12 shim for discrete GPUs with <= 4.5 GiB dedicated VRAM (e.g., 4 GB GTX 1650 / RTX 3050 4 GB) while leaving larger GPUs (>= 6 GB) and UMA iGPUs untouched by default. - **Vulkan memory management extensions**: opportunistically enables `VK_EXT_memory_budget`, `VK_EXT_memory_priority`, and `VK_EXT_pageable_device_local_memory` when advertised by the driver, chaining `VkMemoryPriorityAllocateInfoEXT` (`1.0` for critical render targets / depth-stencil / arena allocations vs `0.25` for spillable textures/buffers). - **Proactive VRAM budget steering** (`runtime/src/vulkan_memory.h`, `runtime/shims/d3d12_vulkan_device.cpp`): - Auto-enables on discrete GPUs with <= 4.5 GiB `DEVICE_LOCAL` VRAM (overridable via `LEONIDA_LOW_VRAM=on|off|auto`, `LEONIDA_VRAM_RESERVE_MB`, `LEONIDA_VRAM_CAP_MB`, `LEONIDA_VRAM_LOG=1`). - Preserves a default 512 MiB `DEVICE_LOCAL` headroom reserve for critical RT/DS targets; once live `VK_EXT_memory_budget` headroom drops below the reserve, spillable allocations are proactively routed to system RAM (`HOST_VISIBLE`) instead of evicting render targets or causing `VK_ERROR_OUT_OF_DEVICE_MEMORY`. - Allows sparse tile heaps (`Heap::tiles`) to fall back to system memory when VRAM is exhausted instead of returning `E_OUTOFMEMORY`. - Leaves pipeline cache persistence untouched so this does not overlap #218. - **Ray-tracing opt-out (`LEONIDA_RT_AS=off`)**: cleanly disables RT acceleration structures on non-RT / low-VRAM GPUs and answers `GetRaytracingAccelerationStructurePrebuildInfo` with minimal 256-byte aligned sizes so callers do not allocate or divide by zero. - **Tests**: adds unit tests for the budget/placement policy in `runtime/test/d3d12_state_map_test.cpp` and a live GPU stress test (`runtime/test/d3d12_low_vram_test.cpp`) that oversubscribes VRAM past 100% and verifies critical RT/DS pinning + spillable steering + `LEONIDA_RT_AS=off`. ### Tested - Built `d3d12_state_map_test`, `d3d12_low_vram_test`, and `d3d12_vulkan_device_test` with MSVC 19.44 (`vcvars64`) + Ninja on top of `main` `8f481cf16`. - `d3d12_state_map_test`: PASSED (including new low-VRAM policy & placement unit tests). - `d3d12_low_vram_test`: ALL CHECKS PASSED on GTX 1650 (3,935 MiB VRAM, `budget=1 priority=1 pageable=1`, 512 MiB reserve): - Oversubscribed 277 × 16 MiB (4,432 MiB) spillable textures + 6 critical RT/DS targets: 173 textures in VRAM, 104 (1,664 MiB) proactively steered to system RAM, 0 forced spills, 6/6 critical RT/DS pinned in VRAM. - Verified `LEONIDA_RT_AS=off` disables RT and returns 256-byte prebuild sizes. - `d3d12_vulkan_device_test`: PASSED (60/60 resolves matched, 20/20 `ID3D12Heap::GetDesc` matched, host-image/staging copies, castable formats, and Xbox-ABI proxy checks matched). - `py -3.13 -I scripts/check_no_game_data.py runtime/CMakeLists.txt runtime/shims/d3d12_com.h runtime/shims/d3d12_vulkan_device.cpp runtime/src/vulkan_memory.h runtime/test/d3d12_low_vram_test.cpp runtime/test/d3d12_state_map_test.cpp`: clean. GPUs tested: NVIDIA GeForce GTX 1650 Mobile 4 GB (driver 592.00, Vulkan 1.4.325, Windows 11 26200) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [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. (n/a — Vulkan D3D12 runtime only)
Sangonapou commented 2026-11-24 19:00:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Sangonapou on 2026-11-24T19:00:13Z.


Tested ccffa86b on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, 16 GB), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300), native Windows: d3d12_state_map passes, d3d12_low_vram fails on this 16 GB card

Built at this head with scripts\build_runtime.ps1 (MSVC 19.51, VS Build Tools 2026, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0). No game files.

  • d3d12_state_map: passed (state map, enhanced barriers, subresource decoding, layout tracking, discard ranges, block formats, BAR detection and memory types OK).
  • d3d12_low_vram (ctest, verbose):
[rt] d3d12: low-VRAM survival mode ON (env; 16173 MiB VRAM, 2048 MiB reserved, budget=on, priority=on, pageable=on)
FAIL runtime\test\d3d12_low_vram_test.cpp:157: after.steered_allocations > 0
Device VRAM: 16173 MiB | low_vram_mode=0 (auto=0) | budget=1 priority=1 pageable=1 | reserve=0 MiB
Stress result (320 x 16 MiB = 5120 MiB spillable + 6 critical RT/DS):
  Spillable textures : 320 in VRAM, 0 steered/spilled to system RAM
  Critical RT/DS     : 6 in VRAM, 0 in system RAM
  Stats              : steered=0 (0 MiB), forced_spills=0 (0 MiB)

The 5120 MiB stress fits in 16 GB, so nothing is steered and the > 0 check fails. Note too that the stress run reports low_vram_mode=0 ... reserve=0 MiB, although the line above it turns the mode on with 2048 MiB reserved, so the stress device may not be the one the env enabled. Sizing the stress to the device's budget, or forcing a small budget for the test, would make it pass on large cards. Happy to rerun.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7141453650 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/443#issuecomment-7141453650). Originally posted by [Sangonapou](https://github.com/Sangonapou) on 2026-11-24T19:00:13Z. --- Tested ccffa86b on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, 16 GB), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300), native Windows: `d3d12_state_map` passes, **`d3d12_low_vram` fails** on this 16 GB card Built at this head with `scripts\build_runtime.ps1` (MSVC 19.51, VS Build Tools 2026, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0). No game files. - `d3d12_state_map`: passed (`state map, enhanced barriers, subresource decoding, layout tracking, discard ranges, block formats, BAR detection and memory types OK`). - `d3d12_low_vram` (ctest, verbose): ``` [rt] d3d12: low-VRAM survival mode ON (env; 16173 MiB VRAM, 2048 MiB reserved, budget=on, priority=on, pageable=on) FAIL runtime\test\d3d12_low_vram_test.cpp:157: after.steered_allocations > 0 Device VRAM: 16173 MiB | low_vram_mode=0 (auto=0) | budget=1 priority=1 pageable=1 | reserve=0 MiB Stress result (320 x 16 MiB = 5120 MiB spillable + 6 critical RT/DS): Spillable textures : 320 in VRAM, 0 steered/spilled to system RAM Critical RT/DS : 6 in VRAM, 0 in system RAM Stats : steered=0 (0 MiB), forced_spills=0 (0 MiB) ``` The 5120 MiB stress fits in 16 GB, so nothing is steered and the `> 0` check fails. Note too that the stress run reports `low_vram_mode=0 ... reserve=0 MiB`, although the line above it turns the mode on with 2048 MiB reserved, so the stress device may not be the one the env enabled. Sizing the stress to the device's budget, or forcing a small budget for the test, would make it pass on large cards. Happy to rerun.
jujumoneylol commented 2026-11-24 21:54:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by jujumoneylol on 2026-11-24T21:54:45Z.


Thanks for testing on a 16 GB RTX 3080 Ti and catching both issues, @Sangonapou!

Fixed in 08e18bdfc:

  1. Large-VRAM GPU test failure (d3d12_low_vram_test):

    • Previously, the >4.5 GiB re-create path only set LEONIDA_LOW_VRAM=1 and LEONIDA_VRAM_RESERVE_MB=2048 without a cap, leaving ~14 GiB of headroom on a 16 GB card so the 5,120 MiB stress loop never crossed the reserve.
    • It now sets LEONIDA_VRAM_CAP_MB=2048 + LEONIDA_VRAM_RESERVE_MB=512 and sizes the stress allocation to effective_budget + 512 MiB (2,560 MiB on capped large GPUs), so spillover is deterministically exercised on 8/16/24/32 GB cards while keeping all 6 critical RT/DS targets pinned in DEVICE_LOCAL VRAM.
    • Also flushes stdout and logs the re-created stress device's stats separately from the initial probe so low_vram_mode=0 and the stderr banner no longer interleave misleadingly.
  2. Environment-variable docs check (tests/test_docs_env_vars.py):

    • Documented LEONIDA_LOW_VRAM, LEONIDA_VRAM_RESERVE_MB, LEONIDA_VRAM_CAP_MB, LEONIDA_VRAM_LOG, and LEONIDA_RT_AS=off in docs/d3d12_vulkan.md (§4.8 and §4.10).

Re-verified on Windows 11 26200 / NVIDIA GTX 1650 (both uncapped 4 GB auto mode and LEONIDA_VRAM_CAP_MB=2048 mode), d3d12_state_map_test, tests/test_docs_env_vars.py (4/4), and scripts/check_no_game_data.py. Ready for a rerun on your 16 GB card!

AI-assisted fix and verification.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7145552400 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/443#issuecomment-7145552400). Originally posted by [jujumoneylol](https://github.com/jujumoneylol) on 2026-11-24T21:54:45Z. --- Thanks for testing on a 16 GB RTX 3080 Ti and catching both issues, @Sangonapou! Fixed in `08e18bdfc`: 1. **Large-VRAM GPU test failure (`d3d12_low_vram_test`):** - Previously, the >4.5 GiB re-create path only set `LEONIDA_LOW_VRAM=1` and `LEONIDA_VRAM_RESERVE_MB=2048` without a cap, leaving ~14 GiB of headroom on a 16 GB card so the 5,120 MiB stress loop never crossed the reserve. - It now sets `LEONIDA_VRAM_CAP_MB=2048` + `LEONIDA_VRAM_RESERVE_MB=512` and sizes the stress allocation to `effective_budget + 512 MiB` (2,560 MiB on capped large GPUs), so spillover is deterministically exercised on 8/16/24/32 GB cards while keeping all 6 critical RT/DS targets pinned in `DEVICE_LOCAL` VRAM. - Also flushes stdout and logs the re-created stress device's stats separately from the initial probe so `low_vram_mode=0` and the `stderr` banner no longer interleave misleadingly. 2. **Environment-variable docs check (`tests/test_docs_env_vars.py`):** - Documented `LEONIDA_LOW_VRAM`, `LEONIDA_VRAM_RESERVE_MB`, `LEONIDA_VRAM_CAP_MB`, `LEONIDA_VRAM_LOG`, and `LEONIDA_RT_AS=off` in `docs/d3d12_vulkan.md` (§4.8 and §4.10). Re-verified on Windows 11 26200 / NVIDIA GTX 1650 (both uncapped 4 GB auto mode and `LEONIDA_VRAM_CAP_MB=2048` mode), `d3d12_state_map_test`, `tests/test_docs_env_vars.py` (4/4), and `scripts/check_no_game_data.py`. Ready for a rerun on your 16 GB card! AI-assisted fix and verification.
jujumoneylol commented 2026-11-26 07:49:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by jujumoneylol on 2026-11-26T07:49:42Z.


Rebased onto main (a73a57e13) → head 922235029, resolving conflicts with main's VK_EXT_memory_budget HUD reader, dedicated_image / memory_mutex(), and robustness2 / device_fault setup.

Re-verified on Windows 11 / NVIDIA GeForce GTX 1650 (4 GB):

  • ctest: d3d12_low_vram, d3d12_vram_budget, d3d12_dxr_validation, d3d12_state_map all PASS (0 failed; d3d12_dxr_validation_khr skipped on non-RT GPU)
  • d3d12_low_vram_test with LEONIDA_VRAM_CAP_MB=2048 + LEONIDA_VRAM_RESERVE_MB=512: 6/6 critical RT/DS pinned in VRAM, 68 spillable allocations (1,088 MiB) steered to system RAM, 0 forced spills
  • tests/test_docs_env_vars.py (4/4) and scripts/check_no_game_data.py PASS
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7185878174 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/443#issuecomment-7185878174). Originally posted by [jujumoneylol](https://github.com/jujumoneylol) on 2026-11-26T07:49:42Z. --- Rebased onto `main` (`a73a57e13`) → head `922235029`, resolving conflicts with `main`'s `VK_EXT_memory_budget` HUD reader, `dedicated_image` / `memory_mutex()`, and `robustness2` / `device_fault` setup. Re-verified on Windows 11 / NVIDIA GeForce GTX 1650 (4 GB): - `ctest`: `d3d12_low_vram`, `d3d12_vram_budget`, `d3d12_dxr_validation`, `d3d12_state_map` all PASS (0 failed; `d3d12_dxr_validation_khr` skipped on non-RT GPU) - `d3d12_low_vram_test` with `LEONIDA_VRAM_CAP_MB=2048` + `LEONIDA_VRAM_RESERVE_MB=512`: 6/6 critical RT/DS pinned in VRAM, 68 spillable allocations (1,088 MiB) steered to system RAM, 0 forced spills - `tests/test_docs_env_vars.py` (4/4) and `scripts/check_no_game_data.py` PASS
ammonium231 commented 2026-11-26 09:24:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-26T09:24:35Z.


RTX 3090 / 621.40 (24322 MiB VRAM), validation on, this PR merged onto current main a73a57e13: d3d12_low_vram auto-steering stays off (low_vram_mode=0, auto=0, cap=0). With LEONIDA_LOW_VRAM=1 and a 2048 MiB cap the stress path passes (75 spillable in VRAM, 85 steered; 6/6 critical RT/DS pinned; LEONIDA_RT_AS=off ok). d3d12_state_map and d3d12_vram_budget also pass, 0 VUID.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7187940387 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/443#issuecomment-7187940387). Originally posted by [ammonium231](https://github.com/ammonium231) on 2026-11-26T09:24:35Z. --- RTX 3090 / 621.40 (24322 MiB VRAM), validation on, this PR merged onto current main a73a57e13: d3d12_low_vram auto-steering stays off (low_vram_mode=0, auto=0, cap=0). With LEONIDA_LOW_VRAM=1 and a 2048 MiB cap the stress path passes (75 spillable in VRAM, 85 steered; 6/6 critical RT/DS pinned; LEONIDA_RT_AS=off ok). d3d12_state_map and d3d12_vram_budget also pass, 0 VUID.
Tyrannys commented 2026-11-27 20:47:53 +00:00 (Migrated from github.com)

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


Profile M data point for #443's memory priority (VK_EXT_memory_priority + VK_EXT_pageable_device_local_memory) on a 12 GB card, A/B with one variable (#443 in or out). Counts only. AI-assisted (Claude Code).

RUN c3-G1b | 2026-11-27 | Tyrannys | AI-assisted: Claude Code
BASE:        2859d0c9b + #2233 #2275 #2418 #2440 #2020 #2166 #2432 #2224 #2179 #2228 #1851 #1882 #2260 #2267 #1592 (+ local test fix) + #443 (922235029) | shaders: library re-translated with w64-one-lane-fold, rest as before
MACHINE:     RTX 4070 SUPER 12 GB, desktop | NVIDIA 621.01 | Windows 11 | 64 GB
RECIPE:      OreoFR's world recipe (#1608, 2026-11-27 08:23) + DEVIATIONS: COMPILE_GATE=0 PIPELINE_PREWARM_ORDER=1 SHADOW_ALIAS_MS=1000 SKIP_COMPUTE=<1,009 ray-hit programs> RT_AS=off DEVICE_FAULT=1 TITLE_HUD=1 MEM_PROBE=60 FRAME_PACING=1 PRESENT_NO_TEAR=1 | precompile: yes, all library programs except the skip list (1,674; 0 failed)
OS/DRIVER:   TdrDelay=60
TARGET:      process shared GPU memory around world start; frames/s | PREDICTED: world reached ~600-900 s; shared flat vs control
MEASURED:    full 1,804 s, PresentX 2,753 ok / 0 failed, 3.58 M D3D12 calls, 12,639 submissions; no world frame (story loading screen to the end); 0.59 frames/s at the end
             world-start pipeline burst (HUD graphics PSOs 208 -> 707) at ~546 s
             process dedicated / shared (MiB, Windows GPU counters, means): 300 s..burst 9,084 / 1,219; burst+0..180 s 10,488 / 1,359; +180..240 s 10,596 / 1,615; +240 s..end 10,641 / 2,137 (max 2,233)
             largest 30 s rise in shared: +736 MiB (at 436 s, before the burst); shared grows in steps, no single jump at world start
             HUD after the burst: VRAM 10.1-11.5 GB used vs 10.7 GB budget
             3D engine mean: 6.1% (boot..300 s), 4.2%, 15.5%, 29.1%, 4.4% (phases as above); compute 0.0%, copy 0.2-0.5%
             submit phases t>=300 s (means, ms per submission): heaps 27.7, shadows 36.2, textures 31.0; 7.7 submissions/s
END:         time limit
CACHES:      warm (pipeline journal + session/heavy caches) | RUN 1 of 1
INSTRUMENTS: TITLE_HUD, MEM_PROBE=60, DEVICE_FAULT=1, Windows GPU performance counters every 10 s, gputaskman --json every 30 s
VERDICT:     prediction missed (no world frame)
RUN c3-G1b-ctl | 2026-11-27 | Tyrannys | AI-assisted: Claude Code
BASE:        same as c3-G1b without #443
MACHINE:     same
RECIPE:      same
OS/DRIVER:   same
TARGET:      same | PREDICTED: world reached ~600-900 s, shared jumps at world start
MEASURED:    914 s (see END), PresentX 2,767 ok / 0 failed, 1.99 M D3D12 calls; no world frame (story loading screen)
             world-start pipeline burst (HUD graphics PSOs 210 -> 642) at ~298 s
             process dedicated / shared (MiB, means): burst+0..180 s 9,250 / 3,438; +180..240 s 9,431 / 3,440; +240 s..end 10,293 / 3,434 (max 3,442)
             largest 30 s rise in shared: +2,564 MiB at 261 s, at the burst, then flat at ~3.4 GiB
             HUD after the burst: VRAM 10.3-12.3 GB used vs 10.2-10.7 GB budget
             3D engine mean: 11.6% (boot..300 s), 6.6%, 18.1%, 16.7%; compute 0.0%, copy 0.2-0.9%
             submit phases t>=300 s (means, ms per submission): heaps 37.3, shadows 19.3, textures 40.1; 5.3 submissions/s
END:         process exit code 1 at 914 s with no fault, no device loss, no crash report; the cause is not in the log
CACHES:      warm, same as c3-G1b plus its writes | RUN 1 of 1
INSTRUMENTS: same as c3-G1b
VERDICT:     prediction held for the shared jump, missed for the world
RUN c3-G1c | 2026-11-27 | Tyrannys | AI-assisted: Claude Code
BASE:        same as c3-G1b (with #443); local DirectStorage predictor profile regenerated after 2a491668a (BC7 endpoint fields 4,228 -> 4,406 of 6,144)
MACHINE:     same
RECIPE:      same as c3-G1b
OS/DRIVER:   same
TARGET:      process shared GPU memory; DirectStorage decompression errors | PREDICTED: shared stays below the control as in c3-G1b; 0 decompression errors
MEASURED:    full 1,803 s, PresentX 4,104 ok / 0 failed, 6.25 M D3D12 calls; 0 decompression errors (c3-G1b 8, c3-G1b-ctl 7); past the story load into the opening sequence at ~840-900 s
             world-start pipeline burst at ~360 s
             process dedicated / shared (MiB, means): 0..300 s 2,898 / 2,654 (shared 2,730 already at 102 s); burst+0..180 s 9,043 / 3,105; +180..240 s 9,464 / 3,105; +240 s..end 9,957 / 3,091 (max 3,113)
             one 15 s GPU stall at ~850 s on an upscaler dispatch batch ("device-stall" diagnostic), recovered, no device loss
             after 900 s: 0.22 frames/s, 5.5 submissions/s; ms per submission: heaps 16.0, shadows 12.2, textures 474.6
             3D engine mean: 9.9%, 20.3%, 6.4%, 17.0%, 25.8% (phases as above); compute 0.0%, copy 0.2-0.9%
END:         time limit
CACHES:      warm, after c3-G1b and c3-G1b-ctl | RUN 1 of 1
INSTRUMENTS: same as c3-G1b
VERDICT:     prediction missed for shared memory (about the control's level), held for the decompression errors

Reading (n=1 per arm, PROVISIONAL): no shared-memory effect of #443 shows on this 12 GB card. With #443, c3-G1b stayed at ~1.2-2.2 GiB shared but c3-G1c went to ~3.1 GiB, close to the control's ~3.4 GiB; dedicated use was about 10 GiB in all three. The control's end (exit code 1 at 914 s, no fault, no device loss, no crash report) is not explained; it was not a manual close. None of the runs reached gameplay frames, so the frame-rate effect quartz-heron-58 measured is not tested here.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7227849302 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/443#issuecomment-7227849302). Originally posted by [Tyrannys](https://github.com/Tyrannys) on 2026-11-27T20:47:53Z. --- Profile M data point for #443's memory priority (`VK_EXT_memory_priority` + `VK_EXT_pageable_device_local_memory`) on a 12 GB card, A/B with one variable (#443 in or out). Counts only. AI-assisted (Claude Code). ``` RUN c3-G1b | 2026-11-27 | Tyrannys | AI-assisted: Claude Code BASE: 2859d0c9b + #2233 #2275 #2418 #2440 #2020 #2166 #2432 #2224 #2179 #2228 #1851 #1882 #2260 #2267 #1592 (+ local test fix) + #443 (922235029) | shaders: library re-translated with w64-one-lane-fold, rest as before MACHINE: RTX 4070 SUPER 12 GB, desktop | NVIDIA 621.01 | Windows 11 | 64 GB RECIPE: OreoFR's world recipe (#1608, 2026-11-27 08:23) + DEVIATIONS: COMPILE_GATE=0 PIPELINE_PREWARM_ORDER=1 SHADOW_ALIAS_MS=1000 SKIP_COMPUTE=<1,009 ray-hit programs> RT_AS=off DEVICE_FAULT=1 TITLE_HUD=1 MEM_PROBE=60 FRAME_PACING=1 PRESENT_NO_TEAR=1 | precompile: yes, all library programs except the skip list (1,674; 0 failed) OS/DRIVER: TdrDelay=60 TARGET: process shared GPU memory around world start; frames/s | PREDICTED: world reached ~600-900 s; shared flat vs control MEASURED: full 1,804 s, PresentX 2,753 ok / 0 failed, 3.58 M D3D12 calls, 12,639 submissions; no world frame (story loading screen to the end); 0.59 frames/s at the end world-start pipeline burst (HUD graphics PSOs 208 -> 707) at ~546 s process dedicated / shared (MiB, Windows GPU counters, means): 300 s..burst 9,084 / 1,219; burst+0..180 s 10,488 / 1,359; +180..240 s 10,596 / 1,615; +240 s..end 10,641 / 2,137 (max 2,233) largest 30 s rise in shared: +736 MiB (at 436 s, before the burst); shared grows in steps, no single jump at world start HUD after the burst: VRAM 10.1-11.5 GB used vs 10.7 GB budget 3D engine mean: 6.1% (boot..300 s), 4.2%, 15.5%, 29.1%, 4.4% (phases as above); compute 0.0%, copy 0.2-0.5% submit phases t>=300 s (means, ms per submission): heaps 27.7, shadows 36.2, textures 31.0; 7.7 submissions/s END: time limit CACHES: warm (pipeline journal + session/heavy caches) | RUN 1 of 1 INSTRUMENTS: TITLE_HUD, MEM_PROBE=60, DEVICE_FAULT=1, Windows GPU performance counters every 10 s, gputaskman --json every 30 s VERDICT: prediction missed (no world frame) ``` ``` RUN c3-G1b-ctl | 2026-11-27 | Tyrannys | AI-assisted: Claude Code BASE: same as c3-G1b without #443 MACHINE: same RECIPE: same OS/DRIVER: same TARGET: same | PREDICTED: world reached ~600-900 s, shared jumps at world start MEASURED: 914 s (see END), PresentX 2,767 ok / 0 failed, 1.99 M D3D12 calls; no world frame (story loading screen) world-start pipeline burst (HUD graphics PSOs 210 -> 642) at ~298 s process dedicated / shared (MiB, means): burst+0..180 s 9,250 / 3,438; +180..240 s 9,431 / 3,440; +240 s..end 10,293 / 3,434 (max 3,442) largest 30 s rise in shared: +2,564 MiB at 261 s, at the burst, then flat at ~3.4 GiB HUD after the burst: VRAM 10.3-12.3 GB used vs 10.2-10.7 GB budget 3D engine mean: 11.6% (boot..300 s), 6.6%, 18.1%, 16.7%; compute 0.0%, copy 0.2-0.9% submit phases t>=300 s (means, ms per submission): heaps 37.3, shadows 19.3, textures 40.1; 5.3 submissions/s END: process exit code 1 at 914 s with no fault, no device loss, no crash report; the cause is not in the log CACHES: warm, same as c3-G1b plus its writes | RUN 1 of 1 INSTRUMENTS: same as c3-G1b VERDICT: prediction held for the shared jump, missed for the world ``` ``` RUN c3-G1c | 2026-11-27 | Tyrannys | AI-assisted: Claude Code BASE: same as c3-G1b (with #443); local DirectStorage predictor profile regenerated after 2a491668a (BC7 endpoint fields 4,228 -> 4,406 of 6,144) MACHINE: same RECIPE: same as c3-G1b OS/DRIVER: same TARGET: process shared GPU memory; DirectStorage decompression errors | PREDICTED: shared stays below the control as in c3-G1b; 0 decompression errors MEASURED: full 1,803 s, PresentX 4,104 ok / 0 failed, 6.25 M D3D12 calls; 0 decompression errors (c3-G1b 8, c3-G1b-ctl 7); past the story load into the opening sequence at ~840-900 s world-start pipeline burst at ~360 s process dedicated / shared (MiB, means): 0..300 s 2,898 / 2,654 (shared 2,730 already at 102 s); burst+0..180 s 9,043 / 3,105; +180..240 s 9,464 / 3,105; +240 s..end 9,957 / 3,091 (max 3,113) one 15 s GPU stall at ~850 s on an upscaler dispatch batch ("device-stall" diagnostic), recovered, no device loss after 900 s: 0.22 frames/s, 5.5 submissions/s; ms per submission: heaps 16.0, shadows 12.2, textures 474.6 3D engine mean: 9.9%, 20.3%, 6.4%, 17.0%, 25.8% (phases as above); compute 0.0%, copy 0.2-0.9% END: time limit CACHES: warm, after c3-G1b and c3-G1b-ctl | RUN 1 of 1 INSTRUMENTS: same as c3-G1b VERDICT: prediction missed for shared memory (about the control's level), held for the decompression errors ``` Reading (n=1 per arm, PROVISIONAL): no shared-memory effect of #443 shows on this 12 GB card. With #443, c3-G1b stayed at ~1.2-2.2 GiB shared but c3-G1c went to ~3.1 GiB, close to the control's ~3.4 GiB; dedicated use was about 10 GiB in all three. The control's end (exit code 1 at 914 s, no fault, no device loss, no crash report) is not explained; it was not a manual close. None of the runs reached gameplay frames, so the frame-rate effect quartz-heron-58 measured is not tested here.
enlight3d commented 2026-11-29 09:05:22 +00:00 (Migrated from github.com)

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


RUN of #443 (red/green, GPU box, merged build)

Heads: PR head 922235029ad2, main 54b2a81e95c4. Tested as main + PR head (git merge --no-ff, local only): merged cleanly, no conflicts.

Commands (VS 2022 x64 environment, from the worktree root):
cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON
cmake --build runtime/build -j 8 --target d3d12_state_map_test d3d12_low_vram_test d3d12_vulkan_device_test gta6rt
ctest -R "^(d3d12_state_map|d3d12_low_vram)$" --output-on-failure -j1
Also run, because the PR changes the allocation paths it uses: ctest -R "^d3d12_vulkan_device$" -j1

  • Red 1, API (d3d12_com.h, d3d12_vulkan_device.cpp, vulkan_memory.h reverted to main's; tests and CMake registration kept): build failures only, max_device_local_heap_bytes not found (d3d12_state_map_test) and rt::d3d12::device_vram_stats not a member (d3d12_low_vram_test). That only shows the new API is needed.
  • Red 2, behavioural (reverting only d3d12_vulkan_device.cpp does not link, because device_vram_stats lives there, so I kept the whole PR and made one hand edit to disable the steering: the budget is never passed to the placement order in allocate(), and allocate_image() acts as if no budget were available): d3d12_low_vram fails at d3d12_low_vram_test.cpp:173, after.steered_allocations > 0; all 160 spillable textures stay in VRAM and none is steered (the critical 6 stay in VRAM too). That is a mutation of mine, not a revert of the PR.
  • Green, merged: d3d12_state_map Passed, d3d12_low_vram Passed (ALL CHECKS PASSED: with the mode forced on and a 2048 MiB cap, 75 of 160 spillable 16 MiB textures stay in VRAM and 85 are steered to system memory, 0 forced spills, 6 of 6 critical RT/DS in VRAM; the LEONIDA_RT_AS=off checks pass), d3d12_vulkan_device Passed. None skipped.
  • Limit: this card has 24 GiB, so the automatic detection (a discrete GPU with 4.5 GiB or less) is not exercised: the first device in the test reports low_vram_mode=0, and the stress device forces it with LEONIDA_LOW_VRAM=on plus a cap. The 4 GB behaviour reported in the PR is not something I could reproduce.
  • Link: no new imports vs main (dumpbin /imports of gta6rt.exe, DLL!symbol, sorted: 700 entries on main and on main + PR, identical).

Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44 (VS 2022 Build Tools), CMake + Ninja, RelWithDebInfo, -DLEONIDA_REQUIRE_VULKAN=ON, Vulkan SDK 1.4.363.1.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7253528589 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/443#issuecomment-7253528589). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T09:05:22Z. --- RUN of #443 (red/green, GPU box, merged build) Heads: PR head `922235029ad2`, main `54b2a81e95c4`. Tested as main + PR head (`git merge --no-ff`, local only): merged cleanly, no conflicts. Commands (VS 2022 x64 environment, from the worktree root): `cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON` `cmake --build runtime/build -j 8 --target d3d12_state_map_test d3d12_low_vram_test d3d12_vulkan_device_test gta6rt` `ctest -R "^(d3d12_state_map|d3d12_low_vram)$" --output-on-failure -j1` Also run, because the PR changes the allocation paths it uses: `ctest -R "^d3d12_vulkan_device$" -j1` - Red 1, API (`d3d12_com.h`, `d3d12_vulkan_device.cpp`, `vulkan_memory.h` reverted to main's; tests and CMake registration kept): build failures only, `max_device_local_heap_bytes` not found (`d3d12_state_map_test`) and `rt::d3d12::device_vram_stats` not a member (`d3d12_low_vram_test`). That only shows the new API is needed. - Red 2, behavioural (reverting only `d3d12_vulkan_device.cpp` does not link, because `device_vram_stats` lives there, so I kept the whole PR and made one hand edit to disable the steering: the budget is never passed to the placement order in `allocate()`, and `allocate_image()` acts as if no budget were available): `d3d12_low_vram` fails at `d3d12_low_vram_test.cpp:173`, `after.steered_allocations > 0`; all 160 spillable textures stay in VRAM and none is steered (the critical 6 stay in VRAM too). That is a mutation of mine, not a revert of the PR. - Green, merged: `d3d12_state_map` Passed, `d3d12_low_vram` Passed (ALL CHECKS PASSED: with the mode forced on and a 2048 MiB cap, 75 of 160 spillable 16 MiB textures stay in VRAM and 85 are steered to system memory, 0 forced spills, 6 of 6 critical RT/DS in VRAM; the `LEONIDA_RT_AS=off` checks pass), `d3d12_vulkan_device` Passed. None skipped. - Limit: this card has 24 GiB, so the automatic detection (a discrete GPU with 4.5 GiB or less) is not exercised: the first device in the test reports `low_vram_mode=0`, and the stress device forces it with `LEONIDA_LOW_VRAM=on` plus a cap. The 4 GB behaviour reported in the PR is not something I could reproduce. - Link: no new imports vs main (`dumpbin /imports` of `gta6rt.exe`, DLL!symbol, sorted: 700 entries on main and on main + PR, identical). Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44 (VS 2022 Build Tools), CMake + Ninja, RelWithDebInfo, `-DLEONIDA_REQUIRE_VULKAN=ON`, Vulkan SDK 1.4.363.1.
aslan2142 commented 2026-12-01 16:30:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:30:32Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317722802 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/443#issuecomment-7317722802). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:30:32Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

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!443
No description provided.