startup: keep closed lists submittable across their allocator's Reset #1350

Merged
Jess-Doit merged 4 commits from upstream-pr/1357 into main 2026-11-24 09:58:41 +00:00
Jess-Doit commented 2026-11-24 09:10:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-24T09:10:06Z.


Change

Fixes #1352.

In X2W_D3D12_RENDER=1 mode, the D3D12 stand-in (src/startup_stubs/d3d12_xs_device.cpp) had two problems:

  • Resubmits were dropped. queue_execute cleared list_ready on a list's first submit, so later submits of the same closed list did nothing. Desktop D3D12 allows a closed list to be executed again until it is reset.
  • Allocator Reset (slot 8) was forwarded unchanged. That discards the recordings of every list on the allocator, and it is invalid while the GPU still runs them. A console recording survives its allocator's Reset.

Now, in render mode only:

  • Resubmits. A closed list stays submittable until its own Reset (list slot 139).
  • Sampler heaps. retire_draw_sampler_heaps gives each submit its own references to the list's sampler heaps. Before, it moved them into the first submit's batch, which a second submit would have outlived. The list keeps its own references until discard_draw_sampler_heaps at its next Reset.
  • Allocator pool. Each title allocator stands for a pool of desktop allocators, starting with the one it was created with, and a list Reset records on the pool's current one.
    • For each desktop allocator the stand-in counts the lists holding a recording on it. After each submit it also keeps, per queue, a fence value the queue signals.
    • At the title's Reset, the current allocator is reset only if no list holds a recording on it and every queue has passed its last submit.
    • Otherwise the title continues on an idle allocator from the pool, or a new one of the lists' type. The busy one keeps its recordings.
  • Failed tracking. ExecuteCommandLists has already run when the tracking fence is created and signalled. If either step fails, each submitted list's allocator is marked untracked and is never reset or reused again. Its GPU work keeps its memory, at the cost of one allocator.
  • Bookkeeping keys. The tables are keyed by wrapper address. Wrappers are never freed (release only counts), so a later object cannot reuse an entry.

Outside render mode nothing changes: allocator Reset is forwarded, and lists record on the allocator they were reset with.

Fixture

tests/startup_list_resubmit.cpp goes through D3D12XboxCreateDevice with X2W_D3D12_PERMISSIVE=1 X2W_D3D12_LIST_NOOP=1 X2W_D3D12_RENDER=1 X2W_D3D12_DEBUG=1.

  • Setup: list A records a clear to red on allocator a, and list B a clear to green on allocator b. Both clear the same 1x1 RGBA8 target.
  • Each step submits through console queue slot 10, signals a fence and waits for it, then copies the texel back on a desktop queue.
Step Calls Must read
1 submit A red ff0000ff
2 submit B, then A again green, then red
3 allocator a Reset (A still holds its recording), submit B, then A green, then red
4 Reset A on a, clear to blue, submit blue ffff0000
5 queue Wait on fence H (slot 17); submit A behind it; Reset A on b, clear to green; Reset allocator a, which now holds no recording but has a submit the GPU has not passed; the CPU signals H; then submit A blue from the pending submit, then green
6 A on a, clear to red, submit; Reset allocator a; A on a, clear to blue, submit red; x2w_d3d12_allocator_pool_size(a) = 2, because the earlier allocator the GPU has passed is reused; blue

startup_list_resubmit_untracked_* runs the same probe with X2W_TEST_SUBMIT_FENCE_FAIL=1, which makes every submit fence fail. Steps 1–5 must read the same. Nothing may be reset or reused, so step 6 must find 4 desktop allocators behind a.

At the end, GetDeviceRemovedReason must be S_OK, and the debug layer must have stored no error or corruption messages (ID3D12InfoQueue). In step 3 the stand-in logs allocator … Reset -> 0x00000000, 2 desktop allocators.

