Compare real DXR hits at guest AS addresses with identical low 40 bits #1300

Merged
R0Y00 merged 1 commit from upstream-pr/1307 into main 2026-11-24 07:42:03 +00:00
R0Y00 commented 2026-11-24 07:26:23 +00:00 (Migrated from github.com)

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


Refs #874.

This source-built check registers two synthetic guest address ranges separated by 1 TiB with the existing title-to-GPU range table. Each range points to a separate live desktop buffer containing a BLAS at offset 512. Each BLAS contains a triangle at a different position and distance. A TLAS also starts 512 bytes inside its buffer. Its instances are built with distinct masks and IDs and use the resolved interior addresses.

Both the normal and the deliberately truncated cases perform real BLAS/TLAS builds and DispatchRays. Masking both instance references to 40 bits selects a different valid BLAS for the second instance. On both adapters the four rays returned:

Instance lookup Ray 0 Ray 1 Ray 2 Ray 3
Full address ID 7 at 1 miss miss ID 11 at 2
High bits dropped ID 7 at 1 miss ID 11 at 1 miss

Every payload word is checked, including primitive index and the distance bits. This is a test of host range translation consumed by DXR. Encodings used by external builders remain an open question.

At 6e029d1a, Windows 11 build 26200.9974, MSVC x64 Release, debug layer enabled. RTX 4060 Laptop (32.0.16.1656) and Microsoft WARP (10.0.26100.9818) both passed. Eight checks passed with zero skips, zero D3D12 warnings and zero errors.

cmake --build --preset release --target offscreen_check
ctest --preset release --no-tests=error --output-on-failure -R '^dxr_(address_ranges|pipeline|query|update_pipeline)_(hardware|warp)$'
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6576823672 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1307). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T07:26:23Z. --- Refs #874. This source-built check registers two synthetic guest address ranges separated by 1 TiB with the existing title-to-GPU range table. Each range points to a separate live desktop buffer containing a BLAS at offset 512. Each BLAS contains a triangle at a different position and distance. A TLAS also starts 512 bytes inside its buffer. Its instances are built with distinct masks and IDs and use the resolved interior addresses. Both the normal and the deliberately truncated cases perform real BLAS/TLAS builds and DispatchRays. Masking both instance references to 40 bits selects a different *valid* BLAS for the second instance. On both adapters the four rays returned: | Instance lookup | Ray 0 | Ray 1 | Ray 2 | Ray 3 | | --- | --- | --- | --- | --- | | Full address | ID 7 at 1 | miss | miss | ID 11 at 2 | | High bits dropped | ID 7 at 1 | miss | ID 11 at 1 | miss | Every payload word is checked, including primitive index and the distance bits. This is a test of host range translation consumed by DXR. Encodings used by external builders remain an open question. At 6e029d1a, Windows 11 build 26200.9974, MSVC x64 Release, debug layer enabled. RTX 4060 Laptop (32.0.16.1656) and Microsoft WARP (10.0.26100.9818) both passed. Eight checks passed with zero skips, zero D3D12 warnings and zero errors. ```powershell cmake --build --preset release --target offscreen_check ctest --preset release --no-tests=error --output-on-failure -R '^dxr_(address_ranges|pipeline|query|update_pipeline)_(hardware|warp)$' ```
tedin7 commented 2026-11-24 07:40:28 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Reviewed at commit 6e029d1af78d4cd97afcd71b3a49421794167489.

Code Review

  • tests/dxr_check.cpp: AddressScene registers two live AS buffers at 0x2300000000 and 0x2300000000 + (1ull << 40) in era_title_va::Table, verifying both interior 512-byte AS offsets (2 * D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT) and full 64-bit guest-to-host range translation.
  • Updating SetComputeRootShaderResourceView(0, top.DestAccelerationStructureData) ensures the TLAS SRV respects the interior offset when addressScene is active, and both otherBlas / otherVertices remain live until after readback.
  • The negative/truncation control (scene.truncate = true, masking to 40 bits before ranges.translate) cleanly proves that collapsing the high bits misroutes instance 11 onto the first BLAS (hit11@1 and a miss).

Verification

  • Linux (6e029d1a):
    • git diff --check origin/main...HEAD: pass
    • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: pass (16 Markdown files, 289 links)
    • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: pass (1086 files)
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP, --target offscreen_check):
    • Debug (--preset dev): ctest --preset dev -R '^dxr_(address_ranges|pipeline|query)_warp$' --parallel 4 --no-tests=error --output-on-failure — 3/3 passed (dxr_address_ranges_warp, dxr_pipeline_warp, dxr_query_warp)
    • Release /O2 (--preset release): ctest --preset release -R '^dxr_(address_ranges|pipeline|query)_warp$' --parallel 4 --no-tests=error --output-on-failure — 3/3 passed (dxr_address_ranges_warp, dxr_pipeline_warp, dxr_query_warp)
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6035384332 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1307#pullrequestreview-6035384332). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T07:40:28Z. **Review:** COMMENTED --- Reviewed at commit `6e029d1af78d4cd97afcd71b3a49421794167489`. ### Code Review - `tests/dxr_check.cpp`: `AddressScene` registers two live AS buffers at `0x2300000000` and `0x2300000000 + (1ull << 40)` in `era_title_va::Table`, verifying both interior 512-byte AS offsets (`2 * D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT`) and full 64-bit guest-to-host range translation. - Updating `SetComputeRootShaderResourceView(0, top.DestAccelerationStructureData)` ensures the TLAS SRV respects the interior offset when `addressScene` is active, and both `otherBlas` / `otherVertices` remain live until after readback. - The negative/truncation control (`scene.truncate = true`, masking to 40 bits before `ranges.translate`) cleanly proves that collapsing the high bits misroutes instance 11 onto the first BLAS (`hit11@1` and a miss). ### Verification - **Linux** (`6e029d1a`): - `git diff --check origin/main...HEAD`: pass - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py`: pass (16 Markdown files, 289 links) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py`: pass (1086 files) - **Windows Server 2025** (Build 26100, MSVC 14.44.35207 + D3D12 WARP, `--target offscreen_check`): - **Debug (`--preset dev`)**: `ctest --preset dev -R '^dxr_(address_ranges|pipeline|query)_warp$' --parallel 4 --no-tests=error --output-on-failure` — **3/3 passed** (`dxr_address_ranges_warp`, `dxr_pipeline_warp`, `dxr_query_warp`) - **Release `/O2` (`--preset release`)**: `ctest --preset release -R '^dxr_(address_ranges|pipeline|query)_warp$' --parallel 4 --no-tests=error --output-on-failure` — **3/3 passed** (`dxr_address_ranges_warp`, `dxr_pipeline_warp`, `dxr_query_warp`)
upstream-sync closed this pull request 2026-11-24 08:01:32 +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!1300
No description provided.