Repository navigation
Conversation
What shaders wrote through the title memory page table was compared with title memory after the submission's other write-backs. One of a smaller buffer's copy in the same page marks the page changed, so the writes were taken for the title's and lost; in memory that is not tracked the whole page went back over the smaller buffer's bytes. They are now found before anything goes back, and go back by their bytes after the rest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
catminou4
reviewed
Nov 25, 2026
catminou4
left a comment
Contributor
There was a problem hiding this comment.
Page-table writes go back beside those through views, ordered before copy-backs (new before-stage). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Ordering fix; correctness depends on Windows execution timing — hardware validation advised.
DenRakEiw
reviewed
Nov 25, 2026
DenRakEiw
left a comment
There was a problem hiding this comment.
Tested against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:
cargo test -p victory-gpu shadow::: 5/5 passed on RTX 5090 and 5/5 on WARP (includingpage_writes_go_back_beside_what_reached_the_page_meanwhile).cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.- Crash in new
memory::testson both RTX 5090 and WARP: Runningcargo test -p victory-gpu memory::tests -- --skip lists_share_a_table_and_copies_keep_their_views(excluding the pre-existing NVIDIA#1744test) passes the 2 existingmemory::tests(addresses_find_the_copy_holding_them,a_full_table_names_the_largest_copies) and then aborts the test process withexit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUNon both RTX 5090 andVICTORY_WARP=1during the newly addedmemory::tests.
AI-assisted (Gemini 4 Neon).
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.
Problem
A small title buffer lies inside a bigger one, and each has its own host copy. Shaders write the small one's copy through a view and the bigger one's through the title memory page table, in the same 64 KiB page. After the submission one of the two writes is lost:
copy_back_page, which runs after it, takes that for a title write and keeps title memory: the page-table write is lost. Marked writes (copy_back_marked) and declared ranges (copy_back) both do it.copy_back_pageputs the bigger copy's whole page back over what the small one just wrote.Change
Shadow::page_before, run by a newdefer_before). The title-write check is made there, so only title writes trip it. It is made after title memory is read, so a title write during the read is not taken for a shader's.copy_back_pageputs back only the copy's bytes that differ from that, and takes title memory's other bytes, as the other two write-backs do (the shared loop is nowmerge).copy_back_marked.Withheld lists still put no page-table writes back, and a list named twice in a submission is still processed once.
Cost, per marked page whose copy differs from title memory: up to 64 KiB of title memory kept (pooled) until the write-back, and a second read and compare.
Tests
Three synthetic tests write 1 into the small buffer's copy and 2 through the page table, then submit twice in one submission after the title wrote the page, and check that the title's other bytes stay.
main[1, 2][1, 0][1, 2][1, 0][1, 2][0, 2]A fourth (
page_writes_go_back_beside_what_reached_the_page_meanwhile) covers a title write between the two steps, in tracked and untracked memory. The shaders reach the small copy through a root descriptor; its write is declared as a view's (gpu_writes).On an RTX 3060 (Windows 11):
cargo test -p victory-gpu --locked -- --test-threads=1: 145 passed, 2 failed, 2 ignored. The 2 also fail with the fix off and are fixed by GPU: capped view heaps keep the full dynamic range (NVIDIA) #1751 (dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views).cargo xtask policypass.Not verified
Not covered
Pages the title wrote while the submission ran still keep the title's bytes, as before. Nor does it change which pages
Map::preciseleaves out: that is #1963, which this does not depend on.#2242 changes
copy_back_pagetoo, but not the order this fixes; #1963 touches the same parts ofmemory.rs. Both conflict with this textually and I can rebase on whichever lands. #1865 and #1869 merge without conflicts (not built together).AI-assisted (Claude Code).
🤖 Generated with Claude Code