shader: lower scalar first-bit scans in pixel_aot #612
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/618"
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 descent81 on 2026-11-22T16:06:58Z.
Change
Add
s_ff0_i32_b32,s_ff1_i32_b32,s_ff0_i32_b64, ands_ff1_i32_b64. These SOP1 instructions search from the least-significant bit and return its index when the requested bit is found, or0xffffffffotherwise. The 64-bit path reads the existing SGPR pair and only searches the high word when the low word has no match. Both widths preserve SCC, as specified in the AMD RDNA 2 ISA reference.The source-built fixture uses a Python bit-by-bit reference, compares the full 32-bit results and reads SCC before the result comparison can overwrite it. An all-zero and an all-one input check the no-match result for both bit values. Other inputs cover the 31/32 boundary, a low-word match that must win over a high-word match, and a single set bit at position 63. A shader that drops the high word must fail the same reference on that last input.
Verification
Tested
8fedbccon basee7e9133.Evidence and follow-up
The fixture uses source-written assembly and synthetic constants under the repository's MIT license. The vector bit-scan work in #541 and the scalar bit-count work use separate instructions.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-22T19:13:33Z.
Independent Windows run of this PR on physical hardware:
8fedbcc(PR head), built from sourcectest --preset dev --no-tests=error -R '^pixel_aot_' -V: 22/22 passed on hardware and WARP, no skips. The debug layer reporteddebug_errors=0on all 460 draws. I did not run any mutations.AI-assisted.