Negative controls:

  • With src/startup_stubs from main (before #1348), the probe fails at step 2 on both adapters (exit 23):

    2 submit A again: ff00ff00 (expected ff0000ff)
    
  • With the per-queue fence check removed from allocator_idle, step 5 fails on both adapters (exit 56). The readback returns 00000000 instead of the pending blue clear.

  • With the untracked check removed from allocator_idle, startup_list_resubmit_untracked_* fails at step 5 on both adapters in the same way. The allocator holding the pending submit is reset, because its failed fence left no submit to wait for.

Verification

Tested a14064ec (on a merge of main at b9c9f624) on Windows 10 22H2 19045.6456 with a GTX 1060 6 GB (10de:1c03, driver 32.0.15.6094) and in-box WARP (10.0.19041.5794), with the D3D12 debug layer enabled.

. .\tools\dev.ps1
$env:XBOX2WINDOWS_ADAPTER = '1060'
$env:X2W_D3D12_DEBUG = '1'
foreach ($preset in 'dev', 'release') {
    cmake --preset $preset
    cmake --build --preset $preset --target startup_list_resubmit startup_queue_wait d3d12_xs_shim startup_stream_consumer xmem_shim startup_stub_xg_xs offscreen_check startup_dump_fence_check startup_plane_refresh startup_nv12_draw -j 2
    ctest --preset $preset --no-tests=error -R '^startup_(list_resubmit_|queue_wait_|stream_|mrt_|xg_bc7_draw_|address_srv_|address_bc_view_|xg_bc_chain_|dump_fence|plane_refresh_|nv12_draw_)'
}
  • Debug and Release: 26/26 passed in each. Besides startup_list_resubmit_{,untracked_}{warp,hardware}, the selection covers startup_queue_wait_* and the existing render-mode tests that submit through queue_execute: stream request and draw, MRT, BC7 draw, address SRV, address BC view, BC chain, dump fence, plane refresh and NV12 draw.
  • tests/docs_links_check.py: passed.

Probe output, the same on both adapters:

1 submit A: ff0000ff (expected ff0000ff)
2 submit B: ff00ff00 (expected ff00ff00)
2 submit A again: ff0000ff (expected ff0000ff)
3 after allocator Reset, submit B: ff00ff00 (expected ff00ff00)
3 after allocator Reset, submit A: ff0000ff (expected ff0000ff)
4 A reset on a, clear blue: ffff0000 (expected ffff0000)
5 Reset while the GPU waits, pending submit of A: ffff0000 (expected ffff0000)
5 A re-recorded on b: ff00ff00 (expected ff00ff00)
6 A on a, clear red: ff0000ff (expected ff0000ff)
6 desktop allocators behind a: 2 (expected 2)
6 A after the Reset, clear blue: ffff0000 (expected ffff0000)
device removed reason: 0x00000000, debug layer errors: 0

The untracked runs print the same lines, except 6 desktop allocators behind a: 4 (expected 4).

CI runs startup_list_resubmit_warp in the Debug and Release Windows jobs.

Not covered

  • Pool size. Allocators in a pool are kept for the process lifetime. A pool grows only while its allocators are busy; with one list per allocator it settles at two.
  • Resources released while GPU work is in flight are a separate follow-up.
  • The X2W_DRAW_DUMP_FRAME readback tracker was not checked with resubmitted lists.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6578391741 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1357). Originally posted by [Jess-Doit](https://github.com/Jess-Doit) on 2026-11-24T09:10:06Z. --- ## Change Fixes #1352. In `X2W_D3D12_RENDER=1` mode, the D3D12 stand-in (`src/startup_stubs/d3d12_xs_device.cpp`) had two problems: - **Resubmits were dropped.** `queue_execute` cleared `list_ready` on a list's first submit, so later submits of the same closed list did nothing. Desktop D3D12 allows a closed list to be executed again until it is reset. - **Allocator Reset (slot 8) was forwarded unchanged.** That discards the recordings of every list on the allocator, and it is invalid while the GPU still runs them. A console recording survives its allocator's Reset. Now, in render mode only: - **Resubmits.** A closed list stays submittable until its own Reset (list slot 139). - **Sampler heaps.** `retire_draw_sampler_heaps` gives each submit its own references to the list's sampler heaps. Before, it moved them into the first submit's batch, which a second submit would have outlived. The list keeps its own references until `discard_draw_sampler_heaps` at its next Reset. - **Allocator pool.** Each title allocator stands for a pool of desktop allocators, starting with the one it was created with, and a list Reset records on the pool's current one. - For each desktop allocator the stand-in counts the lists holding a recording on it. After each submit it also keeps, per queue, a fence value the queue signals. - At the title's Reset, the current allocator is reset only if no list holds a recording on it and every queue has passed its last submit. - Otherwise the title continues on an idle allocator from the pool, or a new one of the lists' type. The busy one keeps its recordings. - **Failed tracking.** `ExecuteCommandLists` has already run when the tracking fence is created and signalled. If either step fails, each submitted list's allocator is marked untracked and is never reset or reused again. Its GPU work keeps its memory, at the cost of one allocator. - **Bookkeeping keys.** The tables are keyed by wrapper address. Wrappers are never freed (`release` only counts), so a later object cannot reuse an entry. Outside render mode nothing changes: allocator Reset is forwarded, and lists record on the allocator they were reset with. ## Fixture `tests/startup_list_resubmit.cpp` goes through `D3D12XboxCreateDevice` with `X2W_D3D12_PERMISSIVE=1 X2W_D3D12_LIST_NOOP=1 X2W_D3D12_RENDER=1 X2W_D3D12_DEBUG=1`. - **Setup:** list A records a clear to red on allocator a, and list B a clear to green on allocator b. Both clear the same 1x1 RGBA8 target. - **Each step** submits through console queue slot 10, signals a fence and waits for it, then copies the texel back on a desktop queue. | Step | Calls | Must read | |---|---|---| | 1 | submit A | red `ff0000ff` | | 2 | submit B, then A again | green, then red | | 3 | allocator a Reset (A still holds its recording), submit B, then A | green, then red | | 4 | Reset A on a, clear to blue, submit | blue `ffff0000` | | 5 | queue Wait on fence H (slot 17); submit A behind it; Reset A on b, clear to green; Reset allocator a, which now holds no recording but has a submit the GPU has not passed; the CPU signals H; then submit A | blue from the pending submit, then green | | 6 | A on a, clear to red, submit; Reset allocator a; A on a, clear to blue, submit | red; `x2w_d3d12_allocator_pool_size(a)` = 2, because the earlier allocator the GPU has passed is reused; blue | `startup_list_resubmit_untracked_*` runs the same probe with `X2W_TEST_SUBMIT_FENCE_FAIL=1`, which makes every submit fence fail. Steps 1–5 must read the same. Nothing may be reset or reused, so step 6 must find 4 desktop allocators behind a. At the end, `GetDeviceRemovedReason` must be `S_OK`, and the debug layer must have stored no error or corruption messages (`ID3D12InfoQueue`). In step 3 the stand-in logs `allocator … Reset -> 0x00000000, 2 desktop allocators`. **Negative controls:** - With `src/startup_stubs` from `main` (before #1348), the probe fails at step 2 on both adapters (exit 23): ```text 2 submit A again: ff00ff00 (expected ff0000ff) ``` - With the per-queue fence check removed from `allocator_idle`, step 5 fails on both adapters (exit 56). The readback returns `00000000` instead of the pending blue clear. - With the `untracked` check removed from `allocator_idle`, `startup_list_resubmit_untracked_*` fails at step 5 on both adapters in the same way. The allocator holding the pending submit is reset, because its failed fence left no submit to wait for. ## Verification Tested `a14064ec` (on a merge of `main` at `b9c9f624`) on Windows 10 22H2 `19045.6456` with a GTX 1060 6 GB (`10de:1c03`, driver `32.0.15.6094`) and in-box WARP (`10.0.19041.5794`), with the D3D12 debug layer enabled. ```powershell . .\tools\dev.ps1 $env:XBOX2WINDOWS_ADAPTER = '1060' $env:X2W_D3D12_DEBUG = '1' foreach ($preset in 'dev', 'release') { cmake --preset $preset cmake --build --preset $preset --target startup_list_resubmit startup_queue_wait d3d12_xs_shim startup_stream_consumer xmem_shim startup_stub_xg_xs offscreen_check startup_dump_fence_check startup_plane_refresh startup_nv12_draw -j 2 ctest --preset $preset --no-tests=error -R '^startup_(list_resubmit_|queue_wait_|stream_|mrt_|xg_bc7_draw_|address_srv_|address_bc_view_|xg_bc_chain_|dump_fence|plane_refresh_|nv12_draw_)' } ``` - **Debug and Release:** 26/26 passed in each. Besides `startup_list_resubmit_{,untracked_}{warp,hardware}`, the selection covers `startup_queue_wait_*` and the existing render-mode tests that submit through `queue_execute`: stream request and draw, MRT, BC7 draw, address SRV, address BC view, BC chain, dump fence, plane refresh and NV12 draw. - **`tests/docs_links_check.py`:** passed. Probe output, the same on both adapters: ```text 1 submit A: ff0000ff (expected ff0000ff) 2 submit B: ff00ff00 (expected ff00ff00) 2 submit A again: ff0000ff (expected ff0000ff) 3 after allocator Reset, submit B: ff00ff00 (expected ff00ff00) 3 after allocator Reset, submit A: ff0000ff (expected ff0000ff) 4 A reset on a, clear blue: ffff0000 (expected ffff0000) 5 Reset while the GPU waits, pending submit of A: ffff0000 (expected ffff0000) 5 A re-recorded on b: ff00ff00 (expected ff00ff00) 6 A on a, clear red: ff0000ff (expected ff0000ff) 6 desktop allocators behind a: 2 (expected 2) 6 A after the Reset, clear blue: ffff0000 (expected ffff0000) device removed reason: 0x00000000, debug layer errors: 0 ``` The `untracked` runs print the same lines, except `6 desktop allocators behind a: 4 (expected 4)`. CI runs `startup_list_resubmit_warp` in the Debug and Release Windows jobs. ## Not covered - **Pool size.** Allocators in a pool are kept for the process lifetime. A pool grows only while its allocators are busy; with one list per allocator it settles at two. - **Resources released while GPU work is in flight** are a separate follow-up. - **The `X2W_DRAW_DUMP_FRAME` readback tracker** was not checked with resubmitted lists. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-24 10:02:28 +00:00
tedin7 commented 2026-11-24 10:02:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T09:16:10Z.

Review: COMMENTED


Technical peer-review at commit fc6d25db6a6d4bc1a68067d8ee8aafdbd6f7467a.

Verification

  • Linux:
    • git diff --check origin/main...HEAD: clean.
    • tests/docs_links_check.py: passed (16 Markdown files, 301 links).
    • tests/bidi_controls_check.py: passed (1130 tracked files).
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): 11/11 passed (startup_list_resubmit_{warp,hardware}, startup_stream_{request,draw}_*, startup_mrt_{fxc,dxc}_*, startup_xg_bc7_draw_*) in 6.90s (build 25.24s).
    • Release /O2 (--preset release): 11/11 passed in 8.28s (build 42.04s).

