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

Closed
github-bot wants to merge 2 commits from gh-pr/729/head into gh-pr/729/base
Owner

@⁠towiice on GitHub · 2026-11-24 04:11 UTC · original
towiice:recompiler-repeated-skip-flag → main · +97 −1 · 2 files · 2 commits · closed without merging

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 #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

  • the retail title and scripts/smoke.ps1; wave64; AMD; MSVC; the rest of the workspace on this branch
  • the 1 200-program random run from #701 (its tests are in a branch of #172)
  • whether the extra } / guard reopening changes the HLSL of shaders in a way that matters for compile time; I did not measure it

AI use

  • Claude Code (Claude Sonnet 5.5) wrote the program, the test and the fix and ran the tests; the diagnosis is from #701.
**@⁠towiice** on GitHub · 2026-11-24 04:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/729) `towiice:recompiler-repeated-skip-flag` → `main` · +97 −1 · 2 files · 2 commits · closed without merging 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 #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** - the retail title and `scripts/smoke.ps1`; wave64; AMD; MSVC; the rest of the workspace on this branch - the 1 200-program random run from #701 (its tests are in a branch of #172) - whether the extra `}` / guard reopening changes the HLSL of shaders in a way that matters for compile time; I did not measure it **AI use** - Claude Code (Claude Sonnet 5.5) wrote the program, the test and the fix and ran the tests; the diagnosis is from #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 <[email protected]>
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 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:30:45 +00:00
github-bot closed this pull request 2026-11-26 04:30:45 +00:00
Author
Owner

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

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.

**@⁠LocranKing** on GitHub · 2026-11-24 04:46 UTC · [original](https://github.com/xcl-dev/xcl/pull/729#issuecomment-7122334267) 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.
Author
Owner

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

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:

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

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.

**@⁠ItsMrDubey** on GitHub · 2026-11-24 04:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/729#issuecomment-7122492386) 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: - `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. 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.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 05:03 UTC · original · edited 2026-11-24 05:04 UTC

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.

**@⁠QemmHD** on GitHub · 2026-11-24 05:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/729#issuecomment-7122580209) · edited 2026-11-24 05:04 UTC Verified on an RTX 4070 SUPER with the #701 harness ([QemmHD/xcl `review/701-fixes`](https://github.com/QemmHD/xcl/tree/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.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-24 10:44 UTC · original

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

**@⁠raylitebull** on GitHub · 2026-11-24 10:44 UTC · [original](https://github.com/xcl-dev/xcl/pull/729#issuecomment-7129180489) Closing as a duplicate of #765 for #701, which passes the `PR description` check (whereas this PR fails `PR description`).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.