d3d12: decline file-backed/multi-VMA host imports under Wine and deduplicate import memory types (RT-WINE-HOST-IMPORT-POLICY) #2126

Closed
djrolfes wants to merge 1 commit from upstream-pr/2126 into main
djrolfes commented 2026-11-25 21:43:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-11-25T21:43:46Z.


Claimed in the coordination issue as: RT-WINE-HOST-IMPORT-POLICY (#1608)

What and why

Under Wine on Linux, nvidia.ko rejects long-term pinning (pin_user_pages / FOLL_LONGTERM) of file-backed MAP_SHARED views (such as the sparse temp files created under LEONIDA_XMEM_BACKING_DIR) with kernel Cannot map memory with base addr ... errors and also rejects host-pointer imports spanning multiple VMAs. As d3d12_vulkan_device.cpp notes, bursts of those kernel rejections on NVIDIA 620.73 under Wine coincide with spurious VK_ERROR_OUT_OF_HOST_MEMORY (-1) responses on concurrent normal vkAllocateMemory calls, causing E_OUTOFMEMORY (0x8007000e) resource-creation failures even with gigabytes of VRAM and RAM free.

This change fixes four related issues in the host-import path without altering native Windows host-import eligibility or anonymous pagefile section imports (the four runtime-path invariants below — post-hold TOCTOU re-check, memory_mutex() around import vkAllocateMemory, single-pass memory-type deduplication, and stopping early on VK_ERROR_INVALID_EXTERNAL_HANDLE — apply on native Windows as well as Wine):

  1. Adds portable runtime/src/host_import_policy.h (HostImportRangeCheck and host_import_memory_types) and CPU unit test runtime/test/host_import_policy_test.cpp:
    • Under Wine (ntdll!wine_get_version), declines MEM_MAPPED regions backed by a named file (K32GetMappedFileNameW > 0) and ranges spanning multiple AllocationBase values before calling Vulkan, while keeping anonymous VirtualAlloc (MEM_PRIVATE) and anonymous pagefile sections (CreateFileMappingW(INVALID_HANDLE_VALUE, ...)) importable.
    • Deduplicates Vulkan memory types across the preferred (HOST_VISIBLE | HOST_COHERENT) and fallback passes so a failing import never probes the same memory type twice.
  2. Re-verifies host_range_importable after leonida::kernel_writes::hold in create_host_buffer and import_console_heap (closing the TOCTOU window between the writability check and the pin) and stops probing further memory types on VK_ERROR_INVALID_EXTERNAL_HANDLE.
  3. Holds DeviceState::memory_mutex() consistently around vkAllocateMemory in import_console_heap, OpenExistingHeapFromAddress, and the ImageMemory block allocator (matching DeviceState::memory_mutex()'s documented invariant).
  4. Adds a synthetic sparse disk-file-backed section view regression case to runtime/test/d3d12_existing_heap_test.cpp verifying shadow fallback without host import under Wine.

Opened as a draft because prior pull requests are currently open (one-open-PR limit).

Tested

  • python3 -I scripts/check_no_game_data.py on all 5 touched/added files: passed.
  • Portable native CTest (runtime/build/native, Linux / Clang 23.1.5): 100/100 passed (98 passed, 2 conditional skips: shader_library_corpus, vk_sync_validation), including new host_import_policy.
  • Synthetic Windows/Wine tests (clang-cl + xwin, Wine, network-isolated, no retail files):
    • host_import_policy_test: passed
    • d3d12_console_descriptor_heap_test: passed
    • d3d12_xmem_placed_test: passed
    • d3d12_existing_heap_test (including new sparse disk-file-backed section case): passed, 0 kernel Cannot map memory errors.
  • Offline --first-run-ui A/B check (no input, 300 s bounded, read-only package/shaders/BCPack predictor, network-isolated, counts/timings only):
    • Clean main (490f5b9ec): exit 126 at 28.42 s (slot 133 depth texture refused, hr=0x8007000e), 16 kernel Cannot map memory errors across 7 MEM_MAPPED addresses, 2 vkAllocateMemory failed (-1), 347 PresentX ok.
    • This branch (f5bc25cdc + fix): ran full 300.88 s time limit (exit 124), 0 kernel Cannot map memory errors, 0 vkAllocateMemory failed (-1), 0 depth-texture refusals, 7,990 PresentX ok, 200 MEM_PRIVATE slot-133 imports succeeded. Rebased cleanly onto 1fe5072af and re-verified host_import_policy_test + d3d12_existing_heap_test.

GPUs tested: NVIDIA GeForce RTX 3070 Ti (8 GB), driver 620.73.04, Linux (Arch/Omarchy) under Wine.

AI-assisted: yes.

Checklist

  • Based on current main (1fe5072af) and merges cleanly.
  • 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: runtime-only change)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5499681021 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2126). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-11-25T21:43:46Z. --- Claimed in the coordination issue as: RT-WINE-HOST-IMPORT-POLICY (#1608) ### What and why Under Wine on Linux, `nvidia.ko` rejects long-term pinning (`pin_user_pages` / `FOLL_LONGTERM`) of file-backed `MAP_SHARED` views (such as the sparse temp files created under `LEONIDA_XMEM_BACKING_DIR`) with kernel `Cannot map memory with base addr ...` errors and also rejects host-pointer imports spanning multiple VMAs. As `d3d12_vulkan_device.cpp` notes, bursts of those kernel rejections on NVIDIA 620.73 under Wine coincide with spurious `VK_ERROR_OUT_OF_HOST_MEMORY` (`-1`) responses on concurrent normal `vkAllocateMemory` calls, causing `E_OUTOFMEMORY` (`0x8007000e`) resource-creation failures even with gigabytes of VRAM and RAM free. This change fixes four related issues in the host-import path without altering native Windows host-import eligibility or anonymous pagefile section imports (the four runtime-path invariants below — post-`hold` TOCTOU re-check, `memory_mutex()` around import `vkAllocateMemory`, single-pass memory-type deduplication, and stopping early on `VK_ERROR_INVALID_EXTERNAL_HANDLE` — apply on native Windows as well as Wine): 1. Adds portable `runtime/src/host_import_policy.h` (`HostImportRangeCheck` and `host_import_memory_types`) and CPU unit test `runtime/test/host_import_policy_test.cpp`: - Under Wine (`ntdll!wine_get_version`), declines `MEM_MAPPED` regions backed by a named file (`K32GetMappedFileNameW > 0`) and ranges spanning multiple `AllocationBase` values before calling Vulkan, while keeping anonymous `VirtualAlloc` (`MEM_PRIVATE`) and anonymous pagefile sections (`CreateFileMappingW(INVALID_HANDLE_VALUE, ...)`) importable. - Deduplicates Vulkan memory types across the preferred (`HOST_VISIBLE | HOST_COHERENT`) and fallback passes so a failing import never probes the same memory type twice. 2. Re-verifies `host_range_importable` after `leonida::kernel_writes::hold` in `create_host_buffer` and `import_console_heap` (closing the TOCTOU window between the writability check and the pin) and stops probing further memory types on `VK_ERROR_INVALID_EXTERNAL_HANDLE`. 3. Holds `DeviceState::memory_mutex()` consistently around `vkAllocateMemory` in `import_console_heap`, `OpenExistingHeapFromAddress`, and the `ImageMemory` block allocator (matching `DeviceState::memory_mutex()`'s documented invariant). 4. Adds a synthetic sparse disk-file-backed section view regression case to `runtime/test/d3d12_existing_heap_test.cpp` verifying shadow fallback without host import under Wine. Opened as a draft because prior pull requests are currently open (one-open-PR limit). ### Tested - `python3 -I scripts/check_no_game_data.py` on all 5 touched/added files: passed. - Portable native CTest (`runtime/build/native`, Linux / Clang 23.1.5): **100/100 passed** (98 passed, 2 conditional skips: `shader_library_corpus`, `vk_sync_validation`), including new `host_import_policy`. - Synthetic Windows/Wine tests (`clang-cl` + `xwin`, Wine, network-isolated, no retail files): - `host_import_policy_test`: passed - `d3d12_console_descriptor_heap_test`: passed - `d3d12_xmem_placed_test`: passed - `d3d12_existing_heap_test` (including new sparse disk-file-backed section case): passed, **0** kernel `Cannot map memory` errors. - Offline `--first-run-ui` A/B check (no input, 300 s bounded, read-only package/shaders/BCPack predictor, network-isolated, counts/timings only): - Clean `main` (`490f5b9ec`): exit 126 at 28.42 s (`slot 133 depth texture refused`, `hr=0x8007000e`), 16 kernel `Cannot map memory` errors across 7 `MEM_MAPPED` addresses, 2 `vkAllocateMemory failed (-1)`, 347 `PresentX ok`. - This branch (`f5bc25cdc` + fix): ran full 300.88 s time limit (exit 124), **0** kernel `Cannot map memory` errors, **0** `vkAllocateMemory failed (-1)`, **0** depth-texture refusals, **7,990** `PresentX ok`, 200 `MEM_PRIVATE` slot-133 imports succeeded. Rebased cleanly onto `1fe5072af` and re-verified `host_import_policy_test` + `d3d12_existing_heap_test`. GPUs tested: NVIDIA GeForce RTX 3070 Ti (8 GB), driver 620.73.04, Linux (Arch/Omarchy) under Wine. AI-assisted: yes. ### Checklist - [x] Based on current `main` (`1fe5072af`) and merges cleanly. - [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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: runtime-only change)
qhukz13 commented 2026-11-26 00:32:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-26T00:32:10Z.


Review at 1431ac4fb: code reading and the policy test (Linux). My Windows test PC is down right now, so no native run in this comment; I can add one on a GTX 1050 Ti / Windows 10 later.

  • The import rules are unchanged outside Wine, as the description says: HostImportRangeCheck with wine == false still requires a committed, writable page without PAGE_WRITECOMBINE | PAGE_NOCACHE | PAGE_GUARD, which is what the removed loops in create_host_buffer / import_console_heap checked. The file-backed and multi-AllocationBase refusals only apply under Wine (wine_get_version).
  • Four things do change on native Windows too, so "without altering native Windows behavior" is a little broad; all four look harmless to me, but worth naming:
    1. the range is checked again after kernel_writes::hold (closes the TOCTOU, as described);
    2. memory_mutex() is now held around the import vkAllocateMemory calls (the invariant its comment states; no caller of these paths holds it already, so no self-deadlock on the plain std::mutex);
    3. a memory type is probed once, not once per pass;
    4. the probe stops at VK_ERROR_INVALID_EXTERNAL_HANDLE. That one I agree with: the error says the pointer is not importable for the handle type, which another memory type does not change.
  • host_import_policy_test builds with plain g++ 20 on Linux (-fsanitize=address,undefined) and passes. It catches both Wine rules: with if (region.mapped_file) return false; removed it fails, and so it does with the allocation_base comparison removed.

The branch merges into current main without conflicts (134 commits behind).

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7178857330 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2126#issuecomment-7178857330). Originally posted by [qhukz13](https://github.com/qhukz13) on 2026-11-26T00:32:10Z. --- Review at `1431ac4fb`: code reading and the policy test (Linux). My Windows test PC is down right now, so no native run in this comment; I can add one on a GTX 1050 Ti / Windows 10 later. - **The import rules are unchanged outside Wine,** as the description says: `HostImportRangeCheck` with `wine == false` still requires a committed, writable page without `PAGE_WRITECOMBINE | PAGE_NOCACHE | PAGE_GUARD`, which is what the removed loops in `create_host_buffer` / `import_console_heap` checked. The file-backed and multi-`AllocationBase` refusals only apply under Wine (`wine_get_version`). - **Four things do change on native Windows too,** so "without altering native Windows behavior" is a little broad; all four look harmless to me, but worth naming: 1. the range is checked again after `kernel_writes::hold` (closes the TOCTOU, as described); 2. `memory_mutex()` is now held around the import `vkAllocateMemory` calls (the invariant its comment states; no caller of these paths holds it already, so no self-deadlock on the plain `std::mutex`); 3. a memory type is probed once, not once per pass; 4. the probe stops at `VK_ERROR_INVALID_EXTERNAL_HANDLE`. That one I agree with: the error says the pointer is not importable for the handle type, which another memory type does not change. - **`host_import_policy_test`** builds with plain g++ 20 on Linux (`-fsanitize=address,undefined`) and passes. It catches both Wine rules: with `if (region.mapped_file) return false;` removed it fails, and so it does with the `allocation_base` comparison removed. The branch merges into current main without conflicts (134 commits behind). AI-assisted (Claude Code).
djrolfes commented 2026-11-26 02:05:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-11-26T02:05:06Z.


Thanks @qhukz13 for the review at 1431ac4fb and for checking host_import_policy_test under ASan/UBSan!

Verified all four scope notes against 1431ac4fb by code inspection (and left 1431ac4fb unchanged so existing Wine/retail/Linux reviews remain valid; git merge-tree --write-tree origin/main HEAD is still clean with no conflicts):

  1. Post-hold TOCTOU re-check: host_range_importable runs again after leonida::kernel_writes::hold in both DeviceState::import_console_heap and Resource::create_host_buffer regardless of running_under_wine().
  2. DeviceState::memory_mutex() around vkAllocateMemory: Held strictly around vkAllocateMemory in DeviceState::import_console_heap, Resource::create_host_buffer, Device::OpenExistingHeapFromAddress, and the state_.image_memory block-allocator callback. Auditing all callers (add_console_heap / DescriptorHeap, create_at_host_address / make_title_buffer, OpenExistingHeapFromAddress, and allocate_image / ImageMemoryPool::allocate) confirms none already hold memory_mutex() on entry and none of the critical sections call back into any other mutex or runtime function, so self-deadlock or lock-order inversion cannot occur.
  3. Single-pass memory-type deduplication: host_import_types_for / leonida::host_import_memory_types probes each allowed memory type at most once across the preferred and fallback passes on all platforms.
  4. Early stop on VK_ERROR_INVALID_EXTERNAL_HANDLE: Applied in import_console_heap, create_host_buffer, and OpenExistingHeapFromAddress.

Updated the PR description accordingly to clarify "without altering native Windows host-import eligibility" and explicitly name those four cross-platform runtime-path invariants.

CPU-only verification re-run in this follow-up (no Windows, Wine, GPU, or game-data run):

  • python3 -I scripts/check_no_game_data.py on all 5 touched/added files: passed.
  • cmake -S runtime -B runtime/build && cmake --build runtime/build --target host_import_policy_test --config RelWithDebInfo -j 2 && ctest --test-dir runtime/build -R '^host_import_policy$' --output-on-failure -j 2 (Linux / GCC 16.2.1): 1/1 passed.
  • g++ -std=c++20 -O2 -Wall -Wextra -Werror -fsanitize=address,undefined runtime/test/host_import_policy_test.cpp: passed (ok).

AI-assisted: yes; no game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7180442948 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2126#issuecomment-7180442948). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-11-26T02:05:06Z. --- Thanks @qhukz13 for the review at `1431ac4fb` and for checking `host_import_policy_test` under ASan/UBSan! Verified all four scope notes against `1431ac4fb` by code inspection (and left `1431ac4fb` unchanged so existing Wine/retail/Linux reviews remain valid; `git merge-tree --write-tree origin/main HEAD` is still clean with no conflicts): 1. **Post-`hold` TOCTOU re-check:** `host_range_importable` runs again after `leonida::kernel_writes::hold` in both `DeviceState::import_console_heap` and `Resource::create_host_buffer` regardless of `running_under_wine()`. 2. **`DeviceState::memory_mutex()` around `vkAllocateMemory`:** Held strictly around `vkAllocateMemory` in `DeviceState::import_console_heap`, `Resource::create_host_buffer`, `Device::OpenExistingHeapFromAddress`, and the `state_.image_memory` block-allocator callback. Auditing all callers (`add_console_heap` / `DescriptorHeap`, `create_at_host_address` / `make_title_buffer`, `OpenExistingHeapFromAddress`, and `allocate_image` / `ImageMemoryPool::allocate`) confirms none already hold `memory_mutex()` on entry and none of the critical sections call back into any other mutex or runtime function, so self-deadlock or lock-order inversion cannot occur. 3. **Single-pass memory-type deduplication:** `host_import_types_for` / `leonida::host_import_memory_types` probes each allowed memory type at most once across the preferred and fallback passes on all platforms. 4. **Early stop on `VK_ERROR_INVALID_EXTERNAL_HANDLE`:** Applied in `import_console_heap`, `create_host_buffer`, and `OpenExistingHeapFromAddress`. Updated the PR description accordingly to clarify `"without altering native Windows host-import eligibility"` and explicitly name those four cross-platform runtime-path invariants. CPU-only verification re-run in this follow-up (no Windows, Wine, GPU, or game-data run): - `python3 -I scripts/check_no_game_data.py` on all 5 touched/added files: passed. - `cmake -S runtime -B runtime/build && cmake --build runtime/build --target host_import_policy_test --config RelWithDebInfo -j 2 && ctest --test-dir runtime/build -R '^host_import_policy$' --output-on-failure -j 2` (Linux / GCC 16.2.1): 1/1 passed. - `g++ -std=c++20 -O2 -Wall -Wextra -Werror -fsanitize=address,undefined runtime/test/host_import_policy_test.cpp`: passed (`ok`). AI-assisted: yes; no game data.
djrolfes commented 2026-11-27 15:09:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-11-27T15:09:41Z.


Rebased onto origin/main (ec91d695c): 1431ac4fb → 822d8b0b4.

Conflict resolution (runtime/shims/d3d12_vulkan_device.cpp):

  • In the state_.image_memory block-allocator lambda, kept both origin/main's leonida::memory_breakdown::Owner owner(leonida::memory_breakdown::Consumer::image_blocks); scope and this PR's std::lock_guard serial(DeviceState::memory_mutex()); around vkAllocateMemory. All other hunks (host_range_importable, host_import_types_for, import_console_heap, create_host_buffer, OpenExistingHeapFromAddress, runtime/CMakeLists.txt, and runtime/test/d3d12_existing_heap_test.cpp) applied cleanly with no behavioral changes from 1431ac4fb.

CPU-only portable verification (Linux, GCC 16.2.1; no Windows/Wine/GPU/game-data run):

  • python3 -I scripts/check_no_game_data.py on all 5 touched/added files: passed.
  • python3 -m compileall -q make_game.py tools tests: passed.
  • cmake -S runtime -B runtime/build -DCMAKE_BUILD_TYPE=RelWithDebInfo && cmake --build runtime/build --target host_import_policy_test image_memory_test memory_breakdown_test --config RelWithDebInfo -j 4 && ctest --test-dir runtime/build -R '^(host_import_policy|image_memory|memory_breakdown)$' --output-on-failure -j 4: 3/3 passed.
  • g++ -std=c++20 -O2 -Wall -Wextra -Werror -fsanitize=address,undefined runtime/test/host_import_policy_test.cpp: passed (ok).
  • git merge-tree --write-tree origin/main HEAD: clean.

AI-assisted: yes (rebased with Gemini); no game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7221702891 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2126#issuecomment-7221702891). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-11-27T15:09:41Z. --- Rebased onto `origin/main` (`ec91d695c`): `1431ac4fb` → `822d8b0b4`. **Conflict resolution (`runtime/shims/d3d12_vulkan_device.cpp`):** - In the `state_.image_memory` block-allocator lambda, kept both `origin/main`'s `leonida::memory_breakdown::Owner owner(leonida::memory_breakdown::Consumer::image_blocks);` scope and this PR's `std::lock_guard serial(DeviceState::memory_mutex());` around `vkAllocateMemory`. All other hunks (`host_range_importable`, `host_import_types_for`, `import_console_heap`, `create_host_buffer`, `OpenExistingHeapFromAddress`, `runtime/CMakeLists.txt`, and `runtime/test/d3d12_existing_heap_test.cpp`) applied cleanly with no behavioral changes from `1431ac4fb`. **CPU-only portable verification (Linux, GCC 16.2.1; no Windows/Wine/GPU/game-data run):** - `python3 -I scripts/check_no_game_data.py` on all 5 touched/added files: passed. - `python3 -m compileall -q make_game.py tools tests`: passed. - `cmake -S runtime -B runtime/build -DCMAKE_BUILD_TYPE=RelWithDebInfo && cmake --build runtime/build --target host_import_policy_test image_memory_test memory_breakdown_test --config RelWithDebInfo -j 4 && ctest --test-dir runtime/build -R '^(host_import_policy|image_memory|memory_breakdown)$' --output-on-failure -j 4`: 3/3 passed. - `g++ -std=c++20 -O2 -Wall -Wextra -Werror -fsanitize=address,undefined runtime/test/host_import_policy_test.cpp`: passed (`ok`). - `git merge-tree --write-tree origin/main HEAD`: clean. AI-assisted: yes (rebased with Gemini); no game data.
djrolfes commented 2026-11-27 19:33:29 +00:00 (Migrated from github.com)

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


Fresh cold-cache A/B game-run check on current main (43a9d562d) with --first-run-ui (LEONIDA_XMEM_BACKING_DIR enabled) on Linux + Wine 11.22 + NVIDIA RTX 3070 Ti 8 GB (Profile M), in #2464 RUN-block format. All numbers independently recomputed from raw logs and resource samples by a second agent (codex / gpt-6-luna) before posting. PROVISIONAL (n=1 cold per side; plus a second warm clean-main reproduction at 24.36 s).

RUN 2126-A | 2026-11-27 | djrolfes | AI-assisted: Antigravity (Gemini 4 Neon) + Codex (gpt-6-luna verification)
BASE:        main 43a9d562d + none | shaders: main ec91d695c local translation (wave64 emulated; no overlays)
MACHINE:     RTX 3070 Ti 8 GB, desktop, display attached | NVIDIA 620.73.04 | Arch Linux 7.2.15 + Wine 11.22 | Ryzen 7 5800X | 31 GiB RAM
RECIPE:      documented ("Linux, Proton, NVIDIA") + DEVIATIONS: --first-run-ui (enables LEONIDA_XMEM_BACKING_DIR), LEONIDA_ARENA_MB=1024, LEONIDA_GEOMETRY_MB=2048, LEONIDA_ASYNC_PIPELINES=1, LEONIDA_ASYNC_MIN_BYTES=2097152, LEONIDA_ASYNC_MIN_BYTES_GRAPHICS=0 (no skip list), LEONIDA_COMPUTE_WARMUP=0, LEONIDA_VALUE_WAIT_TIMEOUT_MS=30000, LEONIDA_DEVICE_TYPE=6, LEONIDA_MAP_READBACK=1, LEONIDA_DEVICE_FAULT=1, LEONIDA_STARTUP_CACHE_CHECKPOINTS=1, LEONIDA_TITLE_WATCHDOG=0 + local KICK, LEONIDA_TITLE_HUD=1, LEONIDA_KEYBOARD_PAD=1, scripted input starting at t=30 s, 900 s limit | precompile: no
OS/DRIVER:   default Linux NVIDIA driver settings; Wine 11.22 Wayland driver; isolated network namespace
TARGET:      whether clean main survives file-backed XMem host imports under Wine/NVIDIA | PREDICTED (written before the run): crashes or progresses past first-run UI
MEASURED:    first-run UI only (crashed before first scripted press at t=30 s); PresentX ok 301, failed 0; 495 submissions; submit-phases 21.44-23.93 frames/s (final 21.44 frames/s); fatal vkAllocateMemory failed (-1) on heap 0 (8,192 MiB) and heap 1 (24,000 MiB) -> 1 slot-133 depth texture refused (E_OUTOFMEMORY); 0 untranslated compute refusals; min available RAM 16.91 GiB; max GPU memory 2,231 MiB; device loss: no | duration 28.45 s
END:         process crash (Wine unhandled exception, exit 126; a second warm run reproduced the exact same crash at 24.36 s with 276 PresentX ok)
CACHES:      cold | RUN 1 of 1 cold, Arm A
INSTRUMENTS: device fault 1, resource sampling (2 s), frame capture every 600 frames (local only), startup cache checkpoints
VERDICT:     clean main reproduces the file-backed XMem host-import E_OUTOFMEMORY crash (2/2 across cold 28.45 s and warm 24.36 s)
RUN 2126-B | 2026-11-27 | djrolfes | AI-assisted: Antigravity (Gemini 4 Neon) + Codex (gpt-6-luna verification)
BASE:        main 43a9d562d + #2126 (822d8b0b4, applied cleanly) | shaders: main ec91d695c local translation (wave64 emulated; no overlays)
MACHINE:     RTX 3070 Ti 8 GB, desktop, display attached | NVIDIA 620.73.04 | Arch Linux 7.2.15 + Wine 11.22 | Ryzen 7 5800X | 31 GiB RAM
RECIPE:      same as 2126-A except extended hands-free LEONIDA_INPUT_SCRIPT (starting at t=35 s; Arm A crashed at 28.45 s before any scripted press fired), 600 s limit, silent workspace | precompile: no
OS/DRIVER:   same as 2126-A
TARGET:      whether #2126 eliminates the file-backed XMem vkAllocateMemory (-1) crash | PREDICTED (written before the run): 0 fatal heap-0/heap-1 vkAllocateMemory (-1) errors, 0 slot-133 depth texture refusals, clears past 28 s through first-run UI -> menu -> story load -> world load (~260-340 s)
MEASURED:    first-run UI -> menu -> story load -> world load (did not reach play); PresentX ok 5,471, failed 0; 10,954 submissions; submit-phases 0.00-30.17 frames/s; 0 fatal heap-0/heap-1 vkAllocateMemory (-1) failures (16 non-fatal small-BAR 246 MiB heap-2 fallbacks); 0 slot-133 depth texture refusals; 2 untranslated compute shader refusals at world entry; min available RAM 13.08 GiB; max GPU memory 7,319 MiB; device loss: no | duration 283.75 s
END:         process crash (Wine unhandled exception at world entry after the 2 untranslated compute shader refusals, exit 126; same end class as clean main --run baseline without LEONIDA_XMEM_BACKING_DIR)
CACHES:      cold | RUN 1 of 1 cold, Arm B
INSTRUMENTS: same as 2126-A
VERDICT:     prediction held (0 fatal heap-0/heap-1 vkAllocateMemory failures, 0 slot-133 depth texture refusals, 10x runtime progression into world load while saving ~6.6 GiB host RAM vs anonymous-RAM --run baseline: min available RAM 13.08 GiB vs 6.46 GiB)

Reading:

  • MEASURED (n=1 cold per side + second warm Arm A check, PROVISIONAL): On current main (43a9d562d) under Wine 11.22 + NVIDIA 620.73.04, --first-run-ui (LEONIDA_XMEM_BACKING_DIR) crashes 2/2 in 24.36–28.45 s with vkAllocateMemory failed (-1) on both heap 0 and heap 1 despite ~16.9 GiB RAM and ~6 GiB VRAM free. Adding #2126 (822d8b0b4) eliminates those failures completely (0 fatal heap-0/heap-1 failures, 0 depth-texture refusals) and advances through first-run UI -> menu -> story load -> world load (283.75 s, 5,471 presents) while keeping 13.08 GiB host RAM free (vs 6.46 GiB in clean-main --run without LEONIDA_XMEM_BACKING_DIR).
  • NOTE ON RECIPE: Arm B used an extended hands-free input script starting at t=35 s; Arm A crashed at 28.45 s before any scripted input fired, so the script difference could not have affected Arm A's crash.

AI-assisted: Antigravity (Gemini 4 Neon) + Codex (gpt-6-luna independent verification); no game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7226645237 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2126#issuecomment-7226645237). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-11-27T19:33:29Z. --- Fresh cold-cache A/B game-run check on current `main` (`43a9d562d`) with `--first-run-ui` (`LEONIDA_XMEM_BACKING_DIR` enabled) on Linux + Wine 11.22 + NVIDIA RTX 3070 Ti 8 GB (Profile M), in `#2464` RUN-block format. All numbers independently recomputed from raw logs and resource samples by a second agent (`codex` / `gpt-6-luna`) before posting. `PROVISIONAL (n=1 cold per side; plus a second warm clean-main reproduction at 24.36 s)`. ```text RUN 2126-A | 2026-11-27 | djrolfes | AI-assisted: Antigravity (Gemini 4 Neon) + Codex (gpt-6-luna verification) BASE: main 43a9d562d + none | shaders: main ec91d695c local translation (wave64 emulated; no overlays) MACHINE: RTX 3070 Ti 8 GB, desktop, display attached | NVIDIA 620.73.04 | Arch Linux 7.2.15 + Wine 11.22 | Ryzen 7 5800X | 31 GiB RAM RECIPE: documented ("Linux, Proton, NVIDIA") + DEVIATIONS: --first-run-ui (enables LEONIDA_XMEM_BACKING_DIR), LEONIDA_ARENA_MB=1024, LEONIDA_GEOMETRY_MB=2048, LEONIDA_ASYNC_PIPELINES=1, LEONIDA_ASYNC_MIN_BYTES=2097152, LEONIDA_ASYNC_MIN_BYTES_GRAPHICS=0 (no skip list), LEONIDA_COMPUTE_WARMUP=0, LEONIDA_VALUE_WAIT_TIMEOUT_MS=30000, LEONIDA_DEVICE_TYPE=6, LEONIDA_MAP_READBACK=1, LEONIDA_DEVICE_FAULT=1, LEONIDA_STARTUP_CACHE_CHECKPOINTS=1, LEONIDA_TITLE_WATCHDOG=0 + local KICK, LEONIDA_TITLE_HUD=1, LEONIDA_KEYBOARD_PAD=1, scripted input starting at t=30 s, 900 s limit | precompile: no OS/DRIVER: default Linux NVIDIA driver settings; Wine 11.22 Wayland driver; isolated network namespace TARGET: whether clean main survives file-backed XMem host imports under Wine/NVIDIA | PREDICTED (written before the run): crashes or progresses past first-run UI MEASURED: first-run UI only (crashed before first scripted press at t=30 s); PresentX ok 301, failed 0; 495 submissions; submit-phases 21.44-23.93 frames/s (final 21.44 frames/s); fatal vkAllocateMemory failed (-1) on heap 0 (8,192 MiB) and heap 1 (24,000 MiB) -> 1 slot-133 depth texture refused (E_OUTOFMEMORY); 0 untranslated compute refusals; min available RAM 16.91 GiB; max GPU memory 2,231 MiB; device loss: no | duration 28.45 s END: process crash (Wine unhandled exception, exit 126; a second warm run reproduced the exact same crash at 24.36 s with 276 PresentX ok) CACHES: cold | RUN 1 of 1 cold, Arm A INSTRUMENTS: device fault 1, resource sampling (2 s), frame capture every 600 frames (local only), startup cache checkpoints VERDICT: clean main reproduces the file-backed XMem host-import E_OUTOFMEMORY crash (2/2 across cold 28.45 s and warm 24.36 s) ``` ```text RUN 2126-B | 2026-11-27 | djrolfes | AI-assisted: Antigravity (Gemini 4 Neon) + Codex (gpt-6-luna verification) BASE: main 43a9d562d + #2126 (822d8b0b4, applied cleanly) | shaders: main ec91d695c local translation (wave64 emulated; no overlays) MACHINE: RTX 3070 Ti 8 GB, desktop, display attached | NVIDIA 620.73.04 | Arch Linux 7.2.15 + Wine 11.22 | Ryzen 7 5800X | 31 GiB RAM RECIPE: same as 2126-A except extended hands-free LEONIDA_INPUT_SCRIPT (starting at t=35 s; Arm A crashed at 28.45 s before any scripted press fired), 600 s limit, silent workspace | precompile: no OS/DRIVER: same as 2126-A TARGET: whether #2126 eliminates the file-backed XMem vkAllocateMemory (-1) crash | PREDICTED (written before the run): 0 fatal heap-0/heap-1 vkAllocateMemory (-1) errors, 0 slot-133 depth texture refusals, clears past 28 s through first-run UI -> menu -> story load -> world load (~260-340 s) MEASURED: first-run UI -> menu -> story load -> world load (did not reach play); PresentX ok 5,471, failed 0; 10,954 submissions; submit-phases 0.00-30.17 frames/s; 0 fatal heap-0/heap-1 vkAllocateMemory (-1) failures (16 non-fatal small-BAR 246 MiB heap-2 fallbacks); 0 slot-133 depth texture refusals; 2 untranslated compute shader refusals at world entry; min available RAM 13.08 GiB; max GPU memory 7,319 MiB; device loss: no | duration 283.75 s END: process crash (Wine unhandled exception at world entry after the 2 untranslated compute shader refusals, exit 126; same end class as clean main --run baseline without LEONIDA_XMEM_BACKING_DIR) CACHES: cold | RUN 1 of 1 cold, Arm B INSTRUMENTS: same as 2126-A VERDICT: prediction held (0 fatal heap-0/heap-1 vkAllocateMemory failures, 0 slot-133 depth texture refusals, 10x runtime progression into world load while saving ~6.6 GiB host RAM vs anonymous-RAM --run baseline: min available RAM 13.08 GiB vs 6.46 GiB) ``` Reading: - **MEASURED (`n=1` cold per side + second warm Arm A check, PROVISIONAL):** On current `main` (`43a9d562d`) under Wine 11.22 + NVIDIA 620.73.04, `--first-run-ui` (`LEONIDA_XMEM_BACKING_DIR`) crashes 2/2 in `24.36–28.45 s` with `vkAllocateMemory failed (-1)` on both heap 0 and heap 1 despite ~16.9 GiB RAM and ~6 GiB VRAM free. Adding `#2126` (`822d8b0b4`) eliminates those failures completely (`0` fatal heap-0/heap-1 failures, `0` depth-texture refusals) and advances through `first-run UI -> menu -> story load -> world load` (`283.75 s`, `5,471` presents) while keeping `13.08 GiB` host RAM free (vs `6.46 GiB` in clean-`main` `--run` without `LEONIDA_XMEM_BACKING_DIR`). - **NOTE ON RECIPE:** Arm B used an extended hands-free input script starting at `t=35 s`; Arm A crashed at `28.45 s` before any scripted input fired, so the script difference could not have affected Arm A's crash. AI-assisted: Antigravity (Gemini 4 Neon) + Codex (`gpt-6-luna` independent verification); no game data.
aslan2142 commented 2026-12-01 16:42:23 +00:00 (Migrated from github.com)

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


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:7318072839 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2126#issuecomment-7318072839). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:42:23Z. --- 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!2126
No description provided.