Repository navigation
Conversation
…-dev#772) Measured on RDNA2 in native wave64, the index for lane l is (l & 32) | (((addr + offset) >> 2) & 31): - RX 6800M (gfx1031), luckyteagirl: xcl-dev#772 (comment) - gfx1036 with partial EXEC and immediate offsets, certified-retart: xcl-dev#772 (comment) XCL masked the index with 63 and read across the halves. - emit.rs: wave64 uses the half-wave index and reads it through rla_half_fn, as ds_swizzle does. As a result: - The split form needs no exchange, so xcl_x_rla_any and its 32-word slot are gone. - In a 32-lane wave of a wave64 VS / PS, the permute can no longer reach lanes 32..63, so the upper_lanes constant case is gone. - upper_lanes.rs: ds_bpermute is no longer a read of lanes >= 32. ds_permute is unchanged (xcl-dev#925). - docs/wave64-on-wave32.md: ds_bpermute is now listed with the reads that stay inside their half. New test gpu_ds_bpermute_wave64_stays_in_its_half: the three full-EXEC indices, offsets 4 and 128, and EXEC 0xAAAAAAAA_55555555, expected values from the measured model. On main 6efdabc it gives 226 wrong lanes. Three existing assertions that encoded the cross-half reading now expect the half-wave lanes: - gpu_format_stores_atomics_global_lds: l ^ 31 - gpu_split_wave64_cross_half_operations: l ^ 31 - gpu_split_wave64_waves_diverge: l ^ 1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Native wave64 run on RDNA2, the form Not tested lists: pass, and the test's seven cases measured on the hardware with the same inputs. Tested: head
So the native wave64 path gives the half-wave result, and the native form tells the old and new translations apart by the same 226 lanes as your split run. The test's expected values against the hardware. I ran each of the test's seven cases as raw
The last two were only measured by @certified-retart so far; this is a second Not tested: the console itself ( AI use: Claude Code (Claude Opus 5.5) ran the hardware probe and the tests on my PC and wrote this comment. |
|
Independent verification, merged onto current Machine: Windows 11, Ryzen 9 7900X Radeon iGPU (gfx1036, RDNA2, native wave64 — the hardware class this fix targets), RTX 3060 Ti also present; Rust stable MSVC, debug.
AI use: test runs by Devin (Cognition, SWE-2); no code changes. |
|
Independent verification, merged onto current Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.
AI use: test runs by Devin (Cognition, SWE-2); no code changes. |
|
Linux / AMD RDNA3 verification, following up on my #772 correction row. Merged state: head onto current main ( For the wave64/bpermute thread specifically, I ran the bpermute tests three ways on this merge:
So the "stays in each 32-lane half" lowering is green end-to-end on RDNA3 native wave64, and composes correctly with the forced split path. That matches what the community measured in hardware terms in #772: GFX10-GFX11.5 already restrict bpermute to the 32-lane half, and this PR makes the recompiler stop assuming otherwise. One honest side observation from this batch, flagged not blamed: the Counts only, no game data. Not tested: retail titles (none here), Windows, RDNA4. Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting. |
|
Regression pair for Tested
this PR, Presents per 2 s over the whole run (from the
The 64-frame gap is a few single dips in the first 20 s of the PR's run, and a slow phase from about 46 s that both runs have (93 frames in the last 16 s against 107). Both runs built about the same compute pipelines (175 and 160 lines, 17 and 13 from the driver's blob of an earlier run). As the PR says, no wave64 program counted in the retail cache uses Not tested
AI use: Claude Code (Claude Opus 5.5) |
|
This PR still needs a smoke pair for the |
|
@upipibi, the pair for this head is already in an earlier comment: #1022 (comment). That's AI use: Claude Code (Claude Opus 5.5) |
|
Thanks, I missed it. Your pair is now under Regression run in the description, credited. |
|
Tested Tested
Failing on both trees, not from this PR: 1. The direct DXIL backend still reads across the halves. #1426 (merged after this PR's base) translates
So the direct form probably needs the same index, 2. This PR removes Not tested
AI use
|
Branch
fix/bpermute-wave64, commit212fb96onmain6efdabc. Not pushed.Fixes #772.
What the hardware does
In native wave64 on RDNA2,
ds_bpermute_b32lets lanelread lane(l & 32) | (((addr + offset) >> 2) & 31). If that lane is inactive, the result is 0. Two people measured it:lane,63 - laneand(lane + 1) & 63. The half-wave model matched 64/64 lanes in each case.XCL used
& 63and read across the halves. That follows the opcode table's "mod 64". The ACO lowering and both measurements disagree with it.The change
emit.rs,"ds_bpermute_b32"(lane_id & 32u) | (((addr + offset) >> 2) & 31u). Wave32 is unchanged.rla_half_fn, asds_swizzledoes.xcl_x_rla_anyand its 32-word exchange slot are removed.upper_lanesconstant case (select(and(xcl_hw32, l >= 32), c, …)) is therefore removed.upper_lanes.rsds_bpermuteis no longer counted as a read of lanes ≥ 32.ds_permutekeeps its hazard; Recompiler: translate ds_permute_b32 #925 covers that instruction.docs/wave64-on-wave32.mdds_bpermutewith the reads that stay inside their half.The emitter's lines for wave64 in the split form:
Test
The new test is
gpu_ds_bpermute_wave64_stays_in_its_half. It uses source data1000 + lane, so a 0 from an inactive lane can't be mistaken for lane 0. It runs seven cases and compares each with the measured model. It also checks these lanes from luckyteagirl's report directly:63 - lane: lane 0 reads 31, lane 32 reads 63, lane 63 reads 32(lane + 1) & 63: lane 31 reads 0, lane 63 reads 32Before (
main6efdabcwith the new test): 226 wrong lanes. The counts per case match the "full-wave" column of certified-retart's table.4 * lane(identity)4 * (63 - lane)4 * ((lane + 1) & 63)4 * lane,offset:44 * lane,offset:1284 * (63 - lane),offset:44 * (lane ^ 32), EXEC0xAAAAAAAA_55555555After: all seven cases match.
Three existing assertions encoded the cross-half reading and now expect the half-wave lanes. These are the same three that @NathanTheophile listed on the issue:
gpu_format_stores_atomics_global_lds63 - ll ^ 31gpu_split_wave64_cross_half_operations63 - ll ^ 31gpu_split_wave64_waves_divergel ^ 33l ^ 1outside_whole_wave_code_the_upper_lanes_stay_unwrittennow expects one read where it used to expect two.ds_bpermuteis no longer a read of lanes ≥ 32, even after whole-wave code has written them.Tested
RTX 3070, driver 616.56, Windows 11, DXC 1.8.2502.11. The command was
cargo test --workspace --no-fail-fast -- --test-threads=4, in its own target dir.main6efdabc212fb96On both, the usual two tests were skipped (no wave64):
gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware.This GPU has 32-lane waves only, so every wave64 case above ran in the split form. The native wave64 path is not run here.
WaveReadLaneAt, so the explicit(lane_id & 32)index is what keeps it half-wave there.Notes
ds_bpermute_b32in the 22 532 wave64 programs of the retail cache. This is a correctness fix for the instruction, not for any retail shader seen so far.Regression run
Smoke pair by Kalmarv (RTX 5070 Ti, driver 610.74),
main6efdabc(this PR's base) against212fb96: 1184 / 1248 frames, no crash, no device removal on either side (comment).main:
PR:
Not tested
ds_bpermute_b32in the 22 532 wave64 programs counted on Recompiler: ds_bpermute_b32 in wave64 may stay within each 32-lane half on RDNA2 (needs a hardware run) #772, so a smoke run is a regression check only).AI use
🤖 Generated with Claude Code