Code Review Notes

  • Locking & lifetime: Lock ordering is consistent (draw_lock -> allocator_lock in note_submits; list_reset releases allocator_lock before discard_draw_sampler_heaps), and retire_draw_sampler_heaps now copies ComPtrs per submit so resubmissions retain sampler heap references until list_reset.
  • device_create_command_list_x (src/startup_stubs/d3d12_xs_device.cpp:2210): Passes unwrap(allocator) (the initial ID3D12CommandAllocator*) rather than title_allocator(a).current->real. If a new list is created after allocator_reset has swapped current, CreateCommandList will touch the older/busy desktop allocator (though it immediately Close()s the list).
  • allocator_reset (src/startup_stubs/d3d12_xs_device.cpp:1060-1061): next->submits.clear() runs before next->real->Reset(); moving it inside if (SUCCEEDED(hr)) would avoid mutating state on a failed Reset.
  • Coverage: tests/startup_list_resubmit.cpp exercises the allocator->lists != 0 swap path and resubmission across allocator_reset, though as noted in the PR description, Probe::submit waits on the fence after each submit so the in-flight GPU fence branch (GetCompletedValue() < submit.second) is not exercised by the test.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6036523082 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1357#pullrequestreview-6036523082). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T09:16:10Z. **Review:** COMMENTED --- Technical peer-review at commit `fc6d25db6a6d4bc1a68067d8ee8aafdbd6f7467a`. ### Verification - **Linux**: - `git diff --check origin/main...HEAD`: clean. - `tests/docs_links_check.py`: passed (16 Markdown files, 301 links). - `tests/bidi_controls_check.py`: passed (1130 tracked files). - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: 11/11 passed (`startup_list_resubmit_{warp,hardware}`, `startup_stream_{request,draw}_*`, `startup_mrt_{fxc,dxc}_*`, `startup_xg_bc7_draw_*`) in `6.90s` (`build 25.24s`). - **Release `/O2` (`--preset release`)**: 11/11 passed in `8.28s` (`build 42.04s`). ### Code Review Notes - **Locking & lifetime**: Lock ordering is consistent (`draw_lock` -> `allocator_lock` in `note_submits`; `list_reset` releases `allocator_lock` before `discard_draw_sampler_heaps`), and `retire_draw_sampler_heaps` now copies `ComPtr`s per submit so resubmissions retain sampler heap references until `list_reset`. - **`device_create_command_list_x` (`src/startup_stubs/d3d12_xs_device.cpp:2210`)**: Passes `unwrap(allocator)` (the initial `ID3D12CommandAllocator*`) rather than `title_allocator(a).current->real`. If a new list is created after `allocator_reset` has swapped `current`, `CreateCommandList` will touch the older/busy desktop allocator (though it immediately `Close()`s the list). - **`allocator_reset` (`src/startup_stubs/d3d12_xs_device.cpp:1060-1061`)**: `next->submits.clear()` runs before `next->real->Reset()`; moving it inside `if (SUCCEEDED(hr))` would avoid mutating state on a failed `Reset`. - **Coverage**: `tests/startup_list_resubmit.cpp` exercises the `allocator->lists != 0` swap path and resubmission across `allocator_reset`, though as noted in the PR description, `Probe::submit` waits on the fence after each submit so the in-flight GPU fence branch (`GetCompletedValue() < submit.second`) is not exercised by the test.
