Skip to content

fix(startup): reuse upload ring chunks after GPU completion - #2849

Merged
MasterDomino merged 3 commits into
R0Y00:mainfrom
brainbudt:fix/upload-ring-reuse
Nov 26, 2026
Merged

MasterDomino merged 3 commits into
R0Y00:mainfrom
brainbudt:fix/upload-ring-reuse

Conversation

@brainbudt

Copy link
Copy Markdown
Contributor

Problem

Fixes #2837. Since #2823, every reservation advanced a chunk's cursor, but GPU completion never made those bytes available again. After 256 MiB of cumulative uploads, subsequent draws could receive null bindings for the rest of the process.

Change

Track which chunks each command-list recording references and the latest submission fence for each chunk on each queue. Recycle a chunk once every recording has released it and every queue that used it has completed. A closed list keeps its hold because it can be submitted again. Cached frame copies check the chunk generation before reusing an offset.

Scope

Covers the shared startup upload ring, its callers and its regression fixtures. The 256 MiB cap and refusal of uploads while all storage is busy are preserved.

Verification

  • On Linux x86-64, a host probe exercised the original and patched reservation functions with a simulated queue: both refused excess uploads while blocked, and after completion the original still refused the next 16 MiB upload while the patch accepted it (272 MiB cumulative).
  • c++ -std=c++17 -Wall -Wextra -Werror -fsanitize=address,undefined -Isrc tests/upload_reservation_check.cpp -o upload_check && ./upload_check passed with GCC 15 on Linux x86-64 (320 MiB cumulative, covering repeat submission, independent queues, fence failure and device removal), and also passed on macOS ARM64 after rebasing onto 2c56d89.
  • Added gate-ring-reuse for WARP and hardware (ctest --preset dev --no-tests=error -R '^startup_address_console_gate' -V). Windows build and pixel readback remain for CI / hardware verification.

Reviewed with mistral-loop: APPROVE (1 round, mistral-large-4-0 + deepseek-v4-1-flash-1017).
Created with gpt-6.2-astra in Codex (orchestrated with Gemini 4 Neon in T3 Code).

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head 152a2fd (comment only, no approval). Competing slice: #2847 (older, @Holastor) fixes the same issue (#2837). This is a design choice between the two PRs.

Comparison with #2847 (the point raised on #2847: reuse tied to "any submit")

  • #2847 marks a chunk unsubmitted when it is reserved and clears that flag in note_upload_ring_submit for EVERY chunk when ANY queue executes ANY list. A chunk reserved by a still-recording list can be marked idle by an unrelated submit and then reset. It also keeps one (fence, value) per chunk, so a chunk used on two queues is not fully tracked.
  • #2849 does not have that hole by design:
    • Each list's recording owns a chunk mask (WrapperOwn::upload_chunks, set in reserve_upload_ring and in the frame_copy cache hit). UploadRingChunk::recordings counts those holds, and reuse_upload_chunk refuses while it is non-zero. A chunk reserved by a list that has not been reset or released is never recycled.
    • note_submits ORs the masks of the lists actually executed (d3d12_xs_device.cpp, chunks |= list->own().upload_chunks) and stamps last_use[chunk] per queue with that queue's fence value. Reuse needs every queue's stamp completed (UploadQueue::completed), so multi-queue use is covered.
    • Failed signal stamps UINT64_MAX (never reusable), and GetCompletedValue() == UINT64_MAX (device removed) is not counted as completion.
    • A closed list keeps its hold until Reset, Release or a failed Close, because it can be resubmitted.
    • FrameCopy now stores the slice with its generation; a cached offset into a recycled chunk is rejected, so a stale frame copy cannot point at overwritten bytes. #2847 has no equivalent.
  • So on "is reuse bound to the completion of the right lists": yes for #2849, no for #2847 as reviewed.

