tests: verify placed attachment backing at submission (RT-PLACED-IMAGE-DEFER) #1100

Closed
github-bot wants to merge 1 commit from gh-pr/1100/head into gh-pr/1100/base
Owner

@⁠Moriz82 on GitHub · 2026-11-24 18:22 UTC · original
split/rt-placed-image-defer → main · +16 −4 · 1 files · 1 commits · closed without merging

Rebased onto 5129be10. #984 brought deferred slot-133 backing and the first-use fixture into main. This PR now retains three assertions from the original split. All four retry callers must succeed, an equivalent committed image must already have backing, and closing the command list must leave allocation deferred until submission in the default mode. The original test report is below. On c92dc976, d3d12_existing_heap passed 1/1 with deferred backing and 1/1 with LEONIDA_PLACED_IMAGE_DEFER=0 under Wine 11.22 on an RTX 4070 (NVIDIA 620.73.04). Both runs cover the four retry callers, the committed control, the backing check after close, and the 128-pixel readback.

Claimed in the coordination issue as: RT-PLACED-IMAGE-DEFER (claim).

Part of the split of #984 into small pull requests.

Depends on: none

Overlaps: #1079 resolves shader views of live placements by address. This change uses the existing slot-133 placement path on main. Streamed sources and shared BC backing are tracked separately.

What and why

Slot 133 allocated private Vulkan memory for every placed render target, depth/stencil target and storage texture, including attachments that only received a logical descriptor. On a device with a limited memory budget, unused attachments compete with active ones.

The image and its format and layout metadata still exist at creation. The runtime binds memory on the first command replay, shader view or CPU subresource copy that needs the image. Concurrent callers share one successful bind. A failed allocation or bind can be retried, and a failed bind releases its unused allocation. Set LEONIDA_PLACED_IMAGE_DEFER=0 for eager allocation.

Tested

Release cross-build with clang-cl 23 and an xwin SDK. Commands use a configured build directory. PROTON_WINE names the Wine executable and WINEPREFIX selects the test prefix.

cmake --build runtime/build/boot --target gta6rt -j6
cmake --build runtime/build/boot --target d3d12_existing_heap_test -j6
cd runtime/build/boot
export WINEDEBUG=-all
unset LEONIDA_PLACED_IMAGE_DEFER
timeout 120 "$PROTON_WINE" d3d12_existing_heap_test.exe
LEONIDA_PLACED_IMAGE_DEFER=0 timeout 120 "$PROTON_WINE" d3d12_existing_heap_test.exe

Both targets built. The existing-heap test passed twice on the same binary. Each run used a 16 × 8 RGBA8 render target placed at a reserved, inaccessible address.

Check Default Eager rollback
Placed target has backing after RTV creation and command-list close No Yes
Equivalent committed target has backing at creation Yes Yes
Placed target has backing after clear and copy Yes Yes
Cleared pixels read back as magenta 128/128 128/128
Bind helper after one injected failure 4/4 callers succeeded, one successful bind 4/4 callers succeeded, one successful bind

GPUs tested: NVIDIA GeForce RTX 4070 12 GB, driver 620.73.04, CachyOS kernel 7.3.5, Proton Experimental (Wine 11). Native Windows, AMD, Intel and a game boot were not tested on this child. The optional XMA decoder was omitted from the cross-build because its Rust target was unavailable.

AI-assisted: yes.

Checklist

  • One commit directly on upstream main 3aa975421.
  • One runtime change with synthetic render-target readback and a rollback control.
  • All tracked files passed python3 -I scripts/check_no_game_data.py.
  • Runtime only. No translator contract changes.

🤖 Generated with Claude Code

