GPU: page-table writes go back beside those through views in one page #2331
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2331
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2331"
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?
@oVolkra on GitHub · 2026-11-25 10:46 UTC · original
oVolkra:fix/page-table-writes-beside-views→main· +277 −46 · 3 files · 1 commits · openProblem
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 #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
@Marvisak on GitHub · 2026-11-25 15:23 UTC · original · edited 2026-11-26 03:22 UTC
Automated triage for the maintainers.
Verdict: needs work. Thanks for the rebase (
eba5a8b, merges cleanly). The split intoShadow::page_before(run from the newHostList::defer_before, before any write-back) andcopy_back_page(page, before)(merging only the bytes that differ, after the other write-backs) matches the problem described, and the new tests cover the three orderings.The point left open at the last triage is still unanswered. Please run the new
memory::testsandshadow::tests::page_writes_go_back_beside_what_reached_the_page_meanwhileon WARP, both alone and with the default thread count, and post the result. An earlier report saw them abort with0xc0000409. The rebase reply covers only the two pre-existing failures. This reworks the order of title-memory write-backs for every submission, so the maintainers need that result before taking it.CI:
checkpassing.Generated by Claude Code
@oVolkra on GitHub · 2026-11-25 19:21 UTC · original · edited 2026-11-25 22:49 UTC
Rebased onto
main(219878a) to resolve the merge conflicts.The two failing GPU tests (
dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views) also fail onmainwithout these changes.View 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.