Shaders: DPP16 row masks name the console's rows in host waves of 32 #233
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/233"
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?
Imported from DexNom/VIctory. Originally posted by murillojndem on 2026-11-29T22:27:18Z.
A DPP16 row mask names the console's rows of 16 lanes.
dpp()took the row fromlane_index(), the host lane. A console wave64 compute program on a host whose waves have at most 32 lanes runs in two host waves (halves), each one half of the console wave, so its console rows 2 and 3 are the second host wave's lanes 0 to 31, and they tested mask bits 0 and 1. Withrow_mask:0x3the upper half was written, which RDNA2 leaves alone, and with0xCneither half was. Only masks whose two halves agree (0x0, 0x5, 0xA, 0xF) came out right. Programs with DPP go tohalveswhenever nothing in them crosses the halves (lower, wherewavebecomes 32), so this reaches DPP code on 32-lane hosts such as NVIDIA's; hosts with 64-lane waves run such programs whole and are not affected.Change (
emit/lower.rs,dpp()): underhalves, the row index is taken from the console lane,console_thread() & 63(the host wave's first console thread fromwave_base, plus the host lane). The bank index stays by the host lane, since banks lie inside a host wave. Native waves are unchanged.Found by an independent review of #232, which leaves this alone. That PR's tests are wave32 only.
Tests:
emit::wave64_tests::dpp_row_masks_name_the_consoles_rows_in_host_waves_of_32: a 64-thread wave64 program, lowered for host waves of 32, runsv_mov_b32_dpp v1, v0 quad_perm:[1,0,3,2]with row masks 0x3, 0xC, 0x5 and 0x9 over v1 = 0xdead0000 | lane, and stores every lane's v1. Each lane must hold its quad partner's lane number where its console row is in the mask, and its own v1 elsewhere. On main, on an RX 7900 XT, it fails at row_mask 0x3 (lanes 32 to 63 written: lane 32 holds 0x21). With this change it passes.victory-shader --libon the RX 7900 XT and WARP with one test thread: 238 passed, 2 failed, 4 ignored (main: 237, 2, 4). The 2 failures (emit::rect::tests::rectangles_are_drawn_wholeandthe_rectangle_stage_is_a_geometry_shader) fail on main too.-D warnings, with and without--all-features, andcargo xtask policypass. It merges with #232.Limits:
halveswithoutexchange, not changed here:lane_bit(a lane's bit of a 64-bit mask held as a number, asv_cndmask_b32reads one; console lanes 32 to 63 read the low dword), andv_readfirstlane_b32, which reads the host wave's own first lane. They need tests of their own.Generated with Claude Code
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.