Recompiler: match decoded opcodes directly in round-mode scan #1575

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

@⁠pmilewsskiedu-gif on GitHub · 2026-11-24 17:50 UTC · original
pmilewsskiedu-gif:perf/shader-1269 → main · +61 −53 · 2 files · 1 commits · open

Part of #1269. Em::configure_round_modes scans every decoded instruction and previously allocated a lowercase String from each decoder mnemonic. Those mnemonics are already uppercase. This matches the static names directly, preserving f16/f64 rounding-mode, barrier, and end-of-program classification.

Change

  • crates/xcl/src/gpu/recomp/emit.rs: remove one unnecessary lowercase allocation per scanned instruction and compare static uppercase mnemonics.
  • crates/xcl/src/gpu/recomp/tests.rs: assert that all generated RDNA2 and console decoder names satisfy the uppercase invariant.

Validation

Windows 11 Pro 26200, Ryzen 7 7700, NVIDIA RTX 4060 Ti 8 GB (driver 32.0.16.1088), Rust 1.100.0, DXC 1.9.2602.17.

  • cargo build --workspace: passed.
  • cargo test --workspace -- --test-threads=4: 777 passed, 0 failed, 41 ignored. Capability-related SKIPPED messages: 2 native-wave64 tests and 1 heap-window test.
  • xcl shaders <local pack> --recomp --top 0: 26,698 programs, 44,422,713 decoded instructions, 9,665.7 MB of generated HLSL, no translation errors. All aggregate report lines match between builds except the total time.
  • Two sequential debug scans on upstream main 9e3831e: 120.41 s / 117.60 s wall time. On this PR a6c1fbe: 116.91 s / 116.33 s. Mean 119.01 s → 116.62 s (2.0% reduction). This is a small two-pair local measurement, subject to system noise.

Regression run

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: NVIDIA GeForce RTX 4060 Ti
title: local Xbox title (folder name redacted)
seconds: 60
exit: 0x0
frames shown: 1475 (PresentX 1475)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14706 MB
xcl-smoke v1
commit: a6c1fbef0e15a61153e7f33726206b235c7bd179
gpu: NVIDIA GeForce RTX 4060 Ti
title: local Xbox title (folder name redacted)
seconds: 60
exit: 0x0
frames shown: 1639 (PresentX 1639)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14683 MB

The title folder name is redacted; no game files are included. Frame counts vary with cache/startup state, so no runtime FPS benefit is claimed.

Not tested

AMD and Intel GPUs; prolonged gameplay; a matched cold GPU-driver-cache comparison.

AI use

ChatGPT (GPT-6), through Chat On Steroids Core, implemented the patch and regression test, ran the builds, full test suite, benchmark and smoke checks, and wrote this description.

