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. |
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