Skip to content

Recompiler: first structured form stops at a taken jump to a pending target and runs an else it jumps into (#701) - #721

Closed
dadnotdaddy wants to merge 1 commit into
xcl-dev:mainfrom
dadnotdaddy:fix-701
Closed

dadnotdaddy wants to merge 1 commit into
xcl-dev:mainfrom
dadnotdaddy:fix-701

Conversation

@dadnotdaddy

@dadnotdaddy dadnotdaddy commented Nov 24, 2026 •

Copy link
Copy Markdown

Fixes #701: the first structured form ran code after a taken jump to a pending target, and skipped an else that the if branch jumps into.

What is in it

  • crates/xcl/src/gpu/recomp/mod.rs: a skip flag set inside an open guard closes it, so the next item tests the flags again; else_ok refuses if/else when the if branch jumps to the else's start.
  • crates/xcl/src/gpu/recomp/tests.rs: first_structured_form_follows_jumps_to_pending_targets_and_into_the_else, both shapes from the issue, structured and structured: false.

Tested

  • RTX 2070 SUPER (driver 621.24), Ryzen 5 5500, Windows 11 26200, rustc 1.100.0, debug.
  • New test: on main gives the issue's results ([1,1,1,1,1], [1,1,0,0,1]); with the fix [1,1,0,1,0], [1,1,0,1,1].
  • cargo test --workspace -- --test-threads=4: 658 passed, 3 failed, 21 ignored. The 3 (title_textures::placed_title_textures_share_vram_and_preserve_pixels, title_textures::transitions_apply_when_their_list_is_submitted, vram::d32s8_targets_take_their_own_size_of_video_memory) fail the same way on main in the full run here and pass when run alone, on main and on this branch.
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64).

Regression run

  • None: I have no title to run scripts/smoke.ps1 on. A smoke run from a tester would be appreciated.

Not tested

  • AMD / wave64 hardware, any retail title.

AI use

  • Claude Code (Claude Opus 5.5): reproduced the issue in the test, wrote the fix and ran the tests.

…ing target and runs an else it jumps into (xcl-dev#701)

A jump whose target already has a pending skip flag left the open
if (!(xcl_skip_...)) guard in place, so the items after it still ran: any
raised flag now closes the guard, and the next item re-tests it. A jump from
the if branch to the start of the else branch is not raised from that level,
so else_ok accepted the if / else and the else never ran: such an if is now a
plain if, the else running under the skip flag of the jump over it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run of 1b4a1402fc299a65559170464c1e1bd618face5d on AMD RDNA4. I merged it onto current main f4ce27c locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 702 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 661 passed, 0 failed, 21 ignored
  • 0 SKIPPED; first_structured_form_follows_jumps_to_pending_targets_and_into_the_else passes.

Review: Both halves are small: a skip flag raised inside an open guard now closes it, and else_ok refuses an if/else whose if-branch jumps to the else's start. The test runs the two shapes from #701 structured and unstructured. I did not go through every caller of the structurizer.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

@lordon1a

Copy link
Copy Markdown

Independent test report on 1b4a140:

Tested

  • Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver 616.64, wave32, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), rustc 1.100.0 (x86_64-pc-windows-gnullvm), debug build, DXC 1.9.2609.5 (01b62ad4)
  • Command: cargo test -p xcl --lib first_structured_form_follows_jumps_to_pending_targets_and_into_the_else -- --nocapture
  • Result: 1 passed, 0 failed, 0 ignored in 0.64s

Not tested

  • AMD / wave64, Intel GPU, retail title (xcl-smoke)

AI use

  • Antigravity (Google DeepMind agent) — fetched 1b4a140 in a detached worktree, audited the diff, ran the test suite, and posted this report.

@ItsMrDubey

Copy link
Copy Markdown

Test report for 1b4a1402fc299a65559170464c1e1bd618face5d (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

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

This PR's tests:

  • gpu::recomp::tests::first_structured_form_follows_jumps_to_pending_targets_and_into_the_else: ok

Failures:

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.

@upipibi

upipibi commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

A wider check of 1b4a140 with @QemmHD's random-program differential tests from #701 (structure_fuzz.rs, test-only commit 6e9c949 on review/172-structure). They need #172's general form as the reference, so the tree was main 64b3f35 + #172 (ca66c4a) + 6e9c949, run without and with this PR. The two test files conflict only by both appending at the end, and I kept both.

without #721 with #721
random_programs_structure_like_their_graph, XCL_STRUCTURE_FUZZ=5000 (CPU): first structured form walks unlike its graph 132 of 1117 0 of 1119
gpu_random_programs_match_the_reference, XCL_STRUCTURE_FUZZ=600 (600 seeds × wave32 and split wave64, 34 052 blocks run): differences in the first structured form / pc chain 26 0
first_form_runs_code_a_taken_jump_skips, first_form_skips_the_else_branch_it_jumps_into (#[should_panic] until fixed) panic (bug present) no longer panic
this PR's first_structured_form_follows_jumps_to_pending_targets_and_into_the_else – passes

The general form matched the CPU reference in all 1 200 GPU programs both times. So on this corpus the fix covers the whole class, not only the two shapes in #701. The structured count moves from 1117 to 1119 because else_ok now declines a few if/else shapes. Once both land, the two #[should_panic] markers in structure_fuzz.rs can be dropped.

Tested: NVIDIA GeForce RTX 3070 (driver 616.56, wave32), Ryzen 9 5950X, Windows 11 Pro 26100, rustc 1.100.0, debug.

AI-assisted (Claude Code).

@throny

throny commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Retail regression run for 1b4a1402fc299a65559170464c1e1bd618face5d (this PR's head) on NVIDIA, as asked for in #42. Unedited scripts/smoke.ps1 output; the main block is this PR's merge base f4ce27c, so the two builds differ only by this PR.

Tested

  • Windows 11 Pro 10.0.26300, NVIDIA GeForce RTX 4080 (driver 610.88, 32-lane waves), Intel i9-12900K, 64 GB; Rust 1.100.0 stable-x86_64-pc-windows-msvc; release builds (cargo build --release -p xcl), no uncommitted changes.
  • scripts/smoke.ps1 -Game <folder> -Seconds 60, a retail title, warm shader cache. Each build ran twice in a row; the blocks are the second runs. The first runs: f4ce27c 1630 frames, this PR 1634 frames, both exit 0x0, 0 device removals, 0 crashes.

Regression run

main (f4ce27c):

xcl-smoke v1
commit: f4ce27ceb6d1b0576d0c659b713b674778bf1968
gpu: NVIDIA GeForce RTX 4080
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1640 (PresentX 1640)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14749 MB

PR (1b4a140):

xcl-smoke v1
commit: 1b4a1402fc299a65559170464c1e1bd618face5d
gpu: NVIDIA GeForce RTX 4080
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1633 (PresentX 1633)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 14741 MB

Not tested

  • The test suite on this head (other reports here ran it).
  • Whether any program the title builds in those 60 s takes the changed structured form: the run shows nothing broke, not that the change is exercised.
  • AMD / wave64 hardware; anything past the title's menus (the run gets that far in 60 s).

AI use

  • Claude Code (Claude Fable 5.2) read the diff, built both commits, ran the script and wrote this report.

@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.

Recompiler: the first structured form runs code a taken jump skips, and skips an else it jumps into

7 participants