feat(shader): implement global_load_dword_addtid #530
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/530"
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 boykopovar/AnyPS5. Originally posted by DotDebian on 2026-10-04T15:10:15Z.
What
Implements
global_load_dword_addtid(FLAT opcode0x16, global segment), which was rejected asFLAT opcode is not supported.SGPR[saddr] (64-bit) + sign-extended 12-bit offset + lane * 4; one dword is loaded intovdstfor each lane active in EXEC. The instruction has novaddr.LaneIdthatds_read_addtid_b32already uses.off, VCC). Theoffform would read from a null base.tools/progress.pyis unchanged: the new enum name maps toGLOBAL_LOAD_DWORD_ADDTIDby itself.global_store_dword_addtidis not included: main still rejects stores through global addresses, which #390 adds. It can follow once that lands.Sources: encoding from LLVM (
FLATInstructions.td,test/MC/AMDGPU/gfx1030_new.s); semantics from AMD's rocjitsu emulator (ROCm/rocm-systems,emulation/rocjitsu, generatedrdna2/flat_exec.cpp,GlobalLoadDwordAddtidFlat).Tested
Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA RTX 5080 (subgroup size 32). No title.
agc_driver_global_load_addtid(tests/execution/GlobalLoadAddtid.cpp): a compute shader reports its lane withv_mbcnt_lo/hi_u32_b32and loads with a positive offset, a negative offset and under a partial EXEC mask; run as wave32 and wave64 with 32, 64 and 128 threads. It also checks the two rejections. The expected values use the lane the shader reports, so the test does not assume a host lane order.FLAT opcode is not supported) and passes with this change. Scaling the lane by 8 instead of 4 makes it fail.ctest: 184/184 passed.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-04T15:10:37Z.
Progress report (
2cf901b→a701cfb)📈 GPU shader instructions: 80.36% (+0.09%, +1 implemented instructions)
✅ 1 implemented
GLOBAL_LOAD_DWORD_ADDTIDImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T21:08:20Z.
Thanks. Checked against AMD's RDNA2 ISA (opcode 22 in the global table, SGPR base plus lane ID as the offset) and the encoding against LLVM. The address is built the same way as the existing SADDR global loads with the lane times 4 in place of the VGPR offset, EXEC masks the load, and the test covers wave32, wave64 on a 32-lane host, a negative offset and a partial EXEC; it fails on main with
FLAT opcode is not supportedand passes here.One note, not a blocker: LLVM only enables this instruction for targets with
FeatureGFX10_BEncoding, which its gfx1013 model doesn't have (llvm-mc -mcpu=gfx1013rejects it, gfx1030 accepts it). If that model is right for the PS5 GPU, no compiled shader will contain it, so it is harmless either way.Ready to merge from my side.