shader: lower the e64 integer-to-f32 conversions with clamp in pixel_aot #411
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/417"
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-22T01:02:56Z.
Change
Refs #360 — stage 2 (
v_cvt_f32_u32_e64/v_cvt_f32_i32_e64withclamp), per the issue's proposed split. Stage 3 is claimed by @JB2WIN; stage 1 is #392.Stacked on #392 (stage 1), which is stacked on #363; both must land first. Until then the diff against
mainincludes their commits; the incremental change is the single commit on top.lower()accepts the e64 forms with an optionalclampsuffix, same operand guards as stage 1 (entry mask, outstanding-sample overlap, pending loads / un-waited samples viafp_operand); emissionfloat(asuint/asint(src)), wrapped insaturate(...)under clamp. The e32 branch is unchanged and still rejects clamp.omodis explicitly rejected, taking the issue's "or explicitly reject omod if it is out of scope" option, with a measured reason: LLVM 15.0.7's assembler rejects every probed omod syntax (omod:1/2/3,omod(2),mul:2, three-source spellings) on these forms and onv_add_f32_e64/v_mul_f32_e64, and a raw-encoding bit sweep (both dwords, 2-bit fields, values 1–3) never makes the disassembler printomod. omod cannot round-trip through the LLVM 15 text pipeline, so accepting it would be unverifiable. Rejection controls pin this.abs/negon the integer source stay rejected (the assembler itself refuses|s44|/-s44); DPP/SDWA variants stay rejected.check_cvt_int_f32_e64_draw(both backends): e64 plain rows reuse the stage-1 discriminating words (e64 == e32 semantics, nearest-even reference); e64 clamp rows pair (0, 1), (2, 0xFFFFFFFF), (0x80000000, 0x7FFFFFFF) with Python-clamped references. Inputs remainv_mov_b32literals.check_binary's LLVM 15 round-trip list. Rounding assumption unchanged: clamp rows are exact integers or exact clamps, so no new rounding ambiguity.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 (installer omitsllvm-mc; assembly via clang 15.0.7's integrated assembler through a local argv wrapper, disassembly viaLLVM-C.dll15.0.7).Result at this branch (isolated worktree configured with the
devpreset; ctest via--test-diron that build, same filters):pixel_aot_check.py binary(LLVM 15.0.7 round trip, all fixtures incl. e64 plain and clamp)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.pyctest --no-tests=errorCapability skips reported separately:
bvh_wave64_hardware(NVIDIA lanes 32..32),bvh_wave64_warp(WARP 4..4),wave_shuffle_warp(width-4 self-inverse). The e64 plain rows match the nearest-even reference and the clamp rows match the clamped reference bit-for-bit on all three backends (no adapter disagreement to record); both negative controls reportpixel_mismatchon every backend.Evidence and follow-up
docs/experiments.mdrecords the e64/clamp forms, the measured LLVM 15 omod limitation, the clamp rows and both negative controls.v_cvt_u32_f32/v_cvt_i32_f32, e32) remains with @JB2WIN; the inverse instruction's e64 forms stay rejected in both patches.AI-assisted.