Skip to content

Recompiler: a second jump to a pending skip flag stops the code after it (#701) - #729

Closed
towiice wants to merge 2 commits into
xcl-dev:mainfrom
towiice:recompiler-repeated-skip-flag
Closed

towiice wants to merge 2 commits into
xcl-dev:mainfrom
towiice:recompiler-repeated-skip-flag

Conversation

@towiice

@towiice towiice commented Nov 24, 2026

Copy link
Copy Markdown

Part of #701 (shape 1). Stacked on #728; only the top commit belongs here. The first structured form guards the items after a forward jump with if (!(skip flag)), one guard for as long as the set of pending flags stays the same. A second jump to a target whose flag is already pending (two breaks to the same block) leaves the set as it is, so the guard stays open and the items after the jump run although it was taken. The guard is now closed after such a jump; the next item opens a new one that tests the flags again.

What is in it

  • crates/xcl/src/gpu/recomp/mod.rs (emit_structured): close the open guard when an item raises a target that is already pending.
  • crates/xcl/src/gpu/recomp/tests.rs: gpu_a_second_jump_to_a_pending_target_skips_what_follows: a loop with two breaks to the same block and an if before the latch, run on the GPU in the structured form and in the pc chain, five (s10, s11, s12) combinations.

Tested

  • NVIDIA GeForce GTX 1650 SUPER (wave32 only), Windows 11 build 26300, Rust 1.98.1 x86_64-pc-windows-gnullvm (llvm-mingw 20261117), DXC 1.9.2609.5, debug
  • the new test fails without the fix (structured: true, s10 = 1, s11 = 0, s12 = 1: (1, 1, 0), want (0, 1, 0)) and passes with it
  • cargo test -p xcl --lib -- --test-threads=4 (with DXC): 659 passed, 3 failed, 21 ignored; main gives 657 passed and the same 3 failures (see Recompiler: a jump from the if branch to its else branch runs the else branch (#701) #728: hle::d3d12x tests that pass when run alone)

Regression run
None: I have no title for scripts/smoke.ps1. This changes crates/xcl/src, so the two xcl-smoke blocks have to come from someone with a title.

main:
not run

PR:
not run

Not tested

AI use

towiice and others added 2 commits November 24, 2026 01:10
…e branch (xcl-dev#701)

In the first structured form, a conditional jump inside the if branch of an
if / else to the start of the else branch ended at the end of the if branch
(`hi`), so it was taken for a skip over the rest of the branch: an if with no
else, whose body included the s_branch over the else. The jump then fell into
the code after the else and the else branch never ran. In an if branch with an
else (exit set), a jump to `hi` is raised as a skip flag instead; the if / else
is then rejected as before and the else runs under the flag.

The test runs the program on the GPU in the structured form and in the pc chain.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… it (xcl-dev#701)

The first structured form guards the items after a forward jump with
`if (!(skip flag))`, one guard for as long as the set of pending flags stays the
same. A second jump to a target whose flag is already pending (two breaks to the
same block) leaves the set as it is, so the guard stayed open and the items after
the jump ran although it was taken. Close the guard after such a jump; the next
item opens a new one that tests the flags again.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@LocranKing

Copy link
Copy Markdown

Tested on Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB, wave32).

Tested

  • Commit: 425540203e798100f773fcfbadea4004550f49b5 (pr-729, clean tree)
  • Hardware / software: Windows 11 Home Build 26200, AMD Ryzen 5 5500, 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, driver 32.0.16.2101), rustc 1.100.0 (x86_64-pc-windows-msvc, MSVC 14.44.35207), DXC 1.9.2602.17 (SDK 10.0.26100.0), --release
  • cargo test --workspace --release --no-fail-fast -- --test-threads=4: 687 passed, 0 failed, 41 ignored, exit 0; 2 (no wave64) skipped (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware)

Regression run (scripts/smoke.ps1, 60 s, XCL_NETWORK=0, title folder name redacted)

main (64b3f35):

xcl-smoke v1
commit: 64b3f35599bb7102f55d640e1a791e7d6dd3b175
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 544 (PresentX 545)
presents per 2 s (last 3): 22 22 21
device removals: 0
crashes: 0
peak commit: 15491 MB

PR #729 (4255402):

xcl-smoke v1
commit: 425540203e798100f773fcfbadea4004550f49b5
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1497 (PresentX 1497)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14751 MB

Not tested: Debug build, XCL_SAMPLE_RPF / shader corpus tests on this branch, AMD / wave64 hardware.

AI use: Antigravity (Gemini 4 Hydrogen) ran the build, tests, and smoke runs and drafted this report from the command outputs.

@ItsMrDubey

Copy link
Copy Markdown

Test report for 425540203e798100f773fcfbadea4004550f49b5 (this PR's head)

Tested

  • NVIDIA GeForce RTX 4070 Ti 12 GB (Ada), driver 617.14; Intel Core i9-10900K, 32 GB RAM; Windows 11 Pro build 26300
  • Rust 1.88.0 (stable-x86_64-pc-windows-msvc), debug; DXC 1.9.2602.17 from Windows SDK 10.0.26100
cargo build --workspace
cargo test --workspace --no-fail-fast -- --test-threads=4

16 test binaries: 686 passed, 1 failed, 41 ignored. Same machine, main 64b3f3559: 700 passed, 1 failed, 41 ignored.

This PR's tests:

  • gpu::recomp::tests::gpu_a_jump_from_the_if_branch_to_the_else_branch_runs_it: ok
  • gpu::recomp::tests::gpu_a_second_jump_to_a_pending_target_skips_what_follows: ok

Failures:

16 test binaries instead of main's 17 because this branch predates tests/sparse_reinit.rs; nothing crashed.

SKIPPED (no wave64 on this GPU): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.

AI use: Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report from their output.

@QemmHD

QemmHD commented Nov 24, 2026 •

Copy link
Copy Markdown

Verified on an RTX 4070 SUPER with the #701 harness (QemmHD/xcl review/701-fixes, fed3380). On its own, this PR's mod.rs change fixes shape 1: random first-form programs that walk wrong go from 513 to 116 of 4 785, and GPU mismatches from 14 to 4 of 1 200. Your test needs #728's run_scalar_program. With #728: 7 on the CPU, 2 on the GPU, the full suite gives 715 passed / 0 failed / 41 ignored (main: 701 / 0 / 41), and no program that was right on main breaks. The 7 leftovers are a nested variant of shape 2; details and a one-line fix are on #728. Nit: mod.rs:1011 has a raw newline inside the format string where \n would read better (same behaviour).

AI-assisted (Claude Code, Claude Opus 5.5).
Discord: bigpeppa.

@raylitebull

Copy link
Copy Markdown
Member

Closing as a duplicate of #765 for #701, which passes the PR description check (whereas this PR fails PR description).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants