Shaders: round FP16 transcendentals to nearest in either mode #3617
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3617"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T22:23:24Z.
RDNA2 rounds seven FP16 transcendental instructions to nearest even under both values of the tested rounding field. The published RX 6700 XT sweep ran all input encodings with the original and round-to-zero settings, and the harness validated the MODE bits on the device. Sweep results · MODE check
Use nearest-even narrowing for
v_rcp_f16,v_sqrt_f16,v_rsq_f16,v_log_f16,v_exp_f16,v_sin_f16, andv_cos_f16. Ordinary FP16 conversions continue to use the requested rounding mode.On Windows with app-local WARP 1.0.22 and D3D12 Agility 1.620.2, the synthetic regression reports 7 mismatches out of 28 readbacks on
63bcca4, all withFP_ROUND=3. The patch passes all 28. For example,v_rcp_f16(17)changes from0x2b87to0x2b88in that mode. The existing conversion control passes all 38 inputs under both modes. Inputs are synthetic.Coordination claim: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7229239430
AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T22:25:30Z.
Verified
8bfad4cagainst63bcca4on Windows with app-local WARP 1.0.22 and D3D12 Agility 1.620.2. The same synthetic fixture went from 7 wrong outputs in 28 readbacks to 28 correct. The 38-input FP32-to-FP16 control still distinguishes the two rounding settings. Both strict shader Clippy configurations and the repository asset policy passed. Windows CI for this headI also ran both regressions on
4ccc63ewith #3609. It passes the seven-op fixture and the exp midpoint test, including 16 readbacks across the plain, abs, neg, and clamp variants. The two changes can be reviewed separately, with the combined branch available for an integration test.Please keep the Git author on a cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if the work is folded into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-28T00:24:25Z.
Hardware run on AMD, since the report so far is WARP: RX 5700 XT (Navi 10, RDNA1, driver 32.0.21045.29003, Windows 11 26200), head
8bfad4con63bcca4. The test fixture checks the hardware adapter and WARP in turn, and neither was skipped.half_transcendentals_round_to_nearest_in_both_modespasses on both.victory-shader --lib --features host: 303 passed, 0 failed, 3 ignored.AI use: Claude Code (Claude Opus 5.5).
Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-28T04:44:31Z.
Hardware runs for this PR and #3620, both WARP-only so far: RTX 3070 8 GB, driver 616.56, Windows 11, 3 runs each, hardware adapter and WARP in the same process.
8bfad4c:half_transcendentals_round_to_nearest_in_both_modespassed 3 of 3.0fcf49d:f16_results_round_as_the_mode_sayspassed 3 of 3. Thev_cvt_f16_f32probe had 62 inputs, model mismatcheshardware 0andwarp 0, and hardware and WARP differed on 0.main63bcca4runs the same test on its 38 inputs with the same result, so the 24 added midpoint inputs pass on NVIDIA too.AI-assisted (Claude Code, Claude Opus 5.5 built both heads and ran the tests on this card).
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-28T21:55:35Z.
AMD Radeon 780M (RDNA3) + WARP, Windows 11, head
8bfad4c. Before (main63bcca4+ this PR's test): fails on both adapters, every checked case one ulp low with FP_ROUND=3, e.g.rcp(0x4c40)gives0xa55a2b87for0xa55a2b88,sqrt(0x3200)…36edfor…36ee. After: passes, 5 of 5 runs. Full suite (victory-shader+victory-gpu --features diagnostics): 552 passed. AI-assisted (Claude).Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T22:22:43Z.
kilolimaVI independently tested the #3617 and #3717 integration on a physical Radeon 780M (RDNA3). The plain merge 15edfeb failed the nearest-even test in FP_ROUND=3. The follow-up 15f2978 passed both the rounding and NaN tests and all 37 VALU tests on that adapter. Native A/B report
The maintainer can review the narrow integration change when taking both PRs. Please retain the Git authors on cherry-pick or rebase. Tested follow-up
AI-assisted with OpenAI Codex.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.