shader: lower non-packed 16-bit integer VOP3 ops #726
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/732"
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 JB2WIN on 2026-11-22T23:49:06Z.
Change
tools/pixel_aot.pynow lowers the 12 non-packed 16-bit integer VOP3 ops from #669:v_add_nc_u16,v_add_nc_i16,v_sub_nc_u16,v_sub_nc_i16,v_min_u16,v_max_u16,v_min_i16,v_max_i16,v_mul_lo_u16,v_lshlrev_b16,v_lshrrev_b16andv_ashrrev_i16. The plain and_e64spellings are accepted, without modifiers.The change was reworked after review. The result is now a low-16-only value. Only bits 15:0 are defined and tracked, with a tag (
("low16", …)), the same mechanism as #713. Nothing is assumed about the high half.v_cmp_*_{i16,u16};v_mov_b32_sdwawithsrc0_sel:WORD_0,BYTE_0orBYTE_1, which produces an independently defined word.v_mov_b32_e32,v_cndmask_b32data operands;v_cvt_*readers,v_cvt_pkrtz, image coordinates;WORD_1,BYTE_2,BYTE_3andDWORD, and anUNUSED_PRESERVEmerge into a low-16 destination. The new message is "Reads the undefined high half of a 16-bit result".& 15. The helper's final fallback is now an explicitashrrev_i16case followed by aValueError.0xffff. Also refused:op_sel,clamp, source modifiers, DPP/SDWA spellings,v_mad_u16/v_mad_i16, float tokens and wider literals.docs/experiments.md. It cites LLVM'szeroesHigh16BitsOfDestfrom #669 as an untested hypothesis that needs a native control separating preservation, zeroing and any other behaviour.Refs #669. AI-assisted (Claude Code).
Verification
Environment: Windows 11 10.0.26200.9974, NVIDIA GeForce RTX 3080 (driver 32.0.16.2124), WARP 10.0.26100.9818, D3D12 debug layer enabled. Head is rebased on current
main.Draw
draw-int16-vop3(pixel_aot_int16_vop3_{hardware,warp}):v_cndmask_b32outputs.v_mov_b32_sdwa … src0_sel:WORD_0and exported bit-exactly.0x7fffagainst0x8000,0xffff + 1,0 - 1, shift counts 15/16/17/31, a negativeashrrevoperand, signed/unsigned min/max disagreement,0x1234 * 0x0567, and sources whose high and low halves differ.Mutations. Each was detected, with the statuses printed by the test:
v_min_i16→v_min_u16;>> 16uon the low-16 read in the chain;>> 16uon the low-16 read in the compare.src0_sel:WORD_0→WORD_1is refused at lowering.Dev-time checks (not committed): storing the result as a plain value instead of the tag makes the full-word refusal controls fail.
Results:
ctest --preset dev --no-tests=error -R "^pixel_aot_int16_vop3_": 2/2 passed. Times were 7.3 s on the RTX 3080 and 2.2 s on WARP.ctest --preset dev --no-tests=error: 325/325 passed. Skips werebvh_wave64_hardware,bvh_wave64_warpandwave_shuffle_warp, the same as onmain.tests/pixel_aot_check.py binarywith LLVM 15.0.7 (localllvm-mcthrough aclang -cc1asshim): exit 0, including the SDWA widening lines.form_coverage_check.py,rdna2_tools_check.py,pso_readiness_check.pyanddocs_links_check.pypass.Limits
v_cmp_*_i16scanner pattern still uses the widerINTEGER_SOURCE. I did not change it here.docs/coverage/dashboard.svgis not regenerated.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T23:58:21Z.
Review: CHANGES_REQUESTED
The desktop draw demonstrates the proposed upper-half model, but the current lowerer exposes that model as a full 32-bit guest value. LLVM evidence in #669 does not independently establish that the old high half is always preserved on gfx1013, and an uninitialized high half cannot be assumed to be zero. For a first mergeable slice, track a low-16-only result and reject consumers that would observe the high word, unless that word is independently defined by a supported instruction. Reuse the low-half tagging approach in the #713 experiment where it fits. Add a positive low-half draw and a rejected full-word export or arithmetic consumer. Keep the high-word experiment separately documented until a native control distinguishes preservation, zeroing and any other defined behavior.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T06:44:19Z.
Review: APPROVED
The previous change request is resolved at
90f615b. The non-packed results track only the low 16 bits, unsupported full-word consumers are refused, and the focused WARP draw detects all five mutations. I verified both Windows jobs and both Linux jobs on this commit, and the test registration retains the compressed-export fixture.Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T00:05:00Z.
Thanks. I'm reworking this as you describe:
v_mov_b32_sdwawithsrc0_sel:WORD_0/BYTE_0/BYTE_1may read it. Every whole-word or high-half reader (export, 32-bit arithmetic, moves, DPP, VOP3P, packs, SDWAWORD_1) is refused, each with its own control.I'll push it here and ask for a re-review.
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T00:25:30Z.
Reworked as requested and rebased on
main. Results are now low-16-only values, with refusal controls for each whole-word and high-half reader and a drawn chain and compare path. The high-word model is documented separately as an untested hypothesis. Details and results are in the updated description. Full suite: 325/325 on RTX 3080 + WARP.Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T01:42:10Z.
Rebased on
37ed46dand squashed into one commit, with no change in content. Full suite: 333/333 on RTX 3080 + WARP.pixel_aot_int16_vop3_*takes 7.2 s / 2.2 s.Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-23T04:42:54Z.
A related question for a follow-up, not for this PR. On
main,v_cvt_f16_f32(from #324) still merges the destination's old high half into its result (tools/pixel_aot.py, comment: "the high half of the destination is kept"). That is the preserve model this PR now drops. Once this lands, shouldv_cvt_f16_f32move to the same low-16-only result, withv_cvt_f32_f16,v_pack_b32_f16and the SDWAWORD_0move as its readers? Or should it keep the preserve model until a native control exists? I'd open that separately in whichever direction you prefer.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T04:51:28Z.
Keep the existing
v_cvt_f16_f32behavior for now. The low-16 contract here is specific to the twelve integer forms and their verified readers. A separate control should establish what the native conversion leaves in the upper half before changing it. The conversion follow-up does not need to block this PR.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T05:35:59Z.
I pushed
cbf7fa0to resolve conflicts while keeping the current main fixtures and this PR’s low-16-only scope. The Windows Release WARP draw passed and detected all five injected mutations. The form coverage and Python controls passed; the local decoder suite’s LLVM-dependent case was skipped. Waiting for the full CI on this SHA.