R0Y00 commented 2026-11-24 10:02:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T09:26:17Z.

Review: CHANGES_REQUESTED


The resubmission control covers the recorded-but-idle case. The critical untested case is a submit already queued behind an unsignaled fence and a later list Reset releasing its recording. Please add a two-queue or explicit fence-gated fixture for that case, with readback and a prior-allocator reuse control. Also ensure that a failed internal retire-fence creation or Signal cannot mark that allocation reusable: ExecuteCommandLists has already happened. Keep the native GPU work lifetime even when retirement bookkeeping fails, and resync the two queue changes on main.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6036662264 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1357#pullrequestreview-6036662264). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T09:26:17Z. **Review:** CHANGES_REQUESTED --- The resubmission control covers the recorded-but-idle case. The critical untested case is a submit already queued behind an unsignaled fence and a later list Reset releasing its recording. Please add a two-queue or explicit fence-gated fixture for that case, with readback and a prior-allocator reuse control. Also ensure that a failed internal retire-fence creation or Signal cannot mark that allocation reusable: ExecuteCommandLists has already happened. Keep the native GPU work lifetime even when retirement bookkeeping fails, and resync the two queue changes on main.
tedin7 commented 2026-11-24 10:02:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T09:53:06Z.

Review: COMMENTED


Technical retest & peer-review at commit a14064ec28d773ab4582cf11abb762d5b7d39107:

