Recompiler: reuse the lane predicate across vector ALU writes #1341
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!1341
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1341"
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?
@dervoxx on GitHub · 2026-11-24 14:59 UTC · original
dervoxx:recompiler/lane-predicate-reuse→main· +91 −5 · 3 files · 1 commits · openPart of #1269. Reuse the current lane's EXEC bit across consecutive plain vector ALU instructions whose only destination is a VGPR. Every write still selects the previous value for an inactive lane.
What is in it
emit.rsstarts reuse only for adjacent eligible instructions and resets it when leaving a basic block or encountering another instruction.mod.rspasses block-local lookahead.Tested
RTX 5080, driver 32.0.16.2101, Ryzen 9 9900X3D, Windows 11 build 26300, Rust 1.100.0, DXC 1.8.2502.11. Release benchmarks. Debug
cargo build --workspaceandcargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. Two additional runtime skips were reported for native-wave64-only cases.One 88,444-instruction retail compute shader, four windows, native wave64 form, standalone cold DXC at
-O0, base/head/head/base. Wall times 77.36 / 73.73 / 71.64 / 79.88 s. DXIL 23,284,364 to 22,088,252 bytes. Peak sampled private memory 4,114 / 3,790 / 3,788 / 4,117 MiB. Same input via the RTX runtime translation path (split wave64, four windows, fresh XCL caches): 105.901 to 94.812 s, 29,635,620 to 28,428,896 DXIL bytes, 4831 to 4677 MiB sampled peak private memory. One pair.On 12 other compute shaders (180–1000 KiB baseline HLSL, fixed seed 1043, three paired serial rounds at
-O3), cumulative DXC CPU was 51.92 to 49.22 s. Aggregate DXIL per round was effectively flat (1,861,076 to 1,861,168 bytes).Separate runtime-path check with four windows and split wave64 where needed: 12/12 pairs created both PSOs. Summed translation plus DXC 19.45 to 18.10 s, summed D3D12 PSO creation 30.59 to 25.54 s. One pair per program, empty XCL caches, alternating order. One pair accounts for 4.92 s of the 5.05 s PSO difference. Repeating that pair in reverse order with fresh XCL caches returned 1.55 ms (base) and 1.59 ms (head). The internal driver cache was uncontrolled; these timings cannot establish a general driver speedup.
Independent Windows validation on the exact base and head: on both the Ryzen 7 7800X3D Radeon RDNA2 iGPU and RTX 5070, the workspace suite reported 751 passed on the base and 752 on the head, with 0 failures and 41 ignored per run. The branch-join regression passed with native wave64 on Radeon and split wave64 on NVIDIA. The tester reported two additional hardware skips per adapter (mesh shaders on Radeon, native wave64 on NVIDIA). Test report and commands
Regression run
Fresh XCL data and DXIL directories for each 60 s startup run, offline. The frame count was lower on the head. These runs cover startup.
Not tested
Retail runs and compilation timings on the Radeon iGPU and RTX 5070, other AMD generations, Intel, driver compilation of the giant DXIL variants, or full gameplay. The large-source timing covers the DXC stage. It does not demonstrate a fix for the prologue stall.
AI use
Codex with GPT-6.2 Astra implemented the change, ran the comparisons, and drafted this description. GPT-6.2 Sol reviewed the emitter and wrote and exercised the GPU regression test.
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@DavidM1911 on GitHub · 2026-11-24 15:05 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 708 passed, 0 failed, 21 ignored.Thanks!
@ArturoWolff on GitHub · 2026-11-24 15:13 UTC · original
RTX 4060 / Proton: Reusing the EXEC predicate cut DXC time in all four pairs on the generated 2,048-round split-wave compute kernel from #1269. Cold D3D12 pipeline creation did not move consistently. This tests the actual emitters at
930e8b49c1c2ec683d22c724a398b39111cd0e56and88775390ab3f8d63358ea2520ee86fd6893d403b, not the earlier experiment that removed guards.CreateComputePipelineStateThe head retained all 6,159 register-write selects and three memory guards; 6,158 selects used the reused predicate. Each pair saved 51–57% of DXC time, but each revision won two of the four PSO pairs. Fresh processes, no supplied cached PSO, XCL/NVIDIA/vkd3d disk caches disabled; OS/hardware caches not flushed.
Tested: Ryzen 5 5600, RTX 4060, NVIDIA 620.73.04, Linux / GE-Proton11-14, patched vkd3d-proton
4522cc1a8b1347f+, DXC 1.9.2609.5. Releasex86_64-pc-windows-gnullvm. All eight dispatches matched a CPU reference, including cross-wave LDS reads and untouched prefix words. Separately ran the PR lib-test EXE withgpu::recomp::tests::gpu_exec_predicate_recomputed_at_branch_join --exact --nocapture --test-threads=1: 1 passed, 0 failed/ignored/skipped, 728 filtered; covers wave32 and split wave64 with partial EXEC.Not tested: native Windows, native wave64, full suite, retail loading time. This is a compile-time result on one synthetic shader, not a gameplay or general driver-speed claim.
AI use: Hermes Agent, gpt-6.2-astra (experiment, verification and report).
@Aniseto on GitHub · 2026-11-24 15:22 UTC · original
Ran the new test on an NVIDIA Blackwell part at
8877539: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.
gpu_exec_predicate_recomputed_at_branch_joinpasses here in the wave32 plus split-wave64 form. The earlier reports were an RTX 3060 Ti and an RTX 4060 under Proton; this is native Windows on a Blackwell part with driver 32.0.16.2124, where the split form is the only path available.Not tested: native wave64, RDNA2/RDNA4 and Intel GPUs, Wine, release profile, retail titles.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the test, wrote this report; the worktree was not modified.
@thaqiart139-alt on GitHub · 2026-11-24 15:39 UTC · original
Test report for this PR's head
8877539on AMD RDNA2 with native 64-lane waves (the case the description lists as not tested), and on a 32-lane NVIDIA card.Tested
XCL_ADAPTER=radeon/nvidiaand checked withgpu_bench_really_runs -- --nocapture.cargo test --workspace -- --test-threads=4, this PR against its base:main930e8b48877539gpu_exec_predicate_recomputed_at_branch_joinpasses on the iGPU, where its wave64 case runs in 64-lane waves (split_wave64false), and on the RTX 5070 in the split form.gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64); on the iGPUgpu_geometry_mode_es_gs_stripandgpu_mesh_mode_two_passes(no mesh shaders).Not tested
AI use
@Creaa on GitHub · 2026-11-24 16:09 UTC · original
Test report:
8877539on an RTX 4070 (split wave64 form).Setup: RTX 4070 12 GB (driver 617.14), i7-13700F, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0, DXC 1.9.2602.17.
cargo test --workspace -- --test-threads=4(debug): 752 passed, 0 failed, 41 ignored. SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64).gpu_exec_predicate_recomputed_at_branch_joinpasses.xcl shaders <folder> --precompile --only cs [--pipelines], release, 4 windows, split wave64, empty XCL caches, one run each:--pipelines)main930e8b4Within noise on this sample (one run each); your gain was on the 88 k-instruction program, which this sample does not contain.
Not tested: AMD, the large programs, a title run.
AI use: Claude Code (Claude Opus 5.5) ran the tests and measurements on my machine and drafted this comment; I checked it before posting.
@LocranKing on GitHub · 2026-11-24 17:43 UTC · original
Independent Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB, wave32) test and retail smoke report on clean head
88775390ab3f8d63358ea2520ee86fd6893d403b.Tested
88775390ab3f8d63358ea2520ee86fd6893d403b(clean tree, merge-base930e8b4)8024 MiB VRAM, driver32.0.16.2101),rustc 1.100.0(x86_64-pc-windows-msvc, MSVC14.44.35207), DXC1.9.2602.17(SDK10.0.26100.0),--releasecargo build --release --workspace: ok (exit 0)cargo test --workspace --release --no-fail-fast -- --test-threads=4: 752 passed, 0 failed, 41 ignored, exit0SKIPPED(no wave64):gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardwareRegression run
mainbaseline (b7aa9f3bd212088e0d927439284dc5ed325ce3c7):PR head (
88775390ab3f8d63358ea2520ee86fd6893d403b):Not tested: debug build, AMD / native wave64 hardware, offline pack compile timings, extended gameplay past 60 s.
AI use: Antigravity (
Gemini 4 Neon) ran the build, tests, and smoke runs and drafted this report from the command outputs.@Retried on GitHub · 2026-11-24 18:10 UTC · original
Test report for #1341 on NVIDIA Windows. DXC is 21 % faster on a random sample, the driver time is unchanged and the suite passes.
Tested
8877539:cargo build --workspace && cargo test --workspace -- --test-threads=4(debug,XCL_SAMPLE_RPFset): 752 passed, 0 failed, 41 ignored. SKIPPED:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64).8877539cherry-picked ontomainb7aa9f3(it applies cleanly) againstb7aa9f3itself, both release builds, retailshaders.rpf. The two builds were run alternately, two rounds each.retail_translation_survey(seed 1269, 63 programs, DXC in process): total DXC 61 / 61 s → 48 / 48 s (−21 %); median 0.24–0.25 → 0.23 s; p90 2.59–2.61 → 2.09–2.10 s; max 9.4 → 8.4–8.5 s. All 63 compile.CreateComputePipelineState)So on NVIDIA the cached predicate does not slow the driver; the AMD driver slowdown reported for removing the EXEC selects did not show up here. The DXIL is the same size: DXC already merged the repeated
lanebitcalls, so the saving is DXC's own work before it does that.Not tested
Measured and written with Claude Code (Claude Opus 5.5).
board data
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.