tests: native_sdwa_f16 checks and native_cvt_pk_u8_hardware fail on main #3052

Open
opened 2026-11-27 11:51:16 +00:00 by pigalot · 8 comments
pigalot commented 2026-11-27 11:51:16 +00:00 (Migrated from github.com)
Contributor

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


Three native compute tests fail on main 1c879506 (and on 98007de5). There are two separate causes.

Environment: 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_(ir|hardware)|native_cvt_pk_u8_(controls|hardware))$' -V
Test Result
native_sdwa_f16_ir fails, e.g. (0, 'add', '0xa55a4200', '0xa55a4200')
native_sdwa_f16_hardware fails the same way
native_cvt_pk_u8_controls pass
native_cvt_pk_u8_hardware fails: [(8, '0xa5a5a501', '0xa5a5a500'), (24, …), (40, …), …]

Pull-request CI runs only the pr smoke preset, and the full -E '_hardware$' run on main has been cancelled by later pushes. That may be why the IR failure was not seen.

1. native_sdwa_f16_*: the shared comparator now requires HI_A

This does not depend on the GPU. native_sdwa_f16_ir uses no device.

  • Case.matches() in tests/native_sdwa_f16_check.py passes the extracted 16-bit half to native_f16_alu_check.same_half.
  • #3020 (f6cdee10) changed same_half to require got >> 16 == HI_A >> 16 (0xabcd), because the non-SDWA forms now keep D[31:16].
  • A shifted 16-bit half always has 0 above bit 16. So same_half returns False for every SDWA case, even when the word is identical to the expected one.
  • The SDWA test already compares the bits outside the mask exactly, so it only needs the old low-half comparison: equal halves, with any NaN matching any NaN.
  • One possible fix is a low-half helper (or a high= parameter) in native_f16_alu_check.py, used by native_sdwa_f16_check.py. That keeps #3020's stricter check for the non-SDWA forms.

2. native_cvt_pk_u8_hardware: literal 0.5 becomes 1 on this driver

  • The failing word is case 0 in every lane: S0 = 0.5 as a v_mov_b32 literal, select 0. The reference expects 0 (ties to even); the GPU returns 1.
  • The other 15 cases pass, including the ties 1.5, 2.5 and 254.5.
  • The DXIL that compile_dxil emits keeps the operation: bitcast → FMin (36) with 255.0 → Round_ne (26) → fptoui, with no folding.
  • The readback was never measured upstream: #2998 reports a skip (77) on a GPU without shader model 6.6.

A scratch run of the same program (not committed) compared two sources:

S0 Lanes Result
v_cvt_f32_u32 v1, v0 then v_mul_f32 v1, 0.5, v1, so 0.5 × lane, computed at run time 0–7: 0.0, 0.5 … 3.5 0 0 1 2 2 2 3 4, all ties to even
literal 0.5 every lane 1
  • Computed at run time, 0.5 rounds to 0. The wrong result appears only when the value is a compile-time constant.
  • My reading is that the NVIDIA driver's shader compiler folds Round_ne(0.5) (or fptoui(Round_ne(0.5))) to 1. That is a hypothesis: I have not looked at the driver's ISA and have not run this on AMD or WARP.
  • The HLSL paths that cover the same tie, startup_gfx2hlsl_cvt_pk_u8_hardware, compute_store_aot_alu_cvt_pk_u8_hardware, pixel_aot_rndne_hardware and startup_gfx2hlsl_float_round_hardware, pass on this GPU. With a literal, dxc probably folds round(0.5) itself, so the driver never sees it.

Possible directions; the choice is for the maintainers:

  • also feed each S0 at run time (for example from a lane-derived or loaded value), and keep the literal cases;
  • or record the literal-0.5 result as a known driver difference.

I'd rather not change the expected value, since RDNA 2 was measured as ties-to-even.

