startup: exercise upload arena allocation contract #1767

Merged
R0Y00 merged 2 commits from upstream-pr/1774 into main 2026-11-24 19:08:13 +00:00
R0Y00 commented 2026-11-24 18:22:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T18:22:43Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6588568030 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1774). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T18:22:43Z. --- 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.
tedin7 commented 2026-11-24 18:49:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:49:40Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6045336256 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1774#pullrequestreview-6045336256). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T18:49:40Z. **Review:** COMMENTED --- 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.
R0Y00 commented 2026-11-24 19:01:44 +00:00 (Migrated from github.com)

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


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7141422620 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1774#issuecomment-7141422620). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T18:58:54Z. --- 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.
upstream-sync closed this pull request 2026-11-24 20:00:33 +00:00
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!1767
No description provided.