gpu: compare the placed DXR hit distance within 1e-5 of 1 #1419
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1426"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T11:18:02Z.
Change
dxr_placed_build_hardwareandcpu_placed_dxr_hardwarefail on an AMD Radeon RX 6600 (RDNA 2), although the hit, instance, primitive and both misses are correct. On this adapter the hit distance is0x3f7fffff, one ULP below 1, and both checks compare it bit for bit with0x3f800000. Before this change both checks had been measured only on an RTX 4060 Laptop and on WARP, which return exactly1.0f.The other DXR checks for the same triangle at z = 1 already allow this rounding.
check_dxr_rays(dxr_query_*,dxr_pipeline_*) anddxr_facing.cppcompare the distance within 1e-5 of 1, andcheck_dxr_updatewithin 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 thedirect 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,devpreset (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, withdebug_errors=0 debug_warnings=0.Before (same commit, without the change):
After, 3 of 3 runs:
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.pyandtests/bidi_controls_check.py: passed.Negative controls
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.check_ray_controlon 13 inputs. It accepted exactly1.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 inlineRayQueryCommittedRayToffset). I checked one hypothesis, that the result is computed as(1 - TMin) + TMinin float32 with TMin = 0.01: that expression gives exactly1.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
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T11:28:44Z.
Review: COMMENTED
Peer review at
82680176e9c417abb1ac57f3295aaa0a9a8c02ab:git diff --checkclean.tests/dxr_check.cppandtests/cpu/placed_dxr_check.pyrelax only word 3 (hit distance, checked viaabs(distance - 1.0) < 1e-5) to accommodate hardware intersection rounding (0x3f7fffffon 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.docs_links_check.py(16 Markdown files, 322 links) andbidi_controls_check.py(1183 tracked files) passed.--preset dev):dxr_placed_build_warp1/1 passed (0.05s, build28.72s)./O2(--preset release):dxr_placed_build_warp1/1 passed (0.05s, build41.29s).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 is0x3f7fffff, the same word the description reports for the RX 6600; WARP returns0x3f800000.Environment
1002:747e), driver32.0.32029.2010,dxr_tier=11; WARP10.0.26100.9818devpreset (Debug); the captured build log contains noFAILED:entry.dxr_placed_build_*tests printdebug_layer=enabledanddebug_errors=0 debug_warnings=0in every run. The twocpu_placed_dxr_*tests do not print a debug-layer status.Before:
mainat429a8b922587fbd32ab5c4dfa1c3e28c66e06a89From one full
_hardwarerun (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.cppandtests/cpu/placed_dxr_check.pyare unchanged between429a8b9and the PR head's parent,153bb5f6.First mismatch for each (excerpts):
The old
dxr_placed_buildmessage does not print the words. In thecpu_placed_dxroutput the distance bytes areff ff 7f 3f(0x3f7fffff) where00 00 80 3fis expected. I did not run the_warptwins at429a8b9.After: this PR's head
Operator-reported command, run three times from the checkout root:
Each run reports
100% tests passed, 0 tests failed out of 4. Capability skips in these targeted runs: none.(Excerpt from run 1. The two
Slot 133lines 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
0x3f7fffffon hardware (one float32 step below 1) and0x3f800000on WARP (exactly 1). The CPU tests did not print the post-change distance bits.Limits
429a8b9, not a run at the PR head's parent.dxr_.*selection or theprpreset.AI-assisted (Claude Code).