Recompiler: direct DXIL rolls and shares BVH box32/box16 loop #1800
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1800
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1800"
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?
@xADEL on GitHub · 2026-11-24 20:54 UTC · original
xADEL:dxil/roll-bvh-box-loop→main· +332 −88 · 3 files · 1 commits · openDirect DXIL lowering of
image_bvh_intersect_raystill unrolledbox32andbox16separately across all four children, emitting 8 copies of the slab math, 2 copies of the sorting network, 24legacyF16ToF32conversions, and 11 boxrawBufferLoads (15 total with triangle) per instruction. This unifiesty == 4/ty == 5into one guarded region with a single rolled 4-iteration loop, vectorizedwith_mem_i32sloads, and one shared sorting network (the direct-DXIL counterpart to #1542). Part of #1269.What is in it
crates/xcl/src/gpu/dxil/lower_image.rs: add vectorizedbvh_load_box32(2raw_loads viawith_mem_i32s) andbvh_load_box16(1raw_loadviawith_mem_i32s), load the 4 child pointers once viawith_mem_i32s(..., 0xF), unifyty == 4 || ty == 5into a single rolled 4-iteration loop carrying the four(t, id)slots via a 3-slot explicit phi shift register, and emit one sorting network after the loop (reducing per-BVHrawBufferLoads from 15 → 8 andlegacyF16ToF32calls from 24 → 6).crates/xcl/src/gpu/dxil/kernel.rs: bumpTRANSLATOR_VERSIONfrom 7 to 8.crates/xcl/src/gpu/dxil/core_tests.rs: DXIL validation/IR-count test (bvh_intersect_rolls_box_loop_and_validates) and bit-exact GPU test coveringbox32,box16, sorting,tmaxculling, grazing rays, NaN/inverted boxes, triangle, and instance nodes (bvh_intersect_gpu_matches_box_sort_and_triangle).Tested
32.0.16.2124), Intel Core i5-12450HX, 24 GB RAM, Windows 11 Pro (10.0.26300),rustc 1.100.0, Windows SDK10.0.26100.0(dxcompiler.dll/dxil.dll1.9.2602.17), debug tests + release sweep/smoke.XCL_ADAPTER="rtx 3050" cargo test --workspace -- --test-threads=4(rebased head9503770onmain8e87fc7): 992 passed, 0 failed, 45 ignored (both new BVH tests,gpu_bvh_intersect_ray, and all upstreamcore_tests/msaa_tests/geometry_tests/round_testspassed).SKIPPEDGPU tests on this adapter (24): 19no wave64(gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,lower::tests::*,lower_dxil::tests::*wave64 arms), 3 per-lane wave32 unsupported f16/cvt arms (f16_programs_on_the_gpu,f32_programs_on_the_gpu), 1no heap windows(heap_window_out_of_memory_falls_back_to_the_switch_form), 10x887A002DDeveloper Mode required (pso_measurement_compiles_an_exact_synthetic_record).shaders.rpfsweep (xcl shaders <pack> --direct --validate --sample 500 --seed 1, release): 408/408 translated (100.0%: 33 CS, 11 GS, 155 MS, 164 PS, 45 VS), 0 validator errors, 0 panics (2.1 s).Regression run
(Note:
smoke.ps1runs withoutXCL_DIRECT_DXIL=1, so this regression check verifies no default-path regression and is not a gameplay FPS claim for the BVH optimization.)Not tested
XCL_HEAP_WINDOWS=1runtime runs,XCL_DIRECT_DXIL=1full RT title runs, andXCL_SAMPLE_*tests.AI use
8e87fc7(preserving#1748vector loads,#1869, and bumpingTRANSLATOR_VERSIONto8), ran the workspace suite,--direct --validatesweep, andsmoke.ps1runs on this machine, and drafted this description.@minimalhipster990 on GitHub · 2026-11-24 21:22 UTC · original
RTX 4090 benchmark for #1269 — retail BVH compute shader
On one retail wave32 compute shader, PR #1800 reduced median direct DXIL translation time by 15.4% across 11 paired trials. The validated DXIL container was 26.8% smaller. Both revisions returned the expected GPU results for the full shader on three controlled inputs and for both intersection instructions in isolation.
The PR translated faster in 11/11 pairs and created the PSO faster in 9/11. Repeat median PSO creation time fell by 10.6%. The attempt to disable the implicit driver cache returned
0x887A002Don both builds. The first-observed row has one sample per revision with unknown initial cache state. A repeatable cold-driver compilation speedup remains unverified. Microsoft’s ShaderCacheControl documentationInput, builds and timing method
deferred_tiled:CS_LaserLightShadowRaytracing_c3ab3042_Wrapped, the smallest qualifying program in a scan of first compute variants. All 3,332 bytes decoded to 642 instructions. The two exactimage_bvh_intersect_rayinstructions are at byte offsets0x01C8and0x0880. Thread group size was 32 × 1 × 1.7118f495493c73afon both builds. The output container hashes were0f9d95ebc5bb03e2on the parent andf72e8ee89b9a12d5on the PR. Every timed container passed explicit validation and reproduced its revision’s digest.kernel::translate_computeon the direct DXIL path, wave32, one memory window. Archive I/O, shader selection, explicit validation, PSO creation and dispatch were outside the timer.ID3D12Device::CreateComputePipelineStatecall. Device and root signature were ready before timing began. The application supplied no cached PSO blob. Each sample ran in a fresh process with alternating build order. Percentages compare medians for pairs 1–11. The parent pilot and pair 0 are listed separately below.GPU correctness
Full retail shader. Both builds dispatched the original program on three inputs: a zero activity mask, an active mask with an empty root, and an active mask with a box32 root containing four invalid children. All 32 output words started at
0xdeadbeef. In every case all 32 lanes wrote the expected miss value0x7f7fffff. Comparing the entire 20 KiB buffer against its expected contents found zero differing words. A separate coverage probe immediately after the first BVH instruction redirected participating lanes’ final stores outside the output descriptor. All 32 sentinels survived in the empty-box case, while both controls wrote all 32 outputs. This confirmed full-shader coverage of the first BVH site. All timing trials used the original program.Both BVH instructions. We replayed each exact 20-byte instruction with its original register operands in a wave32 GPU readback harness. For each site we tested box32 and box16 nodes with four children, sorting on and off, and lanes containing a four-child hit, a distance-limited hit, a grazing ray and a miss. All 1,024 output words per revision (2 sites × 2 formats × 2 sort modes × 32 lanes × 4 words) matched both the geometric expectations and an independent HLSL + DXC GPU run bit for bit. Parent and PR readbacks also matched. The second site was covered by instruction replay. Full-program coverage of that site and a rendered gameplay frame remain untested.
Individual timings and readback digests
All times below are in nanoseconds. The standalone parent pilot recorded 11,507,100 ns for DXIL and 180,528,300 ns for PSO creation. Pair 0 contains the first PR invocation.
Each site/format/sort combination produced 128 output words. For both sites, both box formats and both revisions, the FNV-1a-64 readback digest was
a87dab4558a7e865with sorting off andef0749ae2a4b4ce5with sorting on.AI disclosure. Codex prepared the harness, ran the measurements on the RTX 4090 and drafted this report.
@futurepro62 on GitHub · 2026-11-24 22:37 UTC · original · edited 2026-11-24 22:46 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
455e4ab(on its base1d027e5).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: 956 passed, 0 failed, 43 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.bvh_intersect_rolls_box_loop_and_validates,bvh_intersect_gpu_matches_box_sort_and_triangle.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 961 passed, 0 failed, 43 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out five tests where this PR's base has them. They fail on main689f2dbtoo, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns their skips into failures. These areheap_window_out_of_memory_falls_back_to_the_switch_form(#1651) and the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests (follow-up on #1651). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@JJAutoCompare on GitHub · 2026-11-25 06:55 UTC · original
Tested
PR #1800 was open at
95037704a20771e8fee14f7454ce8e6a5fa1d271before and after testing. The assigned STOR-WINLAB checkout was clean and detached at that SHA for both runs. I found no equivalent Intel Arc A770 result in the PR discussion or GPU test reports (#42).STOR-WINLAB ran Windows 11 Enterprise Evaluation 26200.9974 on an AMD Ryzen 7 3800X with an Intel Arc A770 (driver 32.0.101.9175,
XCL_ADAPTER=A770). Rust and Cargo were 1.100.0 onx86_64-pc-windows-msvc(rustc0ef1bc386). Both runs logged DXC and DXIL 1.9.2609.5 from%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64viaXCL_DXC_DIR. Cargo used the unoptimized test profile withCARGO_BUILD_JOBS=2,CARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0,CARGO_PROFILE_TEST_DEBUG=0andCARGO_TARGET_DIR=L:/XclTooling/pr1947-1831ec4-t3-97236edf/target.TEMPandTMPwereL:/XclTooling/pr1800/temp.-NoProfile -ExecutionPolicy RemoteSignedand logged mutex acquisition and release. All three processes exited 0.Not tested
PR #1959's triangle type-2/type-3 fixtures, native wave64 GPU execution, other adapters, the workspace suite, retail titles and smoke/regression runs.
AI use
T3 Code / Codex
gpt-6.2-solran both fixtures and wrote this report.@DavidM1911 on GitHub · 2026-11-26 06:19 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.