gpu: compare the placed DXR hit distance within 1e-5 of 1 #1419

Merged
Asimmimx merged 1 commit from upstream-pr/1426 into main 2026-11-24 11:34:16 +00:00
Asimmimx commented 2026-11-24 11:18:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T11:18:02Z.


Change

dxr_placed_build_hardware and cpu_placed_dxr_hardware fail on an AMD Radeon RX 6600 (RDNA 2), although the hit, instance, primitive and both misses are correct. On this adapter the hit distance is 0x3f7fffff, one ULP below 1, and both checks compare it bit for bit with 0x3f800000. Before this change both checks had been measured only on an RTX 4060 Laptop and on WARP, which return exactly 1.0f.

The other DXR checks for the same triangle at z = 1 already allow this rounding. check_dxr_rays (dxr_query_*, dxr_pipeline_*) and dxr_facing.cpp compare the distance within 1e-5 of 1, and check_dxr_update within 1e-4. All of them pass on this RX 6600.

This PR makes the two placed checks follow the same rule:

  • tests/dxr_check.cpp, check_dxr_placed_build: the distance (word 3) must be within 1e-5 of 1, and the other 11 words must match exactly. On a mismatch it prints all 12 words, which the old message did not show. The success line prints the distance bits.
  • tests/cpu/placed_dxr_check.py: the same rule for the direct Windows ray control. The second comparison stays bit-exact: the guest-addressed scene must equal the direct scene byte for byte, distance included. Placement equivalence is what the fixture tests, and its precision is unchanged.
  • docs/experiments.md: both sections now state the rule and record the RX 6600 result.

Verification

Commit 153bb5f6 (main) plus this change, dev preset (Debug). Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0, DXC 1.8.2502.11. AMD Radeon RX 6600 (1002:73ff), driver 32.0.21045.29003, and WARP 10.0.26100.9818. The debug layer was enabled, with debug_errors=0 debug_warnings=0.

Before (same commit, without the change):

dxr_placed_build_hardware ...***Failed   Placed BLAS/TLAS ray output differs from hit7@1, miss, masked miss
cpu_placed_dxr_hardware .....***Failed   direct Windows ray control: expected b'...\x00\x00\x80?...', got b'...\xff\xff\x7f?...'

After, 3 of 3 runs:

ctest --preset dev --no-tests=error -R '^(dxr_placed_build|cpu_placed_dxr)_(hardware|warp)$' -V
dxr_placed_build_hardware: Slot 133 placed BLAS/TLAS: hit7@1 (distance=0x3f7fffff), miss, masked miss; 11/11 words and the distance matched
dxr_placed_build_warp:     Slot 133 placed BLAS/TLAS: hit7@1 (distance=0x3f800000), miss, masked miss; 11/11 words and the distance matched
cpu_placed_dxr_hardware:   valid native/mapped/AOT exit=42 ...; short and unmapped native/mapped/AOT exit=22 first_rejected=1 error=E_INVALIDARG ...  Passed
cpu_placed_dxr_warp:       same  Passed

Also run:

  • ctest --preset dev --no-tests=error -R '^(dxr_.*|cpu_placed_dxr)_(hardware|warp)$': 22/22 passed on the RX 6600 and WARP.
  • ctest --preset pr --no-tests=error: 25/25 passed.
  • tests/docs_links_check.py and tests/bidi_controls_check.py: passed.

Negative controls

  • C++. For a local run, not committed, I changed the expected instance from 7 to 8. Both dxr_placed_build_* failed, and the new output printed the words: placed ray words: 00000001 00000007 00000000 3f7fffff 00000000 ... on hardware and ... 3f800000 ... on WARP. I then restored the file, rebuilt and confirmed the 3/3 passes above.
  • Python. A one-off script, not committed, called check_ray_control on 13 inputs. It accepted exactly 1.0, 1 ULP below and 1 ULP above. It rejected 1.0001, 0.99, NaN, a distance of 0, instance 8, ray 0 reported as a miss, primitive 1, a miss ray that reports a hit, a set word in the masked-miss row and a truncated buffer. All 13 behaved as expected.

