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

Merged
pigalot merged 1 commit from upstream-pr/3053 into main 2026-11-27 12:06:43 +00:00
pigalot commented 2026-11-27 11:55:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T11:55:15Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5526189419 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3053). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-27T11:55:15Z. --- 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.
R0Y00 commented 2026-11-27 12:06:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T12:06:28Z.

Review: APPROVED


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6087868378 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3053#pullrequestreview-6087868378). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T12:06:28Z. **Review:** APPROVED --- 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.
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
R0Y00/Xbox2Windows!3053
No description provided.