shader: lower indexed tbuffer_load_format_* and indexed subword buffer ops #527
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!527
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-523"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Sheffy007 on GitHub · 2026-11-28 00:17 UTC · original
Sheffy007:feat/indexed-tbuffer-and-subword-buffers→main· +505 −32 · 5 files · 1 commits · openSummary
tbuffer_load_format_*/_d16_: Foldindex * strideintooffforSource::Builtroot views (including 40/48-bit root descriptors whose high half is masked withs_and_b320xFF/0xFFFF) andview_strideheap/table views, and lower structured-table indexedtbuffer_load_format_*through(12 | u, stride)handles informat_load(matchinggetDimensionson dword 2).tbuffer_load_format_*/made_raw: Accepttbuffer_load_format_*inTracer::stride_clearedand recordmade_rawsites inResources::unstridedso cleared-stride descriptors dropidxenper RDNA2 ISA 8.1.5 while keepingbuffer_load_format_*refused.buffer_load_{ubyte,sbyte,ushort,sshort}andbuffer_store_{byte,short}withidxenon dword-alignedStructuredBuffer/RWStructuredBufferviews viarawBufferLoad.f32and pairedatomicBinOp.i32(And/Or) on(12 | u, stride)handles.gfx_refusal_tests.rs, an end-to-end Metal GPU value test (addr_tests::indexed_tbuffer_format_and_subword_buffer_ops_run_on_the_gpu) covering structured/heap/root/cleared-stridetbuffer_load_format_*, indexedubyte/sbyte/ushort/sshortloads, and concurrent multi-lane indexedbyte/shortstores, and updateddocs/native-host.md.Verification
cargo xtask policycargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warningscargo clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-gnullvm -- -D warningscargo test -p victory-shader -p xtaskcargo test -p victory-gpu --lib addr_testscc @Olima34
Closes #524
Refs #4, #258
Fold index * stride into byte offsets for tbuffer_load_format_* (and _d16_) on built root views and view-stride heap/table views, lower structured indexed tbuffer_load_format_* via (12 | u, stride) handles in format_load (matching getDimensions on dword 2), drop idxen when stride_cleared or made_raw clears a descriptor's stride, recognize s_and_b32 0xFF/0xFFFF truncation on 40/48-bit root descriptor high halves, and lower indexed buffer_load_{ubyte,sbyte,ushort,sshort} and buffer_store_{byte,short} on structured buffers via rawBufferLoad and paired atomicBinOp. Closes #520 Refs #4, #258@Olima34 on GitHub · 2026-11-28 01:17 UTC · original
Thanks @Sheffy007! Here's an offline check of
53e92d9f, merged onto main86cefd22(it merges cleanly). No game run.Checks on the merge:
cargo test -p victory-shader -p victory-gpu -p victory-hle -p victory -p xtaskpasses. That includes victory-gpu on arm64, so your Metal value testaddr_tests::indexed_tbuffer_format_and_subword_buffer_ops_run_on_the_gpuran on the GPU.x86_64-pc-windows-gnullvm,-D warnings) is clean, andcargo xtask policypasses.Corpus sweep (
examples/sweep+tools/corpus/compare.sh, main → main + #527, by output fingerprint):The sweeps are byte-identical on all three sets. None of our corpora holds a shader refused for the reasons this PR lifts ("a typed-format load by index", "a byte or half buffer load/store by index"), so we can't show a gain here. The cases it covers may come from parts of the game our dumps don't reach (boot, prologue and the first world area on Series S). If you have the hashes of the shaders that motivated #524, we'll look for them in a longer run.
This also settles a side effect we wanted to rule out.
made_raw_atalso pushes plain (non-format) loads through a built raw descriptor intounstrided, which would drop theiridxen. It changed no output in 21,600 shaders.One small question on the code: in the new indexed subword-load path (
subwithSome(index)), theguardargument isn't used, while the non-indexed path passes it toraw_view. If a guarded (EXEC-skipped) load can reach that path, should it go throughbegin_guardedlike the indexed store does?Note: the maintainer listed this PR among those he's holding for now, so it's his call when it lands.
53e92d9f77to2937858791View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.