Evidence and follow-up

No new fixture. The tolerance matches the one in check_dxr_rays. I did not establish why the RX 6600 rounds this distance down; the change does not depend on it. This is separate from #1011 (an RDNA 4 inline RayQuery CommittedRayT offset). I checked one hypothesis, that the result is computed as (1 - TMin) + TMin in float32 with TMin = 0.01: that expression gives exactly 1.0f, so it does not explain the result.

Related RX 6600 results from the same run are in #1414 (gpu_alias_window_hardware) and https://github.com/R0Y00/Xbox2Windows/issues/369#issuecomment-7129818815.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6580581291 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1426). Originally posted by [Asimmimx](https://github.com/Asimmimx) on 2026-11-24T11:18:02Z. --- ## Change `dxr_placed_build_hardware` and `cpu_placed_dxr_hardware` fail on an AMD Radeon RX 6600 (RDNA 2), although the hit, instance, primitive and both misses are correct. On this adapter the hit distance is `0x3f7fffff`, one ULP below 1, and both checks compare it bit for bit with `0x3f800000`. Before this change both checks had been measured only on an RTX 4060 Laptop and on WARP, which return exactly `1.0f`. The other DXR checks for the same triangle at z = 1 already allow this rounding. `check_dxr_rays` (`dxr_query_*`, `dxr_pipeline_*`) and `dxr_facing.cpp` compare the distance within 1e-5 of 1, and `check_dxr_update` within 1e-4. All of them pass on this RX 6600. This PR makes the two placed checks follow the same rule: - `tests/dxr_check.cpp`, `check_dxr_placed_build`: the distance (word 3) must be within 1e-5 of 1, and the other 11 words must match exactly. On a mismatch it prints all 12 words, which the old message did not show. The success line prints the distance bits. - `tests/cpu/placed_dxr_check.py`: the same rule for the `direct Windows ray control`. The second comparison stays bit-exact: the guest-addressed scene must equal the direct scene byte for byte, distance included. Placement equivalence is what the fixture tests, and its precision is unchanged. - `docs/experiments.md`: both sections now state the rule and record the RX 6600 result. ## Verification Commit `153bb5f6` (`main`) plus this change, `dev` preset (Debug). Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0, DXC 1.8.2502.11. AMD Radeon RX 6600 (`1002:73ff`), driver 32.0.21045.29003, and WARP 10.0.26100.9818. The debug layer was enabled, with `debug_errors=0 debug_warnings=0`. **Before** (same commit, without the change): ```text dxr_placed_build_hardware ...***Failed Placed BLAS/TLAS ray output differs from hit7@1, miss, masked miss cpu_placed_dxr_hardware .....***Failed direct Windows ray control: expected b'...\x00\x00\x80?...', got b'...\xff\xff\x7f?...' ``` **After**, 3 of 3 runs: ```powershell ctest --preset dev --no-tests=error -R '^(dxr_placed_build|cpu_placed_dxr)_(hardware|warp)$' -V ``` ```text dxr_placed_build_hardware: Slot 133 placed BLAS/TLAS: hit7@1 (distance=0x3f7fffff), miss, masked miss; 11/11 words and the distance matched dxr_placed_build_warp: Slot 133 placed BLAS/TLAS: hit7@1 (distance=0x3f800000), miss, masked miss; 11/11 words and the distance matched cpu_placed_dxr_hardware: valid native/mapped/AOT exit=42 ...; short and unmapped native/mapped/AOT exit=22 first_rejected=1 error=E_INVALIDARG ... Passed cpu_placed_dxr_warp: same Passed ``` Also run: - `ctest --preset dev --no-tests=error -R '^(dxr_.*|cpu_placed_dxr)_(hardware|warp)$'`: 22/22 passed on the RX 6600 and WARP. - `ctest --preset pr --no-tests=error`: 25/25 passed. - `tests/docs_links_check.py` and `tests/bidi_controls_check.py`: passed. ## Negative controls - **C++.** For a local run, not committed, I changed the expected instance from 7 to 8. Both `dxr_placed_build_*` failed, and the new output printed the words: `placed ray words: 00000001 00000007 00000000 3f7fffff 00000000 ...` on hardware and `... 3f800000 ...` on WARP. I then restored the file, rebuilt and confirmed the 3/3 passes above. - **Python.** A one-off script, not committed, called `check_ray_control` on 13 inputs. It accepted exactly `1.0`, 1 ULP below and 1 ULP above. It rejected 1.0001, 0.99, NaN, a distance of 0, instance 8, ray 0 reported as a miss, primitive 1, a miss ray that reports a hit, a set word in the masked-miss row and a truncated buffer. All 13 behaved as expected. ## Evidence and follow-up No new fixture. The tolerance matches the one in `check_dxr_rays`. I did not establish why the RX 6600 rounds this distance down; the change does not depend on it. This is separate from #1011 (an RDNA 4 inline `RayQuery` `CommittedRayT` offset). I checked one hypothesis, that the result is computed as `(1 - TMin) + TMin` in float32 with TMin = 0.01: that expression gives exactly `1.0f`, so it does not explain the result. Related RX 6600 results from the same run are in #1414 (`gpu_alias_window_hardware`) and https://github.com/R0Y00/Xbox2Windows/issues/369#issuecomment-7129818815. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-24 12:02:55 +00:00
tedin7 commented 2026-11-24 12:02:55 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Peer review at 82680176e9c417abb1ac57f3295aaa0a9a8c02ab:

  • Diff & negative controls: git diff --check clean. tests/dxr_check.cpp and tests/cpu/placed_dxr_check.py relax only word 3 (hit distance, checked via abs(distance - 1.0) < 1e-5) to accommodate hardware intersection rounding (0x3f7fffff on RX 6600), while keeping exact bit-for-bit comparison on the remaining 11 words (hit flag, instance ID, primitive index, spatial miss, masked miss) and exact byte-for-byte comparison between guest-addressed and direct scenes.
  • Linux checks: docs_links_check.py (16 Markdown files, 322 links) and bidi_controls_check.py (1183 tracked files) passed.
  • Win2025 WARP:
    • Debug (--preset dev): dxr_placed_build_warp 1/1 passed (0.05s, build 28.72s).
    • Release /O2 (--preset release): dxr_placed_build_warp 1/1 passed (0.05s, build 41.29s).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6038391856 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1426#pullrequestreview-6038391856). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T11:28:44Z. **Review:** COMMENTED --- Peer review at `82680176e9c417abb1ac57f3295aaa0a9a8c02ab`: - **Diff & negative controls**: `git diff --check` clean. `tests/dxr_check.cpp` and `tests/cpu/placed_dxr_check.py` relax only word 3 (hit distance, checked via `abs(distance - 1.0) < 1e-5`) to accommodate hardware intersection rounding (`0x3f7fffff` on RX 6600), while keeping exact bit-for-bit comparison on the remaining 11 words (hit flag, instance ID, primitive index, spatial miss, masked miss) and exact byte-for-byte comparison between guest-addressed and direct scenes. - **Linux checks**: `docs_links_check.py` (16 Markdown files, 322 links) and `bidi_controls_check.py` (1183 tracked files) passed. - **Win2025 WARP**: - Debug (`--preset dev`): `dxr_placed_build_warp` **1/1 passed** (`0.05s`, build `28.72s`). - Release `/O2` (`--preset release`): `dxr_placed_build_warp` **1/1 passed** (`0.05s`, build `41.29s`).
