startup: lower the FP32 box case of image_bvh_intersect_ray #2922
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2922"
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 lambirou on 2026-11-26T20:34:00Z.
What changed
This is the first translation slice of
image_bvh_intersect_rayintools/startup/gfx2hlsl.py.The supported slice is deliberately narrow:
image_bvh64_intersect_rayis refused by name.0xfffffffffor misses.ByteAddressBufferbinding in the manifest.The emitted HLSL helper follows the public Mesa RADV box test and sorting network (MIT), including the inactive-box rule, the inverse-direction clamp and equal-key ordering. No code from the GPL-3.0 DexNom/VIctory reference is copied.
Tests
Output ends with:
The check covers the CPU reference against the existing gfx1030 box fixture, the emitted sort network, the sort-bit negative control, the all-miss result, manifest and buffer binding, the four-result call, sort-disabled translation, and one refusal control per unsupported shape (no partial output). DXC compiled the emitted HLSL.
Existing
startup_gfx2hlsl_{op_refusals,refusals,compute_controls}still pass.Limits
This slice does not run on a GPU in the game path. It becomes useful once the compute Dispatch path can bind and dispatch the translated program. The triangle and 16-bit box cases are the next slices; the CPU model and witness set in #2921 are the oracle for them.
Refs #870, #1412, #1268.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-26T20:43:23Z.
CI caught a manifest regression in the first head: the new
bvhbaseentry evaluatedsource[2]for every resource, so ordinary table resources raisedIndexError. Fixed in2ec454f9by formatting the BVH base only for thebvhbasekind. The Linux and Windows checks are green on the new head.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-26T21:15:05Z.
Clarification for review: the
bvhbasemanifest line is translator-only in this slice. The compute manifest loader does not yet parsesrv N buf base ... size ..., so a dispatch using this translation is refused as an unsupported manifest line rather than bound at the wrong address. The PR proves the translation, the manifest shape and the DXC compile; runtime binding of a 40-bit console base is a separate slice. If you prefer, I can hold the manifest line behind a translator flag until the runtime consumes it.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-26T21:41:18Z.
A stacked binary16 slice is ready on
lambirou:startup/bvh-intersect-box16at1fd5475d, pending this PR. It adds the 64-byte kind-4 box node withf16tof32, keeps the same sort/descriptor rules, compiles both helpers with DXC, and dispatches five FP32 plus five binary16 cases on WARP: all ten exact. I am holding the seventh PR until this one lands so its diff does not repeat this branch.Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-27T05:29:42Z.
Review: COMMENTED
PR #2922 by @lambirou -- startup: lower the FP32 box case of image_bvh_intersect_ray
What works
Issues
Recommendations
Overall
A well-researched, well-tested implementation. The linear layout extension is cleanly separated from tiled modes. Minor concern about BC format handling in linear mode, but the existing refusal behavior is safe. Ready for merge.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T07:43:41Z.
Review: CHANGES_REQUESTED
The Python controls, DXC compile and five registered WARP helper cases pass on
2ec454f9integrated withmain22107932(Windows 11 build 26200.9974, SDK 10.0.26100, WARP 10.0.26100.9818, debug layer enabled, zero errors). Two cases are still missing from the fixture.(0x25, disabled, 0x2d, 0x35), depths(4, 1, 2, 3), the existing forward ray and extent 19. CPU reference gives(0x25, 0x2d, 0x35, 0xffffffff)in child order. The current CPU network model and actual WARP readback both return(0x25, 0x35, 0x2d, 0xffffffff). Please explicitly compact in original order when sorting is disabled and include this three-hit case before carrying the helper into the stacked binary16 slice.mutant[128:132], which is sorted case 0. The original case 0 already contains hits, so the current!= (INVALID,) * 4assertion passes even if the mutation does nothing. Please compare case 2 (136:140) and assert a predicted mismatch against its unmodified all-miss result.Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-27T08:54:08Z.
Both findings are fixed in
94e90292, on top of currentmain3e9542a6(the branch now includes the merge).h0..h3in child order and returns0xfffffffffor the remaining words. The fixture now has the three-hit node(0x25, disabled, 0x2d, 0x35)with depths(4, 1, 2, 3), the existing forward ray and extent 19; both the CPU reference and the WARP dispatch return(0x25, 0x2d, 0x35, 0xffffffff).136..139, not the sorted case 0 at128..131, and asserts the mutated all-miss case is no longer four0xffffffffwords.Local result:
startup_gfx2hlsl_bvh_dispatch_warppasses all six cases, including the new unsorted case, and the miss-fill control passes. The controls/DXC run also passes. I will carry the same compaction into the stacked binary16 branch before submitting it.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T09:01:33Z.
Review: APPROVED
The two findings are resolved at
94e90292on currentmain3e9542a6. With sorting disabled, the original three-hit counterexample now preserves child order. The updated miss-fill mutation examines the all-miss case and detects changed values there.I rebuilt
offscreen_checkand ranctest --preset <dev|release> --no-tests=error -V -R '^startup_gfx2hlsl_bvh'. Both presets passed 3/3 with no skips, including six exact cases and the miss-fill negative control on WARP and RTX 4060 Laptop. Windows 11 build 26200.9974, SDK 10.0.26100 DXC, WARP driver 10.0.26100.9818, RTX driver 32.0.16.1656, debug layer enabled with zero errors or warnings. Hosted Windows, Linux Python and gfx1013 checks are green. This confirms the translator and the standalone helper readback. A runtime binding for the BVH manifest remains a separate slice.