Recompiler: keep entered far-jump sequences indirect #865

Manually merged
github merged 1 commit from gh-pr/865/head into gh-pr/865/base 2026-11-26 04:34:57 +00:00
Owner

@⁠nova-aryan on GitHub · 2026-11-24 07:01 UTC · original
nova-aryan:contrib/far-jump-entry-targets → main · +73 −1 · 2 files · 1 commits · merged 2026-11-25 01:18 UTC

A branch into the middle of a far-jump address calculation can bypass GETPC. The recognizer still assigned SETPC a constant target, making later control-flow analysis assume an address that the incoming SGPR state does not guarantee. Fixes #863.

What is in it

  • Collect direct and prospective far targets before annotating SETPC.
  • Keep a sequence indirect when an edge enters after GETPC.
  • Add add/subtract controls, direct-entry cases and a forward far-to-far case. Update the README limitation.

Tested

  • Rust 1.100.0, standalone decoder harness under WSL Kali Linux on the contributor's Windows PC.
  • The harness imports the actual rdna2.rs, rdna2_spec.rs and rdna2_xbox.rs source modules with rustc --test.
  • Before the fix, 1 new test passed and 2 failed. After the fix, all 12 decoder tests passed, 0 failed, 0 ignored.
  • The existing LLVM corpus test passed. It checked 23,812 instruction entries, with 23,405 decoded and matching names and lengths; the test excludes the known RDNA1-only instructions.
  • git diff --check passed.

Independent Windows validation reported by ettehn on this exact head: RTX 5070 Ti Laptop, driver 621.24, Windows 11 x64, Rust 1.97.1 MSVC debug. Full workspace run reported 716 passed, 0 failed, 41 ignored, with two passing tests reporting SKIPPED (no wave64). Both new regression failures were reproduced against main, all three new tests passed on the PR, and eight extra backward-entry cases passed. These results were supplied by that contributor.

Regression run
Reported by Anon64 on NVIDIA RTX 3060 12 GB, driver 581.80, Intel Core i9-14900KF, Windows 11 25H2 26200.9974, Rust 1.90.0, release. Same retail title for 60 seconds, clean tree at each commit. Blocks copied verbatim from that report.

main:

xcl-smoke v1
commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1636 (PresentX 1637)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18113 MB

PR head:

xcl-smoke v1
commit: 354403869ee53cf0a69b19497b0309e4c4cd27c9
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1636 (PresentX 1636)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17612 MB

Not tested
The retail run does not establish whether the title reaches the changed code. Native wave64 coverage was skipped in the reported Windows workspace run. Windows full-suite and retail results above are attributed contributor reports. The author's local validation remains the standalone WSL decoder harness. Other GPU families and retail titles remain unverified.

AI use
Codex with GPT-6.1-sol investigated the issue, wrote the fix and tests, ran the standalone checks and drafted this description.

**@⁠nova-aryan** on GitHub · 2026-11-24 07:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/865) `nova-aryan:contrib/far-jump-entry-targets` → `main` · +73 −1 · 2 files · 1 commits · merged 2026-11-25 01:18 UTC A branch into the middle of a far-jump address calculation can bypass GETPC. The recognizer still assigned SETPC a constant target, making later control-flow analysis assume an address that the incoming SGPR state does not guarantee. Fixes #863. **What is in it** - Collect direct and prospective far targets before annotating SETPC. - Keep a sequence indirect when an edge enters after GETPC. - Add add/subtract controls, direct-entry cases and a forward far-to-far case. Update the README limitation. **Tested** - Rust 1.100.0, standalone decoder harness under WSL Kali Linux on the contributor's Windows PC. - The harness imports the actual rdna2.rs, rdna2_spec.rs and rdna2_xbox.rs source modules with rustc --test. - Before the fix, 1 new test passed and 2 failed. After the fix, all 12 decoder tests passed, 0 failed, 0 ignored. - The existing LLVM corpus test passed. It checked 23,812 instruction entries, with 23,405 decoded and matching names and lengths; the test excludes the known RDNA1-only instructions. - git diff --check passed. Independent Windows validation [reported by ettehn](https://github.com/ivall/xcl/pull/865#issuecomment-7124854369) on this exact head: RTX 5070 Ti Laptop, driver 621.24, Windows 11 x64, Rust 1.97.1 MSVC debug. Full workspace run reported 716 passed, 0 failed, 41 ignored, with two passing tests reporting SKIPPED (no wave64). Both new regression failures were reproduced against main, all three new tests passed on the PR, and eight extra backward-entry cases passed. These results were supplied by that contributor. **Regression run** Reported by [Anon64](https://github.com/ivall/xcl/pull/865#issuecomment-7124833629) on NVIDIA RTX 3060 12 GB, driver 581.80, Intel Core i9-14900KF, Windows 11 25H2 26200.9974, Rust 1.90.0, release. Same retail title for 60 seconds, clean tree at each commit. Blocks copied verbatim from that report. main: ``` xcl-smoke v1 commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1636 (PresentX 1637) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 18113 MB ``` PR head: ``` xcl-smoke v1 commit: 354403869ee53cf0a69b19497b0309e4c4cd27c9 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1636 (PresentX 1636) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17612 MB ``` **Not tested** The retail run does not establish whether the title reaches the changed code. Native wave64 coverage was skipped in the reported Windows workspace run. Windows full-suite and retail results above are attributed contributor reports. The author's local validation remains the standalone WSL decoder harness. Other GPU families and retail titles remain unverified. **AI use** Codex with GPT-6.1-sol investigated the issue, wrote the fix and tests, ran the standalone checks and drafted this description.
An incoming branch can bypass GETPC and invalidate the fixed-target assumption. Collect direct and prospective far targets before publishing annotations, and preserve indirect jumps when a target enters their calculation. Fixes #863.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:34:56 +00:00
github manually merged commit 354403869e into gh-pr/865/base 2026-11-26 04:34:57 +00:00
Author
Owner

