shader: verify unsigned pixel comparisons on raw bit patterns #610
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/616"
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-22T16:02:05Z.
Change
Add a focused follow-up fixture for the integer predicate lowering in #306. The shader exports both operand orders of
v_cmp_lt_u32throughv_cndmask_b32, usingvcc_lofor e32 ands52for e64. The three input cases cover the sign boundary, equal words, and a pair whose unsigned order would reverse if a register move quieted the first NaN. The readback checks all four channels of 4,096 pixels per draw. Replacing both comparisons with the signed forms must produce a pixel mismatch.Verification
Tested commit
11090f5on base9b0df70with Windows 11 build 26300.10075, Windows SDK 10.0.26100.0 and LLVM 23.1.5.Evidence and follow-up
The fixture is original synthetic gfx1013 assembly authored in
tests/pixel_aot_check.pyunder the repository's MIT license. The raw inputs enter the constant buffer as 32-bit words, and the expected outputs come from Python unsigned comparisons.Checklist
This patch was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by MarlomMedeiros on 2026-11-22T18:11:41Z.
Review: COMMENTED
Community review + independent run on a second-vendor adapter, since the reported hardware is a Radeon RX 9060 XT.
Environment
11090f5on base9b0df70ctest --preset dev --no-tests=error -R '^pixel_aot_predicate_rounding_(warp|hardware)$' -V: both passeddebug_errors=0 debug_warnings=0,pixels=4096 max_absolute_error=0tests/pixel_aot_check.pycontrols pass on this commitReview notes
order * 2broadcast:vcc_loe32 forward and reverse, thens52e64 forward and reverse. Sign boundary, equal words and the NaN-payload pair each isolate a distinct failure mode.0x80000000vs0x7fffffffyields (0,1) unsigned and (1,0) signed, so theu32toi32mutation necessarily reports a mismatch at that case; the0x7f800002/0x7fc00001pair orders correctly only when the comparison reads raw bits, so a float-domain implementation fails it without needing a NaN-quieting assumption.9b0df70is ~30 commits behind currentmain(8f57366); the insertion point nearcheck_unsigned_less_than_drawshas been stable, so a rebase should be trivial.No blockers found.
AI-assisted: yes. All reported checks ran locally on the adapter and driver listed.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T18:00:35Z.
@lambirou Independent AMD (RDNA4) result on
11090f5. Measurements only, no code change.Environment
debug_layer=unavailable(Tools.Graphics.DirectXisNotPresenthere)11090f5.No LLVM with gfx1013 support on this machine, so the
binarypath described in your verification block was not run. What follows is the D3D12 draw path plus every CTest entry registered in this tree.Commands
Observed
23 tests, 23 passed, 0 failed, 0 skipped (116.75 s):
rdna2_tools_check, then the eleven_hardwaresuites (pixel_aot,buffer_color,u32_from_f32,attribute,three_way,predicate_rounding,blend_scalar,bfm,e64,integer_nc,rndne) and their eleven_warpcounterparts.On the main draw suite (separate targeted run, same build):
pixels=4096and one atpixels=64, every onemax_absolute_error=0(4 channels per pixel).max_absolute_error=0.Why this is worth measuring on this adapter
The fixture covers both operand orders of
v_cmp_lt_u32throughv_cndmask_b32, withvcc_lofor e32 ands52for e64, and one case whose unsigned order would reverse if the first NaN were quieted by a register move. That is a pure integer-predicate path, so an adapter difference would surface as a wrong pixel rather than a compile error. All 16,384 channels per draw matched on both backends.Limit
The negative control you describe (replacing both comparisons with the signed forms must produce a pixel mismatch) lives in the
binarypath, which needs LLVM 23.1.5 — not installed here. So this run confirms the draw results and the registered tool checks, not the negative control.AI-assisted; runs executed locally.