Recompiler: group-shared and texel sub as a compare-exchange loop #2742
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2752"
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 jhincromwel-star on 2026-11-26T10:09:47Z.
What is in it
Tested
cargo test --workspace -- --test-threads=4: N passed, N failed, N ignored (SKIPPED GPU tests: …)Regression run
main:
PR:
Not tested
AI use
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T10:16:26Z.
Review: COMMENTED
At
efb14e7, the LDS part of this PR replaces variableds_subwith a compare-exchange loop in bothemit.rsandlower_mem.rs. #1919 is already open for the same Blackwell LDS subtract failure and changes those same files and the fuzz/test fixtures. Its author first tried a compare-exchange loop, then replaced it after measuring 318.9 ms for that loop versus 9.7 ms for the current #1919 approach in a 32-lane, one-slot contention case. Those are #1919's published measurements, not a benchmark of this PR.Could you compare or coordinate the LDS approach with #1919 before both fixes proceed, and identify which texel-sub behavior here is distinct? A focused contention comparison of this head against #1919 would make the tradeoff reviewable. This is an exact-head source and overlap review assisted by Codex (GPT-6.2 Astra and GPT-6.2 Sol); I have not measured this head's performance or Blackwell behavior.
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T10:26:33Z.
On the RX 6800M, the new
gpu_ds_sub_rtn_u32_with_a_variable_operandtest fails on the HLSL/DXC path at exact clean headefb14e746d6a4367ed56bb5468daa39f87fce4b2. The Direct DXIL path passes.Tested
Windows 11 Home build 26200, Ryzen 9 5980HX, AMD Radeon RX 6800M (PCI
1002:73df, driver30.0.13002.13003), Rust 1.99.0 MSVC, and Windows SDK DXC/DXIL 1.8.2502.11. I setXCL_ADAPTER=AMD Radeon RX 6800MandXCL_REQUIRE_GPU=1. The test does not print the adapter name. I independently enumerated it in DXGI, and the test runner requires the explicit name match.XCL_DIRECT_DXIL=0XCL_DIRECT_DXIL=1b49be18with this test added, HLSL/DXC-O0The failing HLSL runs read
0xffffffffat lane 0, expected0xfffff7e0(0 - (1 + … + 64)). The main control added the PR test plus an HLSL dump and kept main's translator unchanged. The two captured HLSL files differ only in the subtract statement: main usesInterlockedAddwith a negated value, while head uses a bounded compare-exchange loop. Both emitGroupMemoryBarrierWithGroupSync()before and after the subtraction. The optimization control changed only the test's compilation argument. These results isolate an optimization-sensitive failure with the new HLSL lowering on this stack. They do not identify the compiler or driver stage responsible.Not tested
Blackwell, other driver and DXC versions, #1919's alternate implementation, full workspace suite, retail title, and performance. The local control files were restored after testing.
AI use
OpenAI Codex (GPT-6.2 Sol) ran the tests and local controls, compared emitted HLSL, and drafted this report. OpenAI Codex (GPT-6.2 Astra) checked the logs and shader diff before posting.
Imported from ivall/xcl. Originally posted by sage-sage on 2026-11-26T10:30:40Z.
Test report: passes on NVIDIA Ada; this card does not show the bug. Exact head
efb14e74(its base is currentmainb49be18, so head = merged).Tested
cargo test --workspace -- --test-threads=4: 1436 passed, 0 failed, 47 ignored;gpu_ds_sub_rtn_u32_with_a_variable_operandpassesmainon this machine (wave64, debug layer, Developer Mode, heap windows)lower_mem.rsandemit.rstaken back tomain(local only), the new test still passes here: Ada's driver accepts the group-sharedatomicrmw addof a negated value, so on this card the test checks the compare-exchange loop's result but does not reproduce the refusal.Not tested
Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Imported from ivall/xcl. Originally posted by SzczepanGrela on 2026-11-26T12:15:25Z.
Additional RX 9070 / Wine result: I did not reproduce the HLSL failure reported above on this stack.
Tested
efb14e746d6a4367ed56bb5468daa39f87fce4b2, against mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7with only the PR's new 35-line synthetic test appended. Main's translator was unchanged. No local source changes on the head.8293130ebe370b1+(local asserts-disabled build), DXC/DXIL 1.9.2602.17, Rust 1.97.1, releasex86_64-pc-windows-gnubinaries.XCL_ADAPTER="AMD Radeon RX 9070",XCL_REQUIRE_GPU=wave64,XCL_NETWORK=0, andXCL_DIRECT_DXIL=0or1. Fresh process and XCL DXIL cache directory for every run; vkd3d shader cache disabled.gpu::recomp::tests::gpu_ds_sub_rtn_u32_with_a_variable_operand: 3/3 fresh-process passes per backend on the head and 3/3 per backend on the main control. Each run reported 1 passed, 0 failed, 0 ignored, 0 skip markers. The test checks the final LDS value in all 64 lanes and 64 distinct returned old values.gpu::recomp::tests::gpu_ds_: 5 passed, 0 failed, 0 ignored, 0 skip markers per revision/backend.gpu::dxil::ops_tests::groupshared_barrier_and_atomics_run: 1 passed, 0 failed, 0 ignored, 0 skip markers per revision.The Windows libtest binaries were invoked directly through the GE-Proton Wine executable, with
--nocapture --test-threads=1and--exactfor individual tests. Raw summaries, source inventories, and executable hashes were checked after the runs. This establishes a passing result on this particular stack; it does not explain the RX 6800M result.Not tested
Native Windows, other GPUs, alternate DXC or driver versions, the full fuzz/workspace suites, retail workloads, smoke runs, or performance.
AI use
OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, ran and checked the synthetic comparisons, and drafted this report. Publication authorized by the account owner.
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-26T12:15:59Z.
Regression run of
efb14e7on 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 was run right after this PR's head, since peak commit on this title drifted up over the day on this machine (main peaked at 19.2 GB this morning).main:
this PR:
102 % of main's frames, 107 % of its peak commit. One run each.
Not tested: the suite on this head; whether the title runs the group-shared/texel sub atomics 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 andrewDoing on 2026-11-26T20:21:26Z.
Independent Blackwell test on NVIDIA GeForce RTX 5070, driver 616.92, Ryzen 7 5700X3D, Windows build 26300.10075, Rust 1.100.0 MSVC, SDK DXC/DXIL 1.8.2502.11. Tested clean PR head
efb14e746d6a4367ed56bb5468daa39f87fce4b2(parentb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7).With
XCL_ADAPTER=NVIDIA GeForce RTX 5070andXCL_REQUIRE_GPU=wave64, rancargo test --locked -p xcl --lib gpu::recomp::tests::gpu_ds_sub_rtn_u32_with_a_variable_operand -- --exact --test-threads=1 --nocapture, first withXCL_DIRECT_DXIL=0, then=1. Each run: 1 passed, 0 failed, 0 ignored, no skips. The test checked that all 64 lanes observed the final shared value and returned distinct prior values.Not tested: the full suite on this head, a title, or performance.
AI use: OpenAI Codex with GPT-6.2 Astra ran the tests and reported results; Codex coordinated and prepared this summary.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:35:33Z.
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:52:33Z.
Triage (#1607) – head
efb14e7Main already fixes the same driver refusal:
5835139("Recompiler: LDS ds_sub_u32 hides its negation from the driver") changesds_sub_u32/ds_sub_rtn_u32to add(0 - v) | WaveActiveBitOr(0)inemit.rs:rmw32andlower_mem.rs:rmw32, changes the fuzz test'sSubthe same way, and addsgpu_ds_sub_u32_of_a_register. It landed before this PR was opened.This PR replaces the same lines with a compare-exchange loop, so it conflicts. In
emit.rsit also turns texel (At::Ref) imageatomic_subinto a CAS loop, but nothing shows a driver refusing those. The description is the empty template. If main's form is still refused on some driver, a new PR with that measurement would be the place for the CAS loop.Recommendation: close (superseded by main commit
5835139).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:59:45Z.
Closing as superseded: this change is already on
main(5835139). main5835139'LDS ds_sub_u32 hides its negation from the driver' fixes the same Blackwell E_OUTOFMEMORY in emit.rs rmw32 and lower_mem.rs rmw32 with fuzz_tests and a GPU test; same four files as this PR (which uses a CAS loop)Two independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed