Repository navigation
Conversation
8ca5f81 to
14dec7f
Compare
Melow-code
left a comment
There was a problem hiding this comment.
Real bug — VGPR data+1 was read outside the declared operands for add/min/max/swap. The fix is minimal and correct: register index instead of value, resolved only in the cmpxchg and mskor branches. 13 programs unblocked (329→316 refused) is a credible sweep.
|
Independent split-wave64 check of 14dec7f on an RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC debug, DXC 1.8.2502.11. I extended the bundled buffer, global, and LDS atomic fixture to run a 64-lane program on two hardware waves. The shader enabled 21 lanes across both halves. Per-lane DXIL matched the HLSL and CPU expectations for all 128 memory words and 448 destination values. The 43 inactive lanes retained their initial memory and register values, and both EXEC words restored correctly. With only main’s memory lowering restored, per-lane translation refused
AI-assisted. Codex (GPT-6 family, exact variant unavailable) extended and ran the test and drafted this report. |
14dec7f to
b6e884f
Compare
|
Remaining before merge: one independent AMD GPU pass on the current head |
|
Thanks, @raylitebull. An AMD pass on the current head Please post the passed, failed and ignored counts, any SKIPPED lines, and your GPU, driver and DXC version. We will post the NVIDIA run on AI use: Claude Code (Claude Opus 5.5) wrote this. |
|
NVIDIA run on the exact head
The AMD pass is still open; the request is above. AI use: OpenAI Codex (GPT-6) ran the tests and summarized the logs; Claude Code (Claude Opus 5.5) wrote this comment. |
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
The 32-bit buffer, flat and LDS lowering read a second VGPR before selecting the atomic operation. For add, min, max and exchange this register is outside the instruction's declared operands. The per-lane bridge correctly rejected that extra read. Resolve the extra register only for compare-exchange and masked OR. The GPU test checks return values and memory against HLSL. A four-window sweep accepts 329 of 2689 compute programs, up from 316.
b6e884f to
39601b4
Compare
|
@DavidM1911 Rebased onto The one conflict was in the atomic lowering. Tested on the rebased head:
Not tested: AMD. AI use: a Codex (GPT-6.2) helper did the rebase and ran the suite; Claude Code (Claude Opus 5.5) pushed it and wrote this. |
Melow-code
left a comment
There was a problem hiding this comment.
Review: XCL PR #1911 — read a second atomic operand only where it is used
Author: Kalmarv. lower_mem.rs +33/-11, lower_dxil.rs tests +57. Fetch: git fetch xcl pull/1911/head:xcl1911 (base 689f2db).
Verdict: mergeable as is
The bug is real and the fix is minimal: the 32-bit buffer/flat/LDS atomic lowering read vreg(vdata + 1) unconditionally before knowing which atomic op it was lowering. For add, min, max and swap that register is outside the instruction's declared operands, and the per-lane bridge rightly rejects reads the ISA does not name — which is why the sweep sat at 316 of 2689 programs.
The fix changes rmw32 to take the register index of the second operand instead of a resolved Value, and resolves it only inside the two branches that need it — cmpswap/fcmpswap/cmpst_* (the comparand) and mskor_b32 (the mask). Both resolutions happen inside the guarded block, so the bridge sees exactly the ISA's operand list. The 64-bit path (atomic64, x2) is untouched — it already reads both halves of its pair. The MGSAD/imm path (DATA0/DATA1) keeps its operand-order swap for cmpst_* (cmpst puts the comparand in DATA0 per the ISA) while deferring the vreg to the use site.
The test is the right shape: a kernel with ADD, CMPSWAP, flat ADD, DS WRITE/ADD_RTN/CMPST_RTN/READ/MSKOR, run through DXC as reference and the direct-DXIL pipeline as the test subject, asserting both memory contents and per-lane VGPR return values against HLSL-computed expectations. The sweep result (329 accepted, up from 316 — thirteen programs that previously failed on the phantom read now translate) is the number that matters, and it is small enough to be believable rather than suspicious.
Notes (non-blocking)
rmw32'ssecond_vgpr: u64is only meaningful for two op names; every other caller passesvdata + 1unused. A doc line on the parameter ("read for cmpswap and mskor only") would stop the next caller from passing a real value expecting it to be used.- The thirteen newly accepted programs come from the sweep, not from a named repro. If one of them matters later, the bisect handle is the op name in
rmw32's match — the fix is per-op, so a regression shows as one op failing again. - Style and test harness match the module. Good to merge.
|
@Kalmarv here's the AMD pass you asked for, on the rebased head Tested: Windows 11 Pro 26200, Ryzen 7 5800X, rustc 1.100.0, DXC 1.9.2602.17, release.
Not tested: a title, |
Part of #1269. The 32-bit buffer, flat and LDS atomic lowering read a second VGPR before selecting the operation. For add, min, max and exchange that register is not one of the instruction's operands, so the per-lane bridge correctly refused the extra read and the whole program fell back to the HLSL form.
What is in it
crates/xcl/src/gpu/dxil/lower_mem.rs: the second register is resolved only for compare-exchange and masked OR, the two operations that use it.crates/xcl/src/gpu/recomp/lower_dxil.rs: a GPU test that checks the return values and memory of the per-lane atomics against HLSL.Tested
39601b4(basemaincbc296a, after Recompiler: take native compute mask branches across the whole wave #1910):cargo test --release -p xcl --lib, unfiltered with GPU tests included, 1,099 passed, 0 failed, 26 ignored, with 23 skip notices (20 for no native wave64, 3 for unsupported wave32 FP). The atomics GPU test and Recompiler: take native compute mask branches across the whole wave #1910's native-wave branch test both ran on the card.39601b4, Ryzen 7 5800X, DXC 1.9.2602,cargo test --release -p xcl --lib -- --test-threads=4: 1,097 passed, 2 failed, 26 ignored, with nono wave64skips, so every native-wave64 test ran. The two failures are the fuzz seeds 722 and 1599 tracked in DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115, which fail the same way onmainon that card. On an RTX 3060 on the same machine: 1,099 passed, 0 failed, 26 ignored.8ca5f81:cargo test --offline --release --workspace -- --test-threads=4gave 960 passed, 0 failed, 43 ignored. A native compute survey with four switch-selected memory windows put 329 of 2,689 programs in the per-lane form, up from 316 onmainc4d37be.Regression run
scripts/smoke.ps1, the same retail title for 60 s each, one after the other on the machine under Tested, release builds from clean trees.maincbc296a(this PR's base):this PR,
39601b4:PR vs
main: 1287 / 1113 frames (116 %), peak commit 26844 / 24774 MB (108 %); device removals 0 and crashes 0 on the PR run, 0 and 0 onmain.Both runs are on the rebased head and its new base.
main's run was still loading over its last 6 s (0, 2 and 0 presents), so the difference in frames is load timing, not this change.Not tested
AI use
OpenAI Codex (GPT-6.2) wrote the change and the test and ran the suite and the pack count. Claude Code (Claude Opus 5.5) wrote this description and opened the PR.
🤖 Generated with Claude Code