Repository navigation
Recompiler: translate ds_permute_b32 as RDNA2 runs it - #2222
NWProgramming00 wants to merge 1 commit into
Conversation
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>
|
Independent RX 6800M verification on exact PR head Environment: Windows 11 build 26200, Ryzen 9 5980HX, Radeon RX 6800M (RDNA2), driver Focused tests: Paired guarded retail smoke: Same locally owned title (
The different startup time makes the frame totals unsuitable as a performance comparison. The title logs show no dispatches in this window, so the smoke run does not exercise I also attempted a 60-second base run. An external safety monitor stopped it after about 24 seconds when available commit fell to 952 MB (physical free 988 MB); it produced no AI assistance: OpenAI Codex (GPT-6; exact variant not exposed) prepared the isolated runs, checked the logs and revisions, and drafted this report. No game data or shaders are attached. |
|
Tested the head Tested
No
The 3 extra passes are the new tests. The failures are the same on both trees:
Not tested: a release build, a title or smoke run, RDNA4, a wave64 VS / PS using AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this comment from their output. |
…upstream xcl-dev#2222) LATER shared semantics: the backend-independent ds_permute_reference model (no 32-lane-half crossing, highest sender wins, inactive lanes neither send nor receive) + the hardware-pinned value test land verbatim in recomp/tests.rs. The HLSL/DXIL emit halves stay out for the future SPIR-V path.
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>
|
Tested head
Not tested: retail title; direct DXIL; AMD wave64 hardware. AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted). |
|
Independent desktop NVIDIA verification of PR #2222 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; 1126 filtered out × 3 (0.00s × 3, 0 skipped) |
cargo test --release -p xcl --lib gpu_ds_permute_b32 -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1126 filtered out × 3 (0.24s, 0.23s, 0.24s, 0 skipped; live RTX 4060 execution) |
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; 1126 filtered out × 3 (0.00s × 3, 0 skipped) |
cargo test --release -p xcl --lib gpu::recomp::tests:: -- --test-threads=4 (3 consecutive runs) |
150 passed; 0 failed; 17 ignored; 960 filtered out × 3 (5.24s, 5.27s, 5.51s; 2 tests self-skipped: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware — no wave64 on Wave32-only Ada; 148 executed) |
cargo build --release -p xcl |
Clean build (1m 02s, exit 0, 0 new warnings) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (568e7db7729c8fa6c8f0f4b32d798faaf11462bb, same machine):
xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1587 (PresentX 1587)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14527 MB
PR #2222 (22133f3abd080bdcdc0ff67703fadfb33bf0c06b):
xcl-smoke v1
commit: 22133f3abd080bdcdc0ff67703fadfb33bf0c06b
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1574 (PresentX 1574)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14497 MB
Limits of coverage
ds_permute_b32HLSL lowering (collisions, partialEXEC, high address bits, cross-half addresses, and refusal for wave64 VS/PS in 32-lane waves) was directly verified on desktop RTX 4060 via all 3 new tests (3/3each,0skipped) andgpu::recomp::tests::(148executed,0failed,2Wave64-only tests self-skipped on Wave32-only Ada).- Native Wave64 hardware execution was not exercised on Wave32-only Ada; the 60 s retail smoke confirms zero runtime regression on
title: 29640639(single-run frame/commit delta vs. parent reflects normal startup variance, not this PR).
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
|
RX 9070 / RADV / Wine verification of exact head Tested
Main passes the reference-model test; the GPU and graphics-refusal tests fail their translation assertions before any feature GPU dispatch. The first GPU fixture's translation records five unsupported Additional owned filter
The independent verifier scatters active senders in ascending order, then applies receiver activity. Every readback matches: no cross-half transfer, highest active sender wins, an uncovered active receiver gets zero, and inactive receivers keep their distinct input sentinels. This checks 3,502,080 matrix result slots, including inactive receivers. Head and current-main integration readbacks match byte-for-byte and repeat identically. Main's additional filter passes only explicit CPU translation-refusal controls: 0 matrix GPU dispatches. The unchanged direct DXIL backend also refuses the same program in all three modes on every source; no fallback is counted as direct GPU coverage. Across the original and owned groups: 1,752 captured GPU dispatches. There are 580 in each requested mode, plus 12 separate physical-width probes; 586 dispatches use physical native wave64, including its six probes. Independently verified 6,346,176 words, including input/result registers, 16 SGPR and 16 VGPR guards, unchanged SCC and complete flat-memory readbacks. Original and owned programs were independently re-encoded from the public ISA tables; shader metadata and physical widths agree. 0 ignored, 0 skipped, no device-removal markers. Inherited Not tested Raw RDNA4 ISA measurements, direct DXIL GPU execution, graphics-stage GPU execution, guest Compute ABI integration, full suite, native Windows, other GPUs, retail workload, AI use OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, wrote the owned test-only matrix and captures, ran comparisons, independently verified routing, collision winners, masks, offsets, guards, wave widths and source/executable provenance, and drafted this report. Publication authorized by the account owner. |
ds_permute_b32(the forward lane permute) was refused by the translator. This translates it in the HLSL path the way RDNA2 hardware runs it, after the measurements on #925 (closed unmerged by its author) and new measurements on an RDNA2 GPU.Behaviour, measured: each active lane sends DATA0 to lane
((ADDR + offset) >> 2) & 31of its own 32-lane half, in wave64 too, so it never crosses the halves. Of several senders to one lane the highest wins. An active lane that nobody sends to gets 0. Inactive lanes neither send nor receive. No LDS memory is used.What is in it
crates/xcl/src/gpu/recomp/emit.rs:ds_permute_b32inds(). Each receiver looks at the 32 senders of its half in lane order throughrla_half_fn(asds_swizzle_b32), so the split wave64 form needs no exchange. A wave64 VS / PS that may run in 32-lane waves still refuses it, becauseupper_lanesdoes not model its writes to lanes 32..63. The emitted code follows Recompiler: translate ds_permute_b32 #925 by @maximecmb.crates/xcl/src/gpu/recomp/tests.rs, three tests:ds_permute_reference_matches_rdna2_values: the reference model on values read from the hardware.gpu_ds_permute_b32: wave32, native wave64 and split wave64. It covers a reversal, two senders per lane, high address bits, offsets 8 and 128, andADDR = 4*lane + 2with offset 2. That last case catches an implementation that shifts the address and the offset apart. The case was suggested on Recompiler: translate ds_permute_b32 #925 by @akimfomin.ds_permute_b32_refused_where_upper_lanes_do_not_exist.Tested
XCL_ADAPTER=radeon). Rust 1.100 MSVC, release.ds_permute_b32 v10, v4, v5 offset:N, with v10 preset to mark inactive lanes), in native wave64 and wave32. They cover identity, reversal, rotation, collisions (all lanes to lane 5), high address bits, cross-half addresses, offsets 8 / 128 / 2, and four random address + random EXEC cases. All 26 match the half-wave model above._h = 0),gpu_ds_permute_b32fails on both adapters. With the offset dropped, it also fails on both.cargo build --release --workspace, thencargo test --release --workspace --no-fail-fast -- --test-threads=4, with and withoutXCL_DIRECT_DXIL=all, against base568e7dbon the same machine:568e7dbXCL_DIRECT_DXIL=allXCL_DIRECT_DXIL=allThe +3 are the new tests. The failing tests are the same on base and PR, and all are tracked:
fuzz_validate_and_gpu_0..3on NVIDIA (#1905),fuzz_validate_and_gpu_1seed 540 on RDNA2 (#2115, #2170),gpu_image_get_resinfo_1d_arraywith direct DXIL (#2046), andoffline_compute_pipeline_is_reused_by_a_second_processwith direct DXIL (#1674). The SKIPPED lines are the same set as on base: no wave64 on NVIDIA, the debug layer, and Developer Mode.Regression run
Base (
main06c9f55), NVIDIA GeForce RTX 5070 Ti:This PR (
22133f3), same card:Earlier runs here ended at about 44 s on
mainand on this PR alike. The cause was #695: this PC had no active playback device. With one active, both runs reach their end.Not tested
ds_permute_b32.ds_permute_b32.AI use
🤖 Generated with Claude Code