**@⁠Moriz82** on GitHub · 2026-11-24 18:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1100) `split/rt-placed-image-defer` → `main` · +16 −4 · 1 files · 1 commits · closed without merging **Rebased onto `5129be10`.** #984 brought deferred slot-133 backing and the first-use fixture into main. This PR now retains three assertions from the original split. All four retry callers must succeed, an equivalent committed image must already have backing, and closing the command list must leave allocation deferred until submission in the default mode. The original test report is below. On `c92dc976`, `d3d12_existing_heap` passed 1/1 with deferred backing and 1/1 with `LEONIDA_PLACED_IMAGE_DEFER=0` under Wine 11.22 on an RTX 4070 (NVIDIA 620.73.04). Both runs cover the four retry callers, the committed control, the backing check after close, and the 128-pixel readback. Claimed in the coordination issue as: RT-PLACED-IMAGE-DEFER ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)). Part of the split of #984 into small pull requests. Depends on: none Overlaps: #1079 resolves shader views of live placements by address. This change uses the existing slot-133 placement path on main. Streamed sources and shared BC backing are tracked separately. ### What and why Slot 133 allocated private Vulkan memory for every placed render target, depth/stencil target and storage texture, including attachments that only received a logical descriptor. On a device with a limited memory budget, unused attachments compete with active ones. The image and its format and layout metadata still exist at creation. The runtime binds memory on the first command replay, shader view or CPU subresource copy that needs the image. Concurrent callers share one successful bind. A failed allocation or bind can be retried, and a failed bind releases its unused allocation. Set `LEONIDA_PLACED_IMAGE_DEFER=0` for eager allocation. ### Tested Release cross-build with clang-cl 23 and an xwin SDK. Commands use a configured build directory. `PROTON_WINE` names the Wine executable and `WINEPREFIX` selects the test prefix. ```sh cmake --build runtime/build/boot --target gta6rt -j6 cmake --build runtime/build/boot --target d3d12_existing_heap_test -j6 cd runtime/build/boot export WINEDEBUG=-all unset LEONIDA_PLACED_IMAGE_DEFER timeout 120 "$PROTON_WINE" d3d12_existing_heap_test.exe LEONIDA_PLACED_IMAGE_DEFER=0 timeout 120 "$PROTON_WINE" d3d12_existing_heap_test.exe ``` Both targets built. The existing-heap test passed twice on the same binary. Each run used a 16 × 8 RGBA8 render target placed at a reserved, inaccessible address. | Check | Default | Eager rollback | | --- | --- | --- | | Placed target has backing after RTV creation and command-list close | No | Yes | | Equivalent committed target has backing at creation | Yes | Yes | | Placed target has backing after clear and copy | Yes | Yes | | Cleared pixels read back as magenta | 128/128 | 128/128 | | Bind helper after one injected failure | 4/4 callers succeeded, one successful bind | 4/4 callers succeeded, one successful bind | GPUs tested: NVIDIA GeForce RTX 4070 12 GB, driver 620.73.04, CachyOS kernel 7.3.5, Proton Experimental (Wine 11). Native Windows, AMD, Intel and a game boot were not tested on this child. The optional XMA decoder was omitted from the cross-build because its Rust target was unavailable. AI-assisted: yes. ### Checklist - [x] One commit directly on upstream main `3aa975421`. - [x] One runtime change with synthetic render-target readback and a rollback control. - [x] All tracked files passed `python3 -I scripts/check_no_game_data.py`. - [x] Runtime only. No translator contract changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Retain the regression checks omitted from the integrated fixture. Verify
the four retry callers each succeeded, an equivalent committed image
already has backing, and closing the command list leaves the placement
in its expected state until submission.

Co-authored-by: Plaaasma <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:38:11 +00:00
github-bot closed this pull request 2026-11-26 09:38:11 +00:00
Author
Owner

@⁠Plaaasma on GitHub · 2026-11-24 18:36 UTC · original

Native Windows check, AI-assisted (Claude Code). Windows 11, i9-13900K, 64 GB, RTX 4070 Ti 12 GB (NVIDIA 630.20), MSVC 2022 (VS 17 generator, Release), Vulkan.

Head 84d0675f1. Built d3d12_existing_heap_test, then ctest -C Release -R "^d3d12_existing_heap$" --output-on-failure --timeout 300:

  • d3d12_existing_heap: passed, 1.17 s (exit 0)
  • new case: first GPU use: deferred backing, 128 cleared pixels matched; four first-use callers, two bind attempts
  • OpenExistingHeapFromAddress: 8 cases match against both the host NVIDIA adapter and WARP

1 passed, 0 failed.

**@⁠Plaaasma** on GitHub · 2026-11-24 18:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1100#issuecomment-7140874082) Native Windows check, AI-assisted (Claude Code). Windows 11, i9-13900K, 64 GB, RTX 4070 Ti 12 GB (NVIDIA 630.20), MSVC 2022 (VS 17 generator, Release), Vulkan. Head `84d0675f1`. Built `d3d12_existing_heap_test`, then `ctest -C Release -R "^d3d12_existing_heap$" --output-on-failure --timeout 300`: - `d3d12_existing_heap`: **passed**, 1.17 s (exit 0) - new case: `first GPU use: deferred backing, 128 cleared pixels matched; four first-use callers, two bind attempts` - `OpenExistingHeapFromAddress`: 8 cases match against both the host NVIDIA adapter and WARP 1 passed, 0 failed.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:40 UTC · original · approved these changes

