Repository navigation
Shaders: lower v_mbcnt through Ubfe - #3686
Open
Ingenioeren wants to merge 1 commit into
Open
Ingenioeren wants to merge 1 commit into
Ingenioeren wants to merge 1 commit into
Conversation
|
Hardware run: RX 5700 XT (Navi 10, RDNA1, 32–64 lanes, driver 32.0.21045.29003, Windows 11 26200), head
AI use: Claude Code (Claude Opus 5.5). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v_mbcnt_lo_u32_b32andv_mbcnt_hi_u32_b32currently build(1 << below) - 1, select the full-width mask, AND it with the source, and then count bits. Extracting the low bits with DXIL Ubfe removes three written instructions per form. The full-source select is retained for widths of 32 or more, since Ubfe masks its width to five bits. Lane selection, wave-size requirements and accumulation are unchanged.Synthetic compute shaders with a dynamic mask and accumulator, counting the complete written function body:
v_mbcnt_lo_u32_b32v_mbcnt_hi_u32_b32These are DXIL instruction counts, not GPU timing or frame-rate measurements. The test-only instruction counter is identical to #3600 and the subsequent lowering PRs.
Validation:
cargo test --locked --offline -p victory-shader mbcnt -- --nocapture: the count regression fails on the original lowering at 27/30 and passes at 24/27 after the change. The execution test passes before and after: 113,280 inputs for each of wave32/wave64 and full/even-lane EXEC, 453,120 cases per revision on RX 6750 XT. It checks low/high counts, their chained accumulation, unsigned wraparound, single-bit/complement/edge/random masks, all lane positions and inactive destinations against an independent per-bit CPU reference. DXIL validation passes. WARP reports no wave support and skips these executions.cargo test --locked --offline -p victory-shader --no-fail-fast: baseline 300 passed / 2 known failures / 3 ignored; final 302 passed / the same 2 failures / 3 ignored. The two existing local validator failures remainrectangles_get_their_fourth_cornerandelements_sharing_a_row_keep_their_order(PSV mismatch). Integration: 3 passed / 1 ignored; doc tests: 0.cargo clippy --locked --offline -p victory-shader --all-targets --all-features -- -D warnings: passed.cargo run --locked --offline -p xtask -- policy --staged: passed for all 3 changed files. Existing formatting deviations match main in each changed file.No game files were used and no game run was performed. Other GPU vendors, Linux/RADV, graphics and mesh execution were not tested. #599/#3556 address separate ballot/lane semantics in or near this arm; this PR retains main's behavior and may need a small rebase depending on merge order.
AI assistance: prepared with OpenAI Codex, reviewed by Ingenioeren.