Repository navigation
Conversation
…alars At -O0 (>8 MB HLSL) bvh_intersect emitted 5 allocas per call site for tn[4], id[4], pairs[5], and child[k], while at -O1/-O3 the per-k type==5u branches, swap diamonds (tn[j] < tn[i]), and scalar ?: ternaries inflated control-flow graphs and DXC/driver compile times. Unroll the 4 child boxes manually with a single type==5u branch, compute hit/t via scalar registers tn0..tn3 and id0..id3 using branchless select helpers, replace the sorting network branches with select swaps, and use select for triangle offset/hit selection. Measured on RTX 3060 (32 BVH calls in traversal loop, mem_windows=4, DXC 1.9.2602.17): -O3 cold PSO -18.0% / DXC -30.4%, -O1 cold PSO -13.5% / DXC -18.8%, -O0 allocas 162->2 / cold PSO -14.2%. Part of xcl-dev#2088. Assisted-by: Antigravity (Gemini 4 Hydrogen)
|
The native wave64 run listed as untested (on RDNA4 rather than RDNA2), plus an RTX 3060: the new test passes on both. Head
Not tested: RDNA2, |
|
Independent Turing validation of Two test-only commits based on this PR head are available for cherry-pick:
Tested Windows 11 Pro 26200, i7-9750H, 32 GB RAM, Quadro RTX 3000 6 GB (driver
Synthetic compilation measurements The modified manual benchmark passed (release, 450.26 s). It retains the supplied 32-call BVH traversal workload, dynamic sort, four memory windows, and split-wave64. The embedded baseline helper matches the parent helper after accessor/comment normalization. No other compiler/GPU workload was launched by this validation.
DXC was faster in all 12 pairs. First PSO creation was slower in 3/4 pairs at both O3 and O1, faster in 4/4 at O0. First-PSO ranges, base/scalar in ms: O3
Supplemental commands (with the linked test-only changes): Not tested: native wave64/AMD, retail shader packs or titles, GPU execution throughput, frame rate, time to first playable frame, or guaranteed cold-cache performance. AI use: Codex and three agents prepared these test-only extensions, checked BVH semantics and benchmark arithmetic, ran the local validation, and wrote this report. The exact model identifier is unavailable in this session. This is a measured test report, not a formal code-review approval. |
|
Independent RX 6800M (RDNA2 native-wave64) check of exact PR head Environment: Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver I ran the clean-head The new reference fixture's Limits: This is focused synthetic correctness evidence on RDNA2. I did not run the full workspace suite, title smoke, sampled shader packs, GPU throughput, or cold PSO timing on this head. I am not claiming a performance change. AI use: OpenAI Codex (GPT-6; exact variant unavailable in this session) ran the tests, checked the exact head and clean worktree, and drafted this report. No game data was used. |
|
Focused HLSL-path verification on exact head Tested
Not tested The benchmark, retail inputs, the parent, the full workspace suite and game regression runs. AI use OpenAI Codex (GPT-6.2 Sol) ran the tests and wrote this report. |
|
Test report: Suite,
The scalar form was slower in all 3 pairs at O3 and at So on this card the DXC time improves at every level, but I do not reproduce the −18 % cold PSO at RTX 4060 8 GB (32.0.16.2101), Ryzen 7 5700X, 24 GB, Windows 11 26200, rustc 1.100.0, DXC 1.9.2609.5. Not tested: any title, retail shaders, AMD / Intel, GPU time, the branch merged with today's AI use: Claude Code (Claude Opus 5.5) read the diff, ran the tests and the benchmark, and wrote this. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Ran the bvh_intersect tests at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build. The new What this adds: the author tested an Ampere RTX 3060 with Windows SDK DXC 1.9.2602.17; this is a Blackwell wave32 part with DXC 1.9.2609.5. The new GPU parity test ran on the real adapter here. I did not repeat the cold PSO timing benchmark. Not tested: the cold PSO A/B timings, a paired 60 s smoke run, native wave64 hardware, AMD and Intel GPUs, Wine, release profile, retail title data. AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
Part of #2088. Replaces local array and vector-subscript indexing (
tn[4],id[4],pairs[5],child[k]) and scalar?:ternaries inPRELUDE_MEM'sbvh_intersecthelper (crates/xcl/src/gpu/recomp/emit.rs) with scalar registers and branchlessselectoperations.At
-O0(> 8 MBHLSL), DXC emitted 5 stackallocas and dynamicgetelementptrsequences perbvh_intersectcall site; at-O1and-O3, per-ktype == 5ubranches inside the unrolled loop,if (tn[j] < tn[i])swap diamonds, and scalar?:ternaries on triangle offsets bloated control-flow graphs and slowed both DXC and cold NVIDIA PSO compilation.What is in it
crates/xcl/src/gpu/recomp/emit.rs: replaces[unroll] for k+tn[4]/id[4]/pairs[5]/child[k]inbvh_intersectwith a singletype == 5ubox-load branch (bvh_box16_bounds), 4 scalarbvh_box_tevaluations (tn0..tn3,id0..id3), a branchless 5-stepbvh_swapsorting network insideif (sort), andselectfor GPURT triangle offsets and hit selection; addsbvh_intersect_uses_scalars_without_local_arrays.crates/xcl/src/gpu/recomp/tests.rs: adds DXIL IR validation/zero-alloca testbvh_intersect_dxil_has_zero_allocas_and_validates(-O0,-O1,-O3), wave32/split-wave64 edge-case parity testgpu_bvh_intersect_scalar_matches_reference, and manual cold PSO benchmarkbench_cold_bvh_intersect_pso.Controlled synthetic benchmark (
32IMAGE_BVH(64)_INTERSECT_RAYcalls in anS_CBRANCH_VCCNZtraversal loop, dynamicsort,mem_windows = 4, median of 3 timestamp-salted runs on NVIDIA GeForce RTX 3060 / driver32.0.15.9144, DXC1.9.2602.17, warm re-create verified50–69 ms):alloca/gep/br/phi-O3baseline-O3scalar-O1baseline-O1scalar-O0baseline-O0scalarTested
32.0.15.9144), AMD Ryzen 5 7500F 6-Core Processor, Windows 11 x64,rustc 1.100.0 (0ef1bc386 2026-11-09), Windows SDK DXC1.9.2602.17, debug & release.cargo test -p xcl --lib gpu::recomp -- --test-threads=4: 369 passed, 1 failed (gpu_clamp_and_omod_per_instructiononv_pk_add_i16 clamp, verified failing identically onmain1a0bbe3), 20 ignored (SKIPPED: 21no wave64, 3 refused#1426f16 forms).cargo test -p xcl --lib -- --test-threads=4: 1183 passed, 1 failed (gpu_clamp_and_omod_per_instruction, pre-existing onmain), 27 ignored (SKIPPEDlines: 21no wave64, 3 refused#1426f16 forms, 1ShaderCacheControl/ Developer Mode unavailable).cargo test -p xcl --test '*' -- --test-threads=4(aftercargo build --workspace): 70 passed, 0 failed, 20 ignored (SKIPPED: 1heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows;XCL_SAMPLE_*unset).cargo test --release -p xcl --lib gpu::recomp::tests::bench_cold_bvh_intersect_pso -- --ignored --nocapture: 1 passed, 0 failed (reported above;ShaderCacheControl(DISABLE)unavailable0x887A002D, cold misses verified via salted DXIL cache misses vs warm repeats).Regression run
Not tested
no wave64on RTX 3060).XCL_SAMPLE_*retail shader packs (unset).ID3D12Device9::ShaderCacheControlcache disable (Windows Developer Mode not active; cold PSO runs verified via salted DXIL cache misses vs50–69 mswarm hits).AI use
Antigravity (Gemini 4 Hydrogen): replaced
bvh_intersectarray indexing and scalar ternaries with scalar registers andselecthelpers incrates/xcl/src/gpu/recomp/emit.rs, wrote the synthetic IR/GPU parity tests and cold NVIDIA PSO benchmark, and ran the test, benchmark, and smoke checks.