tests: compare SDWA binary16 halves without the kept high half #3053

Manually merged
github merged 1 commit from gh-pr/3053/head into gh-pr/3053/base 2026-11-27 12:08:35 +00:00
Owner

@⁠pigalot on GitHub · 2026-11-27 11:55 UTC · original
pigalot:tests/sdwa-f16-low-half → main · +13 −5 · 2 files · 1 commits · merged 2026-11-27 12:06 UTC

Refs #3052 (part 1, the two native_sdwa_f16_* failures). Part 2, native_cvt_pk_u8_hardware, is a separate cause and is not touched here.

Change

#3020 made native_f16_alu_check.same_half require the kept HI_A in bits 31:16 of the stored word. native_sdwa_f16_check.Case.matches() passes it the selected half, already shifted down to 16 bits. So since #3020 every SDWA case has failed, including words equal to the expected one, e.g. (0, 'add', '0xa55a4200', '0xa55a4200').

  • Shared comparator: the 16-bit comparison (bit equality, any NaN matches any NaN) is now same_binary16 in tests/native_f16_alu_check.py.
    • same_half calls it after its HI_A check, so the non-SDWA check is unchanged.
    • native_sdwa_f16_check.py calls it directly. Its bits outside the selected half were already compared exactly.
  • New guard: check_mutants now requires every expected word to match itself. Without that, a comparator that rejects everything satisfied all three mutant asserts.

Only test code changes.

Verification

main eff2dd7a plus this change. Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 5090 (driver 32.0.16.1088), dev preset with the debug layer on.

ctest --preset dev --no-tests=error -R '^native_(sdwa_f16|f16_alu)_' -V
Check Result
native_f16_alu_ir pass: 82 results match the model; 16 refusals carry the named diagnostic
native_f16_alu_hardware pass: 164 words matched the model, high half kept
native_sdwa_f16_ir pass: 17 results and 10 refusals (failed on main)
native_sdwa_f16_hardware pass: 34 results and 2030 guards (failed on main)
Negative control: SDWA check back on same_half native_sdwa_f16_ir fails at the new assert all(case.matches(case.want) ...)
Negative control: same_binary16 returns True for any half native_sdwa_f16_ir fails at the src1 word-swap mutant assert

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture. There is no new fixture; both controls above were run.
  • I updated README/docs when a capability or build requirement changed. Nothing changed.
  • I did not include game files, dumps, distribution links or secrets.

This change was AI-assisted.

**@⁠pigalot** on GitHub · 2026-11-27 11:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3053) `pigalot:tests/sdwa-f16-low-half` → `main` · +13 −5 · 2 files · 1 commits · merged 2026-11-27 12:06 UTC Refs #3052 (part 1, the two `native_sdwa_f16_*` failures). Part 2, `native_cvt_pk_u8_hardware`, is a separate cause and is not touched here. ## Change #3020 made `native_f16_alu_check.same_half` require the kept `HI_A` in bits 31:16 of the stored word. `native_sdwa_f16_check.Case.matches()` passes it the selected half, already shifted down to 16 bits. So since #3020 every SDWA case has failed, including words equal to the expected one, e.g. `(0, 'add', '0xa55a4200', '0xa55a4200')`. - **Shared comparator:** the 16-bit comparison (bit equality, any NaN matches any NaN) is now `same_binary16` in `tests/native_f16_alu_check.py`. - `same_half` calls it after its `HI_A` check, so the non-SDWA check is unchanged. - `native_sdwa_f16_check.py` calls it directly. Its bits outside the selected half were already compared exactly. - **New guard:** `check_mutants` now requires every expected word to match itself. Without that, a comparator that rejects everything satisfied all three mutant asserts. Only test code changes. ## Verification `main` `eff2dd7a` plus this change. Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 5090 (driver 32.0.16.1088), dev preset with the debug layer on. ```powershell ctest --preset dev --no-tests=error -R '^native_(sdwa_f16|f16_alu)_' -V ``` | Check | Result | |---|---| | `native_f16_alu_ir` | pass: `82 results match the model; 16 refusals carry the named diagnostic` | | `native_f16_alu_hardware` | pass: `164 words matched the model, high half kept` | | `native_sdwa_f16_ir` | pass: `17 results and 10 refusals` (failed on `main`) | | `native_sdwa_f16_hardware` | pass: `34 results and 2030 guards` (failed on `main`) | | Negative control: SDWA check back on `same_half` | `native_sdwa_f16_ir` fails at the new `assert all(case.matches(case.want) ...)` | | Negative control: `same_binary16` returns True for any half | `native_sdwa_f16_ir` fails at the `src1` word-swap mutant assert | ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. There is no new fixture; both controls above were run. - [x] I updated README/docs when a capability or build requirement changed. Nothing changed. - [x] I did not include game files, dumps, distribution links or secrets. This change was AI-assisted.
#3020 made native_f16_alu_check.same_half require the kept HI_A in bits
31:16 of the stored word. native_sdwa_f16_check passes it a half that is
already shifted down to 16 bits, so every case failed, including words
equal to the expected one (native_sdwa_f16_ir and _hardware).

The 16-bit comparison (any NaN matches any NaN) is now same_binary16.
same_half calls it after its HI_A check, and the SDWA check calls it
directly. check_mutants also requires every expected word to match
itself, so a comparator that rejects everything fails there instead of
passing the mutant checks.

Refs #3052 (the SDWA part). AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 12:08:34 +00:00
github manually merged commit 4ea1b55423 into gh-pr/3053/base 2026-11-27 12:08:35 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-27 12:06 UTC · original · approved these changes

Reviewed 4ea1b554 with main 35f7197e (integration tree 69466018). The source-only comparator fix preserves exact bits outside the selected half and the existing non-SDWA high-half check. I reproduced the equal-word assertion (a55a4200 vs a55a4200) on clean main in both IR and GPU modes. With this patch, both modes of native_f16_alu_check.py and native_sdwa_f16_check.py passed in Debug and Release /O2 using runtime binaries from that main tree. SDWA matched 17 IR results and 10 refusals, and 34 hardware results plus 2,030 guards. The non-SDWA check still matched 82 IR and 164 GPU results. A separate comparator check rejected the accept-all and reject-all mutants and confirmed NaN handling, signed zero and 16-bit bounds. Windows 11 26200.9974, SDK 10.0.26100, RTX 4060 Laptop driver 32.0.16.1656, native replay debug layer off. The unrelated native_cvt_pk_u8_hardware remains tracked in #3052.

**@⁠R0Y00** on GitHub · 2026-11-27 12:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3053#pullrequestreview-6087868378) · **approved these changes** Reviewed `4ea1b554` with `main` `35f7197e` (integration tree `69466018`). The source-only comparator fix preserves exact bits outside the selected half and the existing non-SDWA high-half check. I reproduced the equal-word assertion (`a55a4200` vs `a55a4200`) on clean main in both IR and GPU modes. With this patch, both modes of `native_f16_alu_check.py` and `native_sdwa_f16_check.py` passed in Debug and Release /O2 using runtime binaries from that main tree. SDWA matched 17 IR results and 10 refusals, and 34 hardware results plus 2,030 guards. The non-SDWA check still matched 82 IR and 164 GPU results. A separate comparator check rejected the accept-all and reject-all mutants and confirmed NaN handling, signed zero and 16-bit bounds. Windows 11 26200.9974, SDK 10.0.26100, RTX 4060 Laptop driver 32.0.16.1656, native replay debug layer off. The unrelated `native_cvt_pk_u8_hardware` remains tracked in #3052.
This discussion has been locked. Commenting is limited to contributors.
No description provided.