Recompiler: translate ds_permute_b32 as RDNA2 runs it #2222
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2222
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2222"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@NWProgramming00 on GitHub · 2026-11-25 10:19 UTC · original
NWProgramming00:recomp/ds-permute→main· +134 −0 · 2 files · 1 commits · opends_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 #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 #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
@luckyteagirl on GitHub · 2026-11-25 10:32 UTC · original
Independent RX 6800M verification on exact PR head
22133f3abd080bdcdc0ff67703fadfb33bf0c06b(base568e7db7729c8fa6c8f0f4b32d798faaf11462bb). Both worktrees were clean, built with separate Cargo targets.Environment: Windows 11 build 26200, Ryzen 9 5980HX, Radeon RX 6800M (RDNA2), driver
30.0.13002.13003, Rust 1.99 MSVC, DXC/DXIL 1.9.2609.5.XCL_ADAPTER=6800M.Focused tests:
cargo test --locked -p xcl --lib -j 2 ds_permute -- --test-threads=1 --show-outputon the PR head, withXCL_REQUIRE_GPU=wave64andXCL_DIRECT_DXIL=0: 3 passed, 0 failed, 0 ignored. This includesgpu_ds_permute_b32; there were no SKIPPED lines. The reference-model and graphics refusal tests also passed.cargo build --release --locked -p xcl -j 2passed for both base and PR head.Paired guarded retail smoke: Same locally owned title (
title: 2ef5fd64), default HLSL path, separate freshXCL_DATA_ROOTandXCL_DXIL_CACHEper run,XCL_ADAPTER=6800M, networking disabled. Each run was scheduled for 12 seconds and ended normally:568e7db0x022133f30x0The 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
ds_permute_b32; the focused GPU test does.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
xcl-smokecompletion block. At 18 seconds, the log had reached 54 presents in the prior 2 seconds and reported 9,245 MB process commit. I did not attempt a 60-second PR run under the same memory pressure. Thus this report does not satisfy the PR's required clean 60-second regression pair or remove its draft blocker.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.
@cindertheblue on GitHub · 2026-11-25 21:33 UTC · original
Tested the head
22133f3on RDNA3 (listed as untested), in native wave64, plus a second gfx1036 driver. The three tests pass on both GPUs, and the two changes you used as controls (half bit dropped, offset dropped) makegpu_ds_permute_b32fail on both.Tested
gfx1036), driver 32.0.21045.5002, on the same machine. Windows 11 Home 26200.9974, rustc 1.99.1, DXC 1.8.2502.11 (SDK 10.0.26100), debug, its own Cargo target,cargo build --workspacefirst, no local changes.cargo test -p xcl --lib ds_permute -- --test-threads=1 --nocapture(the three new tests):gfx1036XCL_REQUIRE_GPU=wave64XCL_DIRECT_DXIL=1{t}_h = 0u(half bit dropped)gpu_ds_permute_b32fails:wave64 split=false lane 32: v10{t}_a = {a};(offset dropped)gpu_ds_permute_b32fails:wave64 split=false lane 1: v12emit.rsfrom568e7db{"ds_permute_b32: DS": 5}and{"ds_permute_b32: LDS outside compute": 1}main6d12f58(clean merge)No
SKIPPEDlines in any of these. The native wave64 form runs here: the half-bit failure is inwave64 split=false.cargo test --workspace --no-fail-fast -- --test-threads=4, once each, against568e7dbon the same machine:568e7dbXCL_DIRECT_DXIL=allThe 3 extra passes are the new tests. The failures are the same on both trees:
fuzz_validate_and_gpu_1(#2115: seed 722 on the RX 7600 XT, 540 on the iGPU), and withXCL_DIRECT_DXIL=allalsogpu_image_get_resinfo_1d_array(#2046) andoffline_compute_pipeline_is_reused_by_a_second_process(#1674). The same 8SKIPPEDlines in all six runs.ds_permute_b32cases in native wave64 (full and partialEXEC, offsets 0, 2, 4, 128, 132, 65532) gave the half-wave result on all 64 lanes, as did the same cases on this gfx1036.Not tested: a release build, a title or smoke run, RDNA4, a wave64 VS / PS using
ds_permute_b32.AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this comment from their output.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.