Verification

  • Linux:
    • git diff --check origin/main...HEAD: clean.
    • tests/docs_links_check.py: passed (16 Markdown files, 303 links).
    • tests/bidi_controls_check.py: passed (1,150 tracked files).
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): 9/9 passed in 2.15s (build 25.66s): startup_list_resubmit_{warp,hardware}, startup_list_resubmit_untracked_{warp,hardware}, startup_queue_wait_{warp,hardware}, startup_stream_request_warp, startup_stream_draw_{warp,hardware}.
    • Release /O2 (--preset release): 9/9 passed in 1.91s (build 37.75s): 9/9 passed.

Retest of Earlier Findings

  1. device_create_command_list_x (src/startup_stubs/d3d12_xs_device.cpp): Resolved — now resolves title_allocator(a).current->real under allocator_lock instead of passing the initial unwrap(allocator).
  2. allocator_reset (src/startup_stubs/d3d12_xs_device.cpp): Resolved — next->submits.clear(), allocator_swaps, and title.current = next now run only inside if (SUCCEEDED(hr)) after next->real->Reset().
  3. GPU-busy fence & untracked-allocator fallback: Verified — tests/startup_list_resubmit.cpp step 5 queues a submit behind an unsignalled fence (queue_wait slot 17), resets the list onto another allocator, resets the first allocator, and verifies the pending submit still renders blue after the CPU signals the fence with zero ID3D12InfoQueue errors. Step 6 verifies prior-allocator reuse (pool size 2), and X2W_TEST_SUBMIT_FENCE_FAIL=1 (startup_list_resubmit_untracked_*) verifies untracked allocators are never reset or reused (pool size 4).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6037040795 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1357#pullrequestreview-6037040795). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T09:53:06Z. **Review:** COMMENTED --- Technical retest & peer-review at commit `a14064ec28d773ab4582cf11abb762d5b7d39107`: ### Verification - **Linux**: - `git diff --check origin/main...HEAD`: clean. - `tests/docs_links_check.py`: passed (16 Markdown files, 303 links). - `tests/bidi_controls_check.py`: passed (1,150 tracked files). - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: **9/9 passed** in `2.15s` (build `25.66s`): `startup_list_resubmit_{warp,hardware}`, `startup_list_resubmit_untracked_{warp,hardware}`, `startup_queue_wait_{warp,hardware}`, `startup_stream_request_warp`, `startup_stream_draw_{warp,hardware}`. - **Release `/O2` (`--preset release`)**: **9/9 passed** in `1.91s` (build `37.75s`): **9/9 passed**. ### Retest of Earlier Findings 1. **`device_create_command_list_x` (`src/startup_stubs/d3d12_xs_device.cpp`)**: Resolved — now resolves `title_allocator(a).current->real` under `allocator_lock` instead of passing the initial `unwrap(allocator)`. 2. **`allocator_reset` (`src/startup_stubs/d3d12_xs_device.cpp`)**: Resolved — `next->submits.clear()`, `allocator_swaps`, and `title.current = next` now run only inside `if (SUCCEEDED(hr))` after `next->real->Reset()`. 3. **GPU-busy fence & untracked-allocator fallback**: Verified — `tests/startup_list_resubmit.cpp` step 5 queues a submit behind an unsignalled fence (`queue_wait` slot 17), resets the list onto another allocator, resets the first allocator, and verifies the pending submit still renders blue after the CPU signals the fence with zero `ID3D12InfoQueue` errors. Step 6 verifies prior-allocator reuse (pool size 2), and `X2W_TEST_SUBMIT_FENCE_FAIL=1` (`startup_list_resubmit_untracked_*`) verifies untracked allocators are never reset or reused (pool size 4).