**@⁠pmilewsskiedu-gif** on GitHub · 2026-11-24 17:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/1575) `pmilewsskiedu-gif:perf/shader-1269` → `main` · +61 −53 · 2 files · 1 commits · open Part of #1269. `Em::configure_round_modes` scans every decoded instruction and previously allocated a lowercase `String` from each decoder mnemonic. Those mnemonics are already uppercase. This matches the static names directly, preserving f16/f64 rounding-mode, barrier, and end-of-program classification. ### Change - `crates/xcl/src/gpu/recomp/emit.rs`: remove one unnecessary lowercase allocation per scanned instruction and compare static uppercase mnemonics. - `crates/xcl/src/gpu/recomp/tests.rs`: assert that all generated RDNA2 and console decoder names satisfy the uppercase invariant. ### Validation Windows 11 Pro 26200, Ryzen 7 7700, NVIDIA RTX 4060 Ti 8 GB (driver 32.0.16.1088), Rust 1.100.0, DXC 1.9.2602.17. - `cargo build --workspace`: passed. - `cargo test --workspace -- --test-threads=4`: **777 passed, 0 failed, 41 ignored**. Capability-related SKIPPED messages: 2 native-wave64 tests and 1 heap-window test. - `xcl shaders <local pack> --recomp --top 0`: **26,698 programs**, **44,422,713 decoded instructions**, 9,665.7 MB of generated HLSL, no translation errors. All aggregate report lines match between builds except the total time. - Two sequential debug scans on upstream main `9e3831e`: **120.41 s / 117.60 s** wall time. On this PR `a6c1fbe`: **116.91 s / 116.33 s**. Mean 119.01 s → 116.62 s (**2.0% reduction**). This is a small two-pair local measurement, subject to system noise. ### Regression run ```text xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: NVIDIA GeForce RTX 4060 Ti title: local Xbox title (folder name redacted) seconds: 60 exit: 0x0 frames shown: 1475 (PresentX 1475) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14706 MB ``` ```text xcl-smoke v1 commit: a6c1fbef0e15a61153e7f33726206b235c7bd179 gpu: NVIDIA GeForce RTX 4060 Ti title: local Xbox title (folder name redacted) seconds: 60 exit: 0x0 frames shown: 1639 (PresentX 1639) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14683 MB ``` The title folder name is redacted; no game files are included. Frame counts vary with cache/startup state, so no runtime FPS benefit is claimed. ### Not tested AMD and Intel GPUs; prolonged gameplay; a matched cold GPU-driver-cache comparison. ### AI use ChatGPT (GPT-6), through Chat On Steroids Core, implemented the patch and regression test, ran the builds, full test suite, benchmark and smoke checks, and wrote this description.
Avoid one temporary lowercase String per decoded instruction when classifying f16/f64 rounding and barriers. Add an invariant test for uppercase names in both instruction tables.

On a local 26,698-program shader-pack scan, two debug runs each averaged 119.01 s on main and 116.62 s with the change. All 26,698 programs translated successfully, with unchanged aggregate HLSL size.

Assisted-by: Chat On Steroids Core (GPT-6)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:57:58 +00:00
Author
Owner

@⁠nnonno91 on GitHub · 2026-11-24 18:03 UTC · original

Independent AMD and generated-HLSL comparison on a6c1fbef0e15a61153e7f33726206b235c7bd179.

Tested

  • Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62), Rust 1.100.0 MSVC, DXC 1.8.2502.11, debug.
  • cargo build --workspace --locked passed. cargo test --locked -p xcl --lib -- round_mode gpu_safe_s_barrier_multi_warp_and_early_endpgm --test-threads=1 --nocapture passed all four tests, including the f16 rounding and barrier GPU tests, with zero skips.
  • cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-output reported 777 passed, 0 failed, and 41 ignored. One reported GPU skip (heap_window_out_of_memory_falls_back_to_the_switch_form, no heap windows). The bundled title passed.
  • A temporary integration test, cargo test --locked -p xcl --test round_mode_probe -- --exact compare_generated_rounding_shaders --nocapture --test-threads=1, generated HLSL and logged the translator’s complete, unsupported_why, and ignored results on base 9e3831e1f570d3646e53ab753b19ec07eb8f1485 and this PR. The seven synthetic programs exercise f16, f32 and f64 rounding, an SGPR MODE write, and a barrier with an early terminator. Across wave32, native wave64 and split wave64, all 21 generated HLSL files and diagnostics matched byte for byte. Both revisions completed 15 and refused the same six unsupported-mode cases.

Not tested

Retail shaders, retail title runs, and performance. The comparison used seven synthetic programs.

AI use

OpenAI Codex (GPT-6 family, exact variant unavailable) wrote the temporary comparison, ran the checks, and drafted this report.

