gpu/recomp: implement DS_WRITE_ADDTID_B32 and DS_READ_ADDTID_B32 #79
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!79
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/79/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?
@certified-retart on GitHub · 2026-11-23 01:36 UTC · original
certified-retart:feat/recomp-ds-addtid→main· +102 −1 · 2 files · 1 commits · merged 2026-11-23 10:29 UTCSummary
Implements
DS_WRITE_ADDTID_B32(opcode0xB0) andDS_READ_ADDTID_B32(opcode0xB1) in the RDNA2 → HLSL shader recompiler (gpu::recomp::emit::Emitter::ds).Both opcodes already decoded in
rdna2_spec.rs, butEmitter::dspreviously fell through to the unsupported DS path (after also unnecessarily looking up the unusedADDRVGPR).Changes
crates/xcl/src/gpu/recomp/emit.rs(Emitter::ds):ds_write_addtid_b32andds_read_addtid_b32before the genericADDRVGPR lookup so unusedADDR/DATA1fields are not read or spuriously declared.GDS=1withErr("GDS")before settingself.uses_lds = true.((m0 & 0xFFFFu) + offset16 + 4u * lane_id)(whereoffset16 = OFFSET0 | (OFFSET1 << 8)andm0is SGPR124), indexingxcl_lds[((at) >> 2) & 8191u]consistently with the rest ofEmitter::ds.DATA0) and reads (VDST) on the active lane predicate (EXEC), and updatexcl_gs_baseon active writes during geometry-shader phase.crates/xcl/src/gpu/recomp/tests.rs:ds_addtid_translates_with_m0_offset_and_lane_id: verifies zero unsupported ops,xcl_ldsallocation, exact address expression, ignored nonzeroADDR/DATA1VGPR fields, andGDS=1rejection withoutxcl_ldsallocation.gpu_ds_addtid_roundtrip_and_exec_masking: verifies bidirectional LDS placement (DS_WRITE_B32→DS_READ_ADDTID_B32andDS_WRITE_ADDTID_B32→DS_READ_B32) with nonzeroM0[31:16]andOFFSET1 = 0x40, plus wave64EXECmasking on both writes and reads.Verification
cargo test -p xcl --lib ds_addtid_translates— passed (1 passed; 0 failed).XCL_ADAPTER=1,XCL_REQUIRE_GPU=wave64, D3D12 Agility SDK 1.620.2):cargo test -p xcl --lib gpu_ds_addtid_roundtrip_and_exec_masking -- --test-threads=1— passed (1 passed; 0 failed).@Lum7nt on GitHub · 2026-11-23 05:57 UTC · original
Tested locally on Windows — both
ds_addtid_translates_with_m0_offset_and_lane_idand the GPU dispatch testgpu_ds_addtid_roundtrip_and_exec_maskingpass cleanly.Key implementation details verified:
DS_WRITE_ADDTID_B32andDS_READ_ADDTID_B32before the genericADDRVGPR lookup, ensuring unused VGPR operands are not spuriously emitted into the recompiled shader.((m0 & 0xFFFFu) + offset16 + 4u * lane_id) & 0xFFFFuwith proper masking intoxcl_lds[((at >> 2) & 8191u)].Clean and direct implementation.
@ivall on GitHub · 2026-11-23 10:29 UTC · original
Merged. It conflicted with #67 in
Emitter::ds; resolved keeping #67's split-aware LDS slot, and the addtid forms also clamp below the split wave64 exchange (XCL_X_LDS_TOP) in the split form. Tested on Windows 11 with an RX 9070 (RDNA4):cargo test --workspacegreen with the retail samples (shader pack, console DLLs, texture archive), also withXCL_SPLIT_WAVE64=1(the 32-lane split path forced on RDNA). Unicorn Overlord and XDefiant run with this round merged. Thanks!