Costs and open points in #2849 (not blockers for the comparison)

  • It is the larger change: Wrapper* list is threaded through every reserve_upload_ring / ring_copy / frame_copy / upload_from_title caller (about 12 callsites in d3d12_draw.inl and d3d12_xs_device.cpp) and the ring now takes allocator_lock instead of its own lock. I found no nested allocator_lock acquisition on those paths, but the CreateCommittedResource call now runs under allocator_lock; worth a look by whoever owns the locking.
  • A title that keeps many closed lists un-reset pins their chunks (conservative, same refusal as today, not worse).
  • Any other holder of an upload-ring GPU address that outlives a recording (for example a descriptor written once and used by a later list) is not covered by the per-recording mask. This applies to both PRs; I did not find such a case, but it is the question to ask the author.

Tests

  • tests/upload_reservation_check.cpp (check_ring_reuse) drives the real header logic (reserve_upload_chunk, UploadQueue, reuse_upload_chunk, discard_upload_chunks) with two fake queues. It covers the negative cases: closed list still held, latest submit on every queue, device removal, untracked submit. #2847 has no equivalent unit test of the fence logic.
  • Two mutations on this head, both caught: dropping the || chunk.recordings check fails "closed list can be resubmitted"; replacing completed >= target with true fails "latest submit on every queue must complete".
  • gate-ring-reuse (WARP and hardware) checks the positive case (new payload accepted after completion). The negative case (no reuse while the queue is still held) is covered by the existing gate-ring fixture, which must keep refusing while the gate is closed; I could not run either fixture here.
  • Not covered by any unit test: the glue in d3d12_xs_device.cpp (mask OR in note_submits, discard in list_reset / list_close failure / release). Only the D3D12 fixtures exercise it.

Not verified here

  • D3D12 fixtures and CI results on this head: CI was still pending when I checked. No Windows run done by me. The PR body claims the fix helps long startup runs; I cannot check that on the real title, so that part stays with @R0Y00 or MasterDomino.

Checked locally: git diff --check origin/main...HEAD clean, python3 tests/docs_links_check.py ok, python3 tests/bidi_controls_check.py ok, c++ -std=c++17 -Isrc tests/upload_reservation_check.cpp passes (rc 0), plus the two mutations above (each reverted with git checkout -- .).

Summary: on the design question #2849 is the more complete answer (per-list holds, per-queue fences, generation check on cached frame copies, unit-level negative controls), at the price of a bigger diff touching every ring caller. #2847 needs its finding 1 fixed before it can be considered. I leave the choice to @R0Y00.

AI-assisted; commands listed were executed locally.

@RenzoWit35 RenzoWit35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows run of head 152a2fd (comment only). This adds the D3D12 fixture results that the earlier review could not run.

Environment: Windows 11 build 26300, VS Build Tools 2026 (MSVC 14.51), Windows SDK 10.0.26100, DXC 1.8.2502, dev preset, WARP. D3D12 debug layer not enabled.

Results on this head

  • ctest --preset dev --no-tests=error -R '^(upload_reservation|startup_address_console_gate.*_warp)$': all 4 pass (upload_reservation, startup_address_console_gate_warp, _gate_ring_warp, _gate_ring_reuse_warp).
  • Ring-adjacent WARP set, -R 'upload_reservation|slot133|frame_copy|unified_buffer|startup_address|startup_stream|startup_root|startup_indirect|startup_mesh|startup_compute' -E '_hardware': 173 tests, 171 pass, 0 fail, 2 capability skips (startup_root_heap_warp, startup_slot133_heap_cap_warp_debug1).

Negative control: same build, with src/startup_stubs/d3d12_xs_device.cpp, d3d12_draw.inl and upload_reservation.h taken from the base 2c56d896 and only d3d12_xs_shim rebuilt. gate_warp and gate_ring_warp still pass. gate_ring_reuse_warp fails with {'left': 0, 'right': 32768} wrong pixels, found ['00000000']; expected 03ff5aff left, 355d48ff right, the same numbers as in #2837. So the new mode rejects the old behaviour, and gate-ring still requires the refusal while the queue is held.