trick-ye commented 2026-11-24 12:03:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by trick-ye on 2026-11-24T11:28:40Z.


RX 7800 XT (RDNA 3) run at this PR's head 82680176e9c417abb1ac57f3295aaa0a9a8c02ab: all four tests pass, 3 of 3 runs. The hardware hit distance is 0x3f7fffff, the same word the description reports for the RX 6600; WARP returns 0x3f800000.

Environment

  • AMD Radeon RX 7800 XT (1002:747e), driver 32.0.32029.2010, dxr_tier=11; WARP 10.0.26100.9818
  • Operator-attested environment: Windows 11 build 26200.9974; MSVC 19.42.34436; Windows SDK 10.0.26100.0; DXC 1.9.2602.17; Python 3.13.0; AMD Software 26.11.2.
  • dev preset (Debug); the captured build log contains no FAILED: entry.
  • Debug layer: the two dxr_placed_build_* tests print debug_layer=enabled and debug_errors=0 debug_warnings=0 in every run. The two cpu_placed_dxr_* tests do not print a debug-layer status.
  • Wave width: not printed by these tests and not measured here.

Before: main at 429a8b922587fbd32ab5c4dfa1c3e28c66e06a89

From one full _hardware run (259 tests; operator-reported command: ctest --preset dev --no-tests=error -j 1 -R '_hardware$' -V). The full run reported four failures and, separately, four skips; the two failures relevant here are below. tests/dxr_check.cpp and tests/cpu/placed_dxr_check.py are unchanged between 429a8b9 and the PR head's parent, 153bb5f6.

 42/259 Test #149: dxr_placed_build_hardware ..........................***Failed    0.36 sec
