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

Closed
dadnotdaddy wants to merge 1 commit from upstream-pr/721 into main
dadnotdaddy commented 2026-11-24 04:04:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by dadnotdaddy on 2026-11-24T04:04:29Z.


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.
<!-- greyfinch-sync:ivall/xcl:issue:6574350117 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/721). Originally posted by [dadnotdaddy](https://github.com/dadnotdaddy) on 2026-11-24T04:04:29Z. --- 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.
MesshM commented 2026-11-24 07:06:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T04:14:39Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7121839527 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/721#issuecomment-7121839527). Originally posted by [MesshM](https://github.com/MesshM) on 2026-11-24T04:14:39Z. --- 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 commented 2026-11-24 07:06:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lordon1a on 2026-11-24T04:15:48Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7121857562 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/721#issuecomment-7121857562). Originally posted by [lordon1a](https://github.com/lordon1a) on 2026-11-24T04:15:48Z. --- 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 commented 2026-11-24 07:06:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ItsMrDubey on 2026-11-24T04:57:33Z.


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:

  • hle::kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory fails on this machine on every run, on this PR's head and on main 64b3f3559 alike (5 of 5 reruns on main), so it is not from this PR. #650 fixes it here.

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.

<!-- greyfinch-sync:ivall/xcl:comment:7122493141 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/721#issuecomment-7122493141). Originally posted by [ItsMrDubey](https://github.com/ItsMrDubey) on 2026-11-24T04:57:33Z. --- 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: - `hle::kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory` fails on this machine on every run, on this PR's head and on `main` `64b3f3559` alike (5 of 5 reruns on `main`), so it is not from this PR. #650 fixes it here. 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 commented 2026-11-24 07:06:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-24T05:10:40Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7122697373 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/721#issuecomment-7122697373). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T05:10:40Z. --- 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 commented 2026-11-24 07:06:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-24T06:26:39Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7123938436 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/721#issuecomment-7123938436). Originally posted by [throny](https://github.com/throny) on 2026-11-24T06:26:39Z. --- 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.
upstream-sync closed this pull request 2026-11-24 11:04:58 +00:00
raylitebull commented 2026-11-24 11:05:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-24T10:44:16Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7129176717 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/721#issuecomment-7129176717). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-24T10:44:16Z. --- Closing as a duplicate of #765 for #701, which passes the `PR description` check (whereas this PR fails `PR description`).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!716
No description provided.