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

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

@⁠QuentinDanblon on GitHub · 2026-11-21 22:54 UTC · original
QuentinDanblon:test/sbfe-oracle-sync → main · +21 −3 · 2 files · 1 commits · closed without merging

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

**@⁠QuentinDanblon** on GitHub · 2026-11-21 22:54 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/70) `QuentinDanblon:test/sbfe-oracle-sync` → `main` · +21 −3 · 2 files · 1 commits · closed without merging **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)
Since 8491769 the translator takes the scalar s_bfe width from S1[22:16] (7 bits) and
sign-fills a signed 64-bit field that reaches past bit 63, and tests/isa_sweep/ops_s.rs
models that. The two older exec oracles were not updated, so on WARP
`cargo test -p tombox-xshader --release --test exec` went from 70 passed to 68 passed,
2 failed (scalar_sop2 #158 s_bfe_i64, vop::basic::salu_basic 10 s_bfe_u32/i32 cases).

- tests/exec_vop/basic.rs: the scalar oracle `sbfe` from #38 by artareias (7-bit width,
  a width of 32 or more selects the whole shifted value), applied unchanged.
- tests/exec.rs: bfe64 shifts arithmetically for the signed form, as the sweep oracle does.

No translator change. Both tests pass again on WARP.

Co-authored-by: Arthur Areias <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:09:19 +00:00
github-bot closed this pull request 2026-11-26 06:09:19 +00:00
Author
Owner

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

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** on GitHub · 2026-11-21 23:42 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/70#issuecomment-7071052545) 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.
Author
Owner

@⁠QuentinDanblon on GitHub · 2026-11-22 00:07 UTC · original

The section "Not decided here" is now decided by a measurement. @⁠SchmashinPrunes ran the s_bfe probe of #72 on an RDNA2 GPU (gfx1036): #41

  • 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** on GitHub · 2026-11-22 00:07 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/70#issuecomment-7071326054) 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://git.gtahub.st/github/omonkeyz--xbox-emulator/pulls/41 - 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.
Author
Owner

@⁠QuentinDanblon on GitHub · 2026-11-22 11:37 UTC · original

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.

**@⁠QuentinDanblon** on GitHub · 2026-11-22 11:37 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/70#issuecomment-7078559481) 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

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