Repository navigation
perf(shader): read constants up to four dwords per load - #373
Open
romainhedouin wants to merge 1 commit into
Open
romainhedouin wants to merge 1 commit into
romainhedouin wants to merge 1 commit into
Conversation
Contributor
|
Note 🤖 GPT-6.2 Sol responding on behalf of brainbudt Two findings from reviewing this PR and its CI failure:
|
Owner
|
Thank you. CI is green, but this now conflicts with #368 and #371 (both just merged) in |
Scalar and per-lane constant reads through raw views (heap and table constant buffers, root SRVs, title memory) issued one raw buffer load per dword; they now load up to four consecutive dwords at once (mask (1 << n) - 1, 4-byte alignment), as D3D12 bounds raw loads per component. Constants at a computed offset of a root CBV load each row the run touches once, instead of a row and three selects per dword. In title memory a run that starts before its copy (on the copy's first page) has an offset just under 2^32 that wraps into the copy from one dword to the next; lanes whose run wraps read it a dword at a time, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
romainhedouin
force-pushed
the
perf/constant-loads-four-dwords
branch
from
November 26, 2026 18:28
e20c8ae to
d1b4717
Compare
Contributor
Author
|
Rebased on
The per-pattern counts in the description were re-measured on the rebase. The non-title-memory rows match the earlier numbers exactly.
|
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.
Constant and root-view reads through raw views (heap and table constant buffers, root SRVs, title memory) issued one raw buffer load per dword. They now load up to four consecutive dwords at once (mask
(1 << n) - 1, 4-byte alignment), asbuffer()already does. Constants at a computed root-CBV offset load each row they touch once, instead of a row and three selects per dword.s_buffer_load_dwordx16through a tableglobal_load_dwordx4through a root views_load_dwordx16from title memoryA load that runs partly past its view relies on D3D12 bounding raw loads per component, as the existing multi-dword
buffer()loads do. In title memory, a run that starts before its copy (on the copy's first page) has an offset just under 2^32 that wraps into the copy between dwords. Lanes whose run wraps read it a dword at a time, as on main.Tested: native victory-shader suite (207 passed), Windows clippy with and without
--all-features,xtask policy. On a 68,064-program synthetic corpus, the 25,897 accepted programs that don't reach the changed loads emit byte-identical DXIL to main, and no program went between accepted and refused. The GPU testsconstants_read_four_dwords_a_load_read_zeros_past_the_viewandruns_from_just_before_a_copy_read_its_first_dwordshaven't run on D3DMetal yet.🤖 Generated with Claude Code