Recompiler: scratch SADDR 0x7F addresses the offset alone (ST form) #2504
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2514"
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?
Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T21:15:09Z.
On RDNA2,
scratch_*picks its address form from SADDR alone:0x7D) is SV (VADDR + offset),0x7F(EXEC_HI) is ST (the offset alone).Both lowerings took
0x7Ffor the SV form and added ADDR's VGPR. So an ST access landed on whatever per-lane address that VGPR held. Now0x7Fgives a zero base, and ADDR is read only for0x7D.The issue also proposed checking an SVE bit and adding SGPR + VGPR. RDNA2 has neither: the RDNA2
ENC_FLAT_SCRATCHspec inrdna2_spec.rshas no SVE field, and both SVE and the SVS form arrived with GFX11 / GFX940. The source for the GFX10 encoding is LLVM:FLAT_Real_gfx10setsInst{54-48}to EXEC_HI for a scratch op without vaddr and to SGPR_NULL otherwise, and setsInst{55}to 0.scratch_load_dword v1, off, offwith byte 6 =0x7f.So only the ST half of the issue applies, and that is what this fixes.
Fixes #2400
Part of #1269
What is in it
crates/xcl/src/gpu/dxil/lower_mem.rs(scratch): the base is 0 for SADDR0x7F, VADDR for0x7Dand the SGPR otherwise (direct DXIL).crates/xcl/src/gpu/recomp/emit.rs(scratch): the same in the HLSL emitter, which had the same bug.dxil/core_tests.rs::scratch_reads_addr_only_in_the_sv_form: ST and SS containers do not change with ADDR, SV ones do.recomp/tests.rs::scratch_address_forms_follow_saddr: the HLSL address of each form.recomp/tests.rs::gpu_scratch_address_forms: GPU test of the three forms.gpu_more_atomics_sub_dword_scratch_valunow encodes the SV form (0x7D) its comment describes ("2 · lane + 16").Tested
XCL_ADAPTER=NONE_CPU_ONLY, so no D3D12 device was created. DXC 1.8.2502.11 and the dxil.dll validator from the Windows SDK were used.cargo test --workspace -j 4 -- --test-threads=4on57853e01: 1426 passed, 0 failed, 46 ignored. 218 GPU tests SKIPPED:no GPUand adapter-selection skips because ofXCL_ADAPTER, including the newgpu_scratch_address_forms.57853e01(clean detached checkout), AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Windows 11 Pro build 26200, rustc 1.100.0, debug, noXCL_ADAPTERset (hardware adapter, no WARP),CARGO_TARGET_DIRon its own drive:cargo test -p xcl --lib -j 4 -- --test-threads=4: 1300 passed, 1 failed, 26 ignored. The newgpu_scratch_address_forms,scratch_address_forms_follow_saddr,scratch_reads_addr_only_in_the_sv_formand the changedgpu_more_atomics_sub_dword_scratch_valuall ran and passed on the GPU.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1("seed 722: res[30] = 0x1, CPU 0x7fffffff"). It fails the same way, same seed, onmainate120925e, so it is not caused by this PR.cargo build --workspace -j 4thencargo test --workspace -j 4 --no-fail-fast -- --test-threads=4: 1425 passed, 1 failed (the same fuzz test), 46 ignored across all test binaries. 7 SKIPPED messages: sixf16_programs_on_the_gpu/f32_programs_on_the_gpucases that the lowering refuses (unsupported V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32, #1426) andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).cargo clippy -p xcl --lib --tests: no findings on the changed lines. The lib already fails clippy on main, onlower_valu.rs:560andlower_wide.rs:568(approximate TAU).cargo fmt --check: the tree is not rustfmt-clean, so it reports 8536 existing diffs. The added code is formatted the way rustfmt wants.Regression run
scripts/smoke.ps1 -Game <title folder> -Seconds 60, release builds, same title, RX 7800 XT, run one after the other on the same machine.mainisb49be183(newer than this PR's merge base6d12f58a), this PR's head is57853e01(clean tree). The PR's run had 1515 frames, 97 % ofmain's 1563, with no device removal and no crash; its peak commit was 15610 MB against 15808 MB.main:This PR's head:
Not tested
gpu_scratch_address_formson other adapters.Testedbullet skipped every GPU test; the GPU run above supersedes it.AI use
FLATInstructions.tdand MC tests, and ran the commands above.main, were made with Claude Code (Claude Sonnet 5.5), which also added them to this description.🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T21:32:02Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by ahmetbagci8 on 2026-11-25T22:22:17Z.
Tested
57853e017054d715cd46cd3c07cb70e58eddddc832.0.16.1714), Windows 11 Pro (Build 26300), DXCv1.9.2609cargo test -j 2 -p xcl --lib scratch -- --test-threads=4:8 passed; 0 failed; 0 ignored (2.03s)Not tested
scripts/smoke.ps1(no unpacked title locally).AI use
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T22:33:04Z.
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.No new test functions in the diff; the SADDR 0x7F ST-form change is exercised end to end by the existing suite, clean here.
Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T23:17:11Z.
Native RX 6800M validation on exact PR head
57853e017054d715cd46cd3c07cb70e58eddddc8(Windows 11 build 26200, Radeon RX 6800M driver30.0.13002.13003, Rust 1.99.0 MSVC, DXC/DXIL 1.8.2502.11):XCL_ADAPTER=6800M XCL_REQUIRE_GPU=1 XCL_DIRECT_DXIL=1 cargo test --locked -p xcl --lib -j 1 gpu_scratch_address_forms -- --test-threads=1 --show-output: 1 passed, 0 failed, 0 ignored, 0 SKIPPED (1,326 filtered out). The test ran on the RX 6800M;runner::run_codeselects the direct kernel path forXCL_DIRECT_DXIL=1.XCL_DIRECT_DXIL=0to exercise HLSL + DXC lowering: 1 passed, 0 failed, 0 ignored, 0 SKIPPED (1,326 filtered out).Not tested: the full GPU workspace suite, release binary, paired retail smoke runs, other adapters/drivers, and whether the title encounters ST-form scratch instructions. This is focused hardware coverage of the new fixture, not a merge-ready regression run. No game data was uploaded.
AI use: OpenAI Codex (GPT-6; exact variant unavailable) ran the guarded focused tests, checked the exact head and runner selection, reviewed the logs, and drafted this report.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:34:42Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:14:01Z.
Triage (#1607) – head
57853e0#1365 made the same SADDR 0x7F fix in the HLSL path only and was closed as a duplicate of this one (#1607 group D136). #1377 and #1606 are closed too. Main still treats 0x7F like 0x7D (VADDR + offset) in both
emit.rsanddxil/lower_mem.rs. This PR fixes both translators and updatesgpu_more_atomics_sub_dword_scratch_valuto use the SV form.No problems found in the diff.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.