Recompiler: keep pending skip jumps in one variable #1510
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!1510
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1510/head"
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?
@2blponeyy on GitHub · 2026-11-24 17:09 UTC · original
2blponeyy:recompiler/one-skip-variable→main· +91 −28 · 2 files · 1 commits · closed without mergingStructured code keeps a forward jump it cannot nest – a loop break, a jump past a join,
s_endpgmbefore the end – pending until its target, and every level skips its code meanwhile. Each target had its ownbool xcl_skip_<pc>, and every guard tested all the flags that could be set at that point:if (!(xcl_skip_a || xcl_skip_b || …)), written out again with the whole set each time a jump was added or reached. With many crossing jumps that is quadratic. In one retail compute program it is 12 804 guards of up to 10 700 characters: 100 MB of its 155 MB of HLSL.Nothing runs while a jump is pending, so no second one can be set. One
uint xcl_skip(the pending target,0xFFFFFFFFfor none) now holds them all, and a guard is one comparison. Part of #1269.What is in it
crates/xcl/src/gpu/recomp/mod.rs:xcl_skipreplaces the per-target flags. Each guard isxcl_skip == none, plus the targets of jumps into the loop that follows (those jumps run the loop). The reset at a target now comes before the guard of the jumps still pending, which would otherwise skip it.crates/xcl/src/gpu/recomp/tests.rs:crossing_jumps_keep_guards_small, 32 crossing jumps. Onmainthey translate to 1 085 uses ofxcl_skipand the test fails; with this change there are 156. The test runs the program on the GPU for six patterns of taken jumps and checks that each one skips exactly the blocks up to its target.Tested
cargo test --workspace -- --test-threads=4: 756 passed, 0 failed, 41 ignored (SKIPPED:gpu_wave32_program_in_wave64_hardware,gpu_geometry_wave32_prefix_count_over_a_mask, both "no wave64")mainthe new test fails (1 085 uses); with the change it passes, GPU part included.jumps_to_outer_loop_heads_are_structured, as wave32 programs (the test runs its GPU part only with wave64), ran on the GPU translated bymainand by this change, with the same register state in all 1 000.xcl shaders shaders.rpf --recompon a retail pack (26 698 programs,XCL_RECOMP_WINDOWS=4): all 26 698 still translated. The largest CS goes from 154.6 MB of HLSL to 54.0 MB, the pack from 10 759 MB to 10 661 MB, and the other programs barely change size (the next largest, 31.0 MB, by 60 bytes).Regression run
The PR's run came after main's, with the shader cache main's run had filled. That probably explains its higher frame count.
main:
PR:
Not tested
jumps_to_outer_loop_heads_are_structured(wave64 only) and any wave64 GPU: no AMD or Intel hardware.-O0.HANDOFF.md(line 1281) still describes thexcl_skip_<target>flags.AI use
@DarkPanda69 on GitHub · 2026-11-24 17:28 UTC · original
AMD run with 64-lane waves, which this PR lists as not tested, so the GPU part of
jumps_to_outer_loop_heads_are_structuredruns here.Tested: pass, head
28b41d1applied on its basemain9e3831e, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.cargo test -p xcl --lib -- gpu::recomp --test-threads=4:jumps_to_outer_loop_heads_are_structuredok.Not tested: DXC and driver build time of the 54 MB program; Intel; the whole workspace suite; a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@2blponeyy on GitHub · 2026-11-24 17:30 UTC · original
Closing as a duplicate of #1345, which makes the same change and came first. I'll post a test report on #1345 from an NVIDIA 32-lane GPU (RTX 5070 Ti), which its description lists as not tested.
@DavidM1911 on GitHub · 2026-11-24 18:53 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Pull request closed