I can send a PR for part 1 if that helps. This issue was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6645860037 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3052). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-27T11:51:16Z. --- Three native compute tests fail on `main` `1c879506` (and on `98007de5`). There are two separate causes. Environment: 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_(ir|hardware)|native_cvt_pk_u8_(controls|hardware))$' -V ``` | Test | Result | |---|---| | `native_sdwa_f16_ir` | fails, e.g. `(0, 'add', '0xa55a4200', '0xa55a4200')` | | `native_sdwa_f16_hardware` | fails the same way | | `native_cvt_pk_u8_controls` | pass | | `native_cvt_pk_u8_hardware` | fails: `[(8, '0xa5a5a501', '0xa5a5a500'), (24, …), (40, …), …]` | Pull-request CI runs only the `pr` smoke preset, and the full `-E '_hardware$'` run on `main` has been cancelled by later pushes. That may be why the IR failure was not seen. ## 1. `native_sdwa_f16_*`: the shared comparator now requires `HI_A` This does not depend on the GPU. `native_sdwa_f16_ir` uses no device. - `Case.matches()` in `tests/native_sdwa_f16_check.py` passes the extracted 16-bit half to `native_f16_alu_check.same_half`. - #3020 (f6cdee10) changed `same_half` to require `got >> 16 == HI_A >> 16` (`0xabcd`), because the non-SDWA forms now keep D[31:16]. - A shifted 16-bit half always has 0 above bit 16. So `same_half` returns False for every SDWA case, even when the word is identical to the expected one. - The SDWA test already compares the bits outside the mask exactly, so it only needs the old low-half comparison: equal halves, with any NaN matching any NaN. - One possible fix is a low-half helper (or a `high=` parameter) in `native_f16_alu_check.py`, used by `native_sdwa_f16_check.py`. That keeps #3020's stricter check for the non-SDWA forms. ## 2. `native_cvt_pk_u8_hardware`: literal 0.5 becomes 1 on this driver - The failing word is case 0 in every lane: S0 = `0.5` as a `v_mov_b32` literal, select 0. The reference expects 0 (ties to even); the GPU returns 1. - The other 15 cases pass, including the ties 1.5, 2.5 and 254.5. - The DXIL that `compile_dxil` emits keeps the operation: `bitcast` → `FMin` (36) with 255.0 → `Round_ne` (26) → `fptoui`, with no folding. - The readback was never measured upstream: #2998 reports a skip (77) on a GPU without shader model 6.6. A scratch run of the same program (not committed) compared two sources: | S0 | Lanes | Result | |---|---|---| | `v_cvt_f32_u32 v1, v0` then `v_mul_f32 v1, 0.5, v1`, so 0.5 × lane, computed at run time | 0–7: 0.0, 0.5 … 3.5 | 0 0 1 2 2 2 3 4, all ties to even | | literal `0.5` | every lane | 1 | - Computed at run time, 0.5 rounds to 0. The wrong result appears only when the value is a compile-time constant. - My reading is that the NVIDIA driver's shader compiler folds `Round_ne(0.5)` (or `fptoui(Round_ne(0.5))`) to 1. That is a hypothesis: I have not looked at the driver's ISA and have not run this on AMD or WARP. - The HLSL paths that cover the same tie, `startup_gfx2hlsl_cvt_pk_u8_hardware`, `compute_store_aot_alu_cvt_pk_u8_hardware`, `pixel_aot_rndne_hardware` and `startup_gfx2hlsl_float_round_hardware`, pass on this GPU. With a literal, `dxc` probably folds `round(0.5)` itself, so the driver never sees it. Possible directions; the choice is for the maintainers: - also feed each S0 at run time (for example from a lane-derived or loaded value), and keep the literal cases; - or record the literal-0.5 result as a known driver difference. I'd rather not change the expected value, since RDNA 2 was measured as ties-to-even. I can send a PR for part 1 if that helps. This issue was AI-assisted.
akimfomin commented 2026-11-27 12:05:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by akimfomin on 2026-11-27T12:05:00Z.


pigalot’s literal-versus-lane comparison leaves the expected tie unchanged. PortBridge found an independent reference in AnyPS5 #501: their gfx1035-tested SPIR-V path expresses ties-to-even with an explicit integer/fraction check. An independently written CPU check of that arithmetic matched an exact decimal oracle on 10,776 binary32 inputs, including every positive half tie below 255 and its two neighbors.

The next useful control is your existing DXIL test with both literal and lane-derived 0.5 on AMD and WARP. I added exact inputs and reporting to PortBridge Lab #121. If a freshly written integer/fraction lowering is tried, verify the emitted operations as well as the readback because optimization might restore the rounding intrinsic. The AnyPS5 code and hardware results belong to that team. This reference does not establish the NVIDIA cause or a DXIL fix.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7217818302 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3052#issuecomment-7217818302). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-27T12:05:00Z. --- pigalot’s literal-versus-lane comparison leaves the expected tie unchanged. PortBridge found an independent reference in [AnyPS5 #501](https://github.com/boykopovar/AnyPS5/pull/501): their gfx1035-tested SPIR-V path expresses ties-to-even with an explicit integer/fraction check. An independently written CPU check of that arithmetic matched an exact decimal oracle on 10,776 binary32 inputs, including every positive half tie below 255 and its two neighbors. The next useful control is your existing DXIL test with both literal and lane-derived 0.5 on AMD and WARP. I added exact inputs and reporting to [PortBridge Lab #121](https://github.com/akimfomin/PortBridge/issues/121). If a freshly written integer/fraction lowering is tried, verify the emitted operations as well as the readback because optimization might restore the rounding intrinsic. The AnyPS5 code and hardware results belong to that team. This reference does not establish the NVIDIA cause or a DXIL fix.
R0Y00 commented 2026-11-27 12:07:27 +00:00 (Migrated from github.com)
Author
Contributor

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


Part 1 landed in #3053. Independent check for part 2 on main 35f7197e: native_cvt_pk_u8_check.py controls <compile_dxil> <sdk> passed and hardware <native_store_replay> <sdk> failed with the same first mismatch in Debug and Release /O2 on RTX 4060 Laptop (driver 32.0.16.1656, Windows 11 26200.9974, SDK 10.0.26100, native fixture debug layer off). Word 8 was 0xa5a5a501, expected 0xa5a5a500; the shown mismatches repeat every 16 words. This reproduces literal 0.5 on another NVIDIA adapter. The expected tie-to-even value stays 0. I did not measure the AMD/WARP literal-versus-lane control.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7217866753 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3052#issuecomment-7217866753). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T12:07:27Z. --- Part 1 landed in #3053. Independent check for part 2 on `main` `35f7197e`: `native_cvt_pk_u8_check.py controls <compile_dxil> <sdk>` passed and `hardware <native_store_replay> <sdk>` failed with the same first mismatch in Debug and Release `/O2` on RTX 4060 Laptop (driver 32.0.16.1656, Windows 11 26200.9974, SDK 10.0.26100, native fixture debug layer off). Word 8 was `0xa5a5a501`, expected `0xa5a5a500`; the shown mismatches repeat every 16 words. This reproduces literal 0.5 on another NVIDIA adapter. The expected tie-to-even value stays 0. I did not measure the AMD/WARP literal-versus-lane control.
RonLogic commented 2026-11-27 12:58:54 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-27T12:58:54Z.


I reproduced the packed-U8 failure independently on an RTX 4070 at fca7c35b: Release readback first differs at word 8 (0xa5a5a501, expected 0xa5a5a500). I’ll take the direct compute follow-up and test an integer lowering of the measured ties-even conversion against both literal and lane-derived inputs. The SDWA comparator work from #3053 is separate.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7218912199 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3052#issuecomment-7218912199). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-27T12:58:54Z. --- I reproduced the packed-U8 failure independently on an RTX 4070 at `fca7c35b`: Release readback first differs at word 8 (`0xa5a5a501`, expected `0xa5a5a500`). I’ll take the direct compute follow-up and test an integer lowering of the measured ties-even conversion against both literal and lane-derived inputs. The SDWA comparator work from #3053 is separate.
R0Y00 commented 2026-11-27 13:32:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T13:32:13Z.


