d3d12_vulkan: without Resizable BAR, textures and staging buffers leave the BAR window to the arena; tile heaps prefer VRAM (RT-ALLOC-NO-REBAR-RETRIES) #1681

Merged
ImLele69 merged 4 commits from upstream-pr/1681 into main 2026-11-29 15:42:03 +00:00
ImLele69 commented 2026-11-25 07:59:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ImLele69 on 2026-11-25T07:59:45Z.


Claimed in the coordination issue as: RT-ALLOC-NO-REBAR-RETRIES — https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7156470795

What and why

On a card without Resizable BAR the DEVICE_LOCAL | HOST_VISIBLE memory type sits in a heap of about 256 MiB. Two things went wrong once that window or VRAM filled up during the story load (RTX 2070 SUPER 8 GB, NVIDIA 620.70.06, Wine 11.21):

  1. memory_type_order put the window type second for every texture and default-heap buffer that prefers VRAM, and in index order for staging buffers. Textures used it up (nvidia-smi BAR1 at 246 of 256 MiB), and from 18,585 registered images on, every such allocation failed there before reaching system memory.
  2. Tile heaps for reserved resources (Heap::tiles) required DEVICE_LOCAL, so with VRAM full the 8 MiB heaps failed for every type and tiles() returned nothing.

Changes:

  • memory_type_order: only an allocation that asks for both DEVICE_LOCAL and HOST_VISIBLE (the arena, upload buffers with Resizable BAR) tries a BAR-window type (bar_window_type, new) in its place; the others try it last. Nothing changes with Resizable BAR, where that type is not a window.
  • Heap::tiles: DEVICE_LOCAL preferred instead of required. The types are the sparse resource's own memoryTypeBits, so a system-memory type there is valid.

The first version also changed allocate's retries of VK_ERROR_OUT_OF_HOST_MEMORY. main has since made those retries adaptive (they stop while they don't recover), which covers the same case without the regression kawaii-shakal pointed out for the arena, so that part and its failure counter are gone after the merge with main 0d80bc5df.

