Repository navigation
Conversation
Global loads and stores of 2-4 dwords used to emit one mem.Load or mem.Store per dword, so with several memory windows each one was a switch over the windows. Emit a single Load2/3/4 or Store2/3/4 instead, matching what s_load already does. Addresses stay the same. The only difference is an access running past the end of a 4 GiB window, which used to wrap to the start of that window and now reads 0 or is dropped (neither matches the console).
tctev
force-pushed
the
recomp-flat-vector-access
branch
from
November 24, 2026 16:04
338c470 to
dfd1b5b
Compare
Author
|
Closing as a duplicate of #1439, which was opened first and already has the same global/flat change along with the s_buffer_load / buffer_load part. |
Contributor
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
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.
Global loads and stores of 2-4 dwords used to emit one
mem.Loadormem.Storeper dword. With 4 memory windows each of those runs aswitch (xcl_w), so aglobal_load_dwordx4meant four switches for one contiguous access. They now use a singleLoad2/3/4orStore2/3/4instead, likes_loadalready does. Part of #1269.Addresses are unchanged, and single-dword accesses produce the same HLSL as before. The only difference is an access that runs past the end of a 4 GiB window, which used to wrap to the start of that window and now reads 0 or is dropped (neither matches the console). This doesn't touch
mem_accessors, so it doesn't conflict with #1380 or #680.The test extends
gpu_memory_windows_above_4_gibwith an unalignedglobal_load_dwordx4and aglobal_store_dwordx3in window 1 and checks that each is a single accessor call, which fails onmain.Tested
Ran
cargo build --workspace && cargo test --workspace -- --test-threads=4on1d4549ewith this change (debug, Rust 1.100.0, Windows 11 build 26300, i5-12500H, RTX 4050 Laptop GPU with driver 32.0.16.1742). 751 passed, 0 failed, and 41 ignored, withgpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardwareskipped because there is no wave64.Also compiled a synthetic compute program made only of these accesses (150 rounds of x4 and x2 loads and an x4 store), three runs each with a fresh constant per run so the driver cache couldn't help. With 4 windows, DXIL went from 272 KB to 129 KB, DXC from about 15 s to 7 s, and
CreateComputePipelineStatefrom about 10 s to 8 s. With 1 window, DXIL went from 87 KB to 52 KB and the driver from about 0.8 s to 0.5 s. This is an upper bound since real programs mix in other things.Regression run
TODO: still need smoke blocks for
mainand this head. I don't have a retail title, so someone who does will need to run them.Not tested
Haven't tested a retail title, AMD, Linux, native wave64, or this combined with #1380.
AI use
Claude Code (Claude Opus 5.5) wrote the code, test, and benchmark and ran them on the hardware above. I reviewed the diff and the numbers.
🤖 Generated with Claude Code