shader: lower the binary16 rounding ops in pixel_aot #874
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/881"
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 R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T15:28:26Z.
Change
This is the second binary16 slice from #839. It follows the same rules as #854.
tools/pixel_aot.pynow lowersv_floor_f16,v_ceil_f16,v_trunc_f16andv_rndne_f16in the e32 and_e64encodings.VOP1Instructions.tdL449-452 maps these four ops toffloor,fceil,ftruncandfrint.frintrounds to nearest even under the default rounding mode.widen16, then the binary32floor/ceil/trunc/round, thennarrow16. HLSLroundis DXILRound_ne. The narrowing is exact because the rounded value of a finite half is itself a representable half.half16low half, read only by the audited readers;clamp, omod and modifiers are refused.v_ceil_f16_e32andv_rndne_f16_e32sat in the rounding-mode neighbour list. They were only refused there because the entry profile was unknown, not because the form was unsupported. They are replaced byv_fract_f16_e32andv_rcp_f16_e32, which are still unsupported.v_fract_f16, because of its clamp near 1, plusmin/maxand the transcendental ops.Refs #839. AI-assisted (Claude Code).
Verification
Windows 11 10.0.26200.9974, NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) and WARP, at
fc89b9e.draw-f16-round(pixel_aot_f16_round_{hardware,warp}): results are read back as integers and compared with an independent reference. The cases cover:trunc(-0.5),ceil(-0.3)andrndne(-0.4);rndnehalfway values at 0.5, 1.5, 2.5 and -2.5, and at ±1022.5 and ±1023.5, where the ulp is 0.5;struct/math/round, including the sign of zero.floorandceilswapped;truncreplaced byflooron negative inputs;rndnereplaced by round-half-away;check_f16_round_controls.ctest --preset dev --no-tests=error -R "^pixel_aot_f16_round_": 2/2 passed, 22.8 s on the RTX 3080.ctest --preset dev --no-tests=error -j4: 453/453 passed. The only skips are capability skips.clang -cc1asshim standing in forllvm-mc.form_coverage_check.py(8 forms in both TSVs, 7 neighbours uncovered),rdna2_tools_check.py,pso_readiness_check.pyanddocs_links_check.pyall pass.🤖 Generated with Claude Code