Repository navigation
Recompiler: elide EXEC masking where all lanes are active and cache lane active bit - #1356
XaviFortes wants to merge 1 commit into
Conversation
…ane active bit Add a forward must-dataflow pass (exec_active) that proves which PCs in Vertex/Pixel/Compute/Mesh shaders have EXEC equal to its entry value (ballot(true), so every executing lane is active). - Where all lanes are proven active, VGPR writes emit direct assignments (vN = val;) instead of vN = select(lanebit(exec_lo, exec_hi), val, vN);, eliminating per-instruction select/lanebit IR and false read dependencies on the previous VGPR value; lane-mask writes emit ballot(cond) directly. - Where EXEC may be narrowed, cache the per-lane active predicate in a local bool ea refreshed only when EXEC is written, instead of recomputing lanebit(exec_lo, exec_hi) on every VALU instruction. - Mode::Kernel and Mode::Geometry stay conservative (cached ea only); XCL_NO_EXEC_ELIDE=1 disables all-active elision for A/B debugging. Assisted-by: Antigravity (Gemini 4 Neon)
|
NVIDIA run, which this PR lists as not tested: one existing split-wave64 test fails with this PR. Tested: head
The failure,
Not tested: the whole workspace suite; a title. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report. |
|
Following up on @DarkPanda69's split-wave64 failure: same result here (RTX 5070 Ti, driver 616.64, waves 32 only, head
AI use
|
|
Split-wave64 Compute, RTX 4060 / Proton: inactive lanes kept their previous values after independently narrowing and restoring the two EXEC halves. This is a separate generated shader, not a rerun of the ballot-text assertion reported above. Tested Tested: one dispatch per revision; each matched an independent CPU reference for all 192 lane outputs and 80 untouched sentinel words. Ryzen 5 5600, RTX 4060, NVIDIA 620.73.04, GE-Proton11-14, vkd3d-proton Not tested: native wave64, graphics stages, other control flow, full suite, retail loading or performance. This does not clear the separately reported suite failure. AI use: Hermes Agent, gpt-6.2-astra (fixture, execution, verification and report). |
|
Test report: #1356 at Your numbers cover DXC. I checked the other half on AMD, since @Sr-0w saw the AMD driver get slower when exec selects were removed (#1269). Tested
On this path the AMD driver doesn't get faster with #1356. Mean PSO time is up about 10 %, and the total DXIL from the intro's compute programs is about 13 % larger, which I didn't expect. The slowest single PSO did drop, from 27.6 s to 18.6 s. The intro still hits the same watchdog; crash time varies between runs, so I wouldn't read much into 1m37s vs 2m22s. Not tested
AI use: Claude Code (Claude Opus 5.5) ran the builds and the game, extracted the timings from the XCL logs, and drafted this report. |
|
RTX 5080 (wave32 / split-wave64) test report for head
Not tested: AMD native wave64, retail smoke ( |
|
Test report: 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, debug build. 1. GPU hang (
2. The assertion 3. Compile cost on a sample (67 compute programs, every 40th of a retail pack's 2 689,
On this sample the difference is within what I would expect from run-to-run noise; one run each, so no claim either way. The sample has few programs large enough for Full suite: Not tested: AMD, other NVIDIA cards, 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. |
|
@Creaa I think I found the cause of the parallel-run failure of The test encodes its three Reproduced on Fix in #1456: AI-assisted (Claude Code). |
|
Test report — RTX 3060 Ti (Windows 11), branch merged with current
The failing test is pre-existing on |
|
Independent Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB, wave32) test and retail smoke report on clean head Confirms the known wave32 / split-wave64 test failure ( Tested
Regression run PR head ( Not tested: debug build, AMD / native wave64 hardware, extended gameplay past 60 s. AI use: Antigravity ( |
|
Follow-up to my report above: the GPU hang is not your elision's logic. The elision exposes it, and Same machine (RTX 4070, driver 617.14, split wave64).
The other point of my report stands: Separately, on the 31 compute programs of my #680 report, replacing every EXEC guard by AI use: Claude Code (Claude Opus 5.5) ran the experiments on my machine and drafted this comment; I checked it before posting. |
Addresses #1269 (EXEC emulation optimization).
What changed
exec_active.rs,emit.rs,mod.rs):exec_active::all_active_pcs) over decoded RDNA2 instructions that proves which PCs haveEXEC == entry_exec(ballot(true)at entry, so every executing lane is active).EXECand saved-EXECSGPRs acrosss_*_saveexec_b64/_b32,s_mov_b64/_b32(save/copy/restore),s_or_b64/_b32restores,s_wqm_b64/_b32, wave64 pair clobbering,s_movrel*, andLOOP_GUARDloop-head exit edges. Any non-fetchF_INDIRECTbranch makes the whole shader conservative.Vertex,Pixel,Compute, andMeshshaders (KernelandGeometrystay conservative;XCL_NO_EXEC_ELIDE=1disables elision for A/B debugging).vN = val;directly instead ofvN = select(lanebit(exec_lo, exec_hi), val, vN);, eliminating both the per-instructionselect/lanebitIR and the false read dependency on the old VGPR value.ballot(cond)instead ofballot(and(lanebit(...), cond)).select(en, val, v)instead ofselect(and(act, en), val, v).bool ea(emit.rs):EXECmay be narrowed (divergent regions,Kernel,Geometry), caches the current lane's EXEC bit in a localbool earefreshed only whenexec_lo/exec_hiis written (sync_ea()), instead of recomputinglanebit(exec_lo, exec_hi)on every VALU instruction.Benchmark (
retail_translation_survey, 1-in-50 sample of retailshaders.rpf, 4 DXC threads, release build)533 FSSM variants (54 CS, 4 GS, 183 MS/NGG, 242 PS, 2 VS/ES, 48 VS; 917,308 RDNA2 instructions), DXC
1.8.2502.11:main(930e8b4)621e6ab)CS_RaytracingResolve_b1139868)cargo build --workspace && cargo test --workspace -- --test-threads=4on Windows 11 (10.0.26200.0), AMD Radeon RX 7900 XT, DXC1.8.2502.11: 756 passed, 0 failed, 41 ignored, 0 SKIPPED.gpu::recomp::exec_active::tests(straight-line all-active,s_and_saveexec_b64+s_or_b64restore, wave32s_and_saveexec_b32+s_mov_b32restore, and clobbering the high half of a saved wave64 pair) plus end-to-end GPU testgpu_exec_elide_divergent_and_restored_computeverifying both HLSL shape and per-lane GPU output.retail_translation_surveywithXCL_SURVEY_EVERY=50andXCL_SURVEY_DXC=1: 533/533 variants translated and compiled with 0 DXC errors.Regression run
Baseline (
mainancestor4017f8ff8faaae6007fd83910d230a027dd85a33):PR (
recomp-exec-active621e6abad1075703fe74cce3961df439637917ee):Not tested
shaders.rpfDXC sweep (sampled 1-in-50 = 533 shaders across all stages).AI use