Recompiler: sign-extend 32-bit literals for 64-bit signed integer operands #1258
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1258
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1258"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@b3IKK on GitHub · 2026-11-24 13:49 UTC · original
b3IKK:recomp/i64-literal-sign-extend→main· +71 −13 · 2 files · 1 commits · openIn RDNA2 ISA, a 32-bit literal constant (
code == 255) used for a 64-bit signed integer (i64) operand is sign-extended to 64 bits, whileu64/b64literals are zero-extended andf64literals occupy the upper 32 bits.code64only distinguishedf64vs non-f64, so negative 32-bit literals on_i64instructions (v_cmp*_i64,v_ashrrev_i64,s_ashr_i64,s_bfe_i64,s_flbit_i32_i64,v_mad_i64_i32) were zero-extended instead.This replaces
f64: booloncode64/read64withLit64 { U64, I64, F64 }, sign-extending 32-bit literals fori64instructions while keepingu64/b64andf64unchanged.What is in it
crates/xcl/src/gpu/recomp/emit.rs: addLit64 { U64, I64, F64 }and sign-extend 32-bit literals incode64/read64fori64operations insalu64andvalu64.crates/xcl/src/gpu/recomp/tests.rs: add GPU testgpu_i64_literal_is_sign_extendedcoveringV_CMP_EQ_I64,V_ASHRREV_I64,S_ASHR_I64,V_MAD_I64_I32, andV_CMP_EQ_U64control across wave32 and split wave64 (verified failing before the fix).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)cargo test -p xcl --lib gpu_i64_literal_is_sign_extended: 1 passed, 0 failed across wave32 and split wave64 (failed on the GPU before the fix)Regression run
main:
PR:
Not tested
AI use
emit.rs, wrote the fix and GPU test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.In RDNA2 ISA, a 32-bit literal constant (code 255) used for a 64-bit signed integer (i64) operand is sign-extended to 64 bits, while u64 / b64 literals are zero-extended and f64 literals occupy the upper 32 bits. code64 only distinguished f64 vs non-f64, so negative 32-bit literals on _i64 instructions (v_cmp*_i64, v_ashrrev_i64, s_ashr_i64, s_bfe_i64, s_flbit_i32_i64, v_mad_i64_i32) were zero-extended instead. Replace the `f64: bool` parameter on code64/read64 with `Lit64 { U64, I64, F64 }`, sign-extending 32-bit literals for i64 instructions, with a GPU test across wave32 and split wave64. Assisted-by: OpenCode (Gemini 4 Neon)@dcastell1 on GitHub · 2026-11-24 14:01 UTC · original
Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on
main@930e8b4(baseline 751 passed, 0 failed, 41 ignored on this box):One more than the baseline; sign-extending 32-bit literals for 64-bit forms is exercised and green.
Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
@DavidM1911 on GitHub · 2026-11-24 14:02 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:Thanks!
@JJAutoCompare on GitHub · 2026-11-25 05:00 UTC · original
Tested — xcl-dev/xcl PR #1258 was open at
ba00224055aeb359476ad614ad5ec971d360836fbefore and after the run. The checkout was clean and detached at that SHA both times.STOR-WINLAB ran Windows 11 Enterprise Evaluation 25H2 x64 (
26200.9974) on a Ryzen 7 3800X and Intel Arc A770 (driver32.0.101.9175), using Rust and Cargo 1.100.0 (x86_64-pc-windows-msvc) and DXC/DXIL 1.9.2609.5.cargo test --locked -p xcl --lib --no-runcompleted outside the Arc lock in 1m 45s with exit 0. The debug build used two jobs, incremental compilation and debug info disabled, the assigned target slot, and privateTEMPandTMP.L:/XclTooling/Invoke-ArcTest.ps1in a fresh PowerShell process with process-scopedRemoteSigned. It usedXCL_ADAPTER=A770,XCL_DIRECT_DXIL=0, andXCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64.Result — 1 passed, 0 failed, 0 ignored, 0 GPU skips, 728 filtered out, 0.56s. The fixture and wrapper both exited 0. The stock fixture ran standalone wave32. Both comparison masks read back as
0x00000000_FFFFFFFF, covering signed-17sign extension and the unsigned zero-extension control. The scalar arithmetic shift read back-4. On all 32 lanes, the vector arithmetic shift read back-4and the multiply-add read back-100.Not tested — Native or split wave64, direct DXIL, other adapters, the full suite, and retail smoke.
AI use — T3 Code / Codex (
gpt-6.2-sol) ran and reported the verification.@luckyteagirl on GitHub · 2026-11-25 07:03 UTC · original
Independent native wave64 GPU check of exact PR head
ba00224055aeb359476ad614ad5ec971d360836f. The PR description lists AMD/native wave64 as untested.Tested
30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5; debug test build.XCL_ADAPTER=6800M,XCL_REQUIRE_GPU=wave64,XCL_DIRECT_DXIL=0;cargo test --locked -p xcl --lib -j 2 gpu_i64_literal_is_sign_extended -- --test-threads=1 --show-output: 1 passed, 0 failed, 0 ignored, 0 SKIPPED.gpu_waves()runs this fixture in both wave64 and wave32 on the selected AMD adapter. It exercises the HLSL emitter's signed i64 literal path and includes the unsigned control case.This is the focused GPU regression only. I did not run the full workspace suite, direct DXIL mode, or a paired title smoke on this PR; the existing RX 6800M full-suite baseline has GPU device-suspension failures unrelated to this focused test.
AI-assisted checkout, testing, log verification, and report drafting with OpenAI Codex (GPT-6). No game data was used.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.