The direct packed-U8 fix merged in #3058 (246857e4); #3053 already fixed the SDWA comparator. In independent Debug and Release /O2 tests on the RTX 4060 Laptop, both the literal and lane-derived packed-U8 replays now matched all 2,064 words, including guards. The related HLSL WARP tests also passed. Native AMD and the original RTX 5090 report are still useful confirmations. If you can rerun the four original entries on that RTX 5090, please post the exact main commit and result.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7219604498 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3052#issuecomment-7219604498). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T13:32:13Z. --- The direct packed-U8 fix merged in #3058 (`246857e4`); #3053 already fixed the SDWA comparator. In independent Debug and Release `/O2` tests on the RTX 4060 Laptop, both the literal and lane-derived packed-U8 replays now matched all 2,064 words, including guards. The related HLSL WARP tests also passed. Native AMD and the original RTX 5090 report are still useful confirmations. If you can rerun the four original entries on that RTX 5090, please post the exact main commit and result.
lambirou commented 2026-11-27 17:04:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-27T17:04:07Z.


Independent Windows receipt for the fixes on main 2641cc72.

Windows build 10.0.26300.10075, AMD Radeon RX 9060 XT (driver 32.0.32029.2010), D3D12 debug layer not enabled.

ctest --preset dev --no-tests=error -R '^(native_sdwa_f16_(ir|hardware)|native_cvt_pk_u8_(controls|hardware))$' -V

4/4 passed, no skips:

  • native_sdwa_f16_ir: 17 results and 10 refusals.
  • native_cvt_pk_u8_controls: literal and lane-derived programs compiled without Round_ne or fptoui; negated source refused; the three references differ.
  • native_sdwa_f16_hardware: 34 results and 2030 guards.
  • native_cvt_pk_u8_hardware: literal and lane-derived replays matched all 2064 words (1024 results, guards and sentinels).

A second adapter and driver confirm the merged #3053/#3058 fix.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7223989165 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3052#issuecomment-7223989165). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-27T17:04:07Z. --- Independent Windows receipt for the fixes on `main` `2641cc72`. Windows build 10.0.26300.10075, AMD Radeon RX 9060 XT (driver 32.0.32029.2010), D3D12 debug layer not enabled. ``` ctest --preset dev --no-tests=error -R '^(native_sdwa_f16_(ir|hardware)|native_cvt_pk_u8_(controls|hardware))$' -V ``` 4/4 passed, no skips: - `native_sdwa_f16_ir`: 17 results and 10 refusals. - `native_cvt_pk_u8_controls`: literal and lane-derived programs compiled without Round_ne or fptoui; negated source refused; the three references differ. - `native_sdwa_f16_hardware`: 34 results and 2030 guards. - `native_cvt_pk_u8_hardware`: literal and lane-derived replays matched all 2064 words (1024 results, guards and sentinels). A second adapter and driver confirm the merged #3053/#3058 fix.
akimfomin commented 2026-11-27 17:52:42 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by akimfomin on 2026-11-27T17:52:42Z.


One more independent hardware result for #3058. jstrdev ran the two synthetic packed-U8 checks on a physical Intel Arc B580 at 246857e4593880fbc19ab18eb1d4a56ba8370ad6, Windows Debug, driver 32.0.101.9175. Both passed with zero skips, and both literal and lane-derived readbacks matched all 2,064 words. jstrdev’s report and controls