Docs: two passages still describe the pre-fix ring:

  • docs/startup-runtime.md:3322: "refuses exhaustion or allocation failure rather than resetting live storage"
  • docs/experiments.md:16322: the startup_address_console_gate_ring paragraph. It could also name the new startup_address_console_gate_ring_reuse_{warp,hardware} mode.

No hardware results from me. Not checked: a real startup run.

AI-assisted; the commands above were run locally.

@Not-Saii

Copy link
Copy Markdown
Contributor

Tested 152a2fda on Windows hardware, as asked in the Verification section.

Environment: Windows 11 build 26300.9974, MSVC 19.44.35230, Windows SDK 10.0.26100, NVIDIA GeForce RTX 4090 driver 610.88 (32.0.16.1088), WARP and hardware backends, D3D12 debug layer not enabled.

Fixtures

ctest --preset dev --no-tests=error -R '^(startup_address_console_gate|upload_reservation$|startup_slot133_heap_cap)'

13/13 passed. That covers gate, gate-ring and gate-ring-reuse on WARP and hardware, upload_reservation, and all six startup_slot133_heap_cap cases (ring growth below the cap is unchanged).

Full suite: ctest --preset dev --no-tests=error -j 6 --timeout 600 passed 2427/2427, with 30 capability skips (77) and no failures.

Startup run from #2837

I used the same release build and run.ps1 -Render -Translate -FakeUser -GpuMirror -ContinueAsserts 1000, 180 s. The input script pressed A every 5 s from 50 s, so the run does not depend on when the prompt appears. Final x2w-render totals:

build textures uploaded null bindings translated draws not drawn ring refusals
7256cecf 38 (114 MiB) 23,949 6,757 8+ (log capped)
7256cecf with #2823 reverted 1,364 (5.3 GiB) 0 1 0
this PR (152a2fda) 1,364 (5.3 GiB) 0 0 0

The presented picture is no longer black: the loading screen renders.

What this does not show: the startup numbers only show that uploads are no longer refused. The revert, which reuses storage without waiting, gives the same numbers. Protection against early reuse is checked only by gate-ring and the left half of gate-ring-reuse, on one queue. I read the code but did not exercise the frame-copy generation miss, the root-SRV path or a resubmitted closed list on hardware.

Doc nits

  • docs/startup-runtime.md still says the ring "refuses exhaustion or allocation failure rather than resetting live storage". That no longer describes the behaviour.
  • The CMake comment above the gate loop still says the ring control "must lose the first".

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of #2849 (fixes #2837), exact head cab39c2a (= 152a2fda plus a clean merge of main, 5 commits; the PR's own diff is unchanged).

Merge decision stays open: #2847 and #2849 cover the same issue. No merge from this review until @R0Y00 chooses between them (comparison already posted above).

Correctness (code read, src/startup_stubs/upload_reservation.h, d3d12_xs_device.cpp, d3d12_draw.inl):

  • A chunk is reused only when no recording holds it (recordings == 0) AND every queue that used it has a completed fence value at or past that chunk's last submit. Both conditions are needed and both are checked in reuse_upload_chunk.
  • A closed list keeps its hold until Reset, failed Close or Release, so a list that is submitted a second time cannot read recycled bytes. A submit whose fence signal fails records UINT64_MAX, which is never treated as complete (conservative: that chunk is not reused).
  • Device removal (GetCompletedValue() == UINT64_MAX) is not treated as completion.
  • frame_copy re-validates resource + generation before reusing a cached offset, so a recycled chunk cannot serve stale cached slices. Lock order (draw_lock, then allocator_lock) matches queue_execute. No caller of reserve_upload_ring holds allocator_lock.
  • Known limit, not a blocker: a list that is closed and never reset or released pins its chunks, so a leak of such lists falls back to the old refusal behavior.