@⁠Anon64 on GitHub · 2026-11-24 07:17 UTC · original

Regression runs for this PR's head 3544038 and for its base main beaa245, on a retail title (same title, 60 s each), made with scripts/smoke.ps1 (release, clean tree at each commit) and pasted unedited, for Regression run.

main:

xcl-smoke v1
commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1636 (PresentX 1637)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18113 MB

this PR:

xcl-smoke v1
commit: 354403869ee53cf0a69b19497b0309e4c4cd27c9
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1636 (PresentX 1636)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17612 MB

Tested

  • NVIDIA GeForce RTX 3060 12 GB (driver 581.80, wave32), Intel Core i9-14900KF, Windows 11 25H2 26200.9974 (native Windows), Rust 1.90.0

Not tested

  • the unit tests on this machine
  • whether the title reaches the changed code; this is a regression check only

Report written with Claude Code (Claude Opus 5.5) from runs on this machine.

**@⁠Anon64** on GitHub · 2026-11-24 07:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/865#issuecomment-7124833629) Regression runs for this PR's head `3544038` and for its base `main` `beaa245`, on a retail title (same title, 60 s each), made with `scripts/smoke.ps1` (release, clean tree at each commit) and pasted unedited, for **Regression run**. main: ``` xcl-smoke v1 commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1636 (PresentX 1637) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 18113 MB ``` this PR: ``` xcl-smoke v1 commit: 354403869ee53cf0a69b19497b0309e4c4cd27c9 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1636 (PresentX 1636) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17612 MB ``` **Tested** - NVIDIA GeForce RTX 3060 12 GB (driver 581.80, wave32), Intel Core i9-14900KF, Windows 11 25H2 26200.9974 (native Windows), Rust 1.90.0 **Not tested** - the unit tests on this machine - whether the title reaches the changed code; this is a regression check only Report written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠ettehn on GitHub · 2026-11-24 07:18 UTC · original

Independent Windows check on 3544038 (Windows 11 x64, RTX 5070 Ti Laptop, driver 621.24, Rust 1.97.1 MSVC debug). On beaa245 with just the PR’s three new tests, the uninterrupted case passed and both middle-entry tests failed. On the PR head all three passed. The full workspace run finished with 716 passed, 0 failed, 41 ignored; two tests counted as passing reported SKIPPED (no wave64).

I also tested a conditional branch jumping backwards into each of the four instruction positions, for both add and subtract sequences. On main, entering the low add still yielded a fixed target of 0x114. All eight cases passed on the PR: entry at GETPC retained the expected fixed target, and the three middle-entry cases remained indirect. All inputs were synthetic. No retail game was run on this machine.

OpenAI Codex (GPT-6.2 Astra) assisted with verification.

**@⁠ettehn** on GitHub · 2026-11-24 07:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/865#issuecomment-7124854369) Independent Windows check on `3544038` (Windows 11 x64, RTX 5070 Ti Laptop, driver 621.24, Rust 1.97.1 MSVC debug). On `beaa245` with just the PR’s three new tests, the uninterrupted case passed and both middle-entry tests failed. On the PR head all three passed. The full workspace run finished with 716 passed, 0 failed, 41 ignored; two tests counted as passing reported SKIPPED (no wave64). I also tested a conditional branch jumping backwards into each of the four instruction positions, for both add and subtract sequences. On main, entering the low add still yielded a fixed target of 0x114. All eight cases passed on the PR: entry at GETPC retained the expected fixed target, and the three middle-entry cases remained indirect. All inputs were synthetic. No retail game was run on this machine. OpenAI Codex (GPT-6.2 Astra) assisted with verification.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 08:09 UTC · original

Linux / AMD RDNA3 datapoint.

Merged state: head 3544038 onto main 1ec4c98, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 708 passed, 10 failed, 41 ignored. Failures = the known Wine-lane set from my #42 rows plus #718 trio members and a hit of gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes (new flake, see #718 addendum). far-jump indirect sequencing green.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 08:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/865#issuecomment-7125789177) Linux / AMD RDNA3 datapoint. **Merged state:** head `3544038` onto main `1ec4c98`, clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** **708 passed, 10 failed, 41 ignored**. Failures = the known Wine-lane set from my #42 rows plus #718 trio members and a hit of `gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes` (new flake, see #718 addendum). far-jump indirect sequencing green. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Author
Owner

@⁠guinpereira on GitHub · 2026-11-24 11:30 UTC · original

Test report: NVIDIA RTX 5060 Ti (wave32), head 3544038: 719 passed, 0 failed, 41 ignored; the 3 new tests pass

Tested

  • NVIDIA GeForce RTX 5060 Ti 16 GB, driver 32.0.16.1714, 32-lane waves only. Ryzen 7 5700X, 32 GB RAM. Windows 11 Pro 25H2 (26200.9974), Rust 1.99.1 stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (Windows SDK 10.0.26100.0). Debug build, no XCL_SAMPLE_*.
  • PR head 3544038 as is (base beaa245, not rebased on current main), clean tree.
  • cargo build --workspace: ok.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 719 passed, 0 failed, 41 ignored (lib: 675 passed, 21 ignored). SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the same as on main.
  • New tests: far_jumps_keep_uninterrupted_add_and_subtract_sequences, far_jumps_with_an_entry_into_the_sequence_stay_indirect and far_jumps_check_incoming_far_targets_before_resolving pass (CPU-only). The existing GPU test far_jumps_are_direct_branches also passes.
  • Note: #942 changes the same lines of resolve_far_jumps for the same issue (#863), so the two will conflict.

Not tested

  • A retail title / scripts/smoke.ps1 (no title on this machine).
  • The PR rebased on current main.

AI use: Claude Code (Claude Opus 5.5) ran the commands above and wrote this report. No code changes.

**@⁠guinpereira** on GitHub · 2026-11-24 11:30 UTC · [original](https://github.com/xcl-dev/xcl/pull/865#issuecomment-7130180448) **Test report: NVIDIA RTX 5060 Ti (wave32), head `3544038`: 719 passed, 0 failed, 41 ignored; the 3 new tests pass** **Tested** - NVIDIA GeForce RTX 5060 Ti 16 GB, driver 32.0.16.1714, 32-lane waves only. Ryzen 7 5700X, 32 GB RAM. Windows 11 Pro 25H2 (26200.9974), Rust 1.99.1 `stable-x86_64-pc-windows-msvc`, DXC 1.8.2502.11 (Windows SDK 10.0.26100.0). Debug build, no `XCL_SAMPLE_*`. - PR head `3544038` as is (base `beaa245`, not rebased on current `main`), clean tree. - `cargo build --workspace`: ok. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 719 passed, 0 failed, 41 ignored (lib: 675 passed, 21 ignored). `SKIPPED` (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, the same as on `main`. - New tests: `far_jumps_keep_uninterrupted_add_and_subtract_sequences`, `far_jumps_with_an_entry_into_the_sequence_stay_indirect` and `far_jumps_check_incoming_far_targets_before_resolving` pass (CPU-only). The existing GPU test `far_jumps_are_direct_branches` also passes. - Note: #942 changes the same lines of `resolve_far_jumps` for the same issue (#863), so the two will conflict. **Not tested** - A retail title / `scripts/smoke.ps1` (no title on this machine). - The PR rebased on current `main`. **AI use:** Claude Code (Claude Opus 5.5) ran the commands above and wrote this report. No code changes.
This discussion has been locked. Commenting is limited to contributors.
No description provided.