Recompiler: geometry mode's ES s_setpc_b64 ends a block before gs_start (#1360) #1375

Open
github-bot wants to merge 1 commit from github-bot/gh-1375 into main AGit
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-24 15:22 UTC · original
tiagonogueiraa-bit:geometry-setpc-blocks → main · +37 −2 · 2 files · 1 commits · open

In geometry mode the ES hands over to the GS with an s_setpc_b64 that has no resolved target. term() took it for a fall-through, and edges had no ES → GS edge. So with branches in the ES or GS, structured_span merged the ES's last block and the first GS blocks into one stretch, dropped the s_setpc flow, and gave gs_start no pc block. In split wave64 the ES phase ran on into the GS code before the barrier, and the GS phase (xcl_entry_pc = gs_start) matched no block and emitted nothing. Fixes #1360.

What is in it

  • crates/xcl/src/gpu/recomp/mod.rs:
    • term(): an indirect branch without a known target ends its block (Term::Other), as other terminators do.
    • edges gets the ES → GS edge.
  • crates/xcl/src/gpu/recomp/tests.rs: geometry_es_setpc_ends_a_block_before_gs_start (CPU only) translates the issue's ES + GS with a branch in the GS, native and split wave64. It checks for a pc block at gs_start and the ES phase's select(xcl_es_phase, …) jump.

Tested

  • macOS, Rust stable: cargo check -p xcl --lib --tests --target x86_64-pc-windows-msvc passes (C code stubbed, nothing linked).
  • CPU translation with gpu::recomp built on its own (macOS), not a GPU run:
    • The test's program: on main, neither form has a pc block at gs_start; with this change, both do.
    • Every program of the retail pack's shaders.rpf: 5 of 8 158 change, all completely translated before and after. They are ES variants of one VS (VS_VoxelizeGeneric_*) ending in s_setpc_b64: they now end there instead of falling into their s_endpgm block, with one more pc block boundary.
  • @⁠GonZiin, native Windows, RX 9070 XT, on this head 63ad831: geometry_es_setpc_ends_a_block_before_gs_start and #1528's multi_block_es_gs_treats_s_setpc_as_terminator_and_tracks_handoff_edge both pass. cargo test -p xcl --lib gpu_geometry passes 2 tests with no GPU skips. (review)
  • @⁠DavidM1911, RTX 3060 Ti, Windows 11, merged with main: cargo test -p xcl --lib, all passed. (report)
  • The full workspace suite on native Windows: not run yet.

Regression run
Not run. I have no Windows machine here.

Not tested

  • GPU runs of geometry-mode programs: the existing gpu_geometry_mode_es_gs_strip and the two wave32 geometry tests, on any adapter.
  • A retail title.

AI use

  • Claude Code with Claude Opus 5.5. It reproduced the issue on the CPU, wrote the change, the test and this description, and ran the macOS checks.

🤖 Generated with Claude Code

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-24 15:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1375) `tiagonogueiraa-bit:geometry-setpc-blocks` → `main` · +37 −2 · 2 files · 1 commits · open In geometry mode the ES hands over to the GS with an `s_setpc_b64` that has no resolved target. `term()` took it for a fall-through, and `edges` had no ES → GS edge. So with branches in the ES or GS, `structured_span` merged the ES's last block and the first GS blocks into one stretch, dropped the `s_setpc` flow, and gave `gs_start` no `pc` block. In split wave64 the ES phase ran on into the GS code before the barrier, and the GS phase (`xcl_entry_pc = gs_start`) matched no block and emitted nothing. Fixes #1360. **What is in it** - `crates/xcl/src/gpu/recomp/mod.rs`: - `term()`: an indirect branch without a known target ends its block (`Term::Other`), as other terminators do. - `edges` gets the ES → GS edge. - `crates/xcl/src/gpu/recomp/tests.rs`: `geometry_es_setpc_ends_a_block_before_gs_start` (CPU only) translates the issue's ES + GS with a branch in the GS, native and split wave64. It checks for a `pc` block at `gs_start` and the ES phase's `select(xcl_es_phase, …)` jump. **Tested** - macOS, Rust stable: `cargo check -p xcl --lib --tests --target x86_64-pc-windows-msvc` passes (C code stubbed, nothing linked). - CPU translation with `gpu::recomp` built on its own (macOS), not a GPU run: - The test's program: on `main`, neither form has a `pc` block at `gs_start`; with this change, both do. - Every program of the retail pack's `shaders.rpf`: 5 of 8 158 change, all completely translated before and after. They are ES variants of one VS (`VS_VoxelizeGeneric_*`) ending in `s_setpc_b64`: they now end there instead of falling into their `s_endpgm` block, with one more `pc` block boundary. - @⁠GonZiin, native Windows, RX 9070 XT, on this head `63ad831`: `geometry_es_setpc_ends_a_block_before_gs_start` and #1528's `multi_block_es_gs_treats_s_setpc_as_terminator_and_tracks_handoff_edge` both pass. `cargo test -p xcl --lib gpu_geometry` passes 2 tests with no GPU skips. ([review](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1375)) - @⁠DavidM1911, RTX 3060 Ti, Windows 11, merged with `main`: `cargo test -p xcl --lib`, all passed. ([report](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1375)) - The full workspace suite on native Windows: not run yet. **Regression run** Not run. I have no Windows machine here. **Not tested** - GPU runs of geometry-mode programs: the existing `gpu_geometry_mode_es_gs_strip` and the two wave32 geometry tests, on any adapter. - A retail title. **AI use** - Claude Code with Claude Opus 5.5. It reproduced the issue on the CPU, wrote the change, the test and this description, and ran the macOS checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
In geometry mode the ES hands over to the GS with an s_setpc_b64 that has
no resolved target, so term() took it for a fall-through, and `edges`
had no ES -> GS edge. With branches in the ES or GS, structured_span then
merged the ES's last block and the first GS blocks into one stretch. Its
s_setpc flow was dropped and gs_start got no `pc` block. In split wave64
the ES phase ran on into the GS code before the barrier, and the GS phase
(xcl_entry_pc = gs_start) matched no block and emitted nothing.

