Recompiler: preserve control flow across structured jumps #765
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!765
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-765"
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?
@Abuudiii on GitHub · 2026-11-24 04:51 UTC · original
Abuudiii:xcl-701-control-flow→main· +103 −9 · 3 files · 1 commits · openFixes #701 in the legacy structured emitter. Reopen a skip guard when a later branch can set it and preserve actual jumps into the else arm.
What is in it
Tested
f4ce27cand pass with this patch. Exact SGPR results passed on RX 9070 under GE-Proton11-7 / vkd3d-proton 3.1 / DXC 1.9.2609.5: 2 CPU tests and 1 GPU test, no skips.cargo test --workspace --no-fail-fast -- --test-threads=1: 704 passed, 0 failed, 41 ignored; the two wave64 tests skipped (gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware). All three PR regressions ran and passed.64b3f35:cargo test --workspace -- --test-threads=4: 704 passed, 0 failed, 41 ignored, no GPU skips.Regression run
Native Windows runs reported by @ryosen0.
Not tested
AI use
@JoaoPauluu on GitHub · 2026-11-24 04:54 UTC · original
Test report: #765 on NVIDIA under Wine + vkd3d-proton (Linux)
This complements the RX 9070 run in the description with a 32-lane NVIDIA GPU, through the same kind of stack (Wine, vkd3d-proton 3.1, DXC 1.9.2609.5).
Setup
experimental-11.0-20261112(wine-11.0), vkd3d-proton v3.1 (4522cc1a) + the patch from #257, DXVK from Proton, DXC 1.9.2609.5,DXVK_CONFIG="dxgi.hideNvidiaGpu = False"x86_64-pc-windows-gnu(mingw-w64-gcc 16.2.0), debug build of this PR's head4cfd951Results (lib test binary under Wine,
--test-threads=1)structured_: 3 passed, 0 failed, 0 ignored, in 2 of 2 runs:gpu_structured_branch_targets_match_rdna2(ran, not skipped),structured_jump_into_else_preserves_target,structured_repeated_loop_exit_rechecks_guardgpu::recomp,--skip gpu_more_atomics_sub_dword_scratch_valu(that test hangs NVIDIA under vkd3d-proton, dxil-spirv#372 / #175): 185 passed, 0 failed, 18 ignored.SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64)Not tested
AI use: Claude Code (Claude Opus 5.5) built the tests, ran them on the machine above and wrote this report. The counts are pasted from those runs. The account owner asked for test reports to be posted while they were away and has not reviewed this one.
@eizispark on GitHub · 2026-11-24 05:01 UTC · original
Hardware check of
4cfd95109706b8c95e80efe3a20469df9378bbd8(verified clean merge withmain64b3f35): pass.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo test --workspace -- --test-threads=4:704 passed, 0 failed, 41 ignored(GPU tests skipped on this adapter:none)gpu::recomp::tests(gpu_structured_branch_targets_match_rdna2,structured_jump_into_else_preserves_target,structured_repeated_loop_exit_rechecks_guard):3 passed, 0 failedRegression run
main(f4ce27c):PR (
4cfd951):Not tested
AI use
scripts/smoke.ps1harness on this machine and formatted this report.@ryosen0 on GitHub · 2026-11-24 05:10 UTC · original
Native Windows cross-check for
4cfd951(RTX 3060 Ti 8 GB, wave32, Ryzen 7 9800X3D, driver 32.0.16.1742, Windows 11), covering the two gaps in Not tested:Native Windows GPU suite —
cargo test --workspace --no-fail-fast -- --test-threads=1: 704 passed, 0 failed, 41 ignored, exit 0. 2 GPU SKIPPED (gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware— no wave64 on this adapter); your two emitter regressions and the register-readback test pass natively.Paired retail smoke — same title, same duration, release builds, no uncommitted changes; both blocks verbatim.
Main (
f4ce27c, this PR's merge-base):Head (
4cfd951):Both steady 60 presents / 2 s, no device removal — a no-regression check on the retail boot/menus path, not a repro of #701's shader (that stays covered by your synthetic regressions).
AI use: GPT-6.2 Astra (API model selector) in DSH ran the suite and both smokes and drafted this comment; the human contributor reviewed the numbers before posting.
@mastrr9 on GitHub · 2026-11-24 05:14 UTC · original
Independent native Windows NVIDIA RTX 5080 build/test run and code review at head
4cfd95109706b8c95e80efe3a20469df9378bbd8.Code Review
#701cases in the legacy structured emitter:else_okscansc.edgesdirectly (binary-searched by instruction-orderedsrc) to reject any branch from[end, t)targeting[t, u), catching nested conditionals totthatstructurable_topreviously swallowed as an innerif.emit_structuredclosesguardwhenever!g.is_disjoint(&raised)so a subsequent branch raising the same skip flag re-opens a fresh guard check before the following block.structured = trueandfalsemodes.Tested
617.42/32.0.16.1742), Windows 11 Pro 25H2 (26200.9974),rustc 1.100.0 (0ef1bc386 2026-11-09), DXC from Windows SDK10.0.26100.0, debug build.cargo build --workspace && cargo test --workspace -- --test-threads=4ok):gpu::recomp::tests::structured_repeated_loop_exit_rechecks_guardgpu::recomp::tests::structured_jump_into_else_preserves_targetgpu::recomp::tests::gpu_structured_branch_targets_match_rdna2(executed on RTX 5080, not skipped)gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64)gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)Not tested
d3d12SDKLayers.dllnot installed on this host), AMD/wave64 hardware, release build, and retail titles.AI use: Antigravity (Gemini 4 Neon) performed the code review, ran the RTX 5080 workspace tests, and drafted this comment.
@NathanTheophile on GitHub · 2026-11-24 07:00 UTC · original
A random-program check of
4cfd951with @QemmHD's #701 harness (structure_fuzz.rsfrom6e9c949). It's adapted to run without #172: on each tree it compares only main's two forms, the default path and thepcchain, against the harness's CPU reference. The same harness ran onmainand on the other #701 PRs, each with its own build directory.mainbeaa2454cfd9511b4a1404255402(with #728)On #729, seeds 431 and 3252 also give wrong SGPRs on the GPU with 16 inputs each, and identical ones on
main, so they are real miscompiles. This matches @QemmHD's leftovers on #728. On #765 and #721, those seeds are right.Tested: NVIDIA GeForce RTX 4060 Laptop GPU (driver 616.87, 32-lane waves, so wave64 runs split), Windows 11 26200, Rust 1.100.0 MSVC, DXC 1.8.2502.11, debug. Not tested: AMD / native wave64; the harness's general-form (#172) checks, which this adaptation drops.
AI-assisted: Claude Code, Claude Opus 5.5.
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175@Kalmarv on GitHub · 2026-11-24 22:49 UTC · original
Independent confirmation of this fix on current
main, from a different shape of the same bug: two conditional branches whose targets share the start of an else arm.Tested
main689f2db: all 32 words store 9. The structured emitter nests the two conditions and skips the else arm, so the expected 13 is never written.689f2db(a local rebase; the one conflict was inrecomp/mod.rs, next tomain's separate pending-flag fix): all three branch outcomes give the expected values (13, 13, 11).305bbb77ddc3ff2d,6e3fd903765f4376,bf82bfb95451bef8,c3ae68197a76d57f,d3c6619783fb3e57,ee2e847c35bba72c,fbf59c380949b267.else_okedge rejection, all 7 pass a per-lane control-trace comparison against the guest branches; without it, all 7 fail.6e3fd903was built and bound. We have no per-dispatch trace, so whether the title takes the wrong arm with real inputs is not shown.Not tested
The rebased head and a second regression test (a compute dispatch with two branches to the else arm) are ready on our side. We can't push them to a fork just now, because our token lacks the
workflowscope thatmain's newstale.ymlrequires. @Abuudiii, if you rebase ontomain, the conflict is a few lines inrecomp/mod.rs.AI use: Claude Code (Claude Opus 5.5) and Codex helpers ran the check and the GPU tests on our machine; Claude Code wrote this.
@Kalmarv on GitHub · 2026-11-24 22:56 UTC · original
Follow-up to the check above:
cargo test --workspace(debug) on689f2dbwith this PR rebased plus the extra regression test: 979 passed, 0 failed, 45 ignored. The 22 skip notices are 18 native-wave64, 3 unsupported f16 variants and 1 heap windows. The two-branches-to-the-else GPU test ran without a skip. Still not tested: AMD and a smoke pair.AI use: a Codex helper ran the suite on our machine; Claude Code wrote this.
@Kalmarv on GitHub · 2026-11-24 23:03 UTC · original
@Abuudiii the rebase I mentioned above is now on a branch you can pull:
Kalmarv:shared-else-765-rebased. It'see80f924(this PR rebased ontomain689f2db, with the onerecomp/mod.rsconflict resolved) plusafc55fcd, the extra regression test (a compute dispatch with two branches into the else arm). The workspace run above was on that head. Take it, cherry-pick from it, or ignore it, whichever suits you.AI use: Claude Code (Claude Opus 5.5) did the rebase and wrote this.
@DavidM1911 on GitHub · 2026-11-25 11:16 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.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.