117/259 Test #516: cpu_placed_dxr_hardware ............................***Failed    2.36 sec

First mismatch for each (excerpts):

149: Placed BLAS/TLAS ray output differs from hit7@1, miss, masked miss
516: AssertionError: direct Windows ray control: expected b'\x01\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80?...', got b'\x01\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\xff\xff\x7f?...'

The old dxr_placed_build message does not print the words. In the cpu_placed_dxr output the distance bytes are ff ff 7f 3f (0x3f7fffff) where 00 00 80 3f is expected. I did not run the _warp twins at 429a8b9.

After: this PR's head

Operator-reported command, run three times from the checkout root:

ctest --preset dev --no-tests=error -j 1 -R '^(dxr_placed_build|cpu_placed_dxr)_(hardware|warp)$' -V

Each run reports 100% tests passed, 0 tests failed out of 4. Capability skips in these targeted runs: none.

153: Slot 133 placed BLAS/TLAS: hit7@1 (distance=0x3f7fffff), miss, masked miss; 11/11 words and the distance matched
195: Slot 133 placed BLAS/TLAS: hit7@1 (distance=0x3f800000), miss, masked miss; 11/11 words and the distance matched
1/4 Test #153: dxr_placed_build_hardware ........   Passed    0.39 sec
2/4 Test #195: dxr_placed_build_warp ............   Passed    0.08 sec
3/4 Test #519: cpu_placed_dxr_warp ..............   Passed    2.22 sec
4/4 Test #520: cpu_placed_dxr_hardware ..........   Passed    7.00 sec

(Excerpt from run 1. The two Slot 133 lines are identical in runs 2 and 3; test 153 is hardware and test 195 is WARP.)

Expected: the four tests pass with the hardware distance within 1e-5 of 1. Observed: all four tests passed in all three runs. The placed-build test printed 0x3f7fffff on hardware (one float32 step below 1) and 0x3f800000 on WARP (exactly 1). The CPU tests did not print the post-change distance bits.

