shader: lower s_denorm_mode as a tracked MODE write #3651
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3651"
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 lambirou on 2026-11-30T21:24:59Z.
Problem
gfx1013 lists SOPP s_denorm_mode in both coverage references, but pixel_aot refused it and did not track MODE[7:4]. A shader that writes the denormal mode therefore could not be translated, and the form stayed unobserved in gfx1013 and gfx1030. No open pull request covered it.
Change
pixel_aot now lowers s_denorm_mode as a MODE[7:4] write:
The controls cover every value, the subfield reads, the s_setreg and s_round_mode interactions, the float-operation gates and the refusals. The draw writes s_denorm_mode 15, reads the whole field, writes s_round_mode 0xc, reads it again, writes the binary32 and binary16/binary64 subfields with both s_setreg forms, reads each, mixes constant-buffer words and exports through the lossless R32G32B32A32_UINT target. Four wrong references must each report pixel_mismatch.
Verification
Run from the branch at
a208d311:Results:
Limits
The console's initial MODE value and its denormal behavior are not measured. The draw checks the translator's tracked value through s_getreg_b32, not the console's MODE register. The entry state for binary16 lowerings still comes from the explicit half_denorm="preserve" declaration. Non-preserving modes are tracked as state but no floating-point operation is lowered under them; s_setreg denormal targets accept only the preserving values, while s_denorm_mode can write any of the 16 values and a later float operation is refused if its field is not preserve. Mixed-precision operations are handled conservatively.
Refs #312.
AI-assisted: yes.
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-01T02:37:20Z.
Review: APPROVED
Reviewed
fd5dee74by reading the diff; not built or run.Verdict: approve. MODE[7:4] is tracked straight-line, and every float op is gated on its field. No MUST, no SHOULD.
lower()docstring says the s_setreg forms of MODE[7:4] accept "every four-bit value" as a write (tools/pixel_aot.py:4493-4495), and the header comment says "a write may set any of the 16 values" (:735-736). Onlys_denorm_modedoes that. Both s_setreg paths refuse anything other than preserve (:4862,:4925), and the tests pin that refusal (hwreg(HW_REG_MODE, 4, 4), 14→ "Unsupported denormal mode"). The wording should say so.FP_DENORM_*encoding.:4972-4979) runs after every MODE-handlingcontinueand before any ALU lowering, so a float op cannot bypass it. The earlycontinues in the loop are branch/join bookkeeping only. A mnemonic match on_f32/_f16/_f64(plusfma_mix) over-gates moves likev_interp_mov_f32, which is safe.s_nop, and a masked region only the listed SALU forms. So neithers_denorm_modenors_setregcan sit on one path of a join and leave a path-dependent mode.s_getreg_b32of a field is refused until the program writes it, so the assumed entry value is never reported as fact.pixel_aot_sopp_denorm_mode_{hardware,warp}tests (skip 77).Tests: the
pixel_aot_check.pycontrols prove all 16s_denorm_modevalues, the per-field refusal at the first float op, the s_setreg/s_getreg round trips, the spelling refusals and the LLVM 15 encodings. CI ranpixel_aot_check.py,form_coverage_check.pyandrdna2_tools_check.pyat this head. The draw tests are outside theprfilter.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T05:45:41Z.
Review: COMMENTED
The trial merge conflicts in
tests/pixel_aot_check.py: the main SOPP terminal checks and the new denorm-mode checks occupy the same registration sites. Please retain both in the controls, binary and draw selections, and rerun^(pixel_aot_sopk_hwreg|pixel_aot_sopp_)on the updated head. The older approval coversfd5dee74.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T19:02:58Z.
Review: APPROVED
Reviewed
ab295a02on the updated branch. The conflict resolution retains main's terminal SOPP gate. The draw checks exercise denorm preservation and flushing; MODE-dependent reads retain the gate when the relevant state is unknown. Independent Windows 11 build 26300 / MSVC Debugctest --preset dev --no-tests=error -V -j 1 -R '^pixel_aot_sopp_denorm_mode_(warp|hardware)$'passed 2/2, with WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656 for the GPU fixtures.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T19:05:11Z.
Review: COMMENTED
The reviewed revision passed both focused draws. After #3605 and #3675 landed, a trial merge into
521318afconflicts indocs/experiments.mdandtests/pixel_aot_check.py. Please retain the f16 pack/SDWA and subvector registrations and their coverage entries alongside the denorm controls, then rerun the Windows check on the updated head.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T23:53:03Z.
Review: APPROVED
Re-reviewed
677db1ca. The MODE field split, last-write rule and conservative non-preserve refusals remain intact after the branch update. On Windows,python -B tests/pixel_aot_check.pyandpython -B tests/form_coverage_check.pyboth passed. I also ran the exact head'sdraw-sopp-denorm-modescript against the source-built offscreen runner on inbox WARP and RTX 4060 Laptop, both exit 0 with the four wrong-reference controls checked. The trial merge withmain1c4601ffwas clean and Windows, Linux Python and gfx1013 fixture CI passed at this head.