Repository navigation
Conversation
…in Direct DXIL)
|
Two data points for the premise, RTX 3070 (Ampere), driver 616.56, Windows 11:
So the guard may not be what stops a hang on NVIDIA. It still covers Intel, where boykopovar/AnyPS5#26756 reports the ended-wave hang, and it covers waves that skip a barrier but stay alive. A test that hangs or fails without the guard on the RTX 5080 would show which case this PR fixes there. The update below runs this PR. Update, this PR's direct path: I sent the same test's early-exit shader (128 threads, the upper console wave ends before two
So on Ampere the direct path doesn't hang without the guard either. That is consistent with the HLSL result above. AI-assisted (Claude Code). Synthetic tests only. |
9648fe9 to
a6ace09
Compare
lewisnic94-max
left a comment
There was a problem hiding this comment.
[P1] Guest LDS address aliasing
On a6ace09, the clamp at line 80 maps guest LDS words 8188 and 8191 to the same word. After storing 11 and 22, all 64 threads read [22,22] in three RTX 3080 runs. The merge base returned [11,22]. Exposing only word 8191 restored the expected result while the barrier counters at 8189/8190 remained active.
Please preserve distinct guest addresses and add this two-word GPU readback test.
AI-assisted validation by Codex (GPT-6).
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
The direct translator dropped the clamp operand of sample, sample_b and sample_c (the implicit-LOD forms in a pixel shader) when the T# is a cube, so image_sample_cl / _b_cl / _c_cl on a cube sampled below the clamp. The HLSL path passes the clamp for cubes as for every other dimension (TextureCubeArray Sample / SampleBias / SampleCmp with a clamp, no offset), and the hardware applies the minimum LOD whatever the dimension. No validator rule is known to forbid a clamp on a cube. TRANSLATOR_VERSION 7 -> 8: the emitted containers change for these programs. Open PR xcl-dev#1793 also bumps TRANSLATOR_VERSION. Identical edits merge silently in git, so check the bump by hand at merge time: the later change takes the next free number, or the pipeline cache could serve containers of another translator under the same version. The test draws a pixel shader sampling a mipped cube at zero derivatives with clamp 2.0 through both backends, and builds the _b_cl and _c_cl cube forms on both backends (not drawn).
The HLSL path's image_sample_o in a pixel shader with an implicit LOD and a linear mip filter samples the two blended mips with SampleLevel, each moved by the offset in its own texels, and blends them by the LOD's fraction (20271d4). The direct translator still moved the coordinates once, by the offset over the size of the rounded LOD's mip, so the second mip read a texel off when the offset was half its texel or less. Port that form: LOD = the clamped implicit LOD (raised by the _cl clamp, capped at the view's last mip), mips floor(LOD) and the next one (capped too), each with its own texel offset, lerp by the fraction. It is taken under the same conditions read from the S#: MIP_FILTER linear, not anisotropic, and LOD >= 1 or min = mag filter; otherwise the single Sample as before. The texel-offset computation moves into a helper shared with the existing path. TRANSLATOR_VERSION 7 -> 8: the emitted containers change for these programs. Open PR xcl-dev#1793 also bumps TRANSLATOR_VERSION. Identical edits merge silently in git, so check the bump by hand at merge time: the later change takes the next free number, or the pipeline cache could serve containers of another translator under the same version. The existing test gpu_ps_image_sample_offset_implicit_lod_between_mips now also draws its pixel shader through the direct translator and expects the same result.
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
Regression run for this PR: head main this PR: No device removals or crashes; 100 % of main's frames, 97 % of its peak commit. Not tested: the whole suite; the direct DXIL path this PR changes (these runs use the default HLSL path, Written with Claude Code (Claude Opus 5.5) from runs on this machine. |
# Conflicts: # crates/xcl/src/gpu/dxil/core_tests.rs # crates/xcl/src/gpu/dxil/kernel.rs # crates/xcl/src/gpu/dxil/lower.rs
…#2080/xcl-dev#2097's chain tests and xclm's compact tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the recompiler's early-exit-safe `xcl_s_barrier` (0c02b87) to the direct DXIL translator. On RDNA2 `s_endpgm` removes the exiting wave from the workgroup's barrier count; a D3D12 group sync (`bar.sync 0` on NVIDIA) waits for every hardware wave, so one that ended (`s_endpgm`), ran out of its loop budget or diverged after a split-wave64 desync can hang the others. The direct path still lowered `s_barrier` to a bare GROUP_SYNC. Same policy as the HLSL path (`gpu/dxil/group_barrier.rs`): - Compute / Mesh groups of several hardware waves whose program has an `s_barrier`: a bounded arrival barrier on two group-shared words (`alive`: live hardware waves; `state`: generation:20 | arrived:12). Initialized in the entry block (whole group present), decremented once in the single exit block every way out of the program goes through (`s_endpgm`, end of code, exhausted loop budget). A wave that spins past 1 << 20 rounds leaves the count and only fences from then on. Opt-out: `XCL_SAFE_BARRIER=0`. - One hardware wave: a group-shared fence (nothing to wait for). - Kernel ABI: unchanged group sync. With LDS the words sit at 8189..8190 of the 32 KB block, so group-shared memory never exceeds the D3D12 limit; without LDS they get their own [2 x i32]. The split form's exchange moves 2 words down. The non-split form takes only those two words from the program: an access to either goes to word 8188, and every other word, 8191 included, stays separate (clamping everything above 8188 down would alias 8188 and 8191). Programs without `s_barrier` are unchanged. `XCL_SAFE_BARRIER` joins the shader cache bypass list so toggling it never reuses a cached translation (HLSL too).
a6ace09 to
e935deb
Compare
|
Thanks @lewisnic94-max for the clear report and repro. A fix is pushed in
Not yet verified on Windows: this head has only passed a Windows-target AI use: Claude Code (Claude Sonnet 5.5) made the fix and wrote this reply. |
lewisnic94-max
left a comment
There was a problem hiding this comment.
Reviewed commit e935debf939cba5af6e3ecf3fbd6df5b3b3c29a0.
The original two-address direct-DXIL compute fixture now returns [11, 22] on all 64 lanes for guest LDS words 8188 and 8191. The prior head a6ace09 returned [22, 22] on all 64 lanes in three runs. I would retire the P1 for this specific pair.
I also checked the boundary you documented. With the safe barrier enabled, pairs 8188/8189 and 8189/8190 still returned [22, 22] on 64/64 lanes. Both returned [11, 22] with the safe barrier disabled. In lower_mem.rs the unsigned range test redirects exactly words 8189 and 8190 to 8188 on the non-split path. The split path clamps below its exchange and counters. On split wave64, 10/11 stayed distinct and 8188/8191 aliased on all 128 threads with either barrier setting. I would retain the reserved-word limitation in the PR description.
Windows 11 x64, Ryzen 7 5800X, GeForce RTX 3080 (616.92), Rust 1.100.0 MSVC and DXC 1.9.2602.17. One exact regression and two boundary test invocations passed, zero failed, ignored or skipped. These exercised a convergent compute barrier. Mesh shaders, divergent exits and native wave64 were outside this run.
AI assistance: OpenAI Codex (GPT-6) inspected the implementation, analyzed the synthetic test evidence and drafted this review.
|
Regression run of Against the limits in CONTRIBUTING.md: 100 % of AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, AI use: Claude Code (Claude Opus 5.5) built both trees and ran |
Summary
Makes the multi-wave Compute and Mesh
s_barrierin the Direct DXIL path safe against early-exiting waves on split-wave64 NVIDIA GPUs.#1741bounds the single-wave split exchanges. This change covers the remaining unguardedGROUP_SYNCins_barrier(lower.rs), related to#1727. A wave that exits early no longer leaves the others waiting at a barrier it will never reach.xcl_s_barrierlive-wave bookkeeping (0c02b87) to Direct DXIL (group_barrier.rs).XCL_SAFE_BARRIER=0to turn the guard off.TRANSLATOR_VERSIONchange: Recompiler: direct DXIL cache entries change when its sources do #1947 hashes thegpu/dxilsources into the cache identity.XCL_SAFE_BARRIERto the translation cache-bypass list.Tested
Current head
e935deb, on macOS:cargo check --locked --workspace --all-targets --target x86_64-pc-windows-msvc(Rust 1.100.0, the C compiler for one dependency stubbed out) finished with no errors. This is a type check only; nothing was run.Earlier runs, made before the rebase and the LDS fix, not on the current head:
Windows 11 x64, NVIDIA GeForce RTX 5080 16 GB, DXC 1.9.2602.17.
cargo test -p xcl --lib dxil::core_tests -- --test-threads=1: 17 passed, 0 failed, 1 ignoredXCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu_split_wave64 -- --test-threads=1: 5 passed, 0 failedcargo test -p xcl --lib gpu::dxil -- --test-threads=1: 89 passed, 0 failed, 1 ignoredcargo test -p xcl --lib -- --test-threads=1: 849 passed, 0 failed, 22 ignored (no new warnings)Not tested
AI use