Tests and mutations (Linux, GCC, -Wall -Wextra -Werror -fsanitize=address,undefined): tests/upload_reservation_check.cpp passes. Four real mutations each made it fail, and each was reverted with git checkout -- .:

  • skip the completion check -> FAIL: latest submit on every queue must complete
  • skip the recordings check -> FAIL: closed list can be resubmitted
  • no generation bump -> FAIL: 320 MiB cumulative reservations reuse completed storage
  • treat an untracked submit as done -> FAIL: untracked submit prevents reuse
    Negative control: with reuse disabled (as on main) the 320 MiB case cannot pass, and gate-ring-reuse expects payload 18 on the right half where main leaves the null view. I did not run gate-ring-reuse against main's source on Windows.

Other Linux checks: tests/docs_links_check.py, tests/bidi_controls_check.py, git diff --check origin/main...HEAD all clean.

Win2025 WARP (build 26100, MSVC 14.44.35207), head cab39c2a, with --regex '^(upload_reservation|startup_address_console_|startup_stream)':

  • dev: 27/27 passed, release: 27/27 passed. Includes upload_reservation, startup_address_console_gate_ring_reuse_warp and _hardware (hardware ran on WARP), gate_warp, gate_ring_warp.
  • Real-GPU run not available (RunPod stopped).

This does not claim anything about running the game. AI-assisted; commands listed were executed locally.

@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Win2025 WARP receipt for head cab39c2 after updating with main (PR tests N=27 dev, N=27 release; includes upload_reservation and startup_address_console_gate_ring_reuse_warp/_hardware). Merge held: @R0Y00 to choose between #2847 and #2849.

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_stream_consumer upload_reservation_check -- -j 2): 66.22s (configure 2.56s)
    • Test (ctest --preset dev -R '^(upload_reservation|startup_address_console_|startup_stream)' --parallel 2 --no-tests=error --output-on-failure): 27/27 passed (47.90s: startup_stream_draw_warp 3.04s, startup_stream_depth_warp 4.85s, startup_stream_depth_hardware 4.74s, startup_address_console_warp 13.44s, startup_stream_draw_hardware 2.98s, startup_address_console_gate_warp 3.77s, startup_stream_fetch_warp 2.71s, startup_address_console_gate_ring_warp 4.77s, startup_stream_request_warp 1.75s, startup_stream_fetch_hardware 3.54s, startup_stream_viewport_warp 1.45s, startup_stream_interface_warp 1.15s, startup_stream_viewport_hardware 1.40s, startup_stream_rasterizer_hardware 1.17s, startup_stream_rasterizer_warp 1.16s, startup_stream_interface_hardware 1.07s, startup_stream_rasterizer_ignore_warp 1.05s, startup_stream_fetch_translate 0.46s, startup_stream_interface_translate 0.44s, startup_stream_rasterizer_ignore_hardware 1.16s, upload_reservation 0.10s, startup_stream_adapter_filter 0.29s, startup_address_console_gate_ring_reuse_warp 5.12s, startup_address_console_gate_hardware 5.63s, startup_address_console_hardware 14.75s, startup_address_console_gate_ring_hardware 4.81s, startup_address_console_gate_ring_reuse_hardware 4.66s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_stream_consumer upload_reservation_check -- -j 2): 70.12s (configure 2.56s)
    • Test (ctest --preset release -R '^(upload_reservation|startup_address_console_|startup_stream)' --parallel 2 --no-tests=error --output-on-failure): 27/27 passed (24.89s: startup_stream_depth_warp 3.93s, startup_stream_depth_hardware 3.38s, startup_address_console_warp 8.28s, startup_stream_draw_warp 2.34s, startup_stream_request_warp 0.93s, startup_stream_draw_hardware 2.32s, startup_address_console_gate_ring_warp 1.67s, startup_address_console_gate_warp 1.79s, startup_stream_fetch_warp 1.24s, startup_stream_fetch_hardware 1.41s, startup_stream_viewport_warp 0.80s, startup_stream_viewport_hardware 0.82s, startup_stream_rasterizer_warp 0.85s, startup_stream_interface_warp 0.65s, startup_stream_rasterizer_ignore_warp 0.78s, startup_stream_rasterizer_hardware 0.89s, startup_stream_interface_hardware 0.64s, startup_stream_rasterizer_ignore_hardware 0.76s, startup_stream_interface_translate 0.26s, startup_stream_fetch_translate 0.25s, upload_reservation 0.02s, startup_stream_adapter_filter 0.16s, startup_address_console_gate_ring_reuse_warp 1.91s, startup_address_console_gate_hardware 1.86s, startup_address_console_gate_ring_hardware 1.83s, startup_address_console_gate_ring_reuse_hardware 1.71s, startup_address_console_hardware 7.58s)
  • sccache: 22/39 hits; wall 178.6s

