shader: lower v_cvt_norm_i16_f16 and v_cvt_norm_u16_f16 in direct DXIL #3294
No reviewers
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!3294
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3292"
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?
@legacy-code-archaeologist on GitHub · 2026-11-28 05:43 UTC · original
legacy-code-archaeologist:shader/direct-cvt-norm-f16→main· +449 −16 · 4 files · 1 commits · merged 2026-11-28 08:27 UTCFixes #3293, Refs #2935.
Summary
0x63/0x64) and VOP3 (0x1e3/0x1e4)v_cvt_norm_i16_f16andv_cvt_norm_u16_f16inDirectCompute::float_alu()(src/gfx1013_direct_compute.inl) for both direct Compute and Pixel DXIL, sharing unary binary16 source decoding andop_sel[3]half-preserving destination merge withv_fract_f16.round_rne(clamp(x, -1, 1) * 32767)(i16) andround_rne(clamp(x, 0, 1) * 65535)(u16) in exact 32-bit integer arithmetic (matchingtools/pixel_aot.py::f16_cvt_norm_resultto avoid binary32 double-rounding on0x3801..0x3804/0xb801..0xb802and preserve binary16 subnormals), mapping±0.0andNaNto0and saturating|x| >= 1.0(±Infincluded).abs[0],neg[0],op_sel[0],op_sel[3], and VGPR / SGPR / literal / inline-constant sources under the strict((mode_bits ^ 0xf0u) & 0x8000ccu)binary16 mode gate, while refusingclamp,omod, unused modifier bits, high-halfop_selon non-VGPR sources, DPP/SDWA, special scalar sources (106), and non-default/dynamic binary16 modes.tests/native_cvt_norm_f16_check.py,tests/cmake/native_cvt_norm_f16.cmake, anddocs/experiments/native-cvt-norm-f16.md(30cases,11refusals across Compute IR/DXIL/lossless 16-bit Pixel readback + Compute SM 6.6 wave32 replay).Verification
All checks passed on Windows 11 with SDK
10.0.26100.0(devandrelease/O2presets):python -B tests/docs_links_check.py: passed (143Markdown files,663links)ctest --preset dev&ctest --preset release(-R '^(native_cvt_norm_f16_|native_fract_f16_|native_f16_alu_ir)'):9passed,2skipped in each preset:native_cvt_norm_f16_ir(30cases,11refusals) &native_cvt_norm_f16_controls(30cases compiled,11refusals): passednative_cvt_norm_f16_pixel_warp(Microsoft Basic Render Driver,15draws /30cases) &native_cvt_norm_f16_pixel_hardware(NVIDIA Quadro M1000M driver32.0.15.7371,debug_layer=unavailable,15draws /30cases): passednative_f16_alu_ir(435results,39refusals) &native_fract_f16_{ir,controls,pixel_warp,pixel_hardware}(32cases,10refusals,16pixel draws): passednative_cvt_norm_f16_compute_hardware&native_fract_f16_compute_hardware: skipped (77on local Intel HD Graphics 53031.0.101.2111lacking SM 6.6 wave32)dev(native_cvt_norm_f16_ir): dropping RNE tie-to-even rounding failed at slot10(i16_half_tie_even,0xdead3fff != 0xdead4000, plus7+other halfway/subnormal cases); droppingis_nanfailed at slot8(i16_nan_zero,0xdead7fff != 0xdead0000) and slot28(i16_inline_int_193_nan).AI-assisted.
github-bot referenced this pull request2026-11-28 05:56:19 +00:00
@JohnConnorNPC on GitHub · 2026-11-28 06:45 UTC · original
Thanks for this. The lowering checks out: the integer model matches an exact
fractions.Fractionreference andpixel_aot.f16_cvt_norm_resulton all finite binary16 inputs for both kinds, andirandcontrolspass on this head merged into main19358dae(Linux clang-cl build, CPU-only under Wine).Could you add one case before merge? Positive NaN on
v_cvt_norm_u16_f16isn't pinned. The only u16 NaN case isu16_neg_nan_zero(0xFC01), and the sign term already zeroes that one.zero_out = ir.value("or i1 " + is_zero + ", " + sign)(dropsis_nan). It still passesnative_cvt_norm_f16_check.py ir(30 cases matched exact model; 11 refusals matched) andcontrols(compiled 30 cases to DXIL; verified 11 refusals).0xffffinstead of0) but none of the 30 cases. The pixel and compute modes compare against the sameCase.expected(), so they can't catch it either.ge_oneuge→ugtfailsirati16_pos_one_and_over, so the harness does catch a mutant that a case reaches.Suggested fix:
Case('u16_pos_nan_zero', 'u16', 257, 0x7E00). Compute goes to 31 of 32 slots, and pixel gets 30 full-EXEC cases with no padding.This comment was AI-assisted.