GPU: a buffer view slot follows the title buffer that holds its bytes #2895
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!2895
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2895"
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?
@0xkn0wh3r3 on GitHub · 2026-11-25 23:18 UTC · original
0xkn0wh3r3:gpu/buffer-slots-follow-new-and-released-owners→main· +118 −3 · 3 files · 2 commits · openWhat
A buffer view reads the copy of the innermost title buffer that holds its bytes (
shadow::for_view→find). A heap slot made from a view kept the copy it was first made on. Two things change which copy draws refresh for the view (view_copy, fromreadable):The copy the slot showed stayed the same either way. So shaders read a copy that was no longer brought up to date, or a released buffer's copy. The fresh tables a list reuses (
fresh_tables) held the same stale views.This PR adds three things:
shadowcounts title buffers made and released (owners()).HostHeap::mirror: a buffer view slot whose record hasn't changed is checked again only when that count has moved. It's made again when the copy it shows isn't the one its view reads now. Until buffers come or go, the cost is one comparison.fresh_tableskey includes the count, so a list makes a table again after buffers come or go.Where it came from
From DexNom's fork, DexNom/VIctory@5f4c3df (
buffer_owner_current,BUFFER_GENERATION, and the testplaced_buffer_slots_follow_new_and_released_owners). It's reworked for this tree'smirrorand compares againstview_copy, so views with copies of their own (shadow::exact) are handled too. Credited withCo-authored-by: DexNom.Tested
descriptor::host::tests::buffer_view_slots_follow_new_and_released_owners. It places a shader view and an unordered view in a 512-byte title buffer. The slots show its copy, then the copy of a 64-byte buffer placed inside it, then the outer copy again once the inner buffer is released, each time the copyview_copygives. With the check disabled, it fails at the second step (the slot still shows the outer copy).cargo test -p victory-gpu(Windows 11, RTX 5070 Ti): 230 passed. The 2 known NVIDIA failures are fixed by #2121.cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without--features diagnostics: clean.Not tested
fresh_tableskey change within one list.Changes after review
a71de13, race: the owner count now goes up after the buffer map changes, so amirrorthat read the old count looks again.a71de13, constant views: constant views in the heap are made raw views of the copy that holds their bytes, and they now follow it too (shown_copy). The test adds a constant view of the same bytes; without the change, slot 2 keeps the outer copy.@Marvisak on GitHub · 2026-11-26 04:30 UTC · original · edited 2026-11-26 07:23 UTC
Automated triage for the maintainers.
Thanks, that answers the note.
draw::State::cutclearsfresh_tables, so an owner change only rebuilds tables within the current segment. A diagnostics counter can be a follow-up. Nothing else has changed (same head). One cross-PR point: #2821's lock-freereadypath inHostHeap::mirrorwould skipowner_moved, so whichever lands second needs to account for it.CI: passing.
Generated by Claude Code
@0xkn0wh3r3 on GitHub · 2026-11-26 07:06 UTC · original
On the
fresh_tablesnote:fresh_tableslives in one host list segment (State::cutclears it). So a buffer create or release invalidates the tables already made in that segment only, and each is made again at most once, on its next use. The cost is that rebuild plus its dynamic slots, which stay held until the list is reset.I haven't added a counter, to keep this PR small. Telling an owner-change rebuild apart from an ordinary miss needs a second key without the count. If you'd like the number before merging, I can add a diagnostics counter here or as a follow-up.
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.