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

Open
pmilewsskiedu-gif wants to merge 1 commit from upstream-pr/1575 into main
pmilewsskiedu-gif commented 2026-11-24 17:50:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by pmilewsskiedu-gif on 2026-11-24T17:50:56Z.


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.

<!-- greyfinch-sync:ivall/xcl:issue:5477439356 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1575). Originally posted by [pmilewsskiedu-gif](https://github.com/pmilewsskiedu-gif) on 2026-11-24T17:50:56Z. --- 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.
nnonno91 commented 2026-11-24 18:09:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-24T18:03:06Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7140085720 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1575#issuecomment-7140085720). Originally posted by [nnonno91](https://github.com/nnonno91) on 2026-11-24T18:03:06Z. --- 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.
lows78 commented 2026-11-24 18:09:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lows78 on 2026-11-24T18:06:29Z.


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
<!-- greyfinch-sync:ivall/xcl:comment:7140167467 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1575#issuecomment-7140167467). Originally posted by [lows78](https://github.com/lows78) on 2026-11-24T18:06:29Z. --- 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
DavidM1911 commented 2026-11-24 21:09:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T19:51:37Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7142690458 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1575#issuecomment-7142690458). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T19:51:37Z. --- 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!
Foniass commented 2026-12-01 06:10:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:10:06Z.


Triage (#1607) – head a6c1fbe

No open or merged PR makes the same change. The lines shared with #1630 are opcode names in its new opt.rs, not this change; #1630 still lowercases in this scan.
The rewrite is consistent: every name in is_f16_rounded_op / is_f64_rounded_op is uppercased, they have no other callers, and the new test checks that decoder names are uppercase. dxil/lower.rs keeps its own lowercase copy of both functions, which is fine but now differs in convention.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7302563658 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1575#issuecomment-7302563658). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:10:06Z. --- **Triage (#1607)** – head a6c1fbe No open or merged PR makes the same change. The lines shared with #1630 are opcode names in its new opt.rs, not this change; #1630 still lowercases in this scan. The rewrite is consistent: every name in is_f16_rounded_op / is_f64_rounded_op is uppercased, they have no other callers, and the new test checks that decoder names are uppercase. dxil/lower.rs keeps its own lowercase copy of both functions, which is fine but now differs in convention. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1575:upstream-pr/1575'
git switch 'upstream-pr/1575'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1575'
git switch 'upstream-pr/1575'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1575'
git switch 'upstream-pr/1575'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1575'
git switch 'main'
git merge --squash 'upstream-pr/1575'
git switch 'main'
git merge --ff-only 'upstream-pr/1575'
git switch 'main'
git merge 'upstream-pr/1575'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1565
No description provided.