Audited and verified. Implements lazy memory binding (DeferredImageBinding) for title-placed GPU-only attachment textures in slot 133, deferring physical allocation to first replay or view use while allowing RTV/DSV creation immediately from metadata. Thread-safe single-initialization with retry semantics. Tests in
untime/test/d3d12_title_placed_test.cpp verify execution and clearance. Approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1100#pullrequestreview-6045211739) · **approved these changes** Audited and verified. Implements lazy memory binding (DeferredImageBinding) for title-placed GPU-only attachment textures in slot 133, deferring physical allocation to first replay or view use while allowing RTV/DSV creation immediately from metadata. Thread-safe single-initialization with retry semantics. Tests in untime/test/d3d12_title_placed_test.cpp verify execution and clearance. Approved.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:54 UTC · original · approved these changes

Clean-Room Audit — PR #1100 (RT-PLACED-IMAGE-DEFER)

Clean deferred memory binding design for placed render target / depth-stencil / UAV textures (DeferredImageBinding) until first use, preventing premature allocation failure while keeping LEONIDA_PLACED_IMAGE_DEFER=0 override and full readback pixel verification in d3d12_existing_heap_test.cpp. 0 game data.

Verdict: APPROVED

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:54 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1100#pullrequestreview-6045401307) · **approved these changes** ### Clean-Room Audit — PR #1100 (`RT-PLACED-IMAGE-DEFER`) Clean deferred memory binding design for placed render target / depth-stencil / UAV textures (`DeferredImageBinding`) until first use, preventing premature allocation failure while keeping `LEONIDA_PLACED_IMAGE_DEFER=0` override and full readback pixel verification in `d3d12_existing_heap_test.cpp`. 0 game data. **Verdict: APPROVED**
Author
Owner

@⁠iFeyz on GitHub · 2026-11-24 19:51 UTC · original

AMD run (the gap the description lists): RX 9070 XT (RDNA4, GFX1201), AMD proprietary Windows driver 26.11.2 (LLPC, Vulkan 1.4.359), Windows 11, MSVC 2022 RelWithDebInfo.

