xshader: FLAT byte/short/d16_hi verified, FLAT offset decode fix (RDNA2 746/779) #25

Closed
QuentinDanblon wants to merge 0 commits from upstream-pr/25 into main
QuentinDanblon commented 2026-11-21 18:01:18 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by QuentinDanblon on 2026-11-21T18:01:18Z.


Library / area: tombox-xshader (FLAT), progress map

Exports changed (exports.txt rows): none

Source of the behaviour: AMD RDNA2 ISA (FLAT offset fields, FLAT_STORE_*_D16_HI)

Stacked on #22: review only the last two commits.

Scope change: LDS atomics (#23) and MTBUF d16 were claimed first in #17 by @SchmashinPrunes, and the d16 PR is in progress. Both are removed here. This PR is now FLAT only.

FLAT

  • FLAT/global ubyte/sbyte/ushort/sshort loads with zero/sign extension; byte/short/dword(x2/x3/x4) stores; _d16_hi stores of S0[23:16] / S0[31:16]. Each is tested in three address forms: SGPR base + VGPR offset, 64-bit VGPR address, FLAT segment.
  • Decoder fix: the FLAT segment takes an 11-bit unsigned offset (MSB ignored) and ignores SADDR. Only scratch/global offsets are 12-bit signed. The old decoder sign-extended for every segment. This also changes the s_getpc code-table path for FLAT loads; the old negative-offset FLAT test case was not encodable and is replaced.
  • New refusal: FLAT with LDS=1 (memory→LDS transfer). This bit used to be silently ignored.
  • tests/exec_mem/mod.rs: a shared verified() writes the TOMBOX_EXEC_VERIFIED list for every runner.

Tests (WARP, DXC 1.9.2609, #22 + this)

  • Full --test exec (measured with the d16 commit still included): 64 pass, 4 fail. The 4 failures are the vop::basic ones present on main, fixed by #24.
  • New group flat_global: 16 mnemonics, 78 cases + 78 runtime reruns. All 24 exec_mem::* tests pass on this exact tree.
  • --lib 8, --test opcodes 22, --test synthetic 7: all pass.
  • Mutation check: shifting d16_hi stores by 8 instead of 16 makes flat_global fail.

Progress

12 more mnemonics verified. RDNA2 instructions 734/779 → 746/779.

  • cargo test -p tombox-xshader passes (except the vop::basic failures already on main, fixed in #24)
  • 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:6532470484 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/25). Originally posted by [QuentinDanblon](https://github.com/QuentinDanblon) on 2026-11-21T18:01:18Z. --- **Library / area:** tombox-xshader (FLAT), progress map **Exports changed (exports.txt rows):** none **Source of the behaviour:** AMD RDNA2 ISA (FLAT offset fields, FLAT_STORE_*_D16_HI) **Stacked on #22**: review only the last two commits. **Scope change:** LDS atomics (#23) and MTBUF d16 were claimed first in #17 by @SchmashinPrunes, and the d16 PR is in progress. Both are removed here. This PR is now FLAT only. ### FLAT - FLAT/global ubyte/sbyte/ushort/sshort loads with zero/sign extension; byte/short/dword(x2/x3/x4) stores; `_d16_hi` stores of S0[23:16] / S0[31:16]. Each is tested in three address forms: SGPR base + VGPR offset, 64-bit VGPR address, FLAT segment. - **Decoder fix:** the FLAT segment takes an 11-bit *unsigned* offset (MSB ignored) and ignores SADDR. Only scratch/global offsets are 12-bit signed. The old decoder sign-extended for every segment. This also changes the s_getpc code-table path for FLAT loads; the old negative-offset FLAT test case was not encodable and is replaced. - **New refusal:** FLAT with LDS=1 (memory→LDS transfer). This bit used to be silently ignored. - `tests/exec_mem/mod.rs`: a shared `verified()` writes the TOMBOX_EXEC_VERIFIED list for every runner. ### Tests (WARP, DXC 1.9.2609, #22 + this) - Full `--test exec` (measured with the d16 commit still included): 64 pass, 4 fail. The 4 failures are the `vop::basic` ones present on main, fixed by #24. - New group flat_global: 16 mnemonics, 78 cases + 78 runtime reruns. All 24 `exec_mem::*` tests pass on this exact tree. - `--lib` 8, `--test opcodes` 22, `--test synthetic` 7: all pass. - Mutation check: shifting d16_hi stores by 8 instead of 16 makes flat_global fail. ### Progress 12 more mnemonics verified. **RDNA2 instructions 734/779 → 746/779.** - [x] `cargo test -p tombox-xshader` passes (except the `vop::basic` failures already on main, fixed in #24) - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note
SchmashinPrunes commented 2026-11-21 18:44:40 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by SchmashinPrunes on 2026-11-21T18:44:40Z.


PR for the MTBUf d16 part of that claim is in progress, should be pushing soon

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7067479980 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/25#issuecomment-7067479980). Originally posted by [SchmashinPrunes](https://github.com/SchmashinPrunes) on 2026-11-21T18:44:40Z. --- PR for the MTBUf d16 part of that claim is in progress, should be pushing soon
QuentinDanblon commented 2026-11-21 18:48:09 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by QuentinDanblon on 2026-11-21T18:48:09Z.


@SchmashinPrunes thanks, I've removed MTBUF d16 from this PR, which is now FLAT only. For comparison, my d16 version is commit 40159df on QuentinDanblon:ref/mtbuf-d16. It refuses loads from UNORM/SNORM, 32-bit and 16-bit scaled formats, because the ISA gives no rounding/clamp rule for 'converted to 16 bits', and it has 813 d16 cases that pass on WARP. Use whatever helps.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7067523509 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/25#issuecomment-7067523509). Originally posted by [QuentinDanblon](https://github.com/QuentinDanblon) on 2026-11-21T18:48:09Z. --- @SchmashinPrunes thanks, I've removed MTBUF d16 from this PR, which is now FLAT only. For comparison, my d16 version is commit 40159df on [QuentinDanblon:ref/mtbuf-d16](https://github.com/QuentinDanblon/xbox-emulator/commit/40159df). It refuses loads from UNORM/SNORM, 32-bit and 16-bit scaled formats, because the ISA gives no rounding/clamp rule for 'converted to 16 bits', and it has 813 d16 cases that pass on WARP. Use whatever helps.
QuentinDanblon commented 2026-11-21 21:03:25 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by QuentinDanblon on 2026-11-21T21:03:25Z.


Merged in the source sync 1159c96 (adapted). Thanks! Closing.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7069202759 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/25#issuecomment-7069202759). Originally posted by [QuentinDanblon](https://github.com/QuentinDanblon) on 2026-11-21T21:03:25Z. --- Merged in the source sync 1159c96 (adapted). Thanks! Closing.

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!25
No description provided.