Repository navigation
Shaders: lower dynamic v_perm_b32 sign fills once per instruction - #3600
Open
Ingenioeren wants to merge 1 commit into
Open
Ingenioeren wants to merge 1 commit into
Ingenioeren wants to merge 1 commit into
Conversation
|
Independent verification (Windows 11 Pro 26200, D3D12 WARP software adapter only, dxil.dll 1.8.2502.11 from SDK 26100).
Not tested: game shaders, native GPU, other adapters. AI-assisted (Claude Sonnet 5.5) |
|
Hardware run on AMD, since the report so far is WARP only: RX 5700 XT (Navi 10, RDNA1, driver 32.0.21045.29003, Windows 11 26200), head
AI use: Claude Code (Claude Opus 5.5). |
This was referenced Nov 28, 2026
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.
Dynamic
v_perm_b32now packs its four sign-fill bytes once and reuses the existing byte-index shift to select them. Previously, each of the four output bytes rebuilt all four sign fills and selected between them separately.The one-thread synthetic shader drops from 158 to 107 emitted DXIL instructions: 51 fewer (32.3%), including its root-constant loads, UAV store, and block terminators. The test counter follows the bitcode writer's reachable-block and live-instruction plan. The test-only counter uses the same helper as #3592/#3564/#3525 so the PRs merge cleanly.
Candidate measurements (same synthetic shader harness; alternative prototypes discarded):
v_bfi_b32v_sad_u8v_perm_b32(chosen)No open PR changes the
v_perm_b32lowering (checked against the open PR list).Bit identity follows by partitioning each unsigned selector byte: 0-7 use the existing ordinary-byte path; 8-11 index packed bytes that are FF exactly when the corresponding source bit (src1 bit 15/31, then src0 bit 15/31) is set; 12 remains zero; 13-255 remain FF. The four packed fields do not overlap. Arithmetic shifts replicate the intended bit, all shifts have defined amounts below 32, and dynamic shifts remain
(selector & 3) * 8. All operands remain raw integer bits, including bit patterns representing NaNs or denormals. Literal/inline-constant selector lowering is untouched.Validation commands:
63bcca4: 300 passed, 2 failed, 3 ignored.dxil.dllPSV validation errors:emit::rect::tests::rectangles_get_their_fourth_cornerandemit::tests::elements_sharing_a_row_keep_their_order.Not tested: game shaders or game behavior, native GPU instruction counts, runtime performance, other adapters/operating systems, or an exhaustive enumeration of all 96 input bits. The three existing ignored tests were not enabled. The full command stops at the two unit-test failures, so integration/doc tests are not reached by that command.
AI assistance: prepared with OpenAI Codex under Claude Code's direction, reviewed by Ingenioeren.
🤖 Generated with Claude Code