gpu: check live aliases with colliding low 40 address bits #1298

Merged
R0Y00 merged 1 commit from upstream-pr/1305 into main 2026-11-24 07:28:10 +00:00
R0Y00 commented 2026-11-24 07:23:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T07:23:31Z.


Refs #874. This extends the source-built GPU address regression for contributors working on guest address translation.

Two independently backed 256 KiB GPU buffers receive synthetic guest addresses differing only in bit 40. A dispatch writes 4,096 transformed words to the high range. A second launch deliberately clears bit 40 and writes the low range. Each launch checks both CPU-visible buffers and the guards. Removing the high range must preserve the low mapping.

Ran on Windows 11 build 26200.9974 at 6b8b7fa9 with the debug layer enabled. RTX 4060 Laptop driver 32.0.16.1656 and WARP 10.0.26100.9818 both passed with zero debug errors and warnings. Two passed, zero failed, zero skipped.

cmake --build --preset release --target offscreen_check
ctest --preset release --no-tests=error -R '^gpu_alias_(warp|hardware)$' -V

The guest addresses are synthetic. This test checks two separately backed D3D12 buffers and the address table, and makes no inference about address-space placement in other programs.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6576783964 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1305). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T07:23:31Z. --- Refs #874. This extends the source-built GPU address regression for contributors working on guest address translation. Two independently backed 256 KiB GPU buffers receive synthetic guest addresses differing only in bit 40. A dispatch writes 4,096 transformed words to the high range. A second launch deliberately clears bit 40 and writes the low range. Each launch checks both CPU-visible buffers and the guards. Removing the high range must preserve the low mapping. Ran on Windows 11 build 26200.9974 at `6b8b7fa9` with the debug layer enabled. RTX 4060 Laptop driver 32.0.16.1656 and WARP 10.0.26100.9818 both passed with zero debug errors and warnings. Two passed, zero failed, zero skipped. ```powershell cmake --build --preset release --target offscreen_check ctest --preset release --no-tests=error -R '^gpu_alias_(warp|hardware)$' -V ``` The guest addresses are synthetic. This test checks two separately backed D3D12 buffers and the address table, and makes no inference about address-space placement in other programs.
tedin7 commented 2026-11-24 07:27:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T07:27:13Z.

Review: COMMENTED


Dual-platform review at commit 6b8b7fa95e890c2690689158c1ebe84f1ad1480e:

Verification

  • Linux:
    • git diff --check origin/main...HEAD: clean (exit 0)
    • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: passed (16 Markdown files, 289 links)
    • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: passed (1086 tracked files)
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev):
      • cmake --build --preset dev --target offscreen_check -- -j 6 (4.78s)
      • ctest --preset dev -R '^gpu_alias(_.*)?_warp$' --parallel 4 --no-tests=error --output-on-failure: 5/5 passed (0.16s: gpu_alias_warp, gpu_alias_window_warp, gpu_alias_lookup_warp, gpu_alias_lookup_writes_warp, gpu_alias_registry_warp)
    • Release /O2 (--preset release):
      • cmake --build --preset release --target offscreen_check -- -j 6 (2.25s)
      • ctest --preset release -R '^gpu_alias(_.*)?_warp$' --parallel 4 --no-tests=error --output-on-failure: 5/5 passed (0.16s: gpu_alias_warp, gpu_alias_window_warp, gpu_alias_lookup_warp, gpu_alias_lookup_writes_warp, gpu_alias_registry_warp)

Code Review Notes

  • tests/gpu_alias.cpp: Extracting dispatch(...) cleanly deduplicates the compute submission path, and if (dst_buffer != src_buffer) avoids redundant UAV/COMMON transitions when reading and writing the same alias.
  • check_address_width: Declares TitleAllocation high before era_gpu_alias::Alias high_alias, so RAII destruction releases the D3D12 resource/heap before releasing the underlying title allocation.
  • Synthetic colliding guest addresses (0x20000000 vs (1ull << 40) | 0x20000000), guard words (low_dst[-1], high_dst[-1], and count..count+guard_words-1), untouched-buffer assertions, and table.remove(high_address) isolation are all sound.
  • docs/experiments.md: Accurately documents the new bit-40 collision check and ctest invocation.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6035250076 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1305#pullrequestreview-6035250076). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T07:27:13Z. **Review:** COMMENTED --- Dual-platform review at commit `6b8b7fa95e890c2690689158c1ebe84f1ad1480e`: ### Verification - **Linux**: - `git diff --check origin/main...HEAD`: clean (exit 0) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py`: passed (16 Markdown files, 289 links) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py`: passed (1086 tracked files) - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: - `cmake --build --preset dev --target offscreen_check -- -j 6` (`4.78s`) - `ctest --preset dev -R '^gpu_alias(_.*)?_warp$' --parallel 4 --no-tests=error --output-on-failure`: **5/5 passed** (`0.16s`: `gpu_alias_warp`, `gpu_alias_window_warp`, `gpu_alias_lookup_warp`, `gpu_alias_lookup_writes_warp`, `gpu_alias_registry_warp`) - **Release `/O2` (`--preset release`)**: - `cmake --build --preset release --target offscreen_check -- -j 6` (`2.25s`) - `ctest --preset release -R '^gpu_alias(_.*)?_warp$' --parallel 4 --no-tests=error --output-on-failure`: **5/5 passed** (`0.16s`: `gpu_alias_warp`, `gpu_alias_window_warp`, `gpu_alias_lookup_warp`, `gpu_alias_lookup_writes_warp`, `gpu_alias_registry_warp`) ### Code Review Notes - `tests/gpu_alias.cpp`: Extracting `dispatch(...)` cleanly deduplicates the compute submission path, and `if (dst_buffer != src_buffer)` avoids redundant UAV/COMMON transitions when reading and writing the same alias. - `check_address_width`: Declares `TitleAllocation high` before `era_gpu_alias::Alias high_alias`, so RAII destruction releases the D3D12 resource/heap before releasing the underlying title allocation. - Synthetic colliding guest addresses (`0x20000000` vs `(1ull << 40) | 0x20000000`), guard words (`low_dst[-1]`, `high_dst[-1]`, and `count..count+guard_words-1`), untouched-buffer assertions, and `table.remove(high_address)` isolation are all sound. - `docs/experiments.md`: Accurately documents the new bit-40 collision check and ctest invocation.
upstream-sync closed this pull request 2026-11-24 08:01:30 +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!1298
No description provided.