Repository navigation
Direct DXIL: translate ds_permute_b32 as the HLSL path does - #2228
NWProgramming00 wants to merge 3 commits into
Conversation
|
Independent RDNA2 check on exact, clean PR head Environment: Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver I ran
Both runs include AI assistance: OpenAI Codex (GPT-6; exact variant not exposed) ran the commands, checked the logs and head revision, and drafted this report. No game data was used or attached. |
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
|
Found by reading the code at Thanks for the direct-path lowering. The permute itself matches the HLSL lowering in #2222 as far as I can trace it: same sender set, highest sender wins, 0 for an active lane nobody sends to, inactive receivers keep their old value. One question about the refusal:
if self.wave64 && self.split && self.gfx.as_ref().is_some_and(|g| g.vs.is_some() || g.ps.is_some()) {I don't see any path where this condition can be true:
So with By reading only, I can't say whether the direct output is actually wrong there. Its lanes are the real host lanes 0..31, and the direct translator has no |
Each active lane sends DATA0 to lane ((ADDR + offset) >> 2) & 31 of its own 32-lane half, in wave64 too; of several senders the highest lane wins, an active lane nobody sends to gets 0, inactive lanes take no part. Each receiver looks at the 32 senders of its half (rla_half_fn, as ds_swizzle), so the split wave64 form needs no exchange. A wave64 VS / PS that may run in 32-lane waves still refuses it: upper_lanes does not model its writes to lanes 32..63. The model was measured on an RDNA2 gfx1036 in native wave64 and wave32 (26 cases: collisions, partial EXEC, high address bits, cross-half addresses), and matches the measurements reported on xcl-dev#925. The emitted code follows xcl-dev#925 by @maximecmb, which was closed unmerged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The direct translator refused ds_permute_b32. It now lowers it as the HLSL path (xcl-dev#2222) and RDNA2 hardware do: each active lane sends DATA0 to lane ((ADDR + offset) >> 2) & 31 of its own 32-lane half; of several senders the highest wins, an active lane nobody sends to gets 0. Each receiver reads the 32 senders of its half in lane order (unrolled) through read_lane_half, so the split form needs no exchange. A wave64 VS / PS that may run in 32-lane waves still refuses it. gpu_ds_permute_b32 runs its cases through the direct translator too (gpu_ds_permute_b32_direct), whatever XCL_DIRECT_DXIL says. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The refusal tested `split`, which Lw::new clears for a VS / PS, and direct_graphics passed split: false anyway, so a wave64 VS / PS that may run in 32-lane waves was lowered where the HLSL path refuses it. Lw keeps the requested split of a VS / PS in gfx_split, direct_graphics passes split_wave64 as the HLSL path does, and the refusal tests gfx_split. ds_permute_b32_direct_refused_where_upper_lanes_do_not_exist runs translate_pixel / translate_vertex with and without split; it fails with the old condition. Found by upipibi in review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
03d0ba8 to
1aa9794
Compare
|
@upipibi you are right, thanks. The check could not fire: Fixed in
I rebased the stack onto AI use: Claude Code (Claude Opus 5.5) checked the trace, wrote the fix and the test, ran the suite and the smoke pair, and wrote this. |
|
@NWProgramming00 thanks, 1aa9794 looks right to me by reading. Tested head Debug profile (not release), no game files. 1. The five ds_permute tests on head,
2. Negative control. Parent 3.
Skips (25
Not tested: retail title; AMD wave64 hardware. AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted). |
|
Tested: Clean Not tested: Retail smoke, full workspace suite, and native wave64 hardware. AI use: T3 Code / Codex ( |
|
Independent desktop NVIDIA (Wave32-only Ada) verification of PR #2228 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib ds_permute_reference_matches_rdna2_values -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1346 filtered out × 3 (0.00s × 3) |
cargo test --release -p xcl --lib gpu_ds_permute_b32 -- --nocapture (3 consecutive runs; executes both gpu_ds_permute_b32 and gpu_ds_permute_b32_direct) |
2 passed; 0 failed; 0 ignored; 1345 filtered out × 3 (0.31s, 0.24s, 0.23s, 0 skipped; live on RTX 4060 + DXC 1.9.2609.5) |
cargo test --release -p xcl --lib gpu_ds_permute_b32_direct -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1346 filtered out × 3 (0.19s, 0.19s, 0.21s, 0 skipped) |
cargo test --release -p xcl --lib ds_permute_b32_refused_where_upper_lanes_do_not_exist -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1346 filtered out × 3 (0.00s × 3) |
cargo test --release -p xcl --lib ds_permute_b32_direct_refused_where_upper_lanes_do_not_exist -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1346 filtered out × 3 (0.01s × 3) |
cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4 (3 consecutive runs) |
184 passed; 0 failed; 3 ignored; 1160 filtered out × 3 (4.03s, 4.39s, 4.15s; 183 executed + 1 expected Wave32-only skip dispatch_chain_native_wave64_builds_whole: no wave64) |
cargo test --release -p xcl --lib gpu::recomp::pso:: (3 consecutive runs) |
27 passed; 0 failed; 1 ignored; 1319 filtered out × 3 (0.08s × 3, 0 skipped) |
cargo build --release -p xcl |
Clean build (1m 14s, exit 0, 0 new warnings) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact merge-base (e120925e3abc9956a8b9bae631969d32e8ccd43c, cached baseline on the same machine):
xcl-smoke v1
commit: e120925e3abc9956a8b9bae631969d32e8ccd43c
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1602 (PresentX 1602)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13979 MB
PR #2228 (1aa97946e97e71e5baca0a62d088e552d0214ad5):
xcl-smoke v1
commit: 1aa97946e97e71e5baca0a62d088e552d0214ad5
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1606 (PresentX 1606)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13975 MB
Runtime log observations (xcl.log)
9221log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
19585 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample13975 MB committed by the process; video memory 6115 MB local, 4651 MB non-local.
Limits of coverage
- Both HLSL (
gpu_ds_permute_b32) and direct DXIL (gpu_ds_permute_b32_direct)ds_permute_b32lowering matched the RDNA2 reference live on desktop Wave32-only RTX 4060 (3/3,0skipped), alongside both VS/PS upper-lane refusal tests (3/3),gpu::dxil::(183executed +1expectedno wave64skip × 3), andgpu::recomp::pso::(27/0/1× 3). - Native Wave64 GPU execution is not available on this Wave32-only NVIDIA RTX 4060 (
dispatch_chain_native_wave64_builds_wholeskipped as expected), and the warm-cache 60 s retail smoke ontitle: 29640639confirms zero runtime regression rather than exercising a retail shader usingds_permute_b32.
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Stacked on #2222.
06d8deais #2222's commit22133f3, rebased ontoe120925; the patch is the same. This PR's commits are9f2cacc(the lowering) and1aa9794(the refusal fix from review).#2222 translates
ds_permute_b32in the HLSL path. The direct DXIL translator (XCL_DIRECT_DXIL) still refused it. This PR lowers it there the same way, so the two backends agree and match the RDNA2 measurements on #2222:((ADDR + offset) >> 2) & 31of its own 32-lane half, so it never crosses the halves.What is in it
crates/xcl/src/gpu/dxil/lower_mem.rs:ds_permute_b32inLw::ds. Each receiver reads the 32 senders of its half in lane order (the loop is unrolled) throughread_lane_half, asds_swizzle_b32does, so the split form needs no exchange. A wave64 VS / PS that may run in 32-lane waves refuses it, as in the HLSL path.crates/xcl/src/gpu/dxil/kernel.rs,lower.rsandcrates/xcl/src/gpu/recomp/pso.rs(1aa9794): before that commit the refusal could not fire. It testedsplit, whichLw::newclears for a VS / PS, anddirect_graphicspassedsplit: false.Lwnow keeps the requested split of a VS / PS ingfx_split.direct_graphicspassessplit_wave64, as the HLSL path does.gfx_split.crates/xcl/src/gpu/recomp/tests.rs:gpu_ds_permute_b32and a newgpu_ds_permute_b32_directshare one body. The new test runs the same five cases through the direct translator whateverXCL_DIRECT_DXILsays, in wave32, native wave64 and split wave64.crates/xcl/src/gpu/recomp/tests.rs:ds_permute_b32_direct_refused_where_upper_lanes_do_not_existrunstranslate_pixelandtranslate_vertexwith and without split. It fails with the old condition.Tested
XCL_ADAPTER=radeon). Rust 1.100 MSVC, release.03d0ba8; the lowering itself is unchanged since): the 26 RDNA2 code blocks from Recompiler: translate ds_permute_b32 as RDNA2 runs it #2222 ran through the direct translator (runner::direct_kernel_full) on each adapter and were compared bit for bit with the gfx1036's own results. They give 26/26 equal on the RTX 5070 Ti and 26/26 equal on the Radeon.ds_permutefilter).gpu_ds_permute_b32_directfails on both adapters, and with the offset dropped it fails too (checked on03d0ba8).1aa9794's condition put back to the old one, the new refusal test fails.cargo build --release --workspace, thencargo test --release --workspace --no-fail-fast -- --test-threads=4, with and withoutXCL_DIRECT_DXIL=all, against basee120925on the same machine:e1209251aa9794)XCL_DIRECT_DXIL=allXCL_DIRECT_DXIL=allThe +5 are the
ds_permutetests: three from #2222 and two here. The failing tests are the same on base and PR, and both are tracked:fuzz_validate_and_gpu_0..3on NVIDIA (#1905) andfuzz_validate_and_gpu_1on RDNA2 (#2115, #2170).Regression run
Base (
maine120925), NVIDIA GeForce RTX 5070 Ti:This PR (
1aa9794), same card:The base is
e120925, themaincommit just before #2555. Since #2555, a run first prepares the whole shader pack, which takes about 5 hours from an empty cache here. The stack merges cleanly into currentmain8b957be.Not tested
ds_permute_b32.AI use
🤖 Generated with Claude Code