shader: lower finite in-range binary16 to 16-bit integer conversions in pixel_aot #1070
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1077"
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 tedin7 on 2026-11-24T00:26:36Z.
Change
Adds
v_cvt_i16_f16andv_cvt_u16_f16(plain,_e32,_e64) topixel_aot, the follow-up to the integer-to-binary16 slice in #839. The work is AI-assisted (Claude Code).VOP1Instructions.tdL436-437 selectsfp_to_sintandfp_to_uint) and keeps the two's-complement low half as alow16result for the audited 16-bit integer readers. The high-half refusals stay.clamp, omod, DPP/SDWA, non-finite and unproven or runtime sources, and out-of-range values (32768 and -32800 for i16, -1 for u16), plus the round-toward-zero mode.Refs #839
Verification
Commit under test:
6ef8952aon top ofd33845b9. Environment: Linux, Python 3.13 venv fromrequirements-dev.txt, LLVM 19 tools (llvm-mc-19,llvm-objcopy-19,libLLVM.so.19.1). No Windows, DXC or D3D12 adapter here.Ran and passed:
./out/pe-env/bin/python -B tests/pixel_aot_check.py: exit 0, including the newcheck_f16_to_int_controls(every spelling, operand kind, exact refusal messages, range boundaries, mode, scheduling, readers) and a reference check over all 65,536 binary16 values for both kinds againststructformateandmath.trunc../out/pe-env/bin/python -B tests/form_coverage_check.py: passed, with a newcheck_f16_to_int16_forms.check_f16_to_int16_binary(LLVM encodings plus clamp/omod/modifier spellings) and an assemble, disassemble and re-translate round trip of the 9 new draw programs: passed.tests/rdna2_tools_check.py(OK, 97 tests, 8 skipped),tests/docs_links_check.py,tests/bidi_controls_check.py,tests/pso_readiness_check.py,tests/compute_store_check.py binary ...: passed.Negative control: with the lowering branch disabled (same helper kept),
pixel_aot_check.py,form_coverage_check.pyand the binary check all fail withUnsupported instruction ... v_cvt_u16_f16_e32 v24, v34(controls and form coverage) and thev_cvt_i16_f16_e64 v24, -v18refusal case (binary); with it restored they pass.Not run: the GPU draw
draw-f16-to-int16(CTestpixel_aot_f16_to_int16_warpand_hardware) needs DXC and a D3D12 adapter. Its Python side (expected words for all 9 programs, the three mutation models and the WORD_1 refusal) was exercised; the WARP and hardware results are pending, so no adapter, driver or Windows build to report. Also not run on LLVM 15: with LLVM 19 the existingcheck_f16_cvt_int16_binaryand the fullcheck_binaryfixture loop fail on LLVM-version spelling differences unrelated to this change, so I ran only the new binary check and fixtures.Evidence and follow-up
Fixtures are synthetic assembly generated in the test (no external inputs). The draw has 6 baked programs (24 u16 and 24 i16 constants in four operand forms, junk in bits 31:16: signed zeros, -0.5, 0.9995, +-1.5, +-2.5, +-1023.5, 32752, -32752, -32768, 32768 to 65504 for u16), two chains and one reader program, read back through the lossless
R32G32B32A32_UINTtarget. Three mutations (round to nearest even, flipped sign, source read from bits 31:16) must each mismatch. Assumptions: the truncation behaviour comes from the ISA text, not from a native measurement, and the high half of the destination is unmeasured.docs/experiments.mdhas the new paragraph with the exact messages and what is not measured. Runtime sources, saturation and NaN/infinity results stay out of scope for a later slice.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T00:26:51Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
6ef8952ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.