Repository navigation
Backlog
Description
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()intests/native_sdwa_f16_check.pypasses the extracted 16-bit half tonative_f16_alu_check.same_half.- shader: keep D[31:16] in the direct path's binary16 add, sub, subrev and mul #3020 (f6cdee1) changed
same_halfto requiregot >> 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_halfreturns 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) innative_f16_alu_check.py, used bynative_sdwa_f16_check.py. That keeps shader: keep D[31:16] in the direct path's binary16 add, sub, subrev and mul #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.5as av_mov_b32literal, 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_dxilemits keeps the operation:bitcast→FMin(36) with 255.0 →Round_ne(26) →fptoui, with no folding. - The readback was never measured upstream: shader: lower v_cvt_pk_u8_f32 in the direct C++ compute path #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)(orfptoui(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_hardwareandstartup_gfx2hlsl_float_round_hardware, pass on this GPU. With a literal,dxcprobably foldsround(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.
Metadata
Metadata
Assignees
Labels
No labels
Activity
tests: compare SDWA binary16 halves without the kept high half
akimfomin commentedon Nov 27, 2026
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.
tests: compare the selected SDWA binary16 half (#3053)
R0Y00 commentedon Nov 27, 2026
Part 1 landed in #3053. Independent check for part 2 on
main35f7197e:native_cvt_pk_u8_check.py controls <compile_dxil> <sdk>passed andhardware <native_store_replay> <sdk>failed with the same first mismatch in Debug and Release/O2on RTX 4060 Laptop (driver 32.0.16.1656, Windows 11 26200.9974, SDK 10.0.26100, native fixture debug layer off). Word 8 was0xa5a5a501, expected0xa5a5a500; 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 commentedon Nov 27, 2026
I reproduced the packed-U8 failure independently on an RTX 4070 at
fca7c35b: Release readback first differs at word 8 (0xa5a5a501, expected0xa5a5a500). 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.shader: round packed U8 conversions with integer arithmetic (#3058)
R0Y00 commentedon Nov 27, 2026
The direct packed-U8 fix merged in #3058 (
246857e4); #3053 already fixed the SDWA comparator. In independent Debug and Release/O2tests 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 commentedon Nov 27, 2026
Independent Windows receipt for the fixes on
main2641cc72.Windows build 10.0.26300.10075, AMD Radeon RX 9060 XT (driver 32.0.32029.2010), D3D12 debug layer not enabled.
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 commentedon Nov 27, 2026
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 controlsThe run also exposed a test setup gap on multi-GPU machines. At that revision native_store_replay.cpp opens the default device. The
XBOX2WINDOWS_ADAPTERsetting 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.RonLogic commentedon Nov 27, 2026
I reproduced the adapter-selection gap raised in the Arc report. On Windows 11 and RTX 4070, a
native_store_replaybinary built from the same runner source asmain88cddb09still completed both packed-U8 dispatches withXBOX2WINDOWS_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.