xshader: wave32 lane ops address the guest half on 64-lane host waves #62

Closed
QuentinDanblon wants to merge 0 commits from upstream-pr/62 into main
QuentinDanblon commented 2026-11-21 22:02:38 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by QuentinDanblon on 2026-11-21T22:02:38Z.


Library / area: tombox-xshader: wave32 guest lane numbering on 64-lane host waves

Exports changed (exports.txt rows): none

Source of the behaviour: RDNA2 ISA (wave32 lanes 0-31). The observation that AMD drivers can run fragment subgroups 64 wide comes from americas-recomp (GPL, observation only, measured on Vulkan with an RX 7800 XT).

Guest lane numbers were used as absolute host lane indices (WaveReadLaneAt(x, lane & 31), writelane comparing WaveGetLaneIndex() == lane & 31, the DPP row mask row_mask >> (lane >> 4), and STATUS EXECZ/VCCZ via a whole-wave AnyTrue). On a host that runs 64-lane waves, host lanes 32-63 are a second guest wave and would read or write the first one's lanes. ds_ext.rs already used the half base.

  • guest_lane(L) = (WaveGetLaneIndex() & ~31) | (L & 31) for wave32 guests (wave64 guests unchanged), used by v_readlane and v_writelane.
  • guest_any(c): STATUS EXECZ/VCCZ use the ballot word of the lane's own half.
  • DPP row-mask index uses (l >> 4) & 1 for wave32 guests.
  • GDS ds_append/ds_consume (upstream's WaveActiveBallot version) count and elect within the lane's half.
  • On ≤32-lane hosts the half base is 0: one AND/OR more, same results.

Tests

  • WARP: --test opcodes 23/23, including the new lane_numbering_follows_guest_wave (it checks the emitted HLSL for wave32 and that wave64 output is unchanged).

  • WARP: --test exec vop::lanes, exec_mem::ds and exec_mem::gds pass, 12/12.

  • Earlier, on the pre-sync base, the RTX 5090 lane tests passed: readlane/writelane 15/15, permlane 128/128, DPP 406/406.

  • No adapter here runs 64-lane waves (RTX 5090, Intel UHD 770, WARP), so the 64-wide case itself is not executed.

  • cargo test -p tombox-xshader (lane subsets) passes

  • No game or console files and no binaries included

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

<!-- greyfinch-sync:omonkeyz/xbox-emulator:issue:6534971453 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/62). Originally posted by [QuentinDanblon](https://github.com/QuentinDanblon) on 2026-11-21T22:02:38Z. --- **Library / area:** tombox-xshader: wave32 guest lane numbering on 64-lane host waves **Exports changed (exports.txt rows):** none **Source of the behaviour:** RDNA2 ISA (wave32 lanes 0-31). The observation that AMD drivers can run fragment subgroups 64 wide comes from americas-recomp (GPL, observation only, measured on Vulkan with an RX 7800 XT). Guest lane numbers were used as absolute host lane indices (`WaveReadLaneAt(x, lane & 31)`, writelane comparing `WaveGetLaneIndex() == lane & 31`, the DPP row mask `row_mask >> (lane >> 4)`, and STATUS EXECZ/VCCZ via a whole-wave AnyTrue). On a host that runs 64-lane waves, host lanes 32-63 are a second guest wave and would read or write the first one's lanes. `ds_ext.rs` already used the half base. - `guest_lane(L)` = `(WaveGetLaneIndex() & ~31) | (L & 31)` for wave32 guests (wave64 guests unchanged), used by v_readlane and v_writelane. - `guest_any(c)`: STATUS EXECZ/VCCZ use the ballot word of the lane's own half. - DPP row-mask index uses `(l >> 4) & 1` for wave32 guests. - GDS `ds_append`/`ds_consume` (upstream's WaveActiveBallot version) count and elect within the lane's half. - On ≤32-lane hosts the half base is 0: one AND/OR more, same results. ### Tests - WARP: `--test opcodes` 23/23, including the new `lane_numbering_follows_guest_wave` (it checks the emitted HLSL for wave32 and that wave64 output is unchanged). - WARP: `--test exec` vop::lanes, exec_mem::ds and exec_mem::gds pass, 12/12. - Earlier, on the pre-sync base, the RTX 5090 lane tests passed: readlane/writelane 15/15, permlane 128/128, DPP 406/406. - **No adapter here runs 64-lane waves** (RTX 5090, Intel UHD 770, WARP), so the 64-wide case itself is not executed. - [x] `cargo test -p tombox-xshader` (lane subsets) passes - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note
QuentinDanblon commented 2026-11-22 12:03:58 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by QuentinDanblon on 2026-11-22T12:03:58Z.


Folded into #61 (commit 8630ef2, same change rebased on 51f5319), so that everything about real hardware is in one PR. Closing this one.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7078851293 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/62#issuecomment-7078851293). Originally posted by [QuentinDanblon](https://github.com/QuentinDanblon) on 2026-11-22T12:03:58Z. --- Folded into #61 (commit `8630ef2`, same change rebased on `51f5319`), so that everything about real hardware is in one PR. Closing this one.
omonkeyz commented 2026-11-22 13:12:04 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-22T13:12:04Z.


Main's history was rewritten, which auto-closed this PR. It is applied in 93861d6 (merged in 81a1252) with your authorship kept, thanks! (via #61's rebased copy). The added comment lines were stripped on the applied copy (the project keeps code free of comment lines).

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7079639139 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/62#issuecomment-7079639139). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-22T13:12:04Z. --- Main's history was rewritten, which auto-closed this PR. It is applied in 93861d6 (merged in 81a1252) with your authorship kept, thanks! (via #61's rebased copy). The added comment lines were stripped on the applied copy (the project keeps code free of comment lines).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
omonkeyz/xbox-emulator!62
No description provided.