feat: ds_read_addtid_b32 and ds_write_addtid_b32 in the RDNA 2 interpreter and HLSL — 1,208/1,490 #248
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!248
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/248/head"
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?
@lcg007xd-c on GitHub · 2026-11-25 21:11 UTC · original
lcg007xd-c:feat/rdna2-ds-addtid→main· +142 −26 · 14 files · 1 commits · merged 2026-11-25 21:55 UTCChange
The reference interpreter and the HLSL recompiler now run
ds_write_addtid_b32andds_read_addtid_b32(DS opcodes 176-177). Both raisedUntranslated/Untranslatableuntil now.Source: AMD, "RDNA 2" ISA, November 2020, §12.13 "LDS & GDS Instructions" (printed p. 204):
DS_WRITE_ADDTID_B32: "LDS_GS[LDS_BASE + {OFFSET1,OFFSET0} + M0[15:0] + TID*4].u32 = VGPR[DATA0].u32";DS_READ_ADDTID_B32: "VGPR[VDST].u32 = LDS_GS[LDS_BASE + {OFFSET1,OFFSET0} + M0[15:0] + TID*4].u32".These are the LDS counterpart of the
global_*_dword_addtidof #226, and this PR follows the same pattern:emu/rdna2_exec_memory.py): no VGPR address is read. The dword atM0[15:0] + offset + lane × 4is written or read for the active lanes, andM0[31:16]is ignored. NewLDS_ADD_TIDtable and_lds_add_tid.emu/rdna2_hlsl_memory.py):g_lds[(((s[124] & 0xFFFFu) + offset + lane * 4u) >> 2) % 8128u], with the same group barriers as the other LDS accesses.CROSS_LANE_OPSinrdna2_hlsl_graphics.py, so a pixel shader using them takes the multi-lane path with real lane ids._specificinrdna2_hlsl_wave64.py, like global addtid (lane=SV_GroupIndex0-63, the TID in the wave64).Coverage (
rdna2_exec.coverage()): 1,206 → 1,208 of 1,490. All 9 READMEs stay at 81%. Overlap: other open PRs change the same README number.Linked issue: none.
Verification
Linux (Arch, Python 3.14.10), no C++ runtime, no GPU (runtime and GPU tests skip), rebased rebased on
mainaffaf15:The suite is green on this machine since #237 and #238 merged.
Not run here: the two GPU parity tests. I have no Windows,
dxcor WARP, so they skip locally and will run in the Windows CI job. I did check on the CPU that both GPU programs translate (wave32 and wave64) and that the generatedg_ldslines uses[124] & 0xFFFFuandlane. Please look at the CI result oftest_ds_addtid_matches_interpreter_on_gpuand…_in_wave64_on_gpu.Oracle and test data
tests/test_rdna2_exec_ds_addtid.py(7 tests). Expected values are written by hand:0x20 + 0x104 + lane × 4, with M0 =0xABCD0020(high half ignored) and offset{1, 4}, under a partial EXEC, with nothing written below;0x20 + 252;main(Untranslated/Untranslatable).Checklist
E_NOTIMPL), never a fake success.test_readme_sync.pychecks it).Made with AI assistance (Claude Code).
🤖 Generated with Claude Code
DS 176-177 raised Untranslated. No VGPR address: the LDS dword at {OFFSET1,OFFSET0} + M0[15:0] + lane * 4 (ISA section 12.13, p. 204; M0[31:16] ignored). The interpreter reads/writes it for active lanes; the HLSL recompiler indexes g_lds with lane, like the global addtid of #226: listed as lane-dependent for graphics shaders, and translated in wave64 (lane = SV_GroupIndex). Tests: addresses, partial EXEC, wave64 lane 63, the HLSL text, and GPU parity in wave32 and wave64 (a lane reads its neighbour's write through LDS). README: 1,206 -> 1,208 of 1,490 (81%). Co-Authored-By: Claude Opus 5.5 <[email protected]>