gpu: preserve live upload reservations #2823

Manually merged
github merged 1 commit from gh-pr/2823/head into gh-pr/2823/base 2026-11-27 01:25:15 +00:00
Owner

@⁠chadhyatt on GitHub · 2026-11-26 11:51 UTC · original
chadhyatt:backport/upload-reservation-ownership → main · +174 −62 · 9 files · 1 commits · merged 2026-11-26 11:58 UTC

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 59a79a4db3 on 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.
  • Python compile on tests/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.

**@⁠chadhyatt** on GitHub · 2026-11-26 11:51 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2823) `chadhyatt:backport/upload-reservation-ownership` → `main` · +174 −62 · 9 files · 1 commits · merged 2026-11-26 11:58 UTC 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 59a79a4db3d43af0e42b2f3173811b2a03f8924a on 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. - Python `compile` on `tests/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.
Refuse exhausted upload storage instead of reusing capacity without completion.
Check the reservation cursor and retained backing with an authored portable fixture.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:25:12 +00:00
github manually merged commit 59a79a4db3 into gh-pr/2823/base 2026-11-27 01:25:15 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-26 11:56 UTC · original · reviewed

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_ring in d3d12_xs_device.cpp: new chunks start at used=0 and 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.
  • Test wiring: upload_reservation is registered in CMake; the gate-ring Python and C++ fixtures updated to expect retained payload 0 and a null view after refusal.
  • No other open or merged PR covers this slice (searched "upload reservation").

Commands run (Linux):

  • c++ -std=c++17 -Wall -Wextra -Isrc tests/upload_reservation_check.cpp -> all checks passed
  • python3 tests/docs_links_check.py -> ok; python3 tests/bidi_controls_check.py -> ok
  • git diff --check origin/main...HEAD -> clean
  • Mutation 1 (reset used to 0 on exhaustion): upload_reservation_check fails ("insufficient tail refuses the reservation").
  • Mutation 2 (always start at offset 0): fails ("exact remaining active tail").

Not covered here: Windows D3D12 gate behavior (Win2025 run follows in a receipt).

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 11:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2823#pullrequestreview-6073715759) · **reviewed** 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_ring` in d3d12_xs_device.cpp: new chunks start at `used=0` and 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. - Test wiring: `upload_reservation` is registered in CMake; the gate-ring Python and C++ fixtures updated to expect retained payload 0 and a null view after refusal. - No other open or merged PR covers this slice (searched "upload reservation"). Commands run (Linux): - `c++ -std=c++17 -Wall -Wextra -Isrc tests/upload_reservation_check.cpp` -> all checks passed - `python3 tests/docs_links_check.py` -> ok; `python3 tests/bidi_controls_check.py` -> ok - `git diff --check origin/main...HEAD` -> clean - Mutation 1 (reset `used` to 0 on exhaustion): `upload_reservation_check` fails ("insufficient tail refuses the reservation"). - Mutation 2 (always start at offset 0): fails ("exact remaining active tail"). Not covered here: Windows D3D12 gate behavior (Win2025 run follows in a receipt). AI-assisted; commands listed were executed locally.
Author
Owner

@⁠chadhyatt on GitHub · 2026-11-26 11:56 UTC · original

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.

**@⁠chadhyatt** on GitHub · 2026-11-26 11:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2823#issuecomment-7191363595) 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.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-26 11:58 UTC · original

Win2025 WARP receipt for head 59a79a4d.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 59a79a4db3d43af0e42b2f3173811b2a03f8924a:

  • Debug (--preset dev):
    • Build (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 (configure 1.88s)
    • Test (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_control 1.35s, unified_buffer_paths_hardware 1.37s, unified_buffer_paths_skip_copy_back_control 1.20s, unified_buffer_paths_warp 1.20s, upload_reservation 0.02s, startup_stream_draw_warp 2.86s, startup_stream_draw_hardware 3.04s, startup_address_console_gate_ring_warp 3.31s, startup_address_console_gate_warp 3.63s, unified_buffer_paths_reuse_early_control 1.09s)
  • Release /O2 (--preset release):
    • Build (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 (configure 1.87s)
    • Test (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_reservation 0.02s, unified_buffer_paths_hardware 1.43s, unified_buffer_paths_skip_copy_back_control 1.44s, unified_buffer_paths_warp 1.47s, unified_buffer_paths_skip_refresh_control 1.51s, unified_buffer_paths_reuse_early_control 1.12s, startup_stream_draw_warp 2.75s, startup_stream_draw_hardware 2.75s, startup_address_console_gate_ring_warp 1.96s, startup_address_console_gate_warp 2.07s)
  • sccache: 0/16 hits; wall 93.0s

Tests 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.

**@⁠tedin7** on GitHub · 2026-11-26 11:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2823#issuecomment-7191393771) Win2025 WARP receipt for head 59a79a4d. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `59a79a4db3d43af0e42b2f3173811b2a03f8924a`: - **Debug (`--preset dev`)**: - Build (`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` (configure `1.88s`) - Test (`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_control` `1.35s`, `unified_buffer_paths_hardware` `1.37s`, `unified_buffer_paths_skip_copy_back_control` `1.20s`, `unified_buffer_paths_warp` `1.20s`, `upload_reservation` `0.02s`, `startup_stream_draw_warp` `2.86s`, `startup_stream_draw_hardware` `3.04s`, `startup_address_console_gate_ring_warp` `3.31s`, `startup_address_console_gate_warp` `3.63s`, `unified_buffer_paths_reuse_early_control` `1.09s`) - **Release `/O2` (`--preset release`)**: - Build (`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` (configure `1.87s`) - Test (`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_reservation` `0.02s`, `unified_buffer_paths_hardware` `1.43s`, `unified_buffer_paths_skip_copy_back_control` `1.44s`, `unified_buffer_paths_warp` `1.47s`, `unified_buffer_paths_skip_refresh_control` `1.51s`, `unified_buffer_paths_reuse_early_control` `1.12s`, `startup_stream_draw_warp` `2.75s`, `startup_stream_draw_hardware` `2.75s`, `startup_address_console_gate_ring_warp` `1.96s`, `startup_address_console_gate_warp` `2.07s`) - `sccache`: 0/16 hits; wall `93.0s` Tests 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.