GPU: only a shader that can store by address declares its title-memory copies written (12 GB/frame of CPU compare with ray tracing) #916
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!916
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-916"
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?
@SpaghettiMaster545 on GitHub · 2026-11-25 12:41 UTC · original
SpaghettiMaster545:pr/raw-store-written→main· +79 −3 · 2 files · 2 commits · openWhat was wrong
A shader that reads title memory by address declared every numbered copy of that memory written whenever it could store anything at all. Each of those copies was then snapshotted before its submission and compared on the CPU after. The programs that walk the ray-tracing structures read them by address but store their results through views, so every one of their dispatches declared all of the copies.
How it shows in game
With the structure builder running, that came to 12 GB snapshotted and compared per frame (3,030 ranges of 4 MiB). A frame took 3.5 s, 1.3 s of it copying back.
What the change does
Only a program that can store by address (a flat, global or scalar-memory store or atomic, or code that is not fully known) declares the title-memory copies it reads as written. Stores through root views are declared as before (
stores_by_addressinpipeline.rs, used bydraw.rs).How it was tested
cargo test --locked -p victory-gpu --libpasses on this branch (169 passed, 5 ignored).cargo clippy -p victory-gpu --all-targets --locked -- -D warningsshows only the errors thatmainalready has (placed_filler_twins,sort_unstable_by_key,is_multiple_of,depth_written) and adds none.Developed with AI assistance (Claude Code).
@ArturoWolff on GitHub · 2026-11-25 12:52 UTC · original
I checked the store classification independently on Linux at
417592b, using the branch's actualvictory-shaderdecoder and both predicates extracted unchanged frompipeline.rs. Each synthetic stream starts with ans_load_dwordby address. Ten cases passed their decode-name and predicate checks.storesstores_by_addressbuffer_store_dword,tbuffer_store_format_xflat_store_dword,global_atomic_add,s_store_dwords_buffer_store_dword,s_buffer_atomic_adds_load_dwords_setpc_b64, unnamed FLAT opcode0x7fThe scalar-buffer row is worth pinning in a regression test: the new predicate distinguishes the vector descriptor stores, but deliberately or not, still classifies the scalar-buffer forms as possible address writes. That's conservative, not evidence of lost writes. I'd keep it conservative unless the lowering and aliased views are proved separately. This checks the decision behind the reported Windows improvement; it does not measure copy-back volume, VRAM residency or frame time under Proton. No game or GPU run.
AI disclosure: Hermes Agent built and ran the fixtures and wrote this report on ArturoWolff's behalf.
@SpaghettiMaster545 on GitHub · 2026-11-25 15:36 UTC · original
Thanks for checking. I agree it should stay conservative. A scalar buffer store's descriptor can point anywhere, title memory included, and proving otherwise would need the aliasing proof you describe. I pinned the classification in a test (
only_stores_that_can_take_an_address_count_as_address_stores, inf9c0ddc):buffer_store_dworddoes not count,s_store_dword,s_buffer_store_dwordandglobal_store_dworddo, and a plains_load_dworddoes not. It passes on Windows (RTX 5070 Ti, NVIDIA 621.40).View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.