Fix guest wave32 GDS counter returns in compute shaders #56

Closed
github-bot wants to merge 1 commit from gh-pr/56/head into gh-pr/56/base
Owner

@⁠philip-roy-jones on GitHub · 2026-11-21 21:39 UTC · original
fix/gds-compute-wave32-returns → main · +151 −56 · 4 files · 1 commits · closed without merging

Library / area: tombox-xshader compute shaders

Exports changed (exports.txt rows): None

Source of the behaviour: AMD RDNA 2 ISA, section 12.13, DS_CONSUME and DS_APPEND and D3D12 wave size requirements.

On WARP, upstream ds_append and ds_consume each return eight distinct old values within a fully active 32-lane guest wave. The final counter total is correct. The existing test skips the per-wave return assertion on WARP. Upstream already includes the M0 addressing change from #21.

Straight-line compute shaders now form a guest EXEC mask in group memory. The first active lane updates the counter once and broadcasts its old value. Counters inside control flow or alongside the 32 KiB LDS mirror require a native wave32. The WARP regression covers full, partial and empty masks, wraparound, consecutive updates and the reserved GDS boundary.

  • cargo test --locked -p tombox-xshader --no-fail-fast on Windows/WARP passed 134 tests on 0fc7295 and 135 on 1c4638e. Both runs had zero failures and the same 12 ignored tests.

  • cargo test --locked -p tombox-xshader --test exec exec_mem::gds:: passed all three upstream cases and all four on this branch. Both opcodes now return one old value per active guest wave on WARP.

  • cargo test --locked --release -p tombox-xshader --test exec exec_mem::gds:: passed all four branch tests. DXC compiled the native path. Execution of that path still needs compatible hardware.

  • Guest wave64 remains unsupported. A separate Shader Model 5.1 FXC smoke check failed on the shared uint64_t preamble on both revisions.

  • cargo test -p tombox-xshader passes

  • No game or console files and no binaries included

  • No fake success; anything not possible is left missing with a note

**@⁠philip-roy-jones** on GitHub · 2026-11-21 21:39 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/56) `fix/gds-compute-wave32-returns` → `main` · +151 −56 · 4 files · 1 commits · closed without merging **Library / area:** `tombox-xshader` compute shaders **Exports changed (exports.txt rows):** None **Source of the behaviour:** [AMD RDNA 2 ISA, section 12.13, DS_CONSUME and DS_APPEND](https://docs.amd.com/api/khub/documents/Et~wpu9g~Ffl7d9q0QZ~Og/content#page=204) and [D3D12 wave size requirements](https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_WaveSize.html). On WARP, upstream `ds_append` and `ds_consume` each return eight distinct old values within a fully active 32-lane guest wave. The final counter total is correct. The existing test skips the per-wave return assertion on WARP. Upstream already includes the M0 addressing change from [#21](https://git.gtahub.st/github/omonkeyz--xbox-emulator/pulls/21). Straight-line compute shaders now form a guest EXEC mask in group memory. The first active lane updates the counter once and broadcasts its old value. Counters inside control flow or alongside the 32 KiB LDS mirror require a native wave32. The WARP regression covers full, partial and empty masks, wraparound, consecutive updates and the reserved GDS boundary. - `cargo test --locked -p tombox-xshader --no-fail-fast` on Windows/WARP passed 134 tests on `0fc7295` and 135 on `1c4638e`. Both runs had zero failures and the same 12 ignored tests. - `cargo test --locked -p tombox-xshader --test exec exec_mem::gds::` passed all three upstream cases and all four on this branch. Both opcodes now return one old value per active guest wave on WARP. - `cargo test --locked --release -p tombox-xshader --test exec exec_mem::gds::` passed all four branch tests. DXC compiled the native path. Execution of that path still needs compatible hardware. - Guest wave64 remains unsupported. A separate Shader Model 5.1 FXC smoke check failed on the shared `uint64_t` preamble on both revisions. - [x] `cargo test -p tombox-xshader` passes - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:08:40 +00:00
github-bot closed this pull request 2026-11-26 06:08:40 +00:00
Author
Owner

@⁠QuentinDanblon on GitHub · 2026-11-21 21:44 UTC · original

FYI, related work: fix/wave32-lane-halves (PR coming) maps a wave32 guest lane L to host lane (WaveGetLaneIndex() & ~31) | (L & 31) for v_readlane/v_writelane, the DPP row mask and the STATUS EXECZ/VCCZ bits, for hosts that run 64-lane waves. It doesn't touch GDS. Your guest-EXEC-in-group-memory approach for ds_append/consume shouldn't conflict, but we both edit hlsl.rs, so whoever lands second rebases.

**@⁠QuentinDanblon** on GitHub · 2026-11-21 21:44 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/56#issuecomment-7069689478) FYI, related work: `fix/wave32-lane-halves` (PR coming) maps a wave32 guest lane L to host lane `(WaveGetLaneIndex() & ~31) | (L & 31)` for v_readlane/v_writelane, the DPP row mask and the STATUS EXECZ/VCCZ bits, for hosts that run 64-lane waves. It doesn't touch GDS. Your guest-EXEC-in-group-memory approach for ds_append/consume shouldn't conflict, but we both edit `hlsl.rs`, so whoever lands second rebases.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.