Repository navigation
Conversation
Collaborator
Author
|
Closing this draft for now to help keep the open PR queue manageable; the branch stays preserved on the fork so it can be reopened once the queue clears. |
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.
Related to #1723 and #870 (no
Fixes).v_cmp_class_f16andv_cmpx_class_f16had no lowering intools/startup/gfx2hlsl.py.Change
The instruction tests whether the binary16 value in the low half of SRC0 falls in one of ten classes named by the mask in SRC1: bit 0 signalling NaN, 1 quiet NaN, 2 -inf, 3 -normal, 4 -denormal, 5 -0, 6 +0, 7 +denormal, 8 +normal, 9 +inf.
class_f16(reached throughop_v_cmp_class_f16andop_v_cmpx_class_f16) reads the encoding, so a denormal stays a denormal whatever the denormal mode and a NaN keeps its signalling bit. The_e32and_e64spellings, a vector-condition, scalar or exec destination and a narrowed EXEC followcompare(). Theabsandnegthat the instruction encodes act on the sign bit of the half (abs clears it, then neg flips it). Refused:op_sel,clampand any other modifier, a source that is not a register (inline float, literal), unbalanced|, a wrong operand count and the SDWA spelling.The new code sits in its own methods and does not touch
compare()orcommon(), where #1798 lowersv_cmp_class_f32; the two do not share a helper.Tests
tests/startup_gfx2hlsl_cmp_class_f16_check.py, registered inCMakeLists.txt(startup_gfx2hlsl_cmp_class_f16) and in.github/workflows/windows.yml:-v1,|v1|,-|v1|) are compiled as C++ from the emitted statements and run over all 65,536 binary16 values and 25 masks (the ten single class bits, none, all, mixed and bits above 9) against a reference that classifies through Python's binary16 conversion. Six planted faults in the emitted text must each be detected.-1mask) and eight refusals.binary <llvm-mc>: five spellings assemble to recorded encodings (value in SRC0, mask in SRC1).Verified (Linux)
binary llvm-mc-19passes (gfx1013).gfx2hlsl.py, each failing the check, original restored: signalling bit read from the wrong mantissa bit, denormal threshold off by one, mask test changed from&to|, neg flipping the wrong bit.git diff --check origin/main...HEAD,tests/docs_links_check.py,tests/bidi_controls_check.py: pass.git merge-tree: no conflicts withmain, startup: refuse an op_sel the float lowering does not model #1755, startup: refuse a modifier for handlers that do not model one #1778, startup: translate v_swap_b32 in gfx2hlsl #1796, startup: lower the binary32 class comparison #1798, startup: lower a typed buffer load of BUF_FMT_16_16_16_16_FLOAT #1699. startup: guard and verify 64-bit VOP3 shifts in gfx2hlsl #1783 already conflicts withmainon its own.Not verified
No draw on a GPU and no HLSL compiler run: the C++ stand-in treats
uintasunsigned, which matches the HLSL semantics used (no signed or float arithmetic is involved).AI-assisted; commands listed were executed locally.