shader: lower s_round_mode 0x0 and 0xc as MODE[3:2] writes in pixel_aot #2110
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2118"
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 legacy-code-archaeologist on 2026-11-25T00:47:45Z.
s_round_modewrites MODE[3:0]: bits 1:0 are the binary32 rounding and bits 3:2 the binary16/binary64 rounding. pixel_aot already tracks bits 3:2 fors_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2)and the SOPK register forms. Every binary32 lowering assumes nearest even, so this accepts exactly the two immediates that leave bits 1:0 at 0:s_round_mode 0x0acts ashwreg(HW_REG_MODE, 2, 2), 0, ands_round_mode 0xcashwreg(HW_REG_MODE, 2, 2), 3. They share the tracked state and the round-toward-zero gate for binary16, packed and binary64 forms, and the last write wins across all three write forms. A laters_getreg_b32of the field returns 0 or 3.Unsupported rounding mode: binary32 directed or truncating modes0x1to0x3, binary16 directed modes0x4and0x8, combinations of those, bits above bit 3, and the unprinted0x00and0x0c. Decimal, upper-case, register or missing operands are refused asMalformed s_round_mode operand. LLVM 15 prints the SIMM16 in hex.The five controls that pinned
s_round_mode 3asUnsupported instructionnow pin the printed spellings_round_mode 0x3asUnsupported rounding mode. The value is still refused, but the refusal now comes from the new value check.tools/scan_unsupported_shaders.pylists the two accepted immediates as supported, next to the MODE[3:2] setreg entry, andrdna2_tools_checkcovers both the accepted and the refused cases.s_denorm_modestays refused.Tests
Base
246a875d, Windows 11 build 26100, debug layer unavailable.python -B tests/pixel_aot_check.py(newcheck_sopp_round_mode_controls)0x3accepted, decimal accepted,0xcwritten as nearest even, write not counted for the readctest --preset dev --no-tests=error -R '^pixel_aot_sopp_round_mode_' -Von WARP 10.0.26100.8972pixel_aot_check.py binarywith LLVM 15.0.7 (round trip of the draw body, encodings0000a4bf,0c00a4bf,0300a4bf,s_round_mode 12printed as0xc)ctest -R '^pixel_aot_' -E '_hardware$' -j 3, before the rebasetests/form_coverage_check.py,tests/rdna2_tools_check.py(with LLVM, 154 tests, 1 skip),docs_links_check,shader_census_check,shader_probe_check,startup_gfx2hlsl_refusals_checkrdna2_tools_checkfailsThe draw checks the translator's tracked value through
s_getreg_b32, not the console's MODE register. The gfx1030 spelling matches gfx1013 by LLVM-C disassembly (bfa4000c→s_round_mode 0xc), but the repository pins only gfx1013. The archive rescan indocs/experiments.mdwas not repeated fors_round_mode.AI-assisted.
🤖 Generated with Claude Code