Limits

  • One physical GPU and one hardware driver version, plus WARP. The baseline is a single run at 429a8b9, not a run at the PR head's parent.
  • I did not repeat the PR's negative controls, the wider dxr_.* selection or the pr preset.
  • This says nothing about why the distance is one step below 1 on this adapter.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7130148061 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1426#issuecomment-7130148061). Originally posted by [trick-ye](https://github.com/trick-ye) on 2026-11-24T11:28:40Z. --- RX 7800 XT (RDNA 3) run at this PR's head `82680176e9c417abb1ac57f3295aaa0a9a8c02ab`: all four tests pass, 3 of 3 runs. The hardware hit distance is `0x3f7fffff`, the same word the description reports for the RX 6600; WARP returns `0x3f800000`. ## Environment - AMD Radeon RX 7800 XT (`1002:747e`), driver `32.0.32029.2010`, `dxr_tier=11`; WARP `10.0.26100.9818` - Operator-attested environment: Windows 11 build 26200.9974; MSVC 19.42.34436; Windows SDK 10.0.26100.0; DXC 1.9.2602.17; Python 3.13.0; AMD Software 26.11.2. - `dev` preset (Debug); the captured build log contains no `FAILED:` entry. - Debug layer: the two `dxr_placed_build_*` tests print `debug_layer=enabled` and `debug_errors=0 debug_warnings=0` in every run. The two `cpu_placed_dxr_*` tests do not print a debug-layer status. - Wave width: not printed by these tests and not measured here. ## Before: `main` at `429a8b922587fbd32ab5c4dfa1c3e28c66e06a89` From one full `_hardware` run (259 tests; operator-reported command: `ctest --preset dev --no-tests=error -j 1 -R '_hardware$' -V`). The full run reported four failures and, separately, four skips; the two failures relevant here are below. `tests/dxr_check.cpp` and `tests/cpu/placed_dxr_check.py` are unchanged between `429a8b9` and the PR head's parent, `153bb5f6`. ```text 42/259 Test #149: dxr_placed_build_hardware ..........................***Failed 0.36 sec 117/259 Test #516: cpu_placed_dxr_hardware ............................***Failed 2.36 sec ``` First mismatch for each (excerpts): ```text 149: Placed BLAS/TLAS ray output differs from hit7@1, miss, masked miss 516: AssertionError: direct Windows ray control: expected b'\x01\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80?...', got b'\x01\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\xff\xff\x7f?...' ``` The old `dxr_placed_build` message does not print the words. In the `cpu_placed_dxr` output the distance bytes are `ff ff 7f 3f` (`0x3f7fffff`) where `00 00 80 3f` is expected. I did not run the `_warp` twins at `429a8b9`. ## After: this PR's head Operator-reported command, run three times from the checkout root: ```powershell ctest --preset dev --no-tests=error -j 1 -R '^(dxr_placed_build|cpu_placed_dxr)_(hardware|warp)$' -V ``` Each run reports `100% tests passed, 0 tests failed out of 4`. Capability skips in these targeted runs: none. ```text 153: Slot 133 placed BLAS/TLAS: hit7@1 (distance=0x3f7fffff), miss, masked miss; 11/11 words and the distance matched 195: Slot 133 placed BLAS/TLAS: hit7@1 (distance=0x3f800000), miss, masked miss; 11/11 words and the distance matched 1/4 Test #153: dxr_placed_build_hardware ........ Passed 0.39 sec 2/4 Test #195: dxr_placed_build_warp ............ Passed 0.08 sec 3/4 Test #519: cpu_placed_dxr_warp .............. Passed 2.22 sec 4/4 Test #520: cpu_placed_dxr_hardware .......... Passed 7.00 sec ``` (Excerpt from run 1. The two `Slot 133` lines are identical in runs 2 and 3; test 153 is hardware and test 195 is WARP.) Expected: the four tests pass with the hardware distance within 1e-5 of 1. Observed: all four tests passed in all three runs. The placed-build test printed `0x3f7fffff` on hardware (one float32 step below 1) and `0x3f800000` on WARP (exactly 1). The CPU tests did not print the post-change distance bits. ## Limits - One physical GPU and one hardware driver version, plus WARP. The baseline is a single run at `429a8b9`, not a run at the PR head's parent. - I did not repeat the PR's negative controls, the wider `dxr_.*` selection or the `pr` preset. - This says nothing about why the distance is one step below 1 on this adapter. AI-assisted (Claude Code).
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!1419
No description provided.