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

Open
opened 2026-11-26 04:29:56 +00:00 by github-bot · 2 comments
Owner

@⁠QemmHD on GitHub · 2026-11-24 03:48 UTC · original

Two shapes that the first structured form (emit_structured / structured_span, used for single-entry stretches when the general structurizer isn't on) translates wrongly on main (checked at dd2ae9a). Found while reviewing #172; neither comes from #172, and #172's general form gets both right.

1. A jump to a target whose skip flag is already pending leaves the open guard in place (gpu/recomp/mod.rs:924)
The jump doesn't close the open if (!(xcl_skip_…)), so the items after it still run. Shape: a loop with two exits to the same block, plus an if before the latch (two_breaks_program with s11 = 2).
s0..s4 expected [1,1,0,1,0]; the pc chain path (Options { structured: false }) and the default path give [1,1,1,1,1].

2. A jump from the if branch to the start of the else branch is treated as a skip to the end of the if branch (gpu/recomp/mod.rs:693, item_at)
The else branch never runs. Expected [1,1,0,1,1], got [1,1,0,0,1].

Both reproduce on the GPU (RTX 4070 SUPER, NVIDIA 621.24, wave32) and against a CPU reference run. In a random run of 1 200 small programs (600 wave32, 600 split wave64), the pc chain and the default path differed from the CPU reference in 13; the general form of #172 in none.

Tests (test-only commit 6e9c949, branch https://github.com/QemmHD/xcl/tree/review/172-structure, crates/xcl/src/gpu/recomp/tests/structure_fuzz.rs):

  • first_form_runs_code_a_taken_jump_skips and first_form_skips_the_else_branch_it_jumps_into: CPU, #[should_panic] until fixed;
  • gpu_first_form_counter_examples_are_right_in_the_general_form: both shapes on the GPU, in every form.

Since Options { structured: false } still goes through this form for single-entry stretches, it also affects #172's own GPU test, which uses that path as its reference.

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

**@⁠QemmHD** on GitHub · 2026-11-24 03:48 UTC · [original](https://github.com/xcl-dev/xcl/issues/701) Two shapes that the first structured form (`emit_structured` / `structured_span`, used for single-entry stretches when the general structurizer isn't on) translates wrongly on `main` (checked at `dd2ae9a`). Found while reviewing #172; neither comes from #172, and #172's general form gets both right. **1. A jump to a target whose skip flag is already pending leaves the open guard in place** (`gpu/recomp/mod.rs:924`) The jump doesn't close the open `if (!(xcl_skip_…))`, so the items after it still run. Shape: a loop with two exits to the same block, plus an `if` before the latch (`two_breaks_program` with s11 = 2). s0..s4 expected `[1,1,0,1,0]`; the `pc` chain path (`Options { structured: false }`) and the default path give `[1,1,1,1,1]`. **2. A jump from the if branch to the start of the else branch is treated as a skip to the end of the if branch** (`gpu/recomp/mod.rs:693`, `item_at`) The else branch never runs. Expected `[1,1,0,1,1]`, got `[1,1,0,0,1]`. Both reproduce on the GPU (RTX 4070 SUPER, NVIDIA 621.24, wave32) and against a CPU reference run. In a random run of 1 200 small programs (600 wave32, 600 split wave64), the `pc` chain and the default path differed from the CPU reference in 13; the general form of #172 in none. Tests (test-only commit `6e9c949`, branch https://github.com/QemmHD/xcl/tree/review/172-structure, `crates/xcl/src/gpu/recomp/tests/structure_fuzz.rs`): - `first_form_runs_code_a_taken_jump_skips` and `first_form_skips_the_else_branch_it_jumps_into`: CPU, `#[should_panic]` until fixed; - `gpu_first_form_counter_examples_are_right_in_the_general_form`: both shapes on the GPU, in every form. Since `Options { structured: false }` still goes through this form for single-entry stretches, it also affects #172's own GPU test, which uses that path as its reference. AI-assisted (Claude Code, Claude Opus 5.5). Discord: bigpeppa.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:29:56 +00:00
Author
Owner

@⁠towiice on GitHub · 2026-11-24 04:11 UTC · original

Both shapes reproduced on a GTX 1650 SUPER (wave32, DXC 1.9) and fixed in two draft PRs: #728 (shape 2, the jump into the else branch) and #729 (shape 1, stacked on #728 for the test helper). Both wait for xcl-smoke runs from someone with a title. Claude Code (Claude Sonnet 5.5).

**@⁠towiice** on GitHub · 2026-11-24 04:11 UTC · [original](https://github.com/xcl-dev/xcl/issues/701#issuecomment-7121789084) Both shapes reproduced on a GTX 1650 SUPER (wave32, DXC 1.9) and fixed in two draft PRs: #728 (shape 2, the jump into the else branch) and #729 (shape 1, stacked on #728 for the test helper). Both wait for `xcl-smoke` runs from someone with a title. Claude Code (Claude Sonnet 5.5).
Author
Owner

@⁠NathanTheophile on GitHub · 2026-11-24 07:02 UTC · original

On Windows with an RTX 4060 Laptop GPU, the same synthetic regression passed 18/24 register comparisons on main (beaa245), 24/24 on #721 (1b4a140) and #765 (4cfd951), 20/24 on #728 (cff9cf7), and 22/24 on #729 (4255402). The nested else jump still failed on #729. All PR-owned tests passed.

I’d keep #765 as the candidate. cargo test --workspace --no-fail-fast -- --test-threads=4 reported 704 passed, 0 failed, 41 ignored, and two wave64 capability skips. Its description check passed. Required CI and maintainer validation still apply. The local comparison used synthetic fixtures only.

AI use

  • Codex (GPT-6) wrote and ran the shared test and assisted with the comparison.
**@⁠NathanTheophile** on GitHub · 2026-11-24 07:02 UTC · [original](https://github.com/xcl-dev/xcl/issues/701#issuecomment-7124552992) On Windows with an RTX 4060 Laptop GPU, the same synthetic regression passed 18/24 register comparisons on main (`beaa245`), 24/24 on #721 (`1b4a140`) and #765 (`4cfd951`), 20/24 on #728 (`cff9cf7`), and 22/24 on #729 (`4255402`). The nested else jump still failed on #729. All PR-owned tests passed. I’d keep #765 as the candidate. `cargo test --workspace --no-fail-fast -- --test-threads=4` reported 704 passed, 0 failed, 41 ignored, and two wave64 capability skips. Its description check passed. Required CI and maintainer validation still apply. The local comparison used synthetic fixtures only. **AI use** - Codex (GPT-6) wrote and ran the shared test and assisted with the comparison.
This discussion has been locked. Commenting is limited to contributors.
No description provided.