gpu: preserve live upload reservations #2815
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2823"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by chadhyatt on 2026-11-26T11:51:33Z.
AI-assisted backport patch from x2w-microlift.
Refs #2775. Keep upload reservation offsets and backing stable for their lifetime. Grow on demand as before and use remaining unused tails; refuse exhaustion at the existing 256 MiB cap rather than recycle a reservation without a completion contract. This is a bounded correctness change, not a recycling implementation. A long-running workload can exhaust the ring; fence-aware retirement needs a separate change.
The authored portable fixture checks unchanged existing bytes, cursor and return values after growth and exhaustion. The existing Windows gate-ring fixture now expects retained payload 0, null view on later refused draws, and an explicit refusal log. Windows D3D12 gate behavior has not been run on this host.
Verified
59a79a4db3on arm64 macOS:c++ -std=c++17 -Wall -Wextra -fsanitize=address,undefined -Isrc tests/upload_reservation_check.cpp -o out/upload_reservation_check && out/upload_reservation_check: pass.compileontests/startup_address_console_check.py: pass.git diff --check: pass.Suggested Windows verification:
ctest --preset dev --no-tests=error -R "^(upload_reservation|startup_address_console_gate_ring_warp|startup_address_console_gate_warp)$". No Windows or physical GPU result claimed.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T11:56:12Z.
Review: COMMENTED
Review of head
59a79a4d(comment only).Result: sound. The change keeps upload reservation offsets and backing stable and refuses at the cap instead of recycling. It makes no game or startup claim, so the game rule does not apply.
What I checked:
reserve_upload_chunk(src/startup_stubs/upload_reservation.h): overflow-safe bounds test, cursor only moves on success.reserve_upload_ringin d3d12_xs_device.cpp: new chunks start atused=0and reserve through the same helper; the old "wrap to offset 0 of another chunk" loop is gone; fallback scans unused tails of existing chunks; refusal is logged (first 8 only). The old(ptr, offset, resource)wrapper is kept, so callsites are unchanged.upload_reservationis registered in CMake; the gate-ring Python and C++ fixtures updated to expect retained payload 0 and a null view after refusal.Commands run (Linux):
c++ -std=c++17 -Wall -Wextra -Isrc tests/upload_reservation_check.cpp-> all checks passedpython3 tests/docs_links_check.py-> ok;python3 tests/bidi_controls_check.py-> okgit diff --check origin/main...HEAD-> cleanusedto 0 on exhaustion):upload_reservation_checkfails ("insufficient tail refuses the reservation").Not covered here: Windows D3D12 gate behavior (Win2025 run follows in a receipt).
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chadhyatt on 2026-11-26T11:56:35Z.
Thanks for reviewing the exact head and running the independent portable checks. The Windows build-and-test and Linux checks are green. The 256 MiB exhaustion refusal remains intentionally bounded; fence-aware retirement is separate. I will keep the D3D12 gate behavior unclaimed until the Windows receipt.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T11:58:01Z.
Win2025 WARP receipt for head
59a79a4d.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
59a79a4db3d43af0e42b2f3173811b2a03f8924a:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_stream_consumer unified_buffer_paths_check upload_reservation_check -- -j 2):25.45s(configure1.88s)ctest --preset dev -R '^(upload_reservation|startup_address_console_gate_ring_warp|startup_address_console_gate_warp|unified_buffer_paths.*|startup_stream_draw.*)$' --parallel 6 --no-tests=error --output-on-failure): 10/10 passed (3.82s:unified_buffer_paths_skip_refresh_control1.35s,unified_buffer_paths_hardware1.37s,unified_buffer_paths_skip_copy_back_control1.20s,unified_buffer_paths_warp1.20s,upload_reservation0.02s,startup_stream_draw_warp2.86s,startup_stream_draw_hardware3.04s,startup_address_console_gate_ring_warp3.31s,startup_address_console_gate_warp3.63s,unified_buffer_paths_reuse_early_control1.09s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_stream_consumer unified_buffer_paths_check upload_reservation_check -- -j 2):54.96s(configure1.87s)ctest --preset release -R '^(upload_reservation|startup_address_console_gate_ring_warp|startup_address_console_gate_warp|unified_buffer_paths.*|startup_stream_draw.*)$' --parallel 6 --no-tests=error --output-on-failure): 10/10 passed (3.68s:upload_reservation0.02s,unified_buffer_paths_hardware1.43s,unified_buffer_paths_skip_copy_back_control1.44s,unified_buffer_paths_warp1.47s,unified_buffer_paths_skip_refresh_control1.51s,unified_buffer_paths_reuse_early_control1.12s,startup_stream_draw_warp2.75s,startup_stream_draw_hardware2.75s,startup_address_console_gate_ring_warp1.96s,startup_address_console_gate_warp2.07s)sccache: 0/16 hits; wall93.0sTests covered (10/10 dev, 10/10 release): upload_reservation, startup_address_console_gate_warp, startup_address_console_gate_ring_warp, unified_buffer_paths and stream-draw tests. Real-GPU run not available (RunPod stopped).
AI-assisted; commands listed were executed locally.