The run also exposed a test setup gap on multi-GPU machines. At that revision native_store_replay.cpp opens the default device. The XBOX2WINDOWS_ADAPTER setting is handled by the shared test helper, which this runner doesn't use. jstrdev independently checked that the default was the B580 for the recorded run. Printing the selected adapter LUID would make future receipts unambiguous, even when DXGI lists several adapters with identical names. PortBridge coordinated the independent run.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7224882175 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3052#issuecomment-7224882175). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-27T17:52:42Z. --- One more independent hardware result for #3058. jstrdev ran the two synthetic packed-U8 checks on a physical Intel Arc B580 at `246857e4593880fbc19ab18eb1d4a56ba8370ad6`, Windows Debug, driver 32.0.101.9175. Both passed with zero skips, and both literal and lane-derived readbacks matched all 2,064 words. [jstrdev’s report and controls](https://github.com/akimfomin/PortBridge/issues/121#issuecomment-7224783967) The run also exposed a test setup gap on multi-GPU machines. At that revision [native_store_replay.cpp](https://github.com/R0Y00/Xbox2Windows/blob/246857e4593880fbc19ab18eb1d4a56ba8370ad6/tests/native_store_replay.cpp#L45) opens the default device. The `XBOX2WINDOWS_ADAPTER` setting is handled by the [shared test helper](https://github.com/R0Y00/Xbox2Windows/blob/246857e4593880fbc19ab18eb1d4a56ba8370ad6/tests/xmem_test_device.h#L45), which this runner doesn't use. jstrdev independently checked that the default was the B580 for the recorded run. Printing the selected adapter LUID would make future receipts unambiguous, even when DXGI lists several adapters with identical names. PortBridge coordinated the independent run.
RonLogic commented 2026-11-27 18:56:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-27T18:56:10Z.


I reproduced the adapter-selection gap raised in the Arc report. On Windows 11 and RTX 4070, a native_store_replay binary built from the same runner source as main 88cddb09 still completed both packed-U8 dispatches with XBOX2WINDOWS_ADAPTER='no adapter has this name'. I’ll take this test-runner follow-up: honor an explicit adapter filter, reject an unmatched filter before dispatch, and print the actual device’s adapter identity and LUID for hardware reports.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7226021506 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3052#issuecomment-7226021506). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-27T18:56:10Z. --- I reproduced the adapter-selection gap raised in the Arc report. On Windows 11 and RTX 4070, a `native_store_replay` binary built from the same runner source as `main` `88cddb09` still completed both packed-U8 dispatches with `XBOX2WINDOWS_ADAPTER='no adapter has this name'`. I’ll take this test-runner follow-up: honor an explicit adapter filter, reject an unmatched filter before dispatch, and print the actual device’s adapter identity and LUID for hardware reports.
Leyukaka commented 2026-11-29 03:07:47 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T03:07:47Z.


Both causes are fixed on main: #3053 (d6457679) for the native_sdwa_f16_* comparator and #3058 (246857e4) for native_cvt_pk_u8_hardware. The adapter filter gap raised above is fixed by #3155 (5fc9f6ff). The four original entries passed 4/4 on RX 9060 XT at 2641cc72 (above); the packed-U8 replays were also reported passing on RTX 4060 Laptop and Arc B580. native_sdwa_f16_ir and native_cvt_pk_u8_controls pass in both Windows jobs of main run 46194701708 (0614f68c); that run is red on five other tests. The RTX 5090 rerun asked for on 11-27 has not been posted. Close now, or wait for it?

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7249858668 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3052#issuecomment-7249858668). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T03:07:47Z. --- Both causes are fixed on `main`: #3053 (`d6457679`) for the `native_sdwa_f16_*` comparator and #3058 (`246857e4`) for `native_cvt_pk_u8_hardware`. The adapter filter gap raised above is fixed by #3155 (`5fc9f6ff`). The four original entries passed 4/4 on RX 9060 XT at `2641cc72` (above); the packed-U8 replays were also reported passing on RTX 4060 Laptop and Arc B580. `native_sdwa_f16_ir` and `native_cvt_pk_u8_controls` pass in both Windows jobs of `main` run 46194701708 (`0614f68c`); that run is red on five other tests. The RTX 5090 rerun asked for on 11-27 has not been posted. Close now, or wait for it?
Sign in to join this conversation.
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#3052
No description provided.