startup: v_cmp_class_f16 has no lowering (binary16 class compare) #1855
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#1855
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@triggered02 on GitHub · 2026-11-24 19:39 UTC · original
Found in the refusal census (#870). 1 refused shader:
Problem
The binary16 class comparison had no lowering. The binary32 form is handled by the class-compare branch (PR #1798), but the half form needs a different helper: the value is the raw binary16 bit pattern in the low half of the operand word, the ten class bits follow the half format (exponent 5 bits, mantissa 10, quiet bit 0x0200), and an
abs/negmodifier acts on bit 15 rather than bit 31.Fix
tools/pixel_aot.pyalready carried the binary16 helper; it is ported intoPipeline.common()asclass16, and the class-compare branch dispatches on the mnemonic:Measured on the branch:
v_cmp_class_f16_e64 s14, 0x7c01, v0s14 = (((class16(0x00007c01u) & v0) != 0u) ? 1u : 0u);v_cmpx_class_f16_e64 vcc_lo, v0, -1exec = (((class16(v0) & 0xffffffffu) != 0u) ? 1u : 0u);v_cmpx_class_f16_e32 v0, v5exec = (((class16(v0) & v5) != 0u) ? 1u : 0u);The
abs/negmodifier forms lower toclass16((v0 & 0x7fffu))andclass16((v0 ^ 0x8000u)). A float-printed operand is refused by name, because it would otherwise be lowered as its binary32 bit pattern.Test
startup_gfx2hlsl_cmp_class_f16builds VOPC-in-VOP3 encodings from the checked-in decoder's layout, decodes them, then translates. Ten checks: the census form, both exec-mask shapes, theabs/neghandling on bit 15, the float-operand refusal, and — value-level — a Python binary16 classifier (written from the IEEE half layout) compared against the emitted helper body evaluated over all 65,536 binary16 patterns.Fail-first, three genuine class-bit mutations (all fail the value-level check while the text checks pass):
Depends on #1798
This branch is based on
startup/cmp-class(#1798) because the class-compare branch andclass32helper are not onmainyet. Merge #1798 first; after that this PR's diff is only theclass16helper, the mnemonic dispatch and the new test.What this does not establish
v_cmp_class_f64and the arithmetic/compare f16 forms that are not class comparisons are out of scope.AI-assisted (Claude Code).
@ChazY11 on GitHub · 2026-11-25 00:05 UTC · original
Claiming this
Environment: x64 Windows 11 build 26300.9974, MSVC 19.44, Windows SDK 10.0.26100, DXC 10.0.26100 (x64), Python 3.13, physical GPU (RTX 5080 Laptop, 32.0.15.8142) and the in-box WARP.
State of
mainat6218beb2, checked rather than assumed:so the dependency you list (#1798, the
class32helper and the class-compare branch) has landed and this is now only the half form.What I will do
class16fromtools/pixel_aot.pyintoPipeline.common()unchanged (the ten class bits from bits [15:0], quiet bit0x0200), listed next toclass32.bitsbeing the operand's raw word, notself.f(value), so an inline0x7c01reaches the helper as0x00007c01uand not as abinary32 float.
abs/negon the half act on bit 15 ((v0 & 0x7fffu),(v0 ^ 0x8000u)), not bit 31, and are applied to the raw word before the helper.the emitted text for the census form, both exec shapes, the
abs/neghandling and the float-operand refusal — and, value level, a Pythonbinary16 classifier written from the IEEE half layout compared against the emitted helper body evaluated over all 65,536 halves.
Negative controls I will run before claiming the fixture is worth anything: three class-bit mutations (swap
-inf/+inf, swap quiet/signaling NaN,swap
-subnormal/+subnormal) must each fail the value-level check while the text checks still pass.Scope boundaries I will keep
v_cmp_class_f64, no f16 arithmetic or ordering compares: they are not class compares.DXC/WARP pass over it, say so and I will add a draw fixture rather than implying the translation was executed.
Nothing else of mine touches these lines: my only open changes are #2053 (an AGENTS.md list fix) and #2063 (a test that pins handler refusal
behaviour), neither of which edits
gfx2hlsl.py.AI-assisted.
@R0Y00 on GitHub · 2026-11-25 00:35 UTC · original
The encoded 0x7c01 literal now lowers on main via #2092 (
8e17f8fb). The source-built controls cover that decoded literal, e32/e64 and both execution-mask shapes, and check the emitted binary16 helper against all 65,536 input bit patterns. The slice accepts the tested plain operands and rejects ambiguous immediates and half SDWA. Any additional SDWA coverage can follow in #2020. These checks establish the translator behavior for the reported refusal.