Repository navigation
Shaders: a formatted load converts only the fields its DST_SEL reads - #33
Merged
ThatRecompDev merged 1 commit intoNov 25, 2026
Merged
Conversation
FmtLoad converted all four fields of the element and fmt_swizzle chose among them after, so every component's conversion (int-to-float, two divides, f16 widening and the format selects) stayed live even where the program reads only x. FmtLoad now takes V# dword3 and each result component converts the one field its selector names: the unread components fold away. The results are unchanged bit for bit. In a retail game's 122k-dword compute program with 3,281 format loads, the DXIL backend output goes from 1,256,697 to 735,530 instructions (-41%), 26,260 to 6,574 divides, 7.4 to 4.9 MB. Tests: cs_buffer_rule_format_select loads an 8_8_8_8_UINT element through DST_SEL z,y,x,1 and w,0; it fails when the selectors are ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
41% fewer instructions on the biggest compute program with identical results is a great win, especially since that's the one stuck as a stand-in longest. merged, thanks! |
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.
Until now,
FmtLoadconverted all four fields of an element, andfmt_swizzlepicked among them afterwards. Every component's conversion (int-to-float, two divides, f16 widening and the format selects) therefore stayed live, even when the program reads onlyx.FmtLoadnow takes V# dword3. Each result component converts only the one field its selector names, so unread components fold away. Results are unchanged bit for bit.fmt_swizzleandfmt_selectare gone, andprobe_FmtLoadgets the extra argument.A retail game's 122k-dword compute program has 3,281 format loads. Its DXIL backend output shrinks as follows:
fdivThe driver compile scales with that size. That program is the one that stays a stand-in for the longest.
Tests: the new
cs_buffer_rule_format_selectcase loads an 8_8_8_8_UINT element through DST_SEL z,y,x,1 and w,0. It fails when the selectors are ignored. The full suite is green.🤖 Generated with Claude Code