R0Y00 commented 2026-11-24 10:02:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T09:58:27Z.

Review: APPROVED


Re-reviewed a14064ec. A submit without a usable retirement fence now marks each affected allocator as unavailable for reuse. Windows Release passed all six cases from ctest --preset release --no-tests=error -R "^startup_(list_resubmit|queue_wait)_" on WARP and RTX 4060 Laptop. This covers the queued submit behind a gate, resetting its list and allocator, and the injected unavailable retirement fence. There were no skips.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6037118967 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1357#pullrequestreview-6037118967). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T09:58:27Z. **Review:** APPROVED --- Re-reviewed a14064ec. A submit without a usable retirement fence now marks each affected allocator as unavailable for reuse. Windows Release passed all six cases from `ctest --preset release --no-tests=error -R "^startup_(list_resubmit|queue_wait)_"` on WARP and RTX 4060 Laptop. This covers the queued submit behind a gate, resetting its list and allocator, and the injected unavailable retirement fence. There were no skips.
Jess-Doit commented 2026-11-24 10:02:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-24T09:28:34Z.


Thanks for the review. All three points are addressed in 8e2162de, which also merges main (after #1348):

  • device_create_command_list_x: now creates the list on title_allocator(a).current->real, the desktop allocator the title's allocator currently stands for.
  • allocator_reset: next->submits.clear() and the swap counter now run only after the desktop Reset succeeds.
  • The GPU-busy branch: covered by a new step 5, using the queue Wait from #1348.
    • The queue waits on a fence, and a submit of A is queued behind the wait.
    • A is then reset on another allocator, so its first allocator holds no recording, only a submit the GPU has not passed. That allocator is reset next.
    • The pending submit must still clear the target to blue after the CPU signals the fence. The debug layer must store no errors, which the probe now counts through ID3D12InfoQueue.
    • With the fence check removed from allocator_idle, step 5 fails on both adapters (exit 56; the readback returns 00000000).

Debug and Release each passed 24/24 on the GTX 1060 and WARP: the probe, startup_queue_wait_* and the existing render-mode tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7127465229 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1357#issuecomment-7127465229). Originally posted by [Jess-Doit](https://github.com/Jess-Doit) on 2026-11-24T09:28:34Z. --- Thanks for the review. All three points are addressed in `8e2162de`, which also merges `main` (after #1348): - **`device_create_command_list_x`:** now creates the list on `title_allocator(a).current->real`, the desktop allocator the title's allocator currently stands for. - **`allocator_reset`:** `next->submits.clear()` and the swap counter now run only after the desktop `Reset` succeeds. - **The GPU-busy branch:** covered by a new step 5, using the queue Wait from #1348. - The queue waits on a fence, and a submit of A is queued behind the wait. - A is then reset on another allocator, so its first allocator holds no recording, only a submit the GPU has not passed. That allocator is reset next. - The pending submit must still clear the target to blue after the CPU signals the fence. The debug layer must store no errors, which the probe now counts through `ID3D12InfoQueue`. - With the fence check removed from `allocator_idle`, step 5 fails on both adapters (exit 56; the readback returns `00000000`). Debug and Release each passed 24/24 on the GTX 1060 and WARP: the probe, `startup_queue_wait_*` and the existing render-mode tests.
Jess-Doit commented 2026-11-24 10:02:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-24T09:37:45Z.


@R0Y00 thanks. These are addressed in 8e2162de and a14064ec, which also merge main at b9c9f624 (both queue changes from #1348 included):

  • Submit behind an unsignalled fence, then a list Reset releasing its recording (step 5).
    • The queue waits on fence H (slot 17), and a submit of A is queued behind the wait.
    • A is then reset on allocator b, so a's allocator holds no recording but has a submit the GPU has not passed. Allocator a is reset next.
    • After the CPU signals H, the readback is blue from the pending submit. A then reads green from its new recording.
    • The debug layer stores no errors (counted through ID3D12InfoQueue). With the fence check removed, step 5 reads 00000000 on both adapters (exit 56).
  • Prior-allocator reuse control (step 6). A records on a again and is submitted, then a is reset. The earlier allocator the GPU has passed is reused: x2w_d3d12_allocator_pool_size(a) (a new fixture export) stays at 2. A then records and draws on it.
  • Failed retire fence. If the tracking fence cannot be created or signalled after ExecuteCommandLists, each submitted list's allocator is marked untracked and is never reset or reused.
    • startup_list_resubmit_untracked_* forces that with X2W_TEST_SUBMIT_FENCE_FAIL=1. Steps 1–5 must read the same, including the pending blue, and step 6 must find 4 allocators: nothing is reused.
    • With the untracked check removed, that test fails at step 5 on both adapters.

Debug and Release each passed 26/26 on the GTX 1060 and WARP: both probe variants, startup_queue_wait_* and the existing render-mode tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7127673638 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1357#issuecomment-7127673638). Originally posted by [Jess-Doit](https://github.com/Jess-Doit) on 2026-11-24T09:37:45Z. --- @R0Y00 thanks. These are addressed in `8e2162de` and `a14064ec`, which also merge `main` at `b9c9f624` (both queue changes from #1348 included): - **Submit behind an unsignalled fence, then a list Reset releasing its recording (step 5).** - The queue waits on fence H (slot 17), and a submit of A is queued behind the wait. - A is then reset on allocator b, so a's allocator holds no recording but has a submit the GPU has not passed. Allocator a is reset next. - After the CPU signals H, the readback is blue from the pending submit. A then reads green from its new recording. - The debug layer stores no errors (counted through `ID3D12InfoQueue`). With the fence check removed, step 5 reads `00000000` on both adapters (exit 56). - **Prior-allocator reuse control (step 6).** A records on a again and is submitted, then a is reset. The earlier allocator the GPU has passed is reused: `x2w_d3d12_allocator_pool_size(a)` (a new fixture export) stays at 2. A then records and draws on it. - **Failed retire fence.** If the tracking fence cannot be created or signalled after `ExecuteCommandLists`, each submitted list's allocator is marked untracked and is never reset or reused. - `startup_list_resubmit_untracked_*` forces that with `X2W_TEST_SUBMIT_FENCE_FAIL=1`. Steps 1–5 must read the same, including the pending blue, and step 6 must find 4 allocators: nothing is reused. - With the `untracked` check removed, that test fails at step 5 on both adapters. Debug and Release each passed 26/26 on the GTX 1060 and WARP: both probe variants, `startup_queue_wait_*` and the existing render-mode tests.
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
R0Y00/Xbox2Windows!1350
No description provided.