AI-assisted; commands listed were executed locally.

@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

@R0Y00 a choice is needed here. #2837 is a regression on main since #2823: the upload ring refuses every reservation after 256 MiB in total. Two open PRs fix it:

Our comparison is in the review comments on both PRs: #2849 (review) and #2847 (review). It points to #2849 as the more complete fix. Which one would you like merged? We will not merge either until you say.

AI-assisted; commands listed were executed locally.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: fix(startup): reuse upload ring chunks after GPU completion

This PR solves #2837 — after 256 MiB of cumulative uploads the ring exhausts because chunks never become available again.

How it works

  1. Track recording references: UploadChunkMask (bitmask) per recording holds which ring chunks it references. Discarded on list release/reset/close.
  2. Track queue completion: UploadQueue<Fence> template records last_use[index] per chunk per queue. Completed value compared against last-use to determine if the queue is done using the chunk.
  3. Recycle chunks: When a chunk has zero recording references and every queue's fence is past its last-use value, the chunk resets its cursor, bumps its generation counter, and becomes reusable.
  4. Generation tracking: UploadReservation::generation and UploadRingChunk::generation allow callers (like frame_copy) to re-hold a chunk by matching generation.

Comparison with PR #2847 (Holastor)

PR #2847 uses a "closed list" approach: finished chunks stay on a closed list and are reused from there. PR #2849 uses the in-place generation approach: chunks recycle in their original position once all references clear and all queues complete.

Advantages of #2849's approach:

  • Simpler data structure: no separate closed list to manage. The global upload_chunks vector serves as both active pool and recycle target.
  • Generation-based tracking is cache-friendly — access patterns remain localized to the chunk's original position.
  • Clean UploadQueue<Fence> template makes fence comparison logic encapsulated and testable.
  • The bitmask (UploadChunkMask) for recording references is efficient for typical numbers of chunks per recording.

Strengths

  • Clean separation of concerns: hold(), discard_upload_chunks(), and submitted() methods keep the reference counting logic isolated.
  • Fence handling is correct: last_use[i] = UINT64_MAX when signaling fails — this prevents spurious recycling when a queue fails to signal (matching the existing fence-handling conventions).
  • Lock discipline is consistent: Uses the same allocator_lock that guards the upload allocation infrastructure, avoiding new locks or lock ordering issues.
  • Test gate gate-ring-reuse: Extends the existing address console test to verify the reuse path draws payload 18 over the right half after completion.
  • C++17 compatible: Uses std::array and templates without newer C++ extensions.

