tombox-xshader: decode and translate ds_wrap_rtn_b32 on compute LDS #245
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/245"
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 omonkeyz/xbox-emulator. Originally posted by azerioxfr on 2026-11-23T07:16:53Z.
Library / 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 noteImported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-23T14:08:35Z.
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.Imported from omonkeyz/xbox-emulator. Originally posted by SchmashinPrunes on 2026-11-24T13:20:10Z.
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.)
Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-25T13:08:58Z.
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