Repository navigation
Conversation
v_{add,sub,subrev,mul}_f16 (e32 and e64) under the maintainer's first
slice (R0Y00#839): both operands must be statically proven finite (binary16
inline constants, 16-bit literals, tracked constants and register copies,
or an earlier proven result), finite overflow is refused, and the forms
require an explicit binary16 denormal-preserve entry profile
(half_denorm="preserve"). widen16, one precise binary32 operation and
narrow16 give the exact nearest-even result. The result is tracked as a
half16 low half read only by v_cvt_f32_f16 and SDWA WORD_0; every other
reader is refused. Adds controls, LLVM 15 binary fixtures, form coverage
and an integer-readback draw with 11 mutations (pixel_aot_f16_arith_*).
Refs R0Y00#839
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
I refreshed the branch in c608fc1 after #704 and #853. The shared dispatcher retains the divide-FMA, DS NOP and binary16 checks. In an independent run, 80,144 finite-input proof checks matched Python binary16 conversion, and WARP and RTX 4060 Laptop caught all 11 mutations. On the final rebased candidate I reran all three WARP draw modes, the LLVM 15 binary suite, form coverage and docs links. They passed. GitHub CI is running on the updated head. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
This adds the first plain binary16 VOP2 slice from #839.
tools/pixel_aot.pynow lowersv_add_f16,v_sub_f16,v_subrev_f16andv_mul_f16in their e32 and_e64spellings. The scope follows the decisions in #839:binary16 operand lacks a finite proof: <tok>, and a NaN/inf constant givesbinary16 operand is not finite: <tok>.binary16 result overflows: v_<op>_f16. Both boundaries are pinned with both signs: 65520 is refused and 65519.99 is accepted.lower(..., half_denorm="preserve"), also exposed as--half-denorm. Without it the four forms are refused withbinary16 denormal mode unknown at entry. MODE writes that could change the denormal field stay refused, and the existing round-toward-zero gate covers all eight spellings.widen16to both low halves, does oneprecisebinary32 operation, thennarrow16. Binary32mulof two halves is exact. Foradd/sub, double rounding through binary32 is harmless (24 ≥ 2·11+2). An offline numpy run over all 4,030,726,144 finite operand pairs ofaddandmulfound 0 differences; that run is not part of CI. CI runs an independent Python reference.("half16", …), separate from integerlow16. Its only readers arev_cvt_f32_f16(e32/e64, without modifiers),v_cvt_f32_f16_sdwawithWORD_0, andv_mov_b32_sdwawithWORD_0. Every other reader is refused, with a control per reader class.clamp, omod, DPP/SDWA spellings and integer inline constants other than 0 are refused.min/maxstay out of scope.v_add_f16_e64refusal neighbour in the controls andform_coverage_check.pyis replaced byv_min_f16_e64, which is still refused.Refs #839. AI-assisted (Claude Code).
Verification
Windows 11 10.0.26200.9974, NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) and WARP 10.0.26100.9818, debug layer enabled, at
5d80e54.Draw
draw-f16-arith(pixel_aot_f16_arith_{hardware,warp}). It covers 40 literal operand pairs per op, including chains of proven results. Results are read back losslessly through the integer target and checked against an independent reference. The cases cover halfway rounding, positive and negative subnormals, and signed zero, including(-0)+(-0)and exact cancellation. Programs with subnormal operands also pass under-denorm ftz, because the readers useasuintonly.Mutations. Each of these must report a mismatch and does on both adapters, and a reference-side hook checks before the draw that each one changes an expected word:
An SDWA
WORD_1widen of a result is refused at lowering.Dev-time check (not committed). With the new branch disabled, the new controls fail.
Commands:
ctest --preset dev --no-tests=error -R "^pixel_aot_f16_arith_": 2/2 passed, 33.3 s on hardware.ctest --preset dev --no-tests=error -j4: 435/435 passed. Only capability skips remained (bvh_wave64_*,wave_shuffle_warp,spirv_minlod_*).0xffffas-1. It runs locally withllvm-mcthrough aclang -cc1asshim.form_coverage_check.py,rdna2_tools_check.py,pso_readiness_check.pyanddocs_links_check.pypass.Limits
subrevoperand order and the console's binary16 denormal handling are not measured natively. The destination's high half stays unknown and is guarded only by the refusals.tools/scan_unsupported_shaders.pystill reports these forms as unsupported. That is conservative, since the scanner cannot see the finite proof.🤖 Generated with Claude Code