Recompiler: a VOPC SDWA compare's SDST ends the loads it addresses #2794
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2804"
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-26T14:01:59Z.
Part of #2464 (part 1 only; parts 2 and 3 are claimed by oni-swr in that issue).
reload::changesreadSDSTonly from the base encoding. AVOPCSDWA compare withSD= 1 keeps itsSDSTin the extension dword, so thes[x:x+1]pair it writes was not marked. A followings_load_dword*whose address was made of that pair was then treated as a repeat and elided, returning the old value.What is in it
crates/xcl/src/gpu/dxil/reload.rs: when the instruction is an SDWA compare withSD= 1, mark theSDSTpair as written (125 is the null destination and writes nothing). Testan_sdwa_compare_into_an_sgpr_pair_ends_it: it fails without the fix (the load stays "available") and passes with it.Tested
cargo test -j 4 -p xcl --lib -- gpu::dxil::reload gpu::rdna2 --test-threads=4: 25 passed, 0 failed, 0 ignored.89f75c4c:cargo test -p xcl --lib -j 4 -- --test-threads=4: 1309 passed, 1 failed, 27 ignored; 6SKIPPEDlines, all sub-cases off16_programs_on_the_gpu/f32_programs_on_the_gpu(lower_dxil) refused for unsupported F16 ops. The failure isgpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(panic atfuzz_tests.rs:1171); it fails the same way onmainb49be183(run alone, 0 passed, 1 failed), so it is not caused by this PR. I did not run the full lib onmain.left: [(0, false), (2, true)],right: [(0, false), (2, false)]).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, this PR's head is89f75c4c(clean tree). The PR's run had 1449 frames, 93 % ofmain's 1563, with no device removal and no crash; its peak commit was 15673 MB against 15808 MB.main:This PR's head:
Not tested
cargo test --workspace(integration and e2e tests outside-p xcl --lib).SD= 1 followed by a load from its pair: the smoke is a regression check only, and the run was not checked for that.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by SzczepanGrela on 2026-11-26T14:37:28Z.
RX 9070 / Wine paired GPU readback confirms the changed-address case through the direct plain backend.
Tested
89f75c4c26a42ac41f6781aa08586e3955a962f7against mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7.8293130ebe370b1+(local asserts-disabled build), DXC/DXIL 1.9.2602.17, Rust 1.97.1, releasex86_64-pc-windows-gnu.XCL_ADAPTER=AMD Radeon RX 9070,XCL_REQUIRE_GPU=wave64,XCL_NETWORK=0, private caches. GPU fixture requests supported native Wave64 with split disabled, validates each DXIL container, and checks all 64 lanes.Local fixture and source disclosure
Both source copies receive the same local test
gpu::recomp::tests::gpu_sdwa_sdst_scalar_reload_readback; main additionally receives the unchanged upstream CPU regression. Removing these additions reconstructs the original sources. The production delta is only the eight SDWA invalidation lines inreload.rs.The GPU fixture uses 1 KiB of synthetic memory: A=
[0x11110001..0x11110004]at0x140, B=[0x22220001..0x22220004]at0x240. It loads four dwords from base+0x40, saves them, executesV_CMP_LT_F32SDWA withSD=1, then repeats the identical scalar load and copies it to four VGPRs:s[4:5]starts at0x100; SDST=4, only lane 9 compares true, changing the base to0x200.s[6:7]starts at0x100; SDST=5, only lane 41 compares true, writings6=0x200and changing the base to0x200.s[4:5], and null SDST=125: base stays0x100.Each case runs through HLSL/DXC, direct plain, and direct compact. All first reads are A, and the returned base pairs match the expected addresses on both revisions.
Results
Three fresh processes per revision give the same 12 case/path results each. The local GPU test is 1 passed / 0 failed on head, versus 0 passed / 1 failed on main; main fails its final collected-result assertion only for the low/high direct-plain cases.
The
gpu::dxil::reload::tests::filter gives head 7 passed / 0 failed versus main control 6 passed / 1 failed, in three serial processes plus one four-thread process per revision. Its sole main failure isan_sdwa_compare_into_an_sgpr_pair_ends_it.Existing
gpu_sdwa_f16_inline_constantsandgpu_memory_and_exportseach pass separately on both revisions withXCL_DIRECT_DXIL=0and1. Across all 22 processes: no runtime skips or ignored tests. All 72 GPU case/path records, raw summaries, exact failing assertions, source inventories and executable hashes were independently checked.Build:
cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run. Tests: GE-Proton Wine,<libtest.exe> <exact GPU test name> --exact --nocapture --test-threads=1; CPU filter as above without--exact, threads 1 and 4. The local GPU fixture explicitly selects all three translator paths in each invocation.Not tested
Wave32 or forced Wave64 split execution, native Windows, other GPUs, other instruction combinations, full workspace suite, retail workload,
scripts/smoke.ps1, performance or FPS. These are synthetic readback results only.AI use
OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the source delta, wrote the local GPU fixture, ran and independently verified the paired tests, and drafted this report. Publication authorized by the account owner.
Imported from ivall/xcl. Originally posted by retrope13 on 2026-11-26T14:42:21Z.
Independent Windows/NVIDIA (RTX 4060 Laptop 8 GB) full-workspace verification and diff review of
#2804(89f75c4c) againstmain(b49be183): full debug workspace suite + releasereload/rdna2tests green, 0 failures. No title was run.Tested
32.0.16.2140, wave32), Intel Core i5-14500HX (14C/20T), 24 GB RAM, Windows 11 26H2 (build26300.9818),rustc 1.100.0(stable-x86_64-pc-windows-msvc), Windows SDK10.0.26100.0DXC1.9.2602.17,XCL_ADAPTER=NVIDIA.gpu::dxil::reload+gpu::rdna2:cargo test --locked -p xcl --lib -- gpu::dxil::reload gpu::rdna2 --test-threads=4): 25 passed, 0 failed, 0 ignored (0.12 s).cargo test --release --locked -p xcl --lib -- gpu::dxil::reload gpu::rdna2 --test-threads=4): 25 passed, 0 failed, 0 ignored (0.02 s).cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4:main(b49be183): 1435 passed, 0 failed, 47 ignored#2804(89f75c4c): 1436 passed, 0 failed, 47 ignored (+1 new test, 0 failures)Diff Review (
b49be183..89f75c4c)lower::ext_encodingmaps(Variant::Sdwa, "VOPC")toVOPC_VOP_SDWA_SDST_ENC(the only SDWA encoding withSD+SDST), whileSD == 0writesVCC(s[106:107]), already marked viaOPR_VCCatreload.rs:109.r < 125coverss0..s105,VCC, andM0(124, allowed asSOFFSETinreload::key) while excludingNULL(125), andpair(r, 2)markss[r:r+1].reload.rs:346): the comment saysa write of s4 or of s[3:4] reaches it, while the assertions right below testavail(4)(s[4:5]) andavail(5)(s[5:6]) rather thanavail(3)(s[3:4]) — both overlaps[4:5], just noting the minor comment mismatch.Not Tested
#[ignore]/SKIPPEDtests.AI disclosure: Antigravity (Gemini 4 Neon, XHigh) ran the builds/tests, reviewed the diff, and drafted this report.
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-26T14:44:06Z.
Regression run of
89f75c4on a newer retail title: no device removal, no crash, frames and commit within the limits.Setup: RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main
b49be18(this PR's base) and of this PR's exact head,scripts/smoke.ps1 -Game <title>for 60 s withXCL_NETWORK=0and A pressed every 4 s from 20 s. Main ran before and after a batch of 11 PRs and peaked at 23,855 and 23,844 MB, so the baseline held steady over the batch.main:
this PR:
100 % of main's frames, 103 % of its peak commit. One run each.
Not tested: the suite on this head; whether the title reaches the code this PR changes in its first 60 s; AMD.
AI use: Claude Code (Claude Opus 5.5) ran these runs on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T07:48:45Z.
Two contributors checked independently and found that this PR makes the same change as #2479: #1607, group D139. They suggest keeping #2479. If you agree, closing this PR or joining the other one would save the maintainers a review. If the two differ in a way the checks missed, a note in #1607 helps.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-28T21:13:56Z.
Closing as a duplicate of #2479 (confirmed by 2+ contributors in #1607, group D139). Thanks for the contribution — feel free to comment if this covers something #2479 does not.
Pull request closed