Minor observations

  1. max_upload_chunks assert: static_assert(max_upload_chunks <= 32) guarantees UploadChunkMask fits in uint32_t. This is correct but worth noting that changing max_upload_ring_bytes or initial_upload_chunk_bytes would need to respect this constraint.

  2. Chunk growth factor (×2): The doubling growth from 16 MiB up to 256 MiB total is unchanged from the current code. This means at most 16 chunks in the worst case, so the bitmask works comfortably.

  3. reuse_upload_chunk is a template: It takes Queues by const reference. The caller passes queue_submits (an unordered_map). This works but is slightly indirect — the function only needs indexed access. Could potentially be simplified to accept pointers/indices directly, but this is fine as-is.

  4. active index: Made static unsigned active in reserve_upload_ring instead of static std::size_t active. Consistent with the unsigned loop indices below.

Verdict

This is a well-structured, correct implementation that avoids the complexity of a separate closed list. The generation scheme cleanly handles the race between recording release and GPU completion without additional synchronization.

Ready to merge. Approving.

The ring now recycles a chunk once no recording holds it and every queue
that used it has completed. Replace the passages that still said it never
resets storage, and name the new gate_ring_reuse mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MasterDomino

Copy link
Copy Markdown
Collaborator

RX 9070 XT results for #2849, plus a docs-only commit, and why we are merging it now.

Environment: Windows 11 build 26300.9974, AMD Radeon RX 9070 XT, driver 32.0.32029.2010, release preset, D3D12 debug layer not enabled.

Fixtures on cab39c2a

ctest --preset release --no-tests=error -j 4 -R '^(upload_reservation|startup_address_console|startup_list_resubmit|startup_slot133_heap_cap|startup_null|startup_stream_draw)'

31/31 passed, WARP and hardware. That includes upload_reservation, gate, gate_ring and gate_ring_reuse.

Negative control: same tree with reuse_upload_chunk returning {} up front (no recycling, as on main), rebuilt. upload_reservation fails with FAIL: 320 MiB cumulative reservations reuse completed storage, and startup_address_console_gate_ring_reuse_{warp,hardware} fail. gate_ring_{warp,hardware} still pass. Restored and rebuilt afterwards.

Startup run, matched: same machine, same switches, same input script, 300 s each, run back to back with -Render -Translate -FakeUser -GpuMirror -StartupBelow40 -ContinueAsserts 100000 and X2W_D3D12_BUDGET=1. Each arm used a shader cache re-keyed with its own shader_cache_rekey.py and gfx2hlsl.py --pending. Final x2w-render totals:

build textures uploaded null bindings translated draws (not drawn) ring refusals fps
main b505c32b 36 (128 MiB) 377,651 23,703 (160,457) 8 (log capped) 22.5
this PR cab39c2a 1,387 (5.4 GiB) 0 136,985 (0) 0 20.0

Both runs reached the 300 s timeout with no second-chance exception, no trap and no device removal. On main the window stays black. On this PR it shows rendered output. The lower fps on this PR comes with about 5.8 times as many translated draws. As in @Not-Saii's run, these numbers show that uploads are no longer refused. Early-reuse protection is shown only by the fixtures above.

Docs commit b9c738a8: addresses the nits @Not-Saii and @RenzoWit35 raised. docs/startup-runtime.md now describes when a chunk is recycled, instead of saying live storage is never reset. The CMake comment above the gate loop no longer says the ring control "must lose the first". docs/experiments.md names the gate_ring_reuse mode and its negative control. No code changes.

Why we are merging without the choice from @R0Y00: main has been unable to draw past the first 256 MiB of uploads since #2823, and every startup run on it ends on a black window. #2847 and #2849 have converged on the same design: per-recording holds, per-queue fences, generation checks and a hold that survives a closed list. #2849 is the smaller diff and had the fence logic under unit test from the start, with four mutations caught by tedin7. We are merging #2849 once CI passes on b9c738a8. @Holastor, thank you for #2847. Your reviews and fixes there sharpened both PRs. @R0Y00, if you would rather have had #2847, a revert is one commit.

AI-assisted; the commands above were run locally.

