Repository navigation
fix(shader): flush f16 min/max denormal inputs - #2876
Merged
adriadam10 merged 2 commits intoOct 10, 2026
Merged
Conversation
RDNA2 min/max flush half inputs to signed zero when input preservation is disabled, while output flushing alone keeps them. Apply this to the measured binary forms and pin the hardware rows. Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
The ternary forms share minMaxF16 with v_min_f16 and v_max_f16 and follow the same rule on gfx1036: a subnormal half input becomes a signed zero when bit 0 of the f16 denormal field is clear, at IEEE=0 and IEEE=1. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
9 tasks done
Collaborator
|
Checked on the HW oracle (gfx1035): 2048 operand triples (signed zeros, denormals, min normals, ±1, ±inf, quiet/signaling NaNs) at IEEE=0/1 × denorm16 0–3 for |
9 tasks done
This was referenced Oct 23, 2026
Merged
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.
What
v_min_f16andv_max_f16keep denormal inputs when the shader asks to flush them, so their selected result differs from RDNA2. #2036 fixed their IEEE NaN handling but left this gap in TechnicalDebt.The binary forms now flush each half input to its signed zero when denorm16 bit 0 is clear. Output flushing alone preserves the selected input. This applies to the comparison value and the bits returned for a NaN fallback. The second commit applies the same rule to
v_min3_f16,v_max3_f16andv_med3_f16, which shareminMaxF16: on gfx1036 they flush the same way (8,024 operand triples in each of the eight IEEE 0/1 x denorm16 0-3 modes, every row matching the rule, changes only at denorm16 0 and 2). The debt entry retains the f64 gap.Measured with the hardware oracle on gfx1036 (Radeon 610M), at IEEE=0/1 and denorm16=0/1/2/3. Other controls: DX10 clamp enabled, f32 denormals flushed, both rounding fields nearest even, FP16_OVFL=0. These example half results are at IEEE=1:
main0x3c01, 0x03ff0x00000x03ff0xbc01, 0x03ff0x00000x03ff0x3c01, 0x03ff0x03ff0x03ffTested
CachyOS Linux, Release build; RTX 4070 Ti (NVIDIA), Radeon 610M (RADV), and lavapipe, including the pinned CI driver.
agc_driver_f16_min_max_nan: 32 measured operand pairs, eight IEEE/denormal modes, plain and neg/abs forms, and SDWA WORD_0/WORD_1 sources. Includes signed zeros, NaNs, denormals and minimum normals. Main fails with0x03ffinstead of0x0000; the fix passes on all three drivers. Original NaN/ternary tables still pass. The ternary rows fail on the first commit (v_min3_f16 v12, v4, v5, v6 is 0x000003ff, expected 0x00000000) and pass with the second. Runtime below 1.2 s.check_conventions.py, andgit diff --checkpass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)