Repository navigation
startup: lower triangle nodes in image_bvh_intersect_ray - #3105
Conversation
Adopt the FP32 BVH descriptor unit decode, 48-bit end-exclusive bound, positional unsorted results and positive-infinity miss keys for both box kinds. Binary16 fixtures are packed as half values and share the independent model; dev and release WARP and RX 9060 XT dispatch pass 21 cases plus six mutants.
Accept the 64-byte triangle node forms (kinds 0..3), decode their four ID maps and base vertex triples, and emit a watertight ray/triangle helper for return mode 1. The helper returns {t, det, v, w} and keeps the 48-bit descriptor rules. 119 CPU witnesses pass bit-for-bit on WARP and the RX 9060 XT in dev and release, with four negative mutations; the existing box tests remain green.
|
Windows checks #8207 completed successfully on |
Size 0 is a one-unit span, so a binary16 node at offset zero accepts it and an FP32 node needs size 1 at offset zero. Use the decoded extent in the Python guard and both HLSL helpers, with exact-fit, too-short, upper-bound and boundary-dispatch controls.
Size is a count minus one in 64-byte units: size 0 covers a triangle at offset zero, while a triangle in the next unit needs size 1. Cover exact fits, a too-short neighbor, the 4 GiB upper bound and the HLSL boundary dispatch on WARP and hardware.
|
Propagated the decoded-extent rule to this stacked PR on Controls: exact fits |
|
Windows checks #8240 completed successfully on |
|
Merged the updated #3032 branch and |
|
Thanks for the careful slice: the witness reuse, the boundary dispatch and the mutants make this easy to follow. I ran
Happy to re-run the Linux checks on a new head. This comment was AI-assisted. |
- assert the origin, direction and inverse-direction operands of the translated call - ignore the triangle return mode bit for box nodes in the translator guard and helper - add the triangle check to the Linux CI fragment - correct the BVH experiment notes and link both notes from experiments.md
|
@JohnConnorNPC thanks for the detailed review. Points 1-4 are addressed on
Local receipt: |
|
Windows checks #8297 completed successfully on |
|
#3032 is now on |
…-triangle # Conflicts: # docs/experiments/startup-gfx2hlsl-bvh-box32.md # tests/startup_gfx2hlsl_bvh_check.py # tools/startup/gfx2hlsl.py
|
#3032 landed on The conflicts were limited to Local checks on |
R0Y00
left a comment
There was a problem hiding this comment.
Independently reviewed b2f86a8d over main at 2b7ebf18. The triangle path's 64-byte records respect the decoded extent from #3032. I checked the box return-mode controls and the triangle readback, ordering, and boundary controls.
I built offscreen_check from source and ran ctest --test-dir <build> --no-tests=error -j1 -V -R '^startup_gfx2hlsl_bvh' in Debug and Release (/O2): 6/6 passed in each, with no skips. Both sets exercised WARP 10.0.26100.9818 and an NVIDIA GeForce RTX 4060 Laptop GPU (driver 32.0.16.1656) on Windows 11 build 26200.9974. The D3D12 debug layer reported zero errors and warnings. Hosted Windows passed, and the hosted /O2 job was skipped. The subsequent main change from #3175 adds a separate scene-colour reporting tool and documentation. I verified the current trial merge has identical BVH implementation and test contents.
git diff --check flags extra end-of-file blank lines in three new files. They do not affect runtime or test behavior.
What changed
This is the triangle-node slice of
image_bvh_intersect_ray, stacked on #3032 (binary16 box node). The triangle change is5640a903; the heada68c9bd3also merges the updated #3032 branch and currentmainso the tests run on the latest base. Rebased onto main after #3032 landed (b2f86a8d).float3vertices at bytes 0..59 and one ID dword at byte 60.iandjtwo bits each, third index(3-i-j)&3) and the Mesa RADV base vertex triple.x2w_bvh_intersect_triangle: the watertight ray/triangle test in binary32, triangle return mode 1{t, det, v, w}, and the miss{+inf, 1, 0, 0}. The instruction does not testray_extentfor triangles.size=0is a one-unit span), and the 48-bit end-exclusive bound applies. Return mode 0 and reserved bits are refused by name.-Gis, matching the runtime.Tests
The check reuses the 119 triangle witnesses in
tests/gfx1030_bvh_box/check.pyand the independent model intests/gfx1030_bvh_box/bvh_model.py(71 unique node images, 476 result words). It covers all four kinds, every ID map byte, edges and vertices, outside/behind rays, zero and negative-zero directions,t=0,extent=0, 1024x scaling both ways, degenerate/malformed nodes, and the box kinds 6 and 7.Decoded-extent controls: exact fits
(0x00, 0)and(0x08, 1), too-short(0x08, 0), largest extent0x03ffffff, above-4-GiB0x04000000, plus a boundary dispatch where a triangle at offset zero with size 0 hits and a triangle at offset 64 with size 0 misses.The dispatch passes on WARP (
1414:008c, driver10.0.26100.10068) and on an AMD Radeon RX 9060 XT (1002:7590, driver32.0.32029.2010), in dev and release, with four mutants (determinant sign, ID shift,uterm, miss words). The existing box32/box16 tests still pass 6/6 in both presets.Windows checks #8253 is green on
a68c9bd3, merged withmain63a30dc1.Limits
This is a translator slice. It does not bind the node buffer on a D3D12 device, does not execute the native gfx1030 probe, and does not establish title behavior. The runtime manifest loader does not yet consume
bvhbase. Return mode 0 is not modelled and is refused; the sort bit is ignored for triangles. Rebased after #3032 landed.Refs #870, #2921, #2922, #3032, #3040.
AI-assisted.
Review update (2026-11-27,
263604fc)JohnConnorNPC's first four requests are addressed; the stack still waits for #3032.
v18..v26) in the generated call, so swapping the threefloat3operands fails the portable check.0x0effffffandx2w_bvh_descriptor_okuses(word3 & 0xfeffffffu) == 0x80000000u. Portable and GPU dispatch cases cover both box kinds with bit 24 set; the triangle helper still requires mode 1.tests/checks/python-linux/startup_gfx2hlsl_bvh_triangle.txtputs the triangle check in the Linux job.(i,j)pairs, kinds 6 and 7 are named instance and procedural, the witnesses are identified as model-derived, and both notes are linked fromdocs/experiments.md.Receipt:
startup_gfx2hlsl_bvhdispatch 23/23 cases and all mutants on WARP and the RX 9060 XT;startup_gfx2hlsl_bvh_triangledispatch covers all 119 witnesses, four mutants and the boundary cases on both adapters;docs_links_check98 files and 591 links;run_checks_fragments_checkpasses. Windows checks #8297 is green on263604fc.