@MasterDomino MasterDomino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at b9c738a8, which is cab39c2a plus a docs-only commit. Evidence on an RX 9070 XT is in #2849 (comment):

  • Fixtures: 31/31 passed.
  • Negative control: with chunk reuse disabled, upload_reservation and both gate_ring_reuse tests fail, while gate_ring still passes.
  • Matched 300 s startup run against main: null bindings drop from 377,651 to 0, textures uploaded rise from 36 to 1,387, and ring refusals drop from 8 to 0.

All comments and reviews were read in full. The open nits were the stale docs passages, and b9c738a8 fixes them.

AI-assisted.

@MasterDomino
MasterDomino merged commit 6ee878d into R0Y00:main Nov 26, 2026
5 checks passed
@thepatrickworld

Copy link
Copy Markdown
Contributor

Mutation check on the merged code (6ee878d8): which lines of the reuse path this selection notices

Clean dev build at 6ee878d8: rmdir /S /Q out\build\dev, then cmake --preset dev -DINTAKE_PYTHON=... and cmake --build --preset dev (exit codes 0 and 0), tree clean. Selection, 13 entries exactly:

  • upload_reservation (1)
  • startup_address_console_gate_ring{,_reuse}_{warp,hardware} (4)
  • startup_list_resubmit* (8: ``, nodebug_, `untracked_`, `nodebug_untracked_`, times two backends)

Baseline: 13 passed, 0 skipped. Nine single-site mutations, each applied alone and rebuilt, git checkout -- src between runs; one post-restore rebuild re-verified 13 passed.

mutation failures
last_use[i] = signaled ? value : UINT64_MAX; → = value; 1 (upload_reservation)
if (target == UINT64_MAX) return false; → return true; 1 (upload_reservation)
drop `
if (!(recording & bit)) { → if (true) { in hold 1 (upload_reservation)
--chunks[i].recordings; → ; in discard_upload_chunks 3: the unit test and startup_address_console_gate_ring_reuse on both backends
drop the completed(index) loop in reuse_upload_chunk 5: the unit test and all four ring draws
completed >= target → completed > target 1 (upload_reservation)
discard_upload_chunks(...) removed from release_upload_recording (src/startup_stubs/d3d12_xs_device.cpp) 0 — 13 passed
chunks[index].hold(...) removed from the finish lambda in reserve_upload_ring (src/startup_stubs/d3d12_xs_device.cpp) 4, all ring draws

src/startup_stubs/upload_reservation.h for the first seven. _hardware entries ran on the RX 9070 XT (driver 32.0.32029.2010), _warp entries on WARP (Microsoft Basic Render Driver, driver 10.0.26100.9818).

What the matrix says:

  • Four ring draws witness the bookkeeping, not the fence-failure arm. note_submits stores UINT64_MAX when no submit fence exists (creation failed, or X2W_TEST_SUBMIT_FENCE_FAIL=1 suppresses creation) or when Signal fails, and completed() refuses those entries. Both guards are invisible to the selection: the ring draws never fail a submit fence, and the startup_list_resubmit*untracked* entries do set the hook but never fill the ring, so their mask is empty. The behaviour is pinned by upload_reservation; no draw in this selection would notice it changing.
  • The release-time discard changes no verdict. Reading the code, the same mask is also discarded by Reset and by a failed Close, so a list that is reset before it is released arrives with an empty mask. That would make the release-time call redundant rather than unobserved — I did not establish which of the two it is. A list released without a reset would tell them apart.
  • The per-queue completion loop and the hold recorded by finish are the two sites a draw does catch, on both backends.

Scope, since it is easy to over-read this: 13 entries selected by the regex above, one machine, WARP plus one AMD adapter, dev preset, test-only mutations. This does not say the reuse path is correct — only which of these nine lines this selection would notice changing. Other fixtures outside the selection were not run.

If a fixture for either case is wanted (a ring draw that fails the fence, or a list released without a reset), I can send one as a PR.

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

startup: upload ring refuses every reservation after 256 MiB in total since #2823

7 participants