Recompiler: reuse the direct DXIL block traversal buffer #1768
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!1768
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1768"
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?
@jeroenhaentjens on GitHub · 2026-11-24 20:26 UTC · original
jeroenhaentjens:dxil/reuse-cfg-scratch→main· +42 −41 · 2 files · 1 commits · openDirect DXIL allocated a separate successor list per block when ordering the blocks and finding dominators. Reuse a single buffer during traversal and visit edges directly when building predecessors. Block order and emitted bytes were identical in both benchmark fixtures.
Part of #1269.
What is in it
module.rsshares the successor buffer across DFS frames and builds block positions only for serialization.module/opt.rsuses the same successor visitor without allocating a temporary list per block.Tested
Windows 11 Pro 26200, Intel i7-9750H, 32 GB RAM, NVIDIA Quadro RTX 3000 (driver 32.0.15.9706), Rust/Cargo 1.100.0 MSVC, DXC 1.9.2609.5.
Clean PR head
22b21db2d45af526142f4e86165e14918125fb87.cargo build --workspace --lockedpassed.cargo test --workspace --locked --no-fail-fast -- --test-threads=4reported 889 passed, 0 failed, 42 ignored in debug builds without debug symbols or incremental compilation.XCL_ADAPTER=nvidia,XCL_HEAP_WINDOWS=1. The bundled title tests passed.Three tests counted as passes by Cargo returned early:
gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no native wave64), andpso_measurement_compiles_an_exact_synthetic_record(cache control unavailable, 0x887A002D).Benchmark base
b9b6ea6vs patch treeb802bf0(same tree as this head), with local timing and output capture on both sides. The existing syntheticlong_programs_translateshader has 4,001 instructions. Across 12 paired, alternating debug runs, translation including validation had a median of 232.09 → 227.84 ms (ranges 222.41–251.61 and 216.74–242.03 ms). Both outputs were exactly 127,704 bytes and byte-identical (SHA-2565044913c819dff245ee6e05e66847342933c3b7e8deabebf6072d3a835d8eba5).Isolated Rust
-Obenchmark of module optimization and serialization using 5,000 consecutive diamond branches (15,001 blocks), six alternating pairs. Allocations including reallocations fell from 65,094 to 20,115. Median time was 8.22 → 5.70 ms and both bitcode outputs were identical. This measures CPU translation work.Independent AMD/RADV corpus measurement by YaBulochka: base
b9b6ea6and head22b21db, 500 shader records, three runs per side. Median wall time was 91.4 → 95.4 s, within the reported run-to-run spread; all 500 compiled on each run. This does not demonstrate an end-to-end speedup on that workload.Regression run
Paired retail smoke runs supplied by Toons29, reproduced below verbatim from that report, not run locally: AMD Radeon RX 9070 (driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl,XCL_NETWORK=0. Same title and 60-second duration; the baseline commit is on main and the PR commit matches the current head.Not tested
XCL_SAMPLE_*inputs were supplied.AI use
gpt-6.2-sol) implemented the patch, designed and ran the benchmarks and validation, and drafted this description.@YaBulochka on GitHub · 2026-11-24 21:08 UTC · original
AMD/RADV check of this change: on this machine it is within run-to-run noise - no measurable win, no regression.
x86_64-pc-windows-gnu, releaseshaders.rpf, 411,695,600 B, 26,503 recordsxcl shaders <pack> --compile 500 --json,XCL_DIRECT_DXIL=1, no title run, no adapter workThree interleaved runs per side, same pack, same flags:
b9b6ea622b21dbReading: the medians favour the PR by about 5% (0.50 vs 0.53), but the wall, the p90 and the CPU sum do not, and the spread across three runs on one side (88.9-96.2 s) is larger than the difference between the sides (91.4 vs 95.4). So on AMD/RADV this is not a measured improvement - it is consistent with "no cost", which is still worth knowing since the buffer reuse only touches walk order.
If it helps, the number that dominates here is not the traversal but the biggest shaders: the
PedTransformSkinfamily at 7-9 s and ~1 MB HLSL each, which is the same shape I reported in #1269.Builds: both heads built clean with
cargo build --release --target x86_64-pc-windows-gnu -p xcl;dxc_compiled500,dxc_failedempty on every run.@Toons29 on GitHub · 2026-11-25 03:36 UTC · original
Regression run of
22b21db2on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 101 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.@futurepro62 on GitHub · 2026-11-25 16:46 UTC · original
Full-suite run, since this PR has no test report yet. Tested exact head
22b21db(on its baseb9b6ea6).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 --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 888 passed, 0 failed, 42 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.#[test]functions in the diff.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 889 passed, 0 failed, 42 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main06c9f55too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.