xshader tests: sync the s_bfe exec oracles with main (exec back to 70/70 on WARP) #70

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

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


Library / area: tombox-xshader tests (tests/exec.rs, tests/exec_vop/basic.rs). No translator change.

Exports changed (exports.txt rows): none

Source of the behaviour: the translator and the sweep oracle already on main (8491769: s_bfe_u32 width from S1[22:16], s_bfe_i64 arithmetic shift; tests/isa_sweep/ops_s.rs::bfe64). The 32-bit oracle is the one from #38 by @artareias, applied unchanged.

What is wrong on main

8491769 changed the scalar s_bfe lowering and updated the ISA sweep, but two older exec oracles still model the previous behaviour. On WARP, cargo test -p tombox-xshader --release --test exec:

passed failed
0fc7295 70 0
8491769 (main) 68 2
this branch 70 0 (the two tests re-run alone, see below)
  • vop::basic::salu_basic: 26 cases (14 s_bfe_u32, 12 s_bfe_i32; the first are #201/#202, #316/#317, #390/#391), all with a width field of 32 or more. The oracle bfe masks the width to 5 bits and expects 0; the translator returns the shifted value.
  • scalar_sop2 #158 s_bfe_i64 (a = 0x8123456789abcdef, offset 28, width 40): got high word 0xfffffff8, the oracle wants 0x00000008. The oracle shifts logically; the translator and the sweep oracle shift arithmetically for the signed form.

Change

  • tests/exec_vop/basic.rs: the sbfe oracle of #38 (7-bit width; a width of 32 or more selects the whole shifted value). The hlsl.rs half of #38 is already on main, this is the half that was left out.
  • tests/exec.rs: bfe64 shifts arithmetically when signed, the same as isa_sweep/ops_s.rs::bfe64.

Tests

  • WARP: --test exec scalar_sop2 1/1, --test exec salu_basic 1/1 (both fail on main).
  • RTX 5090 (TOMBOX_EXEC_HW=1): same two, 1/1 and 1/1.

Not decided here

A signed field that runs past the top bit (offset + width above 32 or 64) is the one place where the ISA formula read literally ((S0 >> offset) & mask, then sign-extend from bit width - 1) gives a different answer from main: literal zero-fills, main sign-fills. This PR follows main; it does not claim hardware evidence either way. I wrote probe kernels for the rdna2-hwprobe harness of #41 that would measure it on RDNA2 (branch probe/valu-open-questions on my fork, see my comment on #41). They have not been run: I have no AMD GPU.

Also failing on main, not touched here

--test mesh on WARP: 10 passed, 3 failed at 8491769. The new rule that closes the conditional block before an s_barrier in a mesh shader makes the divergent barrier unconditional, so:

  • mesh_divergent_barrier_with_lds_is_refused and mesh_divergent_barrier_with_memory_store_is_refused now translate (they expect the "divergent path" refusal);
  • gpu_mesh_divergent_barrier_without_memory_writes counts 4 GroupMemoryBarrierWithGroupSync() where it expects 3.

If hoisting the barrier is intended, these three tests need new expectations; I left them alone because turning a refusal into an accepted translation is your call.

  • cargo test -p tombox-xshader : the two exec tests fixed here pass on WARP and on an RTX 5090; the three mesh tests above still fail, as on main
  • No game or console files and no binaries included
  • No fake success; anything not possible is left missing with a note

🤖 Generated with Claude Code

<!-- greyfinch-sync:omonkeyz/xbox-emulator:issue:6535474601 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/70). Originally posted by [QuentinDanblon](https://github.com/QuentinDanblon) on 2026-11-21T22:54:47Z. --- **Library / area:** tombox-xshader tests (`tests/exec.rs`, `tests/exec_vop/basic.rs`). No translator change. **Exports changed (exports.txt rows):** none **Source of the behaviour:** the translator and the sweep oracle already on main (`8491769`: `s_bfe_u32` width from S1[22:16], `s_bfe_i64` arithmetic shift; `tests/isa_sweep/ops_s.rs::bfe64`). The 32-bit oracle is the one from #38 by @artareias, applied unchanged. ### What is wrong on main `8491769` changed the scalar `s_bfe` lowering and updated the ISA sweep, but two older exec oracles still model the previous behaviour. On WARP, `cargo test -p tombox-xshader --release --test exec`: | | passed | failed | |---|---|---| | `0fc7295` | 70 | 0 | | `8491769` (main) | 68 | 2 | | this branch | 70 | 0 (the two tests re-run alone, see below) | - `vop::basic::salu_basic`: 26 cases (14 `s_bfe_u32`, 12 `s_bfe_i32`; the first are `#201/#202`, `#316/#317`, `#390/#391`), all with a width field of 32 or more. The oracle `bfe` masks the width to 5 bits and expects 0; the translator returns the shifted value. - `scalar_sop2` `#158 s_bfe_i64` (`a = 0x8123456789abcdef`, offset 28, width 40): got high word `0xfffffff8`, the oracle wants `0x00000008`. The oracle shifts logically; the translator and the sweep oracle shift arithmetically for the signed form. ### Change - `tests/exec_vop/basic.rs`: the `sbfe` oracle of #38 (7-bit width; a width of 32 or more selects the whole shifted value). The `hlsl.rs` half of #38 is already on main, this is the half that was left out. - `tests/exec.rs`: `bfe64` shifts arithmetically when signed, the same as `isa_sweep/ops_s.rs::bfe64`. ### Tests - WARP: `--test exec scalar_sop2` 1/1, `--test exec salu_basic` 1/1 (both fail on main). - RTX 5090 (`TOMBOX_EXEC_HW=1`): same two, 1/1 and 1/1. ### Not decided here A signed field that runs past the top bit (`offset + width` above 32 or 64) is the one place where the ISA formula read literally (`(S0 >> offset) & mask`, then sign-extend from bit `width - 1`) gives a different answer from main: literal zero-fills, main sign-fills. This PR follows main; it does not claim hardware evidence either way. I wrote probe kernels for the `rdna2-hwprobe` harness of #41 that would measure it on RDNA2 (branch `probe/valu-open-questions` on my fork, see my comment on #41). They have not been run: I have no AMD GPU. ### Also failing on main, not touched here `--test mesh` on WARP: 10 passed, 3 failed at `8491769`. The new rule that closes the conditional block before an `s_barrier` in a mesh shader makes the divergent barrier unconditional, so: - `mesh_divergent_barrier_with_lds_is_refused` and `mesh_divergent_barrier_with_memory_store_is_refused` now translate (they expect the "divergent path" refusal); - `gpu_mesh_divergent_barrier_without_memory_writes` counts 4 `GroupMemoryBarrierWithGroupSync()` where it expects 3. If hoisting the barrier is intended, these three tests need new expectations; I left them alone because turning a refusal into an accepted translation is your call. - [x] `cargo test -p tombox-xshader` : the two exec tests fixed here pass on WARP and on an RTX 5090; the three mesh tests above still fail, as on main - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note 🤖 Generated with [Claude Code](https://claude.com/claude-code)
QuentinDanblon commented 2026-11-21 23:42:34 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by QuentinDanblon on 2026-11-21T23:42:34Z.


Update on the three --test mesh failures listed above: #76 by @thatirishguyyy makes them pass by removing the rule that moves a mesh s_barrier out of its branch guard. I tested it (13 / 13 on WARP and on an RTX 5090, 15 / 15 merged with #58) and posted the numbers there, together with what the two options change for a shader that writes LDS or memory.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7071052545 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/70#issuecomment-7071052545). Originally posted by [QuentinDanblon](https://github.com/QuentinDanblon) on 2026-11-21T23:42:34Z. --- Update on the three `--test mesh` failures listed above: #76 by @thatirishguyyy makes them pass by removing the rule that moves a mesh `s_barrier` out of its branch guard. I tested it (13 / 13 on WARP and on an RTX 5090, 15 / 15 merged with #58) and posted the numbers there, together with what the two options change for a shader that writes LDS or memory.
QuentinDanblon commented 2026-11-22 00:07:06 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by QuentinDanblon on 2026-11-22T00:07:06Z.


The section "Not decided here" is now decided by a measurement. @SchmashinPrunes ran the s_bfe probe of #72 on an RDNA2 GPU (gfx1036): https://github.com/omonkeyz/xbox-emulator/pull/41#issuecomment-7071178837

  • 152 of 152 cases match the 7-bit width with sign-fill, which is what main does since 8491769 and what the two oracles in this PR expect. The literal ISA formula (zero-fill) matches 114, width modulo the operand size matches 100.
  • Junk in the unused bits of S1 is ignored. SCC = result != 0.

Status against main f6b979d: this PR is not in main yet, so scalar_sop2 and vop::basic::salu_basic still fail there. The three --test mesh failures are gone, since 59e5ed7 took the change of #76.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7071326054 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/70#issuecomment-7071326054). Originally posted by [QuentinDanblon](https://github.com/QuentinDanblon) on 2026-11-22T00:07:06Z. --- The section "Not decided here" is now decided by a measurement. @SchmashinPrunes ran the `s_bfe` probe of #72 on an RDNA2 GPU (gfx1036): https://github.com/omonkeyz/xbox-emulator/pull/41#issuecomment-7071178837 - 152 of 152 cases match the 7-bit width with sign-fill, which is what main does since `8491769` and what the two oracles in this PR expect. The literal ISA formula (zero-fill) matches 114, width modulo the operand size matches 100. - Junk in the unused bits of S1 is ignored. SCC = result != 0. Status against main `f6b979d`: this PR is not in main yet, so `scalar_sop2` and `vop::basic::salu_basic` still fail there. The three `--test mesh` failures are gone, since `59e5ed7` took the change of #76.
QuentinDanblon commented 2026-11-22 11:37:04 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by QuentinDanblon on 2026-11-22T11:37:04Z.


Main has these oracles in sync now: cargo test -p tombox-xshader --release --test exec passes 73 of 73 on WARP at 51f5319. Closing, nothing left to take from this one.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7078559481 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/70#issuecomment-7078559481). Originally posted by [QuentinDanblon](https://github.com/QuentinDanblon) on 2026-11-22T11:37:04Z. --- Main has these oracles in sync now: `cargo test -p tombox-xshader --release --test exec` passes 73 of 73 on WARP at `51f5319`. Closing, nothing left to take from this one.

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