Skip to content

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

Open
pmilewsskiedu-gif wants to merge 1 commit into
xcl-dev:mainfrom
pmilewsskiedu-gif:perf/shader-1269
Open

pmilewsskiedu-gif wants to merge 1 commit into
xcl-dev:mainfrom
pmilewsskiedu-gif:perf/shader-1269

Conversation

@pmilewsskiedu-gif

Copy link
Copy Markdown

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.

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)
@pmilewsskiedu-gif
pmilewsskiedu-gif marked this pull request as ready for review November 24, 2026 17:51
@nnonno91

Copy link
Copy Markdown

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

lows78 commented Nov 24, 2026

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

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

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants