Repository navigation
Conversation
|
Hardware check for SHADER-635: real RDNA2 treats an empty box as a miss, and this PR matches it on two GPUs. AI-assisted run, synthetic BVH only, no game files. Nobody had measured the instruction itself yet (the reference and this fix both follow the console code), so I ran
Ray A: origin (0.25, 0.25, 0), direction +z. Ray B: origin (0.25, 0.25, 10), direction −z, the negative-direction case from @jaybeebabageyus's claim. Inverse direction (inf, inf, ±1), t max 100.
So the hardware rejects all three kinds of empty box in both directions, including a box that is empty on one axis only. Also at this head: |
|
Follow-up on NaN bounds, since this PR keeps the old NaN behaviour: measured natively on the same gfx1036, a box with a single NaN bound that the ray passes through is a hit in every position I tried (min.x, min.y, min.z, max.x, max.y, max.z). An all-NaN box is a miss. |
|
Added a GPU fixture,
Run with scripts/run_gpu_tests.py --filter cs_bvh_empty_box (Windows, Python 3.13); check.py also reports ok on both. The GPU agrees with the interpreter. AI-assisted. |
|
Tested #3366 (
This adds an RDNA4 run of the translated code only; the native-hardware data, including the open NaN-bound question, is in the comments by TheMrBeez above. (AI-assisted test run.) |
|
Measured on gfx1036 (RDNA2, driver 26.10.1, game MODE) with a raw hw_oracle kernel:
So the hardware culls an empty box (min > max on any one axis, or all three) and keeps a zero-thickness one, as this PR does. I ran the same 13 boxes through this PR's translation (semantic interpreter, |
|
Tested
Nit: |
|
Tested
AI-assisted (Claude Code). No game files. |
|
Tested 34418fe on AMD Radeon RX 9070 XT (RADV GFX1201) and the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass, no regressions.
No game files. AI-assisted. |
|
Tested
No game files. AI-assisted (Claude Code). |
34418fe to
11dd7c2
Compare
|
Rebased onto main aa2988c; conflicts in runtime/test/shaders/check.py and scripts/run_gpu_tests.py (main added cs_w32_andn2_exec and other fixture names to the same lists), kept main's lists and added cs_bvh_empty_box; tests: tests/semantic 7458 run (only the 10 failures that also fail on main), test_image_bvh_empty_box 2 OK, test_run_gpu_tests, test_run_gpu_tests_paths, test_shader_checks, test_docs_* OK. |
|
Tested 11dd7c2 (merged onto main aa2988c) on RTX 3060 (Ampere), driver 617.14, Windows 11, MSVC 14.44, RelWithDebInfo: pass
AI-assisted: this check was run and written with Claude Code (Anthropic) on my machine; the numbers above are its unedited output. |
11dd7c2 to
c74d3eb
Compare
|
Tested
New in this PR:
Every other test has the same result as on One earlier Intel run of this PR crashed the runner while the machine was busy with other test suites. Three reruns on an idle GPU were clean, as were three |
|
Tested The stock synthetic
The one-ULP case repeated on a second run. Moving just the forward ray origin from z = −1 to z = 0 gave two misses for that same box. The other three children kept their expected results throughout. This is consistent with binary32 rounding: subtracting −1 rounds both one-ULP-case endpoints to 2.0. A native gfx1036 comparison using those exact bound words and origins would distinguish an ISA behavior from a translation discrepancy. AI-assisted verification. |
|
Tested
AI-assisted (Claude Code). |
|
Tested
I didn't run the one-ULP Z-bounds variant from the RTX 5090 comment. Synthetic fixture only, no game data. AI-assisted (Claude Code). |
|
Thanks for the one-ULP table. This PR only pins boxes whose min exceeds max by a wide margin (the fixture's empty children), measured on hardware in the earlier work it builds on, and its four asserted child ids are unchanged by your result. The one-ULP inversion is a different question: whether hardware or the translated path rounds the origin subtraction differently. I have no gfx1036 on this machine (only an RTX 4080 SUPER and an Intel UHD 770), so I have not reproduced your table and will not claim either side. If someone with a gfx1036 runs the three minZ words from the two origins through hw_oracle, that would settle it and could become its own small fixture; I will leave this PR as it is. |
|
Tested c74d3eb (merge base 7b7d73f; merges cleanly with current main 3faac55) on AMD Radeon 780M (RADV PHOENIX, Mesa 26.2.6) and NVIDIA GeForce RTX 4070 Laptop (620.70.06, plain and
Synthetic inputs only, no game data. AI-assisted. |
|
Tested c74d3eb on AMD Radeon RX 9070 XT (RADV GFX1201) and the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass, no regressions.
No game files. AI-assisted. |
c74d3eb to
819f3d9
Compare
|
Rebased onto current main (new head |
|
Tested 819f3d9 merged onto main 561b65a (no-op merge, the PR is based on it) on Apple M4, macOS 27.2.1, MoltenVK 1.4.2, Python 3.15.2 and 3.12.16: pass. The GPU fixture is the useful part. The semantic test adds nothing that main doesn't already pin; one more case would change that.
AI-assisted. |
819f3d9 to
ddc0e34
Compare
…axis only (z), so the far >= near check is pinned
|
Thanks @sovljanskii, the mutation table was useful. The PR was CONFLICTING (fixture-name lists only), so I rebased onto upstream/main 1cc6e3c and also added your suggested case: Run on Linux, Python 3.12.16: |
|
Tested The rebased synthetic AI-assisted verification. |
Main now treats a box child with min > max as a miss (measured on hardware there), so this PR no longer changes the translator. It is rebased to the tests only.
What it adds.
tests/semantic/test_image_bvh_empty_box.py: hand-built box32 and box16 nodes, a hit control, an all-axes-empty child, an x-only-empty child; asserts the four returned child ids. Thecs_bvh_empty_boxGPU fixture, and one sentence in the Ray tracing row ofdocs/design.md.Tests. Python 3.12.16, Linux (WSL2): the BVH semantic tests pass (14 OK).
cs_bvh_empty_boxpasses 1/1 on the RTX 4080 SUPER and on the Intel UHD 770 (Windows 11).AI-assisted.