Tested

  • d3d12_state_map_test (Linux, clang 20): new cases for bar_window_type and the order of textures, staging buffers and the arena on the RTX 3090 layout already in the test, with and without Resizable BAR. Passes after the merge.
  • Windows runtime cross-build (clang-cl 20 + xwin) after the merge.
  • Retail 1.0.2.1 boots under Wine 11.21, RTX 2070 SUPER 8 GB, i9-9900KF, 16 GB RAM, counts only: with the first version, no allocation failure was logged up to 26,800-38,900 registered images over several runs (16 in the window before, by 18,585 images). Not repeated with the merged retry logic.
  • Independent runs by whoalin1 (RTX 4070 SUPER, AMD iGPU) and adrianmjim (RX 7900 XT without Resizable BAR) above: no regression. On AMD the window answers VK_ERROR_OUT_OF_DEVICE_MEMORY, so only changes 1 and 2 above can apply there, once VRAM is full.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5487449428 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1681). Originally posted by [ImLele69](https://github.com/ImLele69) on 2026-11-25T07:59:45Z. --- Claimed in the coordination issue as: RT-ALLOC-NO-REBAR-RETRIES — https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7156470795 ### What and why On a card without Resizable BAR the DEVICE_LOCAL | HOST_VISIBLE memory type sits in a heap of about 256 MiB. Two things went wrong once that window or VRAM filled up during the story load (RTX 2070 SUPER 8 GB, NVIDIA 620.70.06, Wine 11.21): 1. `memory_type_order` put the window type second for every texture and default-heap buffer that prefers VRAM, and in index order for staging buffers. Textures used it up (`nvidia-smi` BAR1 at 246 of 256 MiB), and from 18,585 registered images on, every such allocation failed there before reaching system memory. 2. Tile heaps for reserved resources (`Heap::tiles`) required DEVICE_LOCAL, so with VRAM full the 8 MiB heaps failed for every type and `tiles()` returned nothing. Changes: - `memory_type_order`: only an allocation that asks for both DEVICE_LOCAL and HOST_VISIBLE (the arena, upload buffers with Resizable BAR) tries a BAR-window type (`bar_window_type`, new) in its place; the others try it last. Nothing changes with Resizable BAR, where that type is not a window. - `Heap::tiles`: DEVICE_LOCAL preferred instead of required. The types are the sparse resource's own `memoryTypeBits`, so a system-memory type there is valid. The first version also changed `allocate`'s retries of `VK_ERROR_OUT_OF_HOST_MEMORY`. `main` has since made those retries adaptive (they stop while they don't recover), which covers the same case without the regression kawaii-shakal pointed out for the arena, so that part and its failure counter are gone after the merge with `main` `0d80bc5df`. ### Tested - `d3d12_state_map_test` (Linux, clang 20): new cases for `bar_window_type` and the order of textures, staging buffers and the arena on the RTX 3090 layout already in the test, with and without Resizable BAR. Passes after the merge. - Windows runtime cross-build (clang-cl 20 + xwin) after the merge. - Retail 1.0.2.1 boots under Wine 11.21, RTX 2070 SUPER 8 GB, i9-9900KF, 16 GB RAM, counts only: with the first version, no allocation failure was logged up to 26,800-38,900 registered images over several runs (16 in the window before, by 18,585 images). Not repeated with the merged retry logic. - Independent runs by whoalin1 (RTX 4070 SUPER, AMD iGPU) and adrianmjim (RX 7900 XT without Resizable BAR) above: no regression. On AMD the window answers `VK_ERROR_OUT_OF_DEVICE_MEMORY`, so only changes 1 and 2 above can apply there, once VRAM is full. AI-assisted: yes (Claude Code).
whoalin1 commented 2026-11-25 08:52:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T08:52:13Z.


Independent verification (native Windows; RTX 4070 SUPER + AMD Radeon gfx1036 iGPU, LEONIDA_VK_VALIDATION=1): full RelWithDebInfo build 572/572 OK; CPU memory-path tests pass incl. new bar_window_type/ordering cases. GPU ctest memory subset: NVIDIA 15/15 PASS; AMD 11 pass + 4 fail (d3d12_title_va, d3d12_geometry_views, d3d12_title_index_window, d3d12_title_vertex_window) — identical failures reproduced on an origin/main baseline build (iGPU maxPushConstantsSize=128 < 144, UBO fallback not built — documented pre-existing limit), not a regression. Code review clean: attempts=1 for BAR-window/2s-exhausted types, retry success never poisons a type, other memory_type_order callers unaffected. Retail/Wine no-ReBAR claims unverifiable without game files; mechanism matches. AI-assisted verification.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7157574347 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1681#issuecomment-7157574347). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-25T08:52:13Z. --- Independent verification (native Windows; RTX 4070 SUPER + AMD Radeon gfx1036 iGPU, `LEONIDA_VK_VALIDATION=1`): full RelWithDebInfo build 572/572 OK; CPU memory-path tests pass incl. new `bar_window_type`/ordering cases. GPU ctest memory subset: NVIDIA **15/15 PASS**; AMD 11 pass + 4 fail (`d3d12_title_va`, `d3d12_geometry_views`, `d3d12_title_index_window`, `d3d12_title_vertex_window`) — **identical failures reproduced on an origin/main baseline build** (iGPU `maxPushConstantsSize=128 < 144`, UBO fallback not built — documented pre-existing limit), not a regression. Code review clean: attempts=1 for BAR-window/2s-exhausted types, retry success never poisons a type, other `memory_type_order` callers unaffected. Retail/Wine no-ReBAR claims unverifiable without game files; mechanism matches. AI-assisted verification.
kawaii-shakal commented 2026-11-25 09:45:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-25T09:45:29Z.

Review: COMMENTED


Review (read-only, not run). Moving the BAR-window type to the end for allocations that don't ask for host access, and the tile heaps' "prefer, don't require", both look right, and the order tests are clear. One possible regression:

The arena gets one try in the BAR window instead of six. attempts is 1 for any bar_window_type type, including for an allocation that wants both DEVICE_LOCAL and HOST_VISIBLE, the arena among them. The six retries existed because the NVIDIA driver also returns a spurious VK_ERROR_OUT_OF_HOST_MEMORY that succeeds on retry (your description keeps retries for that case elsewhere). On a no-ReBAR card the arena is the one allocation that should land in the window. A single spurious answer would now send it to system memory for the whole run, silently, apart from the placement log. Suggest keeping the retries when wants_window, or for the first allocation in that type, and limiting the single try to allocations that only reached the window as a fallback.

Minor: the failures counter's first message prints at 32 (failed > 16 and a power of two). If 16 was meant, use >=.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6055209045 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1681#pullrequestreview-6055209045). Originally posted by [kawaii-shakal](https://github.com/kawaii-shakal) on 2026-11-25T09:45:29Z. **Review:** COMMENTED --- Review (read-only, not run). Moving the BAR-window type to the end for allocations that don't ask for host access, and the tile heaps' "prefer, don't require", both look right, and the order tests are clear. One possible regression: **The arena gets one try in the BAR window instead of six.** `attempts` is 1 for any `bar_window_type` type, including for an allocation that wants both `DEVICE_LOCAL` and `HOST_VISIBLE`, the arena among them. The six retries existed because the NVIDIA driver also returns a spurious `VK_ERROR_OUT_OF_HOST_MEMORY` that succeeds on retry (your description keeps retries for that case elsewhere). On a no-ReBAR card the arena is the one allocation that should land in the window. A single spurious answer would now send it to system memory for the whole run, silently, apart from the placement log. Suggest keeping the retries when `wants_window`, or for the first allocation in that type, and limiting the single try to allocations that only reached the window as a fallback. Minor: the `failures` counter's first message prints at 32 (`failed > 16` and a power of two). If 16 was meant, use `>=`. AI-assisted review (Claude Code, Claude Opus 5.5).
adrianmjim commented 2026-11-25 11:24:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by adrianmjim on 2026-11-25T11:24:37Z.


Tested 1940c2ac4 applied onto main 42537e7b6 on a discrete AMD GPU without Resizable BAR: Radeon RX 7900 XT (20 GB), AMD driver 32.0.32029.2010 (26.11.2), Windows 11 build 26300, VS 2022 RelWithDebInfo. The memory layout is heap 0 VRAM, heap 1 system memory, and heap 2 a 256 MiB DEVICE_LOCAL | HOST_VISIBLE window. No game files.

This PR alone: no behaviour change on this card, and no regression.

  • The 19 memory tests (d3d12_state_map, indirect_dispatch_count_alloc, image_memory, arena_size, d3d12_vulkan_device, d3d12_texture_memory, d3d12_buffer_tiles, d3d12_texture_tiles, d3d12_sparse_queue_family*, d3d12_placed_heap_lifetime, d3d12_heap_properties, d3d12_existing_heap, d3d12_title_va, d3d12_geometry_views, d3d12_title_*_window, xbox_geometry_upload_batch, d3d12_indirect_rt_upload_sysmem) give the same results as main. 17 pass, and d3d12_texture_tiles (#964) and d3d12_geometry_views fail on both.
  • Whole ctest -j 6: 3 failures out of 402 (13 skipped for missing data or features), the same three as main: d3d12_texture_tiles, d3d12_clear and d3d12_geometry_views.
  • With LEONIDA_GEOMETRY_MB=16, d3d12_title_va_test logs exactly the same allocation failures as main: three vkAllocateMemory failed (-2) ... memory type 2 (flags 0x7, heap 2 of 256 MiB) lines, and no succeeded on retry.

That fits the code:

  • AMD answers VK_ERROR_OUT_OF_DEVICE_MEMORY (-2) when the window is full, so the retry and "exhausted" logic, which acts on -1, never runs here.
  • Textures still get VRAM type 0 first.
  • The arena still asks for HOST_VISIBLE and prefers DEVICE_LOCAL, so it still takes the BAR type first. At 256 MiB it fills this 256 MiB window exactly.

So the retry part of change 2 looks NVIDIA-specific (its failure counter does count AMD's -2 answers, see below), and changes 1 and 3 only matter once VRAM is full.

With #1678 on top (geometry views fall back to system memory when the window is full): d3d12_geometry_views passes, with 64/64 for the table V#, the CBV and the root view. There are no validation messages under LEONIDA_VK_VALIDATION=1, and the fallback is logged once. The whole ctest gives 400 of 402, with only d3d12_texture_tiles and d3d12_clear left. The two changes compose without conflicts.

One thing to watch once both are in: each new geometry-view block first tries the full window once (-2) and then goes to system memory. That is 1 to 4 vkAllocateMemory failed lines in this test. Your new "has failed N times" line counts every failed vkAllocateMemory in allocate and first prints at the 32nd failure (then 64, 128, ...). With #1678 each view block adds one failure that is recovered at once. So a run with 32 or more view blocks, or fewer blocks plus other failures, will print it even though every allocation ended up succeeding.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7161008864 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1681#issuecomment-7161008864). Originally posted by [adrianmjim](https://github.com/adrianmjim) on 2026-11-25T11:24:37Z. --- Tested `1940c2ac4` applied onto `main` `42537e7b6` on a discrete AMD GPU without Resizable BAR: Radeon RX 7900 XT (20 GB), AMD driver 32.0.32029.2010 (26.11.2), Windows 11 build 26300, VS 2022 RelWithDebInfo. The memory layout is heap 0 VRAM, heap 1 system memory, and heap 2 a 256 MiB `DEVICE_LOCAL | HOST_VISIBLE` window. No game files. **This PR alone: no behaviour change on this card, and no regression.** - The 19 memory tests (`d3d12_state_map`, `indirect_dispatch_count_alloc`, `image_memory`, `arena_size`, `d3d12_vulkan_device`, `d3d12_texture_memory`, `d3d12_buffer_tiles`, `d3d12_texture_tiles`, `d3d12_sparse_queue_family*`, `d3d12_placed_heap_lifetime`, `d3d12_heap_properties`, `d3d12_existing_heap`, `d3d12_title_va`, `d3d12_geometry_views`, `d3d12_title_*_window`, `xbox_geometry_upload_batch`, `d3d12_indirect_rt_upload_sysmem`) give the same results as `main`. 17 pass, and `d3d12_texture_tiles` (#964) and `d3d12_geometry_views` fail on both. - Whole `ctest -j 6`: 3 failures out of 402 (13 skipped for missing data or features), the same three as `main`: `d3d12_texture_tiles`, `d3d12_clear` and `d3d12_geometry_views`. - With `LEONIDA_GEOMETRY_MB=16`, `d3d12_title_va_test` logs exactly the same allocation failures as `main`: three `vkAllocateMemory failed (-2) ... memory type 2 (flags 0x7, heap 2 of 256 MiB)` lines, and no `succeeded on retry`. That fits the code: - AMD answers `VK_ERROR_OUT_OF_DEVICE_MEMORY` (-2) when the window is full, so the retry and "exhausted" logic, which acts on -1, never runs here. - Textures still get VRAM type 0 first. - The arena still asks for `HOST_VISIBLE` and prefers `DEVICE_LOCAL`, so it still takes the BAR type first. At 256 MiB it fills this 256 MiB window exactly. So the retry part of change 2 looks NVIDIA-specific (its failure counter does count AMD's -2 answers, see below), and changes 1 and 3 only matter once VRAM is full. **With #1678 on top** (geometry views fall back to system memory when the window is full): `d3d12_geometry_views` passes, with 64/64 for the table V#, the CBV and the root view. There are no validation messages under `LEONIDA_VK_VALIDATION=1`, and the fallback is logged once. The whole `ctest` gives 400 of 402, with only `d3d12_texture_tiles` and `d3d12_clear` left. The two changes compose without conflicts. One thing to watch once both are in: each new geometry-view block first tries the full window once (-2) and then goes to system memory. That is 1 to 4 `vkAllocateMemory failed` lines in this test. Your new "has failed N times" line counts every failed `vkAllocateMemory` in `allocate` and first prints at the 32nd failure (then 64, 128, ...). With #1678 each view block adds one failure that is recovered at once. So a run with 32 or more view blocks, or fewer blocks plus other failures, will print it even though every allocation ended up succeeding.
ImLele69 commented 2026-11-25 11:59:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ImLele69 on 2026-11-25T11:59:39Z.


Thanks @kawaii-shakal, @adrianmjim and @whoalin1. Merged main 0d80bc5df (the branch was conflicting). main now makes the OUT_OF_HOST_MEMORY retries adaptive, which covers what my retry change was for, and keeps the arena's retries at boot, so I dropped that change and the failure counter instead of patching them: the arena regression and the counter's 16/32 and "recovered failures" points no longer apply. What's left is the window ordering and the tile heaps' "prefer, don't require". Description updated; d3d12_state_map_test passes and the runtime cross-builds after the merge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7161776950 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1681#issuecomment-7161776950). Originally posted by [ImLele69](https://github.com/ImLele69) on 2026-11-25T11:59:39Z. --- Thanks @kawaii-shakal, @adrianmjim and @whoalin1. Merged `main` `0d80bc5df` (the branch was conflicting). `main` now makes the `OUT_OF_HOST_MEMORY` retries adaptive, which covers what my retry change was for, and keeps the arena's retries at boot, so I dropped that change and the failure counter instead of patching them: the arena regression and the counter's 16/32 and "recovered failures" points no longer apply. What's left is the window ordering and the tile heaps' "prefer, don't require". Description updated; `d3d12_state_map_test` passes and the runtime cross-builds after the merge.
Timon360SB commented 2026-11-25 14:30:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Timon360SB on 2026-11-25T14:30:41Z.


Independent verification — Turing and Blackwell

  • Base: 0d80bc5df7c873f40965f34f185cb96913786765
  • Head: 86eb22f7e84ed057adb9dc259c53394f05f2c706

Environment

GPU Windows 11 build Resizable BAR
RTX 5070 (12 GB) 26200 Enabled
RTX 2060 SUPER (8 GB) 28000 Unavailable

NVIDIA 621.14, Vulkan SDK 1.4.363.0, MSVC 19.44, Ninja RelWithDebInfo.

Three initial repetitions per configuration, followed by two additional sets of validated runs. Duplicate checkpoint results were excluded.

Results

Test Base Head
d3d12_state_map 24/24 24/24
d3d12_texture_tiles 24/24 24/24
d3d12_existing_heap 24/24 24/24
d3d12_geometry_views 24/24 24/24
d3d12_title_va 24/24 24/24
d3d12_indirect_rt_upload_sysmem 6/24 6/24
d3d12_buffer_tiles 24/24 24/24
d3d12_texture_memory 24/24 24/24
d3d12_heap_properties 24/24 24/24
Total 198/216 198/216

432 unique test executions: 396 passed, 36 failed, 0 skipped.

Findings

  • VulkanInfo reports a separate 214 MiB DEVICE_LOCAL / HOST_VISIBLE heap on the RTX 2060 SUPER.
  • Upload heaps use system memory on the RTX 2060 SUPER and VRAM on the RTX 5070.
  • Geometry views and title-memory checks pass on both revisions, with 64/64 expected values for CPU-written tables, created CBVs and root views.
  • No vkAllocateMemory failed messages in the captured logs.

The only failing test is d3d12_indirect_rt_upload_sysmem under validation, reproduced on both revisions and GPUs:

VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-12281

FAIL: RayQueryKHR ARRAY expected hit=1 miss=0, got hit=0 miss=0

Conclusion

No regressions observed in the nine selected CTest scenarios, including the no-ReBAR Turing configuration.

BAR-window exhaustion and VRAM-pressure fallback were not explicitly forced, so these results establish regression coverage rather than direct verification of allocation behavior under memory exhaustion.

Synthetic tests only. No game files used.
AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165389523 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1681#issuecomment-7165389523). Originally posted by [Timon360SB](https://github.com/Timon360SB) on 2026-11-25T14:30:41Z. --- ## Independent verification — Turing and Blackwell - **Base:** `0d80bc5df7c873f40965f34f185cb96913786765` - **Head:** `86eb22f7e84ed057adb9dc259c53394f05f2c706` ### Environment | GPU | Windows 11 build | Resizable BAR | |---|---|---| | RTX 5070 (12 GB) | 26200 | Enabled | | RTX 2060 SUPER (8 GB) | 28000 | Unavailable | NVIDIA 621.14, Vulkan SDK 1.4.363.0, MSVC 19.44, Ninja RelWithDebInfo. Three initial repetitions per configuration, followed by two additional sets of validated runs. Duplicate checkpoint results were excluded. ### Results | Test | Base | Head | |---|---:|---:| | `d3d12_state_map` | 24/24 | 24/24 | | `d3d12_texture_tiles` | 24/24 | 24/24 | | `d3d12_existing_heap` | 24/24 | 24/24 | | `d3d12_geometry_views` | 24/24 | 24/24 | | `d3d12_title_va` | 24/24 | 24/24 | | `d3d12_indirect_rt_upload_sysmem` | 6/24 | 6/24 | | `d3d12_buffer_tiles` | 24/24 | 24/24 | | `d3d12_texture_memory` | 24/24 | 24/24 | | `d3d12_heap_properties` | 24/24 | 24/24 | | **Total** | **198/216** | **198/216** | 432 unique test executions: 396 passed, 36 failed, 0 skipped. ### Findings - VulkanInfo reports a separate 214 MiB DEVICE_LOCAL / HOST_VISIBLE heap on the RTX 2060 SUPER. - Upload heaps use system memory on the RTX 2060 SUPER and VRAM on the RTX 5070. - Geometry views and title-memory checks pass on both revisions, with 64/64 expected values for CPU-written tables, created CBVs and root views. - No `vkAllocateMemory failed` messages in the captured logs. The only failing test is `d3d12_indirect_rt_upload_sysmem` under validation, reproduced on both revisions and GPUs: `VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-12281` `FAIL: RayQueryKHR ARRAY expected hit=1 miss=0, got hit=0 miss=0` ### Conclusion No regressions observed in the nine selected CTest scenarios, including the no-ReBAR Turing configuration. BAR-window exhaustion and VRAM-pressure fallback were not explicitly forced, so these results establish regression coverage rather than direct verification of allocation behavior under memory exhaustion. Synthetic tests only. No game files used. AI-assisted: yes.
qhukz13 commented 2026-11-25 22:25:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-25T22:25:34Z.


A Pascal data point, since the reports above are Turing, Blackwell and RDNA3. GeForce GTX 1050 Ti 4 GB without Resizable BAR, NVIDIA 582.66, Windows 10 Pro 19045, MSVC RelWithDebInfo, base 0d80bc5df vs head 86eb22f7e.

Memory layout (vulkaninfo): heap 0 VRAM 3.91 GiB, heap 1 system memory 15.96 GiB, heap 2 DEVICE_LOCAL 214 MiB. Types: 0-6 heap 1 with no flags, 7 heap 0 DEVICE_LOCAL, 8 heap 1 HOST_VISIBLE|HOST_COHERENT, 9 the same plus HOST_CACHED, 10 heap 2 DEVICE_LOCAL|HOST_VISIBLE|HOST_COHERENT. So bar_window_type takes type 10 (214 MiB <= kBarWindowBytes), and the PR changes the order here as intended:

allocation main this PR
texture / default buffer (prefers DEVICE_LOCAL) 7, 10, 0-6, 8, 9 7, 0-6, 8, 9, 10
arena (HOST_VISIBLE + DEVICE_LOCAL) 10 first 10 first
staging (HOST_VISIBLE only) 8, 9, 10 8, 9, 10

Staging buffers do not change on this card because the window type already has the highest index; the texture order is where the window was being used up.

Tests, 21 memory tests (d3d12_state_map, indirect_dispatch_count_alloc, image_memory, arena_size, d3d12_vulkan_device, d3d12_texture_memory, d3d12_buffer_tiles, d3d12_texture_tiles, d3d12_sparse_queue_family*, d3d12_placed_heap_lifetime, d3d12_heap_properties, d3d12_existing_heap*, d3d12_title_va, d3d12_geometry_views, d3d12_title_index_window, d3d12_title_vertex_window, xbox_geometry_upload_batch, d3d12_indirect_rt_upload_sysmem), 3 runs plain and 1 with LEONIDA_VK_VALIDATION=1 on each side: identical on base and head, 15 pass and the same 6 fail, no validation messages. The 6 have known causes on this host unrelated to this PR: d3d12_existing_heap* (3, title images whose HOST_TRANSFER image gets no memory type, #1894), d3d12_heap_properties and d3d12_vulkan_device (resource heap tier 1 comparisons, #1389), d3d12_geometry_views (Windows 10 root signature serialization, #2059). So no regression here; the window filling up during a story load is not something these tests reach.

If useful, this layout could go into d3d12_state_map_test next to the RTX 3090 one; it is the case where staging and textures differ.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7176346174 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1681#issuecomment-7176346174). Originally posted by [qhukz13](https://github.com/qhukz13) on 2026-11-25T22:25:34Z. --- A Pascal data point, since the reports above are Turing, Blackwell and RDNA3. GeForce GTX 1050 Ti 4 GB without Resizable BAR, NVIDIA 582.66, Windows 10 Pro 19045, MSVC RelWithDebInfo, base `0d80bc5df` vs head `86eb22f7e`. **Memory layout (vulkaninfo):** heap 0 VRAM 3.91 GiB, heap 1 system memory 15.96 GiB, heap 2 `DEVICE_LOCAL` 214 MiB. Types: 0-6 heap 1 with no flags, 7 heap 0 `DEVICE_LOCAL`, 8 heap 1 `HOST_VISIBLE|HOST_COHERENT`, 9 the same plus `HOST_CACHED`, 10 heap 2 `DEVICE_LOCAL|HOST_VISIBLE|HOST_COHERENT`. So `bar_window_type` takes type 10 (214 MiB <= `kBarWindowBytes`), and the PR changes the order here as intended: | allocation | main | this PR | |---|---|---| | texture / default buffer (prefers `DEVICE_LOCAL`) | 7, **10**, 0-6, 8, 9 | 7, 0-6, 8, 9, **10** | | arena (`HOST_VISIBLE` + `DEVICE_LOCAL`) | 10 first | 10 first | | staging (`HOST_VISIBLE` only) | 8, 9, 10 | 8, 9, 10 | Staging buffers do not change on this card because the window type already has the highest index; the texture order is where the window was being used up. **Tests**, 21 memory tests (`d3d12_state_map`, `indirect_dispatch_count_alloc`, `image_memory`, `arena_size`, `d3d12_vulkan_device`, `d3d12_texture_memory`, `d3d12_buffer_tiles`, `d3d12_texture_tiles`, `d3d12_sparse_queue_family*`, `d3d12_placed_heap_lifetime`, `d3d12_heap_properties`, `d3d12_existing_heap*`, `d3d12_title_va`, `d3d12_geometry_views`, `d3d12_title_index_window`, `d3d12_title_vertex_window`, `xbox_geometry_upload_batch`, `d3d12_indirect_rt_upload_sysmem`), 3 runs plain and 1 with `LEONIDA_VK_VALIDATION=1` on each side: identical on base and head, 15 pass and the same 6 fail, no validation messages. The 6 have known causes on this host unrelated to this PR: `d3d12_existing_heap*` (3, title images whose HOST_TRANSFER image gets no memory type, #1894), `d3d12_heap_properties` and `d3d12_vulkan_device` (resource heap tier 1 comparisons, #1389), `d3d12_geometry_views` (Windows 10 root signature serialization, #2059). So no regression here; the window filling up during a story load is not something these tests reach. If useful, this layout could go into `d3d12_state_map_test` next to the RTX 3090 one; it is the case where staging and textures differ. AI-assisted (Claude Code).
GrahamboJangles commented 2026-11-26 08:19:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by GrahamboJangles on 2026-11-26T08:19:36Z.


Read-through review — head 86eb22f7e (merged with main 0d80bc5df)

Read-through on this CPU-only host (no cmake/clang-cl here — not built; the runtime side is backed by whoalin1's 572/572 native build and the adrianmjim, Timon360SB and qhukz13 hardware reports at this head).

Coordination: claimed on #1608 (RT-ALLOC-NO-REBAR-RETRIES), roster done: ... -> #1681; no open PR defines memory_type_order/bar_window_type (runtime/src/vulkan_memory.h) is touched elsewhere, and no open PR touches the tiles() allocate site — #1678 and #443 change other paths.

Rebase clean: 0d80bc5df..main (a73a57e13) is a zero-byte diff for runtime/src/vulkan_memory.h and runtime/test/d3d12_state_map_test.cpp, and main has not touched the tiles() allocation in d3d12_vulkan_device.cpp (still the old require-DEVICE_LOCAL form). Merges without conflicts.

Order logic (static check, sound):

  • bar_window_type and resizable_bar are exact complements at kBarWindowBytes (device-local heap ≤ 256 MiB vs >): no gap, no overlap, so with Resizable BAR every call is byte-identical to main.
  • wants_window is constant per call, so a type cannot land in both order and window; per-list dedupe is therefore consistent, and window types are appended after both passes — last, after system memory, as the comment claims.
  • The VUID-01713 heap-size filter runs before the classification, so an undersized window heap never sneaks in via window.
  • A texture (required=0, preferred=DEVICE_LOCAL) matches the window type in the first (required | preferred) pass — the type has DEVICE_LOCAL — and is diverted to window, so it stays a fallback, just last, after system memory.
  • Tests cover both flips: window-last for texture/staging, window-first for the arena (order{1,2,3}), and the 24 GiB heap case with !bar_window_type and the pre-change order restored.
  • Tile heaps: allocate(requirements, 0, DEVICE_LOCAL, ...) cannot yield an invalid type — requirements.memoryTypeBits is the sparse resource's own bits. The recorded memory_type flows into TileHeapAllocation; nothing in the diff or at the call sites assumes the tile backing is DEVICE_LOCAL (the arena's own memory_type at tiles_share_arena is a separate allocation).
  • Arena keeps its window-first slot here: the call is required=HOST_VISIBLE|HOST_COHERENT, preferred=DEVICE_LOCAL, so wants_window is true and it retries per main's adaptive rule, as before. kawaii-shakal's pre-merge arena-retry concern no longer applies at this head, as the author's 11:59Z reply says.

Verdict: no blocking issues — the merged version is strictly narrower than the pre-merge one (retry/counter part dropped, covered by main's adaptive retries). Nothing to request; the four independent hardware reports (Turing, Blackwell, RDNA3, Pascal, no- and with-ReBAR) all land on this head with no regression.

Reviewed by Hermes Agent (read-through, not run).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7186458808 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1681#issuecomment-7186458808). Originally posted by [GrahamboJangles](https://github.com/GrahamboJangles) on 2026-11-26T08:19:36Z. --- ## Read-through review — head `86eb22f7e` (merged with `main` `0d80bc5df`) Read-through on this CPU-only host (no cmake/clang-cl here — not built; the runtime side is backed by whoalin1's 572/572 native build and the adrianmjim, Timon360SB and qhukz13 hardware reports at this head). Coordination: claimed on #1608 (`RT-ALLOC-NO-REBAR-RETRIES`), roster `done: ... -> #1681`; no open PR defines `memory_type_order`/`bar_window_type` (`runtime/src/vulkan_memory.h`) is touched elsewhere, and no open PR touches the `tiles()` allocate site — #1678 and #443 change other paths. Rebase clean: `0d80bc5df..main` (`a73a57e13`) is a zero-byte diff for `runtime/src/vulkan_memory.h` and `runtime/test/d3d12_state_map_test.cpp`, and `main` has not touched the `tiles()` allocation in `d3d12_vulkan_device.cpp` (still the old require-DEVICE_LOCAL form). Merges without conflicts. Order logic (static check, sound): - `bar_window_type` and `resizable_bar` are exact complements at `kBarWindowBytes` (device-local heap ≤ 256 MiB vs >): no gap, no overlap, so with Resizable BAR every call is byte-identical to `main`. - `wants_window` is constant per call, so a type cannot land in both `order` and `window`; per-list dedupe is therefore consistent, and `window` types are appended after both passes — last, after system memory, as the comment claims. - The VUID-01713 heap-size filter runs before the classification, so an undersized window heap never sneaks in via `window`. - A texture (`required=0, preferred=DEVICE_LOCAL`) matches the window type in the first (`required | preferred`) pass — the type has DEVICE_LOCAL — and is diverted to `window`, so it stays a fallback, just last, after system memory. - Tests cover both flips: window-last for texture/staging, window-first for the arena (`order{1,2,3}`), and the 24 GiB heap case with `!bar_window_type` and the pre-change order restored. - Tile heaps: `allocate(requirements, 0, DEVICE_LOCAL, ...)` cannot yield an invalid type — `requirements.memoryTypeBits` is the sparse resource's own bits. The recorded `memory_type` flows into `TileHeapAllocation`; nothing in the diff or at the call sites assumes the tile backing is DEVICE_LOCAL (the arena's own `memory_type` at `tiles_share_arena` is a separate allocation). - Arena keeps its window-first slot here: the call is `required=HOST_VISIBLE|HOST_COHERENT, preferred=DEVICE_LOCAL`, so `wants_window` is true and it retries per main's adaptive rule, as before. kawaii-shakal's pre-merge arena-retry concern no longer applies at this head, as the author's 11:59Z reply says. Verdict: no blocking issues — the merged version is strictly narrower than the pre-merge one (retry/counter part dropped, covered by main's adaptive retries). Nothing to request; the four independent hardware reports (Turing, Blackwell, RDNA3, Pascal, no- and with-ReBAR) all land on this head with no regression. Reviewed by Hermes Agent (read-through, not run).
zmasi commented 2026-11-29 02:36:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T02:36:09Z.


Independent Hardware Verification & Cross-PR Interaction Note (RTX 3090, Windows 11)

  • Tested merge: origin/main (04f484006e) + PR #1681 (86eb22f7e8) — clean 3-way merge (0 conflicts).
  • Environment: NVIDIA GeForce RTX 3090 (24 GB, Resizable BAR), Windows 11, Visual Studio 2022 (MSVC 19.44 RelWithDebInfo), Vulkan SDK + VK_LAYER_KHRONOS_validation 1.4.363.1 (LEONIDA_VK_VALIDATION=1).

Red -> Green Results

  1. Red (with #1681's bar_window_type deferral omitted in memory_type_order):
    • d3d12_state_map failed (rc=8) at line 898: memory_type_order(memory, 0xF, 0, local, 1 * mib) == (order{0, 1, 2, 3}).
  2. Green (origin/main 04f484006e + #1681 86eb22f7e8, LEONIDA_VK_VALIDATION=1):
    • 6/6 CTests passed (6.02 s total, 0 Vulkan validation errors):
      • d3d12_texture_memory: Passed (1.34 s, 256 textures: 256 in 1 blocks of 67108864 bytes)
      • d3d12_buffer_tiles: Passed (1.55 s, 12 full tiles matched, native D3D12 tier-4 comparison matched)
      • d3d12_texture_tiles: Passed (0 validation errors)
      • d3d12_title_va: Passed (0 validation errors)
      • d3d12_geometry_views: Passed (0.60 s, 64/64 across table V#, created CBV, and root view; 11 negative controls held)
      • d3d12_state_map: Passed (0.06 s, BAR detection and memory_type_order / bar_window_type cases OK)
    • python -I scripts/check_no_game_data.py across all 3 touched files: passed (0 issues). No game files used.

Heads-Up: Zero-Conflict CI Interaction with Open PR #1874

  • Merging #1681 (86eb22f7e8) + #1874 (6fbb6552ef) onto origin/main (04f484006e) succeeds with zero Git conflicts (git merge-tree / git merge rc=0), but #1874's new vk_memory_fallback_and_pools test fails 2 assertions (rc=8) while d3d12_state_map passes:
    • FAIL: PresentComposer tries VRAM (1) -> BAR (0) -> RAM (2) in order
    • FAIL: OcclusionResolve tries VRAM (1) -> BAR (0) -> RAM (2)
  • Why: #1681 moves bar_window_type (type 0 on #1874's non-ReBAR mock) to the end of memory_type_order(memory, type_bits, 0, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, size) -> {1, 2, 0} (VRAM -> RAM -> BAR). #1874's detail::device_memory_order wraps memory_type_order(..., 0, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, size) with std::stable_partition on device_local && !small_bar, which yielded {1, 0, 2} on main ({0, 1, 2}) but preserves {1, 2, 0} once #1681 is merged.
  • Nothing is wrong in #1681 itself (VRAM -> RAM -> BAR is #1681's exact contract for allocations that do not request HOST_VISIBLE), just flagging so whichever of #1681 or #1874 merges second aligns detail::device_memory_order / vk_memory_fallback_and_pools_test.cpp on {1, 2, 0} vs {1, 0, 2}.

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249530570 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1681#issuecomment-7249530570). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T02:36:09Z. --- ### Independent Hardware Verification & Cross-PR Interaction Note (RTX 3090, Windows 11) - **Tested merge:** `origin/main` (`04f484006e`) + PR `#1681` (`86eb22f7e8`) — clean 3-way merge (`0` conflicts). - **Environment:** NVIDIA GeForce RTX 3090 (24 GB, Resizable BAR), Windows 11, Visual Studio 2022 (MSVC 19.44 `RelWithDebInfo`), Vulkan SDK + `VK_LAYER_KHRONOS_validation` `1.4.363.1` (`LEONIDA_VK_VALIDATION=1`). #### Red -> Green Results 1. **Red (with `#1681`'s `bar_window_type` deferral omitted in `memory_type_order`):** - `d3d12_state_map` failed (`rc=8`) at `line 898: memory_type_order(memory, 0xF, 0, local, 1 * mib) == (order{0, 1, 2, 3})`. 2. **Green (`origin/main` `04f484006e` + `#1681` `86eb22f7e8`, `LEONIDA_VK_VALIDATION=1`):** - **6/6 CTests passed** (`6.02 s` total, `0` Vulkan validation errors): - `d3d12_texture_memory`: Passed (`1.34 s`, `256 textures: 256 in 1 blocks of 67108864 bytes`) - `d3d12_buffer_tiles`: Passed (`1.55 s`, `12 full tiles matched`, native D3D12 tier-4 comparison matched) - `d3d12_texture_tiles`: Passed (`0` validation errors) - `d3d12_title_va`: Passed (`0` validation errors) - `d3d12_geometry_views`: Passed (`0.60 s`, `64/64` across table V#, created CBV, and root view; `11` negative controls held) - `d3d12_state_map`: Passed (`0.06 s`, BAR detection and `memory_type_order` / `bar_window_type` cases OK) - `python -I scripts/check_no_game_data.py` across all 3 touched files: passed (`0` issues). No game files used. #### Heads-Up: Zero-Conflict CI Interaction with Open PR `#1874` - Merging `#1681` (`86eb22f7e8`) + `#1874` (`6fbb6552ef`) onto `origin/main` (`04f484006e`) succeeds with **zero Git conflicts** (`git merge-tree` / `git merge` `rc=0`), **but `#1874`'s new `vk_memory_fallback_and_pools` test fails 2 assertions** (`rc=8`) while `d3d12_state_map` passes: - `FAIL: PresentComposer tries VRAM (1) -> BAR (0) -> RAM (2) in order` - `FAIL: OcclusionResolve tries VRAM (1) -> BAR (0) -> RAM (2)` - **Why:** `#1681` moves `bar_window_type` (`type 0` on `#1874`'s non-ReBAR mock) to the end of `memory_type_order(memory, type_bits, 0, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, size)` -> `{1, 2, 0}` (`VRAM -> RAM -> BAR`). `#1874`'s `detail::device_memory_order` wraps `memory_type_order(..., 0, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, size)` with `std::stable_partition` on `device_local && !small_bar`, which yielded `{1, 0, 2}` on `main` (`{0, 1, 2}`) but preserves `{1, 2, 0}` once `#1681` is merged. - Nothing is wrong in `#1681` itself (`VRAM -> RAM -> BAR` is `#1681`'s exact contract for allocations that do not request `HOST_VISIBLE`), just flagging so whichever of `#1681` or `#1874` merges second aligns `detail::device_memory_order` / `vk_memory_fallback_and_pools_test.cpp` on `{1, 2, 0}` vs `{1, 0, 2}`. AI-assisted: yes
OreoFR commented 2026-11-29 06:06:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T06:06:42Z.


Verified by OreoFR — READY

  • Base: main c8bf0e7b6 + this PR (head 86eb22f7e) merged with --no-ff
  • Red (main + only this PR's tests): d3d12_state_map_test does not compile on main (bar_window_type is the PR's helper). With the three bar_window_type checks taken out, it fails on main at line 898 (memory_type_order(memory, 0xF, 0, local, 1 * mib) == (order{0, 1, 2, 3})): a texture is offered the BAR-window type before system memory.
  • Green (merge): d3d12_state_map passes; ctest (Ninja RelWithDebInfo, all targets, gta6rt launchers excluded) in package p1 = main + #2546 + #1681 + #2479 + #1790 (no shared files): 495 tests, new failures vs main: none; an xmem working-set check failed once in the package as it does on main, and passed 5/5 when re-run alone (main alone: 494 tests, 5 failures: loader, xs_proxy_mock, xmem_no_write_watch, api_ref_state timeout, xbox_present; xbox_present fails in every package as on main). Game A/B below
  • gta6rt.exe links without the XMA decoder (LEONIDA_CARGO=OFF, LEONIDA_XMA2_DECODER_LIB empty), main + this PR alone; imports unchanged vs main (25 DLLs, 655 functions, no WS2_32)
  • Diff read: no issue. The test's expected orders match the new code by hand, and the tile-heap change only moves DEVICE_LOCAL from required to preferred, within the resource's own type bits.
  • Other runs: Consistent with zmasi's run and with adrianmjim's no-ReBAR AMD run (older head).
  • Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44

Game A/B (values only: no captures, logs or game paths leave this machine). A = gta6rt.exe built from main c8bf0e7b6. B = gta6rt.exe built from main + this PR. Both were built without the XMA decoder and launched with main's boot.ps1. Recipe: boot.ps1 -Seconds 210 -GameDir -Runtime -Shaders -OutDir, otherwise the defaults. The seed was a precompiled compute journal beside each gta6rt.exe, the same in both arms. Order: A1, (one #1790 boot), B1, A2, B2.

What this PR's path needs, and what this laptop can show. The reordering only applies to a memory type that bar_window_type() flags: DEVICE_LOCAL | HOST_VISIBLE in a device-local heap of at most the BAR window, which in practice means no Resizable BAR. This RTX 4070 Laptop has Resizable BAR: both arms log upload heaps in VRAM (DEVICE_LOCAL | HOST_VISIBLE, Resizable BAR). So no type is flagged, memory_type_order gives the same order as main, and the no-ReBAR path is not exercised here. Only the CPU unit test above covers it (red/green). The tile-heap change (DEVICE_LOCAL preferred instead of required) does apply with ReBAR. But it only matters when VRAM is full and a tile heap is refused, and no boot here logged an allocation failure. These boots check only that nothing regresses on a ReBAR machine.

Prediction (written before the first boot): the same ReBAR line in both arms, no allocation-failure lines, and first frame and frames/s within noise.

RUN w18-1681-A1 | 2026-11-29 UTC | OreoFR | AI-assisted: Claude Code (Claude Opus 5.5)
BASE:        c8bf0e7b6 | gta6rt built from c8bf0e7b6, boot.ps1 of main
MACHINE:     RTX 4070 Laptop 8 GB (ReBAR), laptop | NVIDIA 621.40 | Windows 11 | 40 GB
RECIPE:      documented (scripts/windows-boot/README.md, boot.ps1 defaults) + DEVIATIONS: -Seconds 210 | seed: precompiled compute journal
OS/DRIVER:   defaults (Resizable BAR on)
TARGET:      upload-heap line; allocation failures; first frame, frames/s | PREDICTED: ReBAR line, 0 failures
MEASURED:    "upload heaps in VRAM (DEVICE_LOCAL | HOST_VISIBLE, Resizable BAR)" | 0 out-of-memory/allocation-failure lines | rendering from t=25 s, median 22.1 frames/s (37 windows, 0 under 5) | PresentX ok 4266
END:         time limit (212 s); no device loss, no fault records
CACHES:      boot's pipeline cache fresh (own folder); seed read-only; NVIDIA driver cache not cleared | RUN 1 of 2 for A
VERDICT:     prediction held
RUN w18-1681-B1 | 2026-11-29 UTC | OreoFR | AI-assisted: Claude Code (Claude Opus 5.5)
BASE:        c8bf0e7b6 + #1681 (86eb22f7e), local merge | gta6rt built from that merge, boot.ps1 of main
MACHINE:     RTX 4070 Laptop 8 GB (ReBAR), laptop | NVIDIA 621.40 | Windows 11 | 40 GB
RECIPE:      as A1
OS/DRIVER:   defaults (Resizable BAR on)
TARGET:      as A1 | PREDICTED: same as A (path not taken with ReBAR)
MEASURED:    "upload heaps in VRAM (DEVICE_LOCAL | HOST_VISIBLE, Resizable BAR)" | 0 out-of-memory/allocation-failure lines | rendering from t=23 s, median 14.7 frames/s (37 windows, 4 under 5) | PresentX ok 2535
END:         time limit (215 s); no device loss, no fault records
CACHES:      as A1 | RUN 1 of 2 for B
VERDICT:     prediction held
RUN w18-1681-A2 | 2026-11-29 UTC | OreoFR | AI-assisted: Claude Code (Claude Opus 5.5)
BASE:        as A1
MACHINE:     RTX 4070 Laptop 8 GB (ReBAR), laptop | NVIDIA 621.40 | Windows 11 | 40 GB
RECIPE:      as A1
OS/DRIVER:   defaults (Resizable BAR on)
TARGET:      as A1 | PREDICTED: ReBAR line, 0 failures
MEASURED:    "upload heaps in VRAM (DEVICE_LOCAL | HOST_VISIBLE, Resizable BAR)" | 0 out-of-memory/allocation-failure lines | rendering from t=23 s, median 14.4 frames/s (36 windows, 5 under 5) | PresentX ok 2552
END:         time limit (213 s); no device loss, no fault records
CACHES:      as A1 | RUN 2 of 2 for A
VERDICT:     prediction held
RUN w18-1681-B2 | 2026-11-29 UTC | OreoFR | AI-assisted: Claude Code (Claude Opus 5.5)
BASE:        as B1
MACHINE:     RTX 4070 Laptop 8 GB (ReBAR), laptop | NVIDIA 621.40 | Windows 11 | 40 GB
RECIPE:      as A1
OS/DRIVER:   defaults (Resizable BAR on)
TARGET:      as A1 | PREDICTED: same as A
MEASURED:    "upload heaps in VRAM (DEVICE_LOCAL | HOST_VISIBLE, Resizable BAR)" | 0 out-of-memory/allocation-failure lines | rendering from t=23 s, median 15.6 frames/s (36 windows, 4 under 5) | PresentX ok 2594
END:         time limit (213 s); no device loss, no fault records
CACHES:      as A1 | RUN 2 of 2 for B
VERDICT:     prediction held

Result: no regression on a Resizable BAR machine. A1's higher frame rate comes from the screen that boot ended on; A2 matches B1 and B2. The PR's own case, no ReBAR, needs a card without Resizable BAR, or with it turned off in the firmware. This laptop can't show it.

AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7251654657 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1681#issuecomment-7251654657). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T06:06:42Z. --- **Verified by OreoFR** — READY - Base: main c8bf0e7b6 + this PR (head 86eb22f7e) merged with --no-ff - Red (main + only this PR's tests): `d3d12_state_map_test` does not compile on main (`bar_window_type` is the PR's helper). With the three `bar_window_type` checks taken out, it fails on main at line 898 (`memory_type_order(memory, 0xF, 0, local, 1 * mib) == (order{0, 1, 2, 3})`): a texture is offered the BAR-window type before system memory. - Green (merge): `d3d12_state_map` passes; ctest (Ninja RelWithDebInfo, all targets, gta6rt launchers excluded) in package p1 = main + #2546 + #1681 + #2479 + #1790 (no shared files): 495 tests, new failures vs main: none; an xmem working-set check failed once in the package as it does on main, and passed 5/5 when re-run alone (main alone: 494 tests, 5 failures: loader, xs_proxy_mock, xmem_no_write_watch, api_ref_state timeout, xbox_present; xbox_present fails in every package as on main). Game A/B below - gta6rt.exe links without the XMA decoder (`LEONIDA_CARGO=OFF`, `LEONIDA_XMA2_DECODER_LIB` empty), main + this PR alone; imports unchanged vs main (25 DLLs, 655 functions, no WS2_32) - Diff read: no issue. The test's expected orders match the new code by hand, and the tile-heap change only moves `DEVICE_LOCAL` from required to preferred, within the resource's own type bits. - Other runs: Consistent with zmasi's run and with adrianmjim's no-ReBAR AMD run (older head). - Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44 **Game A/B** (values only: no captures, logs or game paths leave this machine). A = `gta6rt.exe` built from main `c8bf0e7b6`. B = `gta6rt.exe` built from main + this PR. Both were built without the XMA decoder and launched with main's `boot.ps1`. Recipe: `boot.ps1 -Seconds 210 -GameDir -Runtime -Shaders -OutDir`, otherwise the defaults. The seed was a precompiled compute journal beside each `gta6rt.exe`, the same in both arms. Order: A1, (one #1790 boot), B1, A2, B2. **What this PR's path needs, and what this laptop can show.** The reordering only applies to a memory type that `bar_window_type()` flags: DEVICE_LOCAL | HOST_VISIBLE in a device-local heap of at most the BAR window, which in practice means no Resizable BAR. This RTX 4070 Laptop has Resizable BAR: both arms log `upload heaps in VRAM (DEVICE_LOCAL | HOST_VISIBLE, Resizable BAR)`. So no type is flagged, `memory_type_order` gives the same order as main, and **the no-ReBAR path is not exercised here**. Only the CPU unit test above covers it (red/green). The tile-heap change (DEVICE_LOCAL preferred instead of required) does apply with ReBAR. But it only matters when VRAM is full and a tile heap is refused, and no boot here logged an allocation failure. These boots check only that nothing regresses on a ReBAR machine. Prediction (written before the first boot): the same ReBAR line in both arms, no allocation-failure lines, and first frame and frames/s within noise. ``` RUN w18-1681-A1 | 2026-11-29 UTC | OreoFR | AI-assisted: Claude Code (Claude Opus 5.5) BASE: c8bf0e7b6 | gta6rt built from c8bf0e7b6, boot.ps1 of main MACHINE: RTX 4070 Laptop 8 GB (ReBAR), laptop | NVIDIA 621.40 | Windows 11 | 40 GB RECIPE: documented (scripts/windows-boot/README.md, boot.ps1 defaults) + DEVIATIONS: -Seconds 210 | seed: precompiled compute journal OS/DRIVER: defaults (Resizable BAR on) TARGET: upload-heap line; allocation failures; first frame, frames/s | PREDICTED: ReBAR line, 0 failures MEASURED: "upload heaps in VRAM (DEVICE_LOCAL | HOST_VISIBLE, Resizable BAR)" | 0 out-of-memory/allocation-failure lines | rendering from t=25 s, median 22.1 frames/s (37 windows, 0 under 5) | PresentX ok 4266 END: time limit (212 s); no device loss, no fault records CACHES: boot's pipeline cache fresh (own folder); seed read-only; NVIDIA driver cache not cleared | RUN 1 of 2 for A VERDICT: prediction held ``` ``` RUN w18-1681-B1 | 2026-11-29 UTC | OreoFR | AI-assisted: Claude Code (Claude Opus 5.5) BASE: c8bf0e7b6 + #1681 (86eb22f7e), local merge | gta6rt built from that merge, boot.ps1 of main MACHINE: RTX 4070 Laptop 8 GB (ReBAR), laptop | NVIDIA 621.40 | Windows 11 | 40 GB RECIPE: as A1 OS/DRIVER: defaults (Resizable BAR on) TARGET: as A1 | PREDICTED: same as A (path not taken with ReBAR) MEASURED: "upload heaps in VRAM (DEVICE_LOCAL | HOST_VISIBLE, Resizable BAR)" | 0 out-of-memory/allocation-failure lines | rendering from t=23 s, median 14.7 frames/s (37 windows, 4 under 5) | PresentX ok 2535 END: time limit (215 s); no device loss, no fault records CACHES: as A1 | RUN 1 of 2 for B VERDICT: prediction held ``` ``` RUN w18-1681-A2 | 2026-11-29 UTC | OreoFR | AI-assisted: Claude Code (Claude Opus 5.5) BASE: as A1 MACHINE: RTX 4070 Laptop 8 GB (ReBAR), laptop | NVIDIA 621.40 | Windows 11 | 40 GB RECIPE: as A1 OS/DRIVER: defaults (Resizable BAR on) TARGET: as A1 | PREDICTED: ReBAR line, 0 failures MEASURED: "upload heaps in VRAM (DEVICE_LOCAL | HOST_VISIBLE, Resizable BAR)" | 0 out-of-memory/allocation-failure lines | rendering from t=23 s, median 14.4 frames/s (36 windows, 5 under 5) | PresentX ok 2552 END: time limit (213 s); no device loss, no fault records CACHES: as A1 | RUN 2 of 2 for A VERDICT: prediction held ``` ``` RUN w18-1681-B2 | 2026-11-29 UTC | OreoFR | AI-assisted: Claude Code (Claude Opus 5.5) BASE: as B1 MACHINE: RTX 4070 Laptop 8 GB (ReBAR), laptop | NVIDIA 621.40 | Windows 11 | 40 GB RECIPE: as A1 OS/DRIVER: defaults (Resizable BAR on) TARGET: as A1 | PREDICTED: same as A MEASURED: "upload heaps in VRAM (DEVICE_LOCAL | HOST_VISIBLE, Resizable BAR)" | 0 out-of-memory/allocation-failure lines | rendering from t=23 s, median 15.6 frames/s (36 windows, 4 under 5) | PresentX ok 2594 END: time limit (213 s); no device loss, no fault records CACHES: as A1 | RUN 2 of 2 for B VERDICT: prediction held ``` Result: no regression on a Resizable BAR machine. A1's higher frame rate comes from the screen that boot ended on; A2 matches B1 and B2. The PR's own case, no ReBAR, needs a card without Resizable BAR, or with it turned off in the firmware. This laptop can't show it. AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
MoonEyes commented 2026-11-29 15:42:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T15:42:06Z.


Merged. Tested by @OreoFR on head 86eb22f7e (RTX 4070 Laptop 8 GB, Windows 11): red: without bar_window_type deferral d3d12_state_map fails line 898 (also test does not compile on main); green passes. Correction: no CI check run or commit status exists for this head, so CI did not validate it. My earlier sentence about red jobs was wrong. Thanks @ImLele69!

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7258297332 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1681#issuecomment-7258297332). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T15:42:06Z. --- Merged. Tested by @OreoFR on head 86eb22f7e (RTX 4070 Laptop 8 GB, Windows 11): red: without bar_window_type deferral d3d12_state_map fails line 898 (also test does not compile on main); green passes. Correction: no CI check run or commit status exists for this head, so CI did not validate it. My earlier sentence about red jobs was wrong. Thanks @ImLele69! AI-assisted: yes
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!1681
No description provided.