Repository navigation
feat(shader): implement ds_permute_b32 - #334
Conversation
|
A heads-up on an interaction with my open #304, which neither PR's tests would catch. #304 adds
Whichever of the two lands second needs this one line: case IrOpcode::PermuteU32: |
|
Thanks, agreed: |
|
Ping as promised: #304 is merged now, so |
ds_permute_b32 is the forward (scatter) counterpart of ds_bpermute_b32: every active lane sends its data to lane ((addr + offset) >> 2) & 31 of its wave. As measured on hardware, the highest sending lane wins, an active lane nobody writes to gets 0 and inactive lanes neither send nor receive. It lowers to one shuffle of the data, address and EXEC bit per source lane, using the same wave base as ds_bpermute_b32. Co-Authored-By: Claude <noreply@anthropic.com>
With uniform inputs every lane writes to the same target lane, so only that lane receives the value; the two-lane wave64 path must not share it. Co-Authored-By: Claude <noreply@anthropic.com>
|
Thanks for the reminder. Rebased onto current main and added |
b4b30b7 to
13ac232
Compare
|
Thanks for adding it. My RTX 4090 runs 32-wide subgroups, so I'll test the two-lane wave64 path ( |
Takes the 13 gate-batch PRs that merged upstream (boykopovar#319 boykopovar#329 boykopovar#330 boykopovar#331 boykopovar#325 boykopovar#435 boykopovar#471 boykopovar#294 boykopovar#376 boykopovar#404 boykopovar#394 boykopovar#401 boykopovar#446) in place of astrobot's local versions, as integ/gate-batch cab0eab had them: boykopovar#294 and boykopovar#376 in astrobot's depth model (DepthTarget, state.depth), boykopovar#394 with the thick mip tails, boykopovar#401 over astrobot's slab pool, boykopovar#471 keeping the settled single-lane path. Also takes the rest of main since a818bee (boykopovar#532 boykopovar#340 boykopovar#486 boykopovar#484 boykopovar#316 boykopovar#243 boykopovar#334 boykopovar#434 boykopovar#437 boykopovar#470 boykopovar#373 boykopovar#452 boykopovar#455 and our upstreamed PRs, where astrobot keeps its later revisions and env switches). Resolution notes: relinker converter/matcher/tests are upstream's (boykopovar#432 decoder covers VEX RIP-relative followers); RecompileResult gains boykopovar#316's hostSubgroupSize (set from request.target.subgroupSize); shader disk cache format 9; boykopovar#452's scissor message; upstream's later live-stack and memory-copy decode tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mgp3oZvembQziVNE2xARQK
What
ds_permute_b32(DS 0xb2) threwDS opcode is not supported. The ISA sweep found it. It is the forward (scatter) form ofds_bpermute_b32: every lane sendsdatato lane((addr + offset) >> 2) & 31of its wave.Semantics measured on an RDNA2 GPU (wave32, 6 address patterns: reversed, all to lane 0, random; with
offset:8; with EXEC = low 16 lanes). All matched by a Python model:Lowering:
PermuteU32runs 32 unrolled steps, one per source lane of the wave. Each step shuffles the data, the address and the EXEC bit from that lane and keeps it when the target is this lane. Later lanes overwrite earlier ones. It uses the same wave base (lane & ~31) asds_bpermute_b32. It is costly (96 shuffles), soestimatedSpirvWordsreports it as such. The opcode is rare.Test
agc_driver_ds_permute: random targets,ds_bpermute_b32on the same inputs as a reference,offset:8, and partial EXEC. Expected values were captured on the RDNA2 GPU. On devices whose subgroups are narrower than a wave (lavapipe: 8 lanes) the test reports itself as skipped, like the other cross-lane tests.Tested
Linux, full ctest (100) passes.
permute_offset8 is 0x00001017, expected 0x0000101e.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)