startup: exercise upload arena allocation contract #1774

Manually merged
github merged 2 commits from gh-pr/1774/head into gh-pr/1774/base 2026-11-26 23:32:31 +00:00
Owner

@⁠R0Y00 on GitHub · 2026-11-24 18:22 UTC · original
R0Y00:codex/command-list-upload-arena → main · +192 −0 · 4 files · 2 commits · merged 2026-11-24 19:08 UTC

Refs #1352.

Extract the mapped D3D12 upload arena into an independently exercised helper. The source-built fixture allocates 640 writable bytes with 16-byte alignment on both CPU and GPU, checks allocation offsets and address translation, fills a later page, and verifies that the first allocation still holds its data. Controls reject zero size or alignment, non-power-of-two alignment, overflow, and translations that cross an allocation boundary. Idle reset retires all prior ranges.

The fixture issues no GPU submission. Guest slot binding, rejection after list Close, and GPU use of an upload payload across a pending fence remain outside this measurement. The separate command-list resubmit tests exercise allocator reuse and the lost-fence control with render-target clears.

Verification

Commit 4c4ea4aa, Windows 11 25H2 build 26200.9974, MSVC 19.51.36244.0. D3D12 debug layer enabled on WARP 10.0.26100.9818 and RTX 4060 Laptop GPU 32.0.16.1656.

cmake --build --preset release --target startup_upload_arena startup_list_resubmit
ctest --preset release --no-tests=error -R '^startup_(upload_arena|list_resubmit)' -V
python -B tests/docs_links_check.py
python -B tests/bidi_controls_check.py
git diff HEAD^ HEAD --check

All six CTests passed with zero skips. Link, bidi, and whitespace checks passed.

**@⁠R0Y00** on GitHub · 2026-11-24 18:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1774) `R0Y00:codex/command-list-upload-arena` → `main` · +192 −0 · 4 files · 2 commits · merged 2026-11-24 19:08 UTC Refs #1352. Extract the mapped D3D12 upload arena into an independently exercised helper. The source-built fixture allocates 640 writable bytes with 16-byte alignment on both CPU and GPU, checks allocation offsets and address translation, fills a later page, and verifies that the first allocation still holds its data. Controls reject zero size or alignment, non-power-of-two alignment, overflow, and translations that cross an allocation boundary. Idle reset retires all prior ranges. The fixture issues no GPU submission. Guest slot binding, rejection after list Close, and GPU use of an upload payload across a pending fence remain outside this measurement. The separate command-list resubmit tests exercise allocator reuse and the lost-fence control with render-target clears. ### Verification Commit `4c4ea4aa`, Windows 11 25H2 build 26200.9974, MSVC 19.51.36244.0. D3D12 debug layer enabled on WARP 10.0.26100.9818 and RTX 4060 Laptop GPU 32.0.16.1656. ```powershell cmake --build --preset release --target startup_upload_arena startup_list_resubmit ctest --preset release --no-tests=error -R '^startup_(upload_arena|list_resubmit)' -V python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py git diff HEAD^ HEAD --check ``` All six CTests passed with zero skips. Link, bidi, and whitespace checks passed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:32:29 +00:00
github manually merged commit 350619f04c into gh-pr/1774/base 2026-11-26 23:32:31 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 18:58 UTC · original

Merged the current main into this PR branch and retained the list and RTV registrations and documentation. Windows Release passed 8/8 across the arena, resubmission (including untracked fence) and RTV tests on WARP and RTX 4060 Laptop. Production slot wiring and the separate in-flight upload test remain tracked in #1758/#874.

**@⁠R0Y00** on GitHub · 2026-11-24 18:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1774#issuecomment-7141422620) Merged the current main into this PR branch and retained the list and RTV registrations and documentation. Windows Release passed 8/8 across the arena, resubmission (including untracked fence) and RTV tests on WARP and RTX 4060 Laptop. Production slot wiring and the separate in-flight upload test remain tracked in #1758/#874.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 18:49 UTC · original · reviewed

Reviewed at 4c4ea4aaef1b56d7808db73db882667bbf8129e3.

No P1/P2 defects found in local verification. x2w_upload::Arena in src/startup_stubs/list_upload_pages.h enforces 16-byte minimum power-of-two alignment, checks CPU/GPU alignment parity, prevents integer overflow in allocation and translate() range bounds checks, rolls over to new 64 KiB+ upload pages without invalidating earlier allocations, and clears pages/allocations on reset().

Local Verification

  • Linux checks:
    • python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py prep-verify 1774 --dir /tmp/rev-sm2-rexb/1774 --json (git_diff_check, docs_links_check, bidi_controls_check: all ok)
  • Win2025 Debug (--preset dev) & Release /O2 (--preset release):
    • python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 1774 --targets startup_upload_arena --regex '^startup_upload_arena_warp$'
    • Debug (--preset dev): 1/1 passed (startup_upload_arena_warp 0.12s)
    • Release /O2 (--preset release): 1/1 passed (startup_upload_arena_warp 0.11s)
  • Mutation test:
    • Dropped the upper-bound check (bytes <= it->bytes - offset) in Arena::translate() in src/startup_stubs/list_upload_pages.h and ran python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 1774 --wt /tmp/rev-sm2-rexb/1774 --targets startup_upload_arena --regex '^startup_upload_arena_warp$' --wait 600: FAIL (startup_upload_arena_warp exited with Upload arena contract failed: invalid allocation or range accepted), then restored with git checkout -- ..

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 18:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1774#pullrequestreview-6045336256) · **reviewed** Reviewed at `4c4ea4aaef1b56d7808db73db882667bbf8129e3`. No P1/P2 defects found in local verification. `x2w_upload::Arena` in `src/startup_stubs/list_upload_pages.h` enforces 16-byte minimum power-of-two alignment, checks CPU/GPU alignment parity, prevents integer overflow in allocation and `translate()` range bounds checks, rolls over to new 64 KiB+ upload pages without invalidating earlier allocations, and clears pages/allocations on `reset()`. ### Local Verification - **Linux checks**: - `python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py prep-verify 1774 --dir /tmp/rev-sm2-rexb/1774 --json` (`git_diff_check`, `docs_links_check`, `bidi_controls_check`: all ok) - **Win2025 Debug (`--preset dev`) & Release `/O2` (`--preset release`)**: - `python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 1774 --targets startup_upload_arena --regex '^startup_upload_arena_warp$'` - Debug (`--preset dev`): **1/1 passed** (`startup_upload_arena_warp` `0.12s`) - Release `/O2` (`--preset release`): **1/1 passed** (`startup_upload_arena_warp` `0.11s`) - **Mutation test**: - Dropped the upper-bound check (`bytes <= it->bytes - offset`) in `Arena::translate()` in `src/startup_stubs/list_upload_pages.h` and ran `python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 1774 --wt /tmp/rev-sm2-rexb/1774 --targets startup_upload_arena --regex '^startup_upload_arena_warp$' --wait 600`: **FAIL** (`startup_upload_arena_warp` exited with `Upload arena contract failed: invalid allocation or range accepted`), then restored with `git checkout -- .`. AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.