shader: lower gfx1013 v_cvt_f32_f16 in pixel_aot #293
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/297"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-21T21:13:32Z.
Change
pixel_aotrejectedv_cvt_f32_f16, which widens the binary16 in the low 16 bits of S0 to binary32. This adds awiden16helper that builds the binary32 encoding from the half's sign, exponent and mantissa bits, so the result does not depend on how a desktop driver treats denormals: a subnormal half becomes m × 2^-24 exactly.absandnegmodifiers are applied after widening andclampsaturates the result. Integer inline constants and literals are taken as raw words; a floating-point inline constant and SDWA forms are refused. Independent problem: it widens the conversions the pixel translator accepts.Overlap: #288, #292 and #293 also edit
tools/pixel_aot.py,tests/pixel_aot_check.pyanddocs/experiments.mdon separate lines. I merged all four branches ontod311159in three different orders without conflicts; the controls and the binary check pass on the combination. None depends on another. #232 lowers other conversions (v_cvt_f32_ubyte0, integer conversions) and does not touch this instruction.Verification
Commit
d311159plus this change, Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC.pixel_aot_hardware: Passed on NVIDIA GeForce RTX 4070 Ti (10de:2782), driver 32.0.16.1088.pixel_aot_warp: Passed on WARP 10.0.26100.9818.debug_errors=0andmax_absolute_error=0. Each test runs 41 draws with this change and 40 ond311159; the extra draw is the new one.tests/pixel_aot_check.py binarypasses with the program added to the binary fixtures: LLVM 15.0.6llvm-mcandllvm-objcopy, disassembled throughlibLLVM-17.soandlibLLVM-18.soon Linux (no shared LLVM 15 library was available). Unchanged main passes the same check with both libraries. The Ubuntu CI job runs it with LLVM 15.tests/docs_links_check.pyandtests/bidi_controls_check.pypass.Evidence and follow-up
The fixture is synthetic. Four constant words:
0xdead3c00(1.0 with junk in the high half),0x0000c500drawn as-|s45|(-5.0),0x00007bff(65504, the largest finite half) and0xbeef0001(the smallest subnormal half, 2^-24, again with junk above it), which a multiply by the literal 2^24 turns into 1.0. Negative controls, one per channel, each must reportpixel_mismatchand does: a reference built from the high half, one without the negation, one with a wrong exponent (32752) and one with the subnormal flushed (0). The controls also check that all four conversions go throughwiden16with the modifier outside it, and refuse a floating-point inline constant and an SDWA high-half selection. The translator ond311159rejects the program at its firstv_cvt_f32_f16.Not measured here: NaN and infinite halves, which are not drawn, and whether Scarlett quiets a signaling NaN when widening; the lowering keeps the payload. Recorded in
docs/experiments.md.Checklist
AI-assisted: yes. Written with Claude Opus 5.5; verified on the hardware listed above.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T21:28:32Z.
At
c8b042e, the merge conflicts are indocs/experiments.md. Please retain the neighboring experiment results and the half-widening reproduction command in the shared document.Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-21T21:42:01Z.
Rebased onto
b53bfb0after #270 and #299. The only conflict was indocs/experiments.md: thev_ceil_f32paragraph from #270 is kept before this one. Nothing else changed.At
41474a4(b53bfb0plus this change), Windows 10 Enterprise 26H2 build 26300.9974, MSVC 14.51.36231, Windows SDK 10.0.26100.0 DXC:pixel_aot_hardware: Passed, NVIDIA GeForce RTX 4070 Ti (10de:2782), driver 32.0.16.1088.pixel_aot_warp: Passed, WARP 10.0.26100.9818.b53bfb0, every onedebug_errors=0andmax_absolute_error=0.tests/pixel_aot_check.py binary, the controls,docs_links_check.pyandbidi_controls_check.pypass on Linux with LLVM 15.0.6 tools and libLLVM 17 and 18.This branch merges cleanly with each of my other open pixel_aot pull requests.