tombox-xshader: decode and translate ds_wrap_rtn_b32 on compute LDS #245
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!245
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/245/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?
@azerioxfr on GitHub · 2026-11-23 07:16 UTC · original
azerioxfr:xshader-ds-wrap-rtn→main· +16 −1 · 3 files · 1 commits · closed without mergingLibrary / area: tombox-xshader, compute LDS read-modify-write ops
Exports changed (exports.txt rows): none
Source of the behaviour: opcode from
tests/isa_table/gfx1013.txt(DS 0x34). Semantics from the RDNA2 ISA description ofDS_WRAP_RTN_B32.One topic, +16 / -1: 1 line in
rdna2/mnem.rs, 2 inhlsl.rs, 13 lines of test.What was missing
tests/isa_table.rslists DS 0x34 under "ds: gfx1013 opcodes not named by the decoder".The change
ds_wrap_rtn_b32(0x34)tmp = MEM[addr]; MEM[addr] = tmp >= DATA ? tmp - DATA : tmp + DATA2(unsigned compare, wrapping);vdst = tmpIt uses the same compare-exchange loop as
ds_inc_u32/ds_mskor_b32, so the update is atomic.Tests
ds_lds_mskor_wrxchg2gains sixds_wrap_rtn_b32cases at offsets 0 and 0x104, read back through the neighbouring lane. They cover both branches andtmp == DATA(which gives 0).--release, DXC 1.9.2609)exec_mem::ds::ds_lds_mskor_wrxchg2>instead of>=--test isa_table/--test opcodesRun on
x86_64-pc-windows-gnu(no MSVC linker here). Integer only.cargo test -p tombox-xshader --test exec -- --exact exec_mem::ds::ds_lds_mskor_wrxchg2passesmissingwith a note@omonkeyz on GitHub · 2026-11-23 14:08 UTC · original
Applied locally on main with your authorship kept (cherry-picked,
a1d04e8); the tombox-xshader suite passes in a sandbox (exec 155/155 on WARP). It ships in the next release; this PR will be closed when that is pushed. Thanks.@SchmashinPrunes on GitHub · 2026-11-24 13:20 UTC · original
I checked
ds_wrap_rtn_b32on RDNA2 silicon: a gfx1036 iGPU (Ryzen 5 9600X), ROCm/HIP 5.7.1, one wave32 workgroup with 64 KiB of LDS. That's RDNA2, not gfx1013.d0was often equal to old or old ± 1, to hit the>=edge. The returned value and the stored value matchold >= d0 ? old - d0 : old + d1on all cases.addr + offset, so the offset is added as in the other DS ops.& 8191) wraps such addresses instead. That predates this PR and matters only for out-of-range accesses.(Measured with an AI assistant, Claude.)
@omonkeyz on GitHub · 2026-11-25 13:08 UTC · original
Applied on main in
a1d04e8(cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.Pull request closed