**@⁠nnonno91** on GitHub · 2026-11-24 18:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/1575#issuecomment-7140085720) Independent AMD and generated-HLSL comparison on `a6c1fbef0e15a61153e7f33726206b235c7bd179`. **Tested** - Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62), Rust 1.100.0 MSVC, DXC 1.8.2502.11, debug. - `cargo build --workspace --locked` passed. `cargo test --locked -p xcl --lib -- round_mode gpu_safe_s_barrier_multi_warp_and_early_endpgm --test-threads=1 --nocapture` passed all four tests, including the f16 rounding and barrier GPU tests, with zero skips. - `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-output` reported 777 passed, 0 failed, and 41 ignored. One reported GPU skip (`heap_window_out_of_memory_falls_back_to_the_switch_form`, no heap windows). The bundled title passed. - A temporary integration test, `cargo test --locked -p xcl --test round_mode_probe -- --exact compare_generated_rounding_shaders --nocapture --test-threads=1`, generated HLSL and logged the translator’s `complete`, `unsupported_why`, and `ignored` results on base `9e3831e1f570d3646e53ab753b19ec07eb8f1485` and this PR. The seven synthetic programs exercise f16, f32 and f64 rounding, an SGPR MODE write, and a barrier with an early terminator. Across wave32, native wave64 and split wave64, all 21 generated HLSL files and diagnostics matched byte for byte. Both revisions completed 15 and refused the same six unsupported-mode cases. **Not tested** Retail shaders, retail title runs, and performance. The comparison used seven synthetic programs. **AI use** OpenAI Codex (GPT-6 family, exact variant unavailable) wrote the temporary comparison, ran the checks, and drafted this report.
Author
Owner

@⁠lows78 on GitHub · 2026-11-24 18:06 UTC · original

Test report for #1575 at a6c1fbef0e15a61153e7f33726206b235c7bd179 (clean tree), on an RTX 4090. I am not a graphics developer: Claude Code ran this on my PC, and I can rerun things if that helps.

Tested

  • NVIDIA GeForce RTX 4090 (driver 621.01, 32-lane waves), Intel Core i9-14900KF, 32 GB RAM, Windows 11 Pro 10.0.26200, rustc 1.99.1 MSVC, DXC 1.8.2502.11, debug. XCL_SAMPLE_* unset.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4, one run each:
    • main 9e3831e: 776 passed, 0 failed, 41 ignored
    • this PR a6c1fbe: 777 passed, 0 failed, 41 ignored
  • SKIPPED, the same three on both: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
  • cargo test -p xcl --lib round -- --test-threads=4, 10 runs: 23 passed, 0 failed, no skip in each
  • Script check of the emit.rs diff: the 54 string literals it removes and the 54 it adds are the same, in the same order, apart from case, and every new one is all uppercase

Not tested

  • Translation time, retail titles (no smoke.ps1 run) and retail shaders, release builds, AMD, Intel, native wave64

AI use

  • Claude Code, Claude Opus 5.5: ran the builds, tests and script check, and wrote this report
**@⁠lows78** on GitHub · 2026-11-24 18:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/1575#issuecomment-7140167467) Test report for #1575 at `a6c1fbef0e15a61153e7f33726206b235c7bd179` (clean tree), on an RTX 4090. I am not a graphics developer: Claude Code ran this on my PC, and I can rerun things if that helps. **Tested** - NVIDIA GeForce RTX 4090 (driver 621.01, 32-lane waves), Intel Core i9-14900KF, 32 GB RAM, Windows 11 Pro 10.0.26200, rustc 1.99.1 MSVC, DXC 1.8.2502.11, debug. `XCL_SAMPLE_*` unset. - `cargo build --workspace && cargo test --workspace -- --test-threads=4`, one run each: - `main` `9e3831e`: 776 passed, 0 failed, 41 ignored - this PR `a6c1fbe`: 777 passed, 0 failed, 41 ignored - SKIPPED, the same three on both: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware` (no wave64), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows) - `cargo test -p xcl --lib round -- --test-threads=4`, 10 runs: 23 passed, 0 failed, no skip in each - Script check of the `emit.rs` diff: the 54 string literals it removes and the 54 it adds are the same, in the same order, apart from case, and every new one is all uppercase **Not tested** - Translation time, retail titles (no `smoke.ps1` run) and retail shaders, release builds, AMD, Intel, native wave64 **AI use** - Claude Code, Claude Opus 5.5: ran the builds, tests and script check, and wrote this report
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 19:51 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 19:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/1575#issuecomment-7142690458) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/gpu/recomp/emit.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/1575/head:github-bot/gh-1575'
git switch 'github-bot/gh-1575'

Merge

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