Head 84d0675f1: d3d12_existing_heap built from it passes on this AMD machine (MalexAson reported this test failing on an Intel Iris Xe in #14, so it is not a general Windows failure).

**@⁠iFeyz** on GitHub · 2026-11-24 19:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1100#issuecomment-7142680093) AMD run (the gap the description lists): RX 9070 XT (RDNA4, GFX1201), AMD proprietary Windows driver 26.11.2 (LLPC, Vulkan 1.4.359), Windows 11, MSVC 2022 RelWithDebInfo. Head `84d0675f1`: `d3d12_existing_heap` built from it **passes** on this AMD machine (MalexAson reported this test failing on an Intel Iris Xe in #14, so it is not a general Windows failure).
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:17 UTC · original

Recommendation: [MERGE]

Reasoning: Slot-133 placed render-target/DS/storage images now bind memory on first GPU use instead of always allocating private memory, which cuts memory pressure on limited-budget devices. A moderate runtime behaviour change (+194, new deferred_image_binding.h) with a 102-line test. Verified on NVIDIA RTX 4070 Ti and AMD RX 9070 XT. Watch for interaction with #1079 and with #1190/#1192, which touch the existing-heap test. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 6/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1100#issuecomment-7143327238) **Recommendation:** [MERGE] **Reasoning:** Slot-133 placed render-target/DS/storage images now bind memory on first GPU use instead of always allocating private memory, which cuts memory pressure on limited-budget devices. A moderate runtime behaviour change (+194, new `deferred_image_binding.h`) with a 102-line test. Verified on NVIDIA RTX 4070 Ti and AMD RX 9070 XT. Watch for interaction with #1079 and with #1190/#1192, which touch the existing-heap test. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 6/10
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-24 20:52 UTC · original

GPU verification (AI-assisted, overnight worker w4; independent run, not the author's).

Head tested: 84d0675 on this machine's two GPUs.

AMD Radeon iGPU (gfx1035, RDNA2, driver 24.10.24, Vulkan 1.3.280) — env: VK_LOADER_DRIVERS_SELECT=*amd-vulkan* LEONIDA_VK_DEVICE=radeon VK_LOADER_LAYERS_DISABLE=~implicit~ LEONIDA_VK_VALIDATION=1 LEONIDA_PC_TAIL_UBO=1

  • ctest --test-dir runtime/build -R "d3d12|vk_" --output-on-failure -j4: 115/142 passed, 27 failed — the identical 27 failures reproduce on unmodified main (6293c1c4f, separate worktree build), so all pre-existing/environmental.
  • Placed-image tests specifically: d3d12_existing_heap, d3d12_placed_dimensions, d3d12_placed_heap_lifetime, d3d12_xmem_placed — 4/4 pass, including with LEONIDA_PLACED_IMAGE_DEFER=0 (eager rollback path verified on the iGPU with validation on).
  • python -I scripts/run_gpu_tests.py --build runtime/build: 230/252 passed, 20 skipped, 2 failed — only ms_clip and ms_wave_info_s3, the known AMD iGPU LLPC crashes (fixes in open #802/#808).

NVIDIA RTX 4070 SUPER — env: VK_LOADER_DRIVERS_SELECT=*nv-vk* LEONIDA_VK_DEVICE=4070 VK_LOADER_LAYERS_DISABLE=~implicit~

  • ctest -R "d3d12|vk_" -j4: 141/142 passed; only d3d12_execute_indirect_validation fails — same 5 parity failures reproduce on unmodified main (verified), pre-existing.
  • The 4 placed-image tests also pass on NVIDIA.
  • run_gpu_tests.py: 203/252 passed, 49 skipped, 0 failed.

Verdict: deferred placed-image binding shows no regressions on either GPU; the new concurrency/retry coverage passes under validation. LGTM from this hardware.

**@⁠whoalin1** on GitHub · 2026-11-24 20:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1100#issuecomment-7144182141) GPU verification (AI-assisted, overnight worker w4; independent run, not the author's). Head tested: 84d0675 on this machine's two GPUs. **AMD Radeon iGPU (gfx1035, RDNA2, driver 24.10.24, Vulkan 1.3.280)** — env: `VK_LOADER_DRIVERS_SELECT=*amd-vulkan* LEONIDA_VK_DEVICE=radeon VK_LOADER_LAYERS_DISABLE=~implicit~ LEONIDA_VK_VALIDATION=1 LEONIDA_PC_TAIL_UBO=1` - `ctest --test-dir runtime/build -R "d3d12|vk_" --output-on-failure -j4`: 115/142 passed, 27 failed — **the identical 27 failures reproduce on unmodified main (6293c1c4f, separate worktree build)**, so all pre-existing/environmental. - Placed-image tests specifically: `d3d12_existing_heap`, `d3d12_placed_dimensions`, `d3d12_placed_heap_lifetime`, `d3d12_xmem_placed` — **4/4 pass**, including with `LEONIDA_PLACED_IMAGE_DEFER=0` (eager rollback path verified on the iGPU with validation on). - `python -I scripts/run_gpu_tests.py --build runtime/build`: **230/252 passed, 20 skipped, 2 failed** — only `ms_clip` and `ms_wave_info_s3`, the known AMD iGPU LLPC crashes (fixes in open #802/#808). **NVIDIA RTX 4070 SUPER** — env: `VK_LOADER_DRIVERS_SELECT=*nv-vk* LEONIDA_VK_DEVICE=4070 VK_LOADER_LAYERS_DISABLE=~implicit~` - `ctest -R "d3d12|vk_" -j4`: 141/142 passed; only `d3d12_execute_indirect_validation` fails — same 5 parity failures reproduce on unmodified main (verified), pre-existing. - The 4 placed-image tests also pass on NVIDIA. - `run_gpu_tests.py`: **203/252 passed, 49 skipped, 0 failed**. Verdict: deferred placed-image binding shows no regressions on either GPU; the new concurrency/retry coverage passes under validation. LGTM from this hardware.
Author
Owner

@⁠Moriz82 on GitHub · 2026-11-25 03:42 UTC · original

The deferred slot-133 backing and the matching first-use test are on current main via #984. The test exercises a failed bind and retry, four concurrent callers, and the readback of 128 cleared pixels. The older split also conflicts with the newer image-pooling and placement code, so a rebase would reintroduce overlapping runtime paths.

AI-assisted.

**@⁠Moriz82** on GitHub · 2026-11-25 03:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1100#issuecomment-7152163795) The deferred slot-133 backing and the matching first-use test are on current main via #984. The test exercises a failed bind and retry, four concurrent callers, and the readback of 128 cleared pixels. The older split also conflicts with the newer image-pooling and placement code, so a rebase would reintroduce overlapping runtime paths. AI-assisted.
Author
Owner

@⁠Moriz82 on GitHub · 2026-11-25 03:55 UTC · original · edited 2026-11-25 03:57 UTC

I checked the old runs on 84d0675. CI, No Game Data, and Runtime were waiting for maintainer approval. The conflict-label job was cancelled before it reached a runner.

I rebased the remaining regression assertions onto 5129be10 and pushed c92dc976. The implementation is already in #984. This diff checks all four retry results, the committed-image control, and the placement’s backing after command-list close. On c92dc976, d3d12_existing_heap passed 1/1 with deferred backing and 1/1 with LEONIDA_PLACED_IMAGE_DEFER=0 under Wine 11.22 on an RTX 4070 (NVIDIA 620.73.04). Both runs cover the four retry callers, the committed control, the backing check after close, and the 128-pixel readback.

AI-assisted.

**@⁠Moriz82** on GitHub · 2026-11-25 03:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1100#issuecomment-7152374193) · edited 2026-11-25 03:57 UTC I checked the old runs on `84d0675`. CI, No Game Data, and Runtime were waiting for maintainer approval. The conflict-label job was cancelled before it reached a runner. I rebased the remaining regression assertions onto `5129be10` and pushed `c92dc976`. The implementation is already in #984. This diff checks all four retry results, the committed-image control, and the placement’s backing after command-list close. On `c92dc976`, `d3d12_existing_heap` passed 1/1 with deferred backing and 1/1 with `LEONIDA_PLACED_IMAGE_DEFER=0` under Wine 11.22 on an RTX 4070 (NVIDIA 620.73.04). Both runs cover the four retry callers, the committed control, the backing check after close, and the 128-pixel readback. AI-assisted.
Author
Owner

@⁠Gefik23 on GitHub · 2026-11-25 05:51 UTC · original

Tested 84d0675f1 on NVIDIA GeForce RTX 4060 (Ada), driver 617.42, Windows 11 Pro build 26200, native Windows (not Proton): pass.

Built at this head with scripts\build_runtime.ps1 (MSVC 19.44, VS 2022 Build Tools, Ninja, RelWithDebInfo, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0).

  • ctest -R ^d3d12_existing_heap -V: passed.
  • Full ctest -C RelWithDebInfo: 296/297. The one failure is d3d12_execute_indirect_validation, which also fails on main on this host (stock Windows 11 d3d12core 10.0.26100.7309) and is fixed by #1066; this branch predates it. Game-data tests skipped (LEONIDA_GAME_DIR unset).

AI-assisted (Claude Code ran the build and tests). No game files.

**@⁠Gefik23** on GitHub · 2026-11-25 05:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1100#issuecomment-7154200174) Tested 84d0675f1 on NVIDIA GeForce RTX 4060 (Ada), driver 617.42, Windows 11 Pro build 26200, native Windows (not Proton): pass. Built at this head with `scripts\build_runtime.ps1` (MSVC 19.44, VS 2022 Build Tools, Ninja, RelWithDebInfo, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0). - `ctest -R ^d3d12_existing_heap -V`: passed. - Full `ctest -C RelWithDebInfo`: 296/297. The one failure is `d3d12_execute_indirect_validation`, which also fails on main on this host (stock Windows 11 d3d12core 10.0.26100.7309) and is fixed by #1066; this branch predates it. Game-data tests skipped (LEONIDA_GAME_DIR unset). AI-assisted (Claude Code ran the build and tests). No game files.
Author
Owner

@⁠Moriz82 on GitHub · 2026-11-25 05:52 UTC · original

@⁠Gefik23 Thanks for the native Windows run on 84d0675f1 and for checking the d3d12_execute_indirect_validation failure against main. #1066 is already in the current head.

Could you rerun the targeted test on c92dc9762, once with LEONIDA_PLACED_IMAGE_DEFER unset and once set to 0? Both passed under Wine 11.22 on this head.

ctest --test-dir <build> -C RelWithDebInfo -R "^d3d12_existing_heap$" --output-on-failure

AI-assisted.

**@⁠Moriz82** on GitHub · 2026-11-25 05:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1100#issuecomment-7154226795) @⁠Gefik23 Thanks for the native Windows run on `84d0675f1` and for checking the `d3d12_execute_indirect_validation` failure against main. #1066 is already in the current head. Could you rerun the targeted test on `c92dc9762`, once with `LEONIDA_PLACED_IMAGE_DEFER` unset and once set to `0`? Both passed under Wine 11.22 on this head. `ctest --test-dir <build> -C RelWithDebInfo -R "^d3d12_existing_heap$" --output-on-failure` AI-assisted.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.