Repository navigation
feat(shader): implement global_store_dword_addtid - #569
Conversation
|
Thanks. The first commit is #390's head unchanged (same patch), so I only reviewed the last one. I disassembled the test shader with llvm-mc (gfx1030, since gfx1013 has no addtid encoding, as for #530): the six stores are opcode 0x17 with the offsets, M0 values and EXEC mask in the Order: this needs #390 first. #491 and #495 also carry #390 and change the same BDA files further (ResourceTracker.cpp, SpirvBda.hpp, SpirvBdaRead.cpp, plus RdnaOpcode.hpp), so whichever of them lands after this one needs a rebase. Once #390 is in, a rebase down to the last commit is all this needs.
|
Decode FLAT opcode 0x17 in the global segment and store the data VGPR of each active lane at the SGPR pair base plus the signed offset plus four times the lane id, sharing the address path of global_load_dword_addtid. Co-Authored-By: Claude <noreply@anthropic.com>
f0730c0 to
d044384
Compare
|
Rebased on current main. #390 landed with #491 (be866e4), so this branch is now only the |
|
Thanks for the quick rebase. The branch is now only your addtid commit on main, and the range-diff against f0730c0 shows just the enum context: PPSA21564 has no |
What
Implements
global_store_dword_addtid(FLAT opcode 0x17, global segment), the store half ofglobal_load_dword_addtid(#530). Each active lane stores its data VGPR atsaddr + offset + lane * 4. It reuses the load's decode checks (global segment only, SGPR pair base) and its address path. The two now shareglobalAddtid(inst, write), likedsAddtid.Encoding: the RDNA2 ISA lists it as GLOBAL opcode 23. llvm-mc encodes it from gfx1030 on (
dc5c....), but not for gfx1013, same as the load.The store goes through the flat/global store path that #390 added (merged with #491 as be866e4).
Behaviour measured on HW (gfx1035, wave32 and wave64)
The oracle kernel runs the same instruction list as the test shader and reads back an 8 KiB window around the base. I measured:
ds_write_addtid_b32.HW matched the model on every dword (184 written in wave32, 368 in wave64), and the test's expected memory comes from that same model.
Tested
Linux (CachyOS), RADV and lavapipe. New
agc_driver_global_store_addtidtest: six stores (offsets 0, -256, -1024, 512 masked by EXEC, -2048, 2044; M0 0, 0x40 and 0xffff) in wave32, wave64 native and wave64 split (ComputeTarget(32)). After each dispatch it compares the whole 64 KiB guest block. It also checks the three decode refusals (flat segment, scratch segment, no SGPR base).The test fails without the fix. I checked this with mutations: lane ignored in the address, EXEC ignored, data read from
vdst, M0 added to the address, and wrong refusal text all fail. Likeagc_driver_lds_addtid, the dispatch part skips when subgroups are narrower than a wave (lavapipe, 8 lanes), becauseLaneIdis the subgroup invocation there. The refusals still run on lavapipe.Release build with full ctest. Failing locally, all also failing on
mainwithout this PR, on RADV:agc_driver_pixel_helper_lanesagc_driver_vop3_carry_outagc_driver_global_load_addtid: "wave32 128 threads thread 32 reports lane 32", from RADV's 64-lane subgroup.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)