Repository navigation
gpu/recomp: implement DS_WRITE_ADDTID_B32 and DS_READ_ADDTID_B32 - #79
Merged
Merged
Conversation
Contributor
|
Tested locally on Windows — both Key implementation details verified:
Clean and direct implementation. |
Collaborator
|
Merged. It conflicted with #67 in |
kacper-serewis
pushed a commit
to kacper-serewis/xcl
that referenced
this pull request
Nov 24, 2026
Only ds_write_addtid_b32 / ds_read_addtid_b32 checked the GDS bit (xcl-dev#79). Every other DS instruction with GDS=1 (plain and read2/write2 forms, d16 and 8/16-bit forms, wrxchg2, the read-modify-write atomics) was translated as an access to the group's LDS (xcl_lds): it overwrote the title's groupshared data, read LDS instead of the global data share, and nothing was recorded as unsupported. The GDS check now runs for every DS instruction that reaches LDS memory, after the "LDS outside compute" check, so the ADDTID forms behave exactly as before. ds_swizzle_b32 / ds_bpermute_b32 use no memory and are left as they were. ds_gds_plain_forms_are_unsupported translates DS_ADD_U32, DS_WRITE_B32 and DS_READ_B32 with GDS=1; before the change none was recorded as unsupported and each declared groupshared xcl_lds. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit e642921) (cherry picked from commit 42ab6021e76a5a49cac8dbf3c82c3616e98cc782)
CalvyPZ
pushed a commit
to CalvyPZ/xcl
that referenced
this pull request
Nov 24, 2026
Only ds_write_addtid_b32 / ds_read_addtid_b32 checked the GDS bit (xcl-dev#79). Every other DS instruction with GDS=1 (plain and read2/write2 forms, d16 and 8/16-bit forms, wrxchg2, the read-modify-write atomics) was translated as an access to the group's LDS (xcl_lds): it overwrote the title's groupshared data, read LDS instead of the global data share, and nothing was recorded as unsupported. The GDS check now runs for every DS instruction that reaches LDS memory, after the "LDS outside compute" check, so the ADDTID forms behave exactly as before. ds_swizzle_b32 / ds_bpermute_b32 use no memory and are left as they were. ds_gds_plain_forms_are_unsupported translates DS_ADD_U32, DS_WRITE_B32 and DS_READ_B32 with GDS=1; before the change none was recorded as unsupported and each declared groupshared xcl_lds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
rootw0rm
pushed a commit
to rootw0rm/xcl
that referenced
this pull request
Nov 27, 2026
…nd backend 1d split 1 of 2 (honest split: route halves stay under the line budget). Device frame-clock slots route on Vulkan objects only: xcl-dev#78 SetFrameIntervalX, xcl-dev#79 ScheduleFrameEventX (with ancillary handle routing), xcl-dev#80 WaitFrameEventX, xcl-dev#81 GetFrameStatisticsX — thin adapters over the Linux twin (d3d12x_frame_linux). register_ancillary remembers the schedule block's handles per type (E_INVALIDARG past the 63-handle cap, like Windows; Linux trusts the block — readable() is windows-only); the clock thread signals each with kernelx SetEvent at fire. Unscheduling clears. Null device keeps logging stubs: no behavior change while XCL_VULKAN_BACKEND is unset. Queue xcl-dev#30 PresentX + the real present follow in 1d(ii). Failing-first: the routing test failed pre-fix (E0599 no VulkanQueue; then E_FAIL at xcl-dev#81 with PresentX still stubbed); passes now (slots + ancillary-signal asserts, serialised on CLOCK_SERIAL with the twin's tests). Gates: check -p xcl --tests EXIT 0 (40 pre-existing warnings, none new); check --workspace EXIT 0; lib 794 passed/0 failed/1 ignored (+1 new). Title e2e + retail controls run at 1d(ii).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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).