shader: lower gfx1013 v_cvt_f32_u32 and v_cvt_f32_i32 in pixel_aot #386
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/392"
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 abilliontokens on 2026-11-22T00:11:27Z.
Change
Refs #360 — stage 1 only (
v_cvt_f32_u32_e32,v_cvt_f32_i32_e32), per the issue's proposed split; stages 2–3 stay with the proposer.Depends on #363 (
shader/pixel-fp-mode), which must land first: the discriminating rows (2^24 and above,0xFFFFFFFF) cannot survive the compressed binary16 export, so the fixture uses #363's uncompressed f32 export and lossless readback. This branch is stacked on it.lower()gains one anchored branch:v_cvt_f32_(u32|i32)_e32 vD, S→precise float alu = float(asuint(S))/float(asint(S)), with the existing operand guards (entry mask, outstanding-sample overlap, pending constant loads, un-waited samples viafp_operand). The e64 spellings,abs/negmodifiers,clamp,omod, DPP and SDWA forms do not match and stay rejected.v_mov_b32_e32 vN, 0x…), not constant-buffer words (#360 condition 3).v_mov_b32emitsasfloat(<word>u)— a pure bit-cast — soasuint/asintrecover the exact 32 bits, including0xFFFFFFFFand0x80000000.F32_ROUND_ASSUMPTION = "nearest-even"— CPU references convert via Python float then binary32 (RNE); the Scarlett pipelineMODE.FP_ROUNDis unmeasured. If adapters disagree on a row, the result is recorded, not chosen.check_cvt_int_f32_draw(both backends): five input pairs covering 0, 1, 2^24, 2^24+1 (tie→even), 2^25+1 (rounds down), 2^25+3 (rounds up), 2^25+2 (tie→even),0x7FFFFFFF,0xFFFFFFFF,0x80000000; the reference asserts the tie rows round to even so the fixture discriminates rounding. Negative control: swapping u32↔i32 on (0xFFFFFFFF,0x80000000) must reportpixel_mismatch.check_binary's LLVM 15 round-trip list.docs/coverage/rdna2.tsvis regenerate-only (tools/form_reference.py); both VOP1 rows already exist and coverage derives from the ACCEPTED record at runtime, so no tsv edit.scan_unsupported_shaders.pyis not maintained on this branch's convention (it already lacks several lowered forms); left untouched.Verification
Environment: Windows 11 Pro build 26200.9711, MSVC 14.44.35207 (VS 2022 Build Tools 17.14), Windows SDK 10.0.26100.0 (its DXC), CMake 4.4.3 / Ninja 1.13.2, Python 3.12.10. Adapters: AMD RX 9060 XT (32.0.32029.2010), NVIDIA RTX 5060 Ti (32.0.16.2124), in-box WARP 10.0.26100.9711. Debug layer unavailable (Graphics Tools not installed); runs report
debug_layer=unavailable. LLVM 15.0.7 official win64 binaries (the installer omitsllvm-mc; assembly uses clang 15.0.7's integrated assembler — the same MC layer — through a local argv wrapper, disassembly usesLLVM-C.dll15.0.7).Result at this branch (rebased onto
mainat4f6c39d; isolated worktree configured with thedevpreset, ctest via--test-diron that build, same filters):pixel_aot_check.py binary(LLVM 15.0.7 round trip, all fixtures incl. the new one)pixel_aot_hardware(default adapter, RTX 5060 Ti)pixel_aot_warp(WARP 10.0.26100.9711)pixel_aot_hardwarewithXBOX2WINDOWS_ADAPTER='RX 9060 XT'pixel_aot_hardwarewithXBOX2WINDOWS_ADAPTER='RTX 5060 Ti'tests/form_coverage_check.pyAll draws report
pixels=4096 channels=16384 max_absolute_error=0; the conversion rows match the nearest-even reference bit-for-bit on all three backends (no adapter disagreement to record); the swap negative control reportspixel_mismatchon every backend. Capability skips: none in this group. Until #363 merges, this PR's diff againstmainincludes #363's commits; the incremental change is the single commit on top of them.Evidence and follow-up
docs/experiments.mdrecords the two instructions, the nearest-even assumption (consoleMODE.FP_ROUNDunmeasured), the discriminating rows, the literal-input constraint and the swap negative control.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-22T03:18:26Z.
Small gap noticed while doing stage 3 (#438):
tools/scan_unsupported_shaders.pyhas no pattern for the stage-1 forms, so the scanner still reportsv_cvt_f32_u32_e32/v_cvt_f32_i32_e32as unsupported after this PR. #438 adds the stage-3 pattern with the translator's literal spacing:The stage-1 equivalent would be
r"v_cvt_f32_(?:u32|i32)_e32 v\d+, (?:[vs]\d+|0x[0-9a-f]{1,8}|-?\d+)"(matching the operand set oftools/pixel_aot.py's stage-1 regex), plus a case inTestRdna2Scanner(tests/rdna2_tools_check.py). I left it out of #438 because it belongs to this PR's scope. Happy to fold it into #438 instead if you prefer.This comment is AI-assisted.