term() now ends a block at an indirect branch without a known target, as
it does at other terminators, and `edges` gets the ES -> GS edge.

Over the retail pack (every program translated on the CPU, macOS), 5 of
8 158 programs change. All are ES variants of one VS that end in
s_setpc_b64; they now end there instead of falling into their
s_endpgm block.

geometry_es_setpc_ends_a_block_before_gs_start (CPU only) translates an
ES + GS with a branch in the GS, both native and split wave64.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:52:19 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 16:41 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 16:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/1375#issuecomment-7138068516) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. Thanks!
Author
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-24 19:23 UTC · original

Thank you, @⁠GonZiin, for checking both fixtures against both implementations. That's in Tested, along with @⁠DavidM1911's run, and the PR is ready for review. #1375 came first (15:22 vs 17:17 UTC). If the maintainer wants #1528's fixture here too, I'm happy to add it with @⁠OtavioTadeu credited.

Written with Claude Code (Claude Opus 5.5).

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-24 19:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/1375#issuecomment-7142018088) Thank you, @⁠GonZiin, for checking both fixtures against both implementations. That's in **Tested**, along with @⁠DavidM1911's run, and the PR is ready for review. #1375 came first (15:22 vs 17:17 UTC). If the maintainer wants #1528's fixture here too, I'm happy to add it with @⁠OtavioTadeu credited. Written with Claude Code (Claude Opus 5.5).
Author
Owner

@⁠Mischief8713 on GitHub · 2026-11-24 20:36 UTC · original

GPU run of 63ad831 on Windows (NVIDIA GTX 1660 Ti, Turing): 708 passed, 0 failed, 21 ignored

Tested

  • NVIDIA GeForce GTX 1660 Ti 6 GB (Turing, driver 32.0.16.2114), Ryzen 5 2600X, Windows 11 (10.0.26300), rustc 1.100.0, debug build
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4; build exit 0, test exit 0
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64)
  • The head does not contain current main (9039900). It was run as it is.
  • lib: 708 passed, 0 failed, 21 ignored.
  • gpu::recomp::tests::gpu_geometry_mode_es_gs_strip ran on the GPU and passed (this GPU has mesh shaders). The other geometry tests passed: geometry_es_setpc_ends_a_block_before_gs_start, geometry_wave32_rejects_cross_half_operations, geometry_wave_path_selection_preserves_native_wave64, and the e2e retail_es_gs_voxelize_geometry_mode. gpu_geometry_wave32_prefix_count_over_a_mask printed SKIPPED (no wave64).

Not tested

  • No retail title and no scripts/smoke.ps1 run, so no regression run
  • AMD GPUs; only Turing was run here

AI use

  • Claude Code with Claude Sonnet 5.5 ran the commands and wrote this report. I checked the output.
**@⁠Mischief8713** on GitHub · 2026-11-24 20:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/1375#issuecomment-7143816033) **GPU run of `63ad831` on Windows (NVIDIA GTX 1660 Ti, Turing): 708 passed, 0 failed, 21 ignored** **Tested** - NVIDIA GeForce GTX 1660 Ti 6 GB (Turing, driver 32.0.16.2114), Ryzen 5 2600X, Windows 11 (10.0.26300), rustc 1.100.0, debug build - `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4`; build exit 0, test exit 0 - SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware` (no wave64) - The head does not contain current `main` (`9039900`). It was run as it is. - lib: 708 passed, 0 failed, 21 ignored. - `gpu::recomp::tests::gpu_geometry_mode_es_gs_strip` ran on the GPU and passed (this GPU has mesh shaders). The other geometry tests passed: `geometry_es_setpc_ends_a_block_before_gs_start`, `geometry_wave32_rejects_cross_half_operations`, `geometry_wave_path_selection_preserves_native_wave64`, and the e2e `retail_es_gs_voxelize_geometry_mode`. `gpu_geometry_wave32_prefix_count_over_a_mask` printed SKIPPED (no wave64). **Not tested** - No retail title and no `scripts/smoke.ps1` run, so no regression run - AMD GPUs; only Turing was run here **AI use** - Claude Code with Claude Sonnet 5.5 ran the commands and wrote this report. I checked the output.
Author
Owner

@⁠Toons29 on GitHub · 2026-11-25 03:27 UTC · original

Regression run of 63ad831c on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 63ad831c2147fcfada4e6247a2869106aa302644
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1630 (PresentX 1630)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14817 MB

Against the limits in CONTRIBUTING.md: 101 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

**@⁠Toons29** on GitHub · 2026-11-25 03:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/1375#issuecomment-7151928021) Regression run of `63ad831c` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 63ad831c2147fcfada4e6247a2869106aa302644 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1630 (PresentX 1630) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14817 MB ``` Against the limits in CONTRIBUTING.md: 101 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/gpu/recomp/mod.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1375/head:github-bot/gh-1375'
git switch 'github-bot/gh-1375'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1375'
git switch 'github-bot/gh-1375'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1375'
git switch 'github-bot/gh-1375'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1375'
git switch 'main'
git merge --squash 'github-bot/gh-1375'
git switch 'main'
git merge --ff-only 'github-bot/gh-1375'
git switch 'main'
git merge 'github-bot/gh-1375'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.