shader: lower scalar first-bit scans in pixel_aot #618
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!618
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/618/head"
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?
@descent81 on GitHub · 2026-11-22 16:06 UTC · original
descent81:shader/scalar-first-bit→main· +67 −0 · 4 files · 2 commits · merged 2026-11-23 04:28 UTCChange
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.
@JB2WIN on GitHub · 2026-11-22 19:13 UTC · original
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.