GPU: preserve pre-init dynamic and concurrent view_addresses updates #3175
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!3175
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3175"
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?
@fuzeofficlal on GitHub · 2026-11-26 11:10 UTC · original
fuzeofficlal:fix/gpu-view-addresses-init→main· +287 −19 · 1 files · 1 commits · openSummary
Fixes two correctness bugs in
HostHeap::view_addressesandHostHeap::note_address(crates/victory-gpu/src/descriptor/host.rs) where descriptor view-address entries were silently zeroed or permanently lost around lazy upload-buffer initialization:view_addresses()call were overwritten with zeros:HostHeap::note_addressdropped every update whileself.addresses(OnceLock) was still uninitialized, andview_addresses()unconditionally zeroedself.count..self.address_slots()on first use. When an earlier draw/dispatch or an earlier shader stage in the same pipeline populated dynamic slots viamake_atand cached them inState::fresh_tables(draw.rs), a subsequent stage/draw requiringview_addresseshitfresh_tableswithout callingmake_atagain and read[0, 0, 0, 0]instead of the buffer GPU address or texture size words.mirror/make_atupdates racingOnceLockpublication were permanently lost:view_addresses()releasedself.madeat the end of theget_or_initclosure beforeOnceLockpublishedself.addresses. Any concurrentmirror()ormake_at()running in that window sawself.addresses.get() == Noneand skippedwrite_address; for title slots,self.made[index]already held the new key so latermirror()calls took the fast path and leftview_addresses[index]permanently stale.Fix
address_state: Mutex<AddressState>(Pending(HashMap<u32, [u32; 4]>)->Ready(usize)) alongside the existingOnceLockinHostHeap.self.addresses.get()fast path innote_addressonce published. Before publication, record dynamic-slot words (index >= self.count) inPending(removing cleared[0; 4]entries) or write directly onceReady(data).view_addresses(), fill title slots undermade, zero dynamic slots, then transitionaddress_statetoReady(data)and replay all pending dynamic-slot words before releasingaddress_stateandmade(preserving lock ordermade -> address_state).Testing
Added two deterministic regression tests in
crates/victory-gpu/src/descriptor/host.rs:dynamic_slots_made_before_view_addresses_keep_their_entries(fails onmainwithSome(0)instead of the latest dynamic buffer address / texture words; passes after fix).concurrent_updates_during_view_addresses_init_are_not_lost(fails onmainwith stale pre-init title-slot address even after re-mirroring; passes after fix for title overwrite, title clear, and dynamic slot creation during the init window).Verified on Windows x64:
cargo test -p victory-gpu --locked view_addresses(RTX 5090): 3/3 passedVICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked view_addresses(RTX 5090): 3/3 passed, 0 debug-layer messagesVICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked descriptor::host::tests -- --test-threads=1: 17/17 passed, 0 debug-layer messagesVICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --locked: 248 passed, 0 failed, 1 ignoredcargo clippy --workspace --all-targets --locked -- -D warnings&--all-features: cleancargo test -p xtask --locked policy::tests::repository_passes_policy: passed@Dukestar69 on GitHub · 2026-11-26 11:28 UTC · original · approved these changes
Verified on RTX 5090 & WARP against
origin/main(63bcca4):cargo test -p victory-gpu --lib descriptor::host:: -- --test-threads=1 --skip dynamic_slots_are_held_until_released: 16/16 passed on RTX 5090 and WARP (includingconcurrent_updates_during_view_addresses_init_are_not_lostanddynamic_slots_made_before_view_addresses_keep_their_entries).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly preserves pre-init dynamic entries and concurrent updates during
view_addressesinitialization.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 11:42 UTC · original
@fuzeofficlal I tested the upload-table allocation independently on main
63bcca43and your exact12a89d2. Both retain the first allocation refusal for the heap's lifetime. A draw needing the table can keep getting dropped after upload memory becomes available.With the same synthetic WARP test, a four-slot title heap first requests 4,194,368 bytes and the fixture refuses that request once. On both baselines there is no second allocator call and the table remains unavailable. The follow-up requests the same 4,194,368 bytes again, obtains a GPU address, reuses it on the next lookup, and updates and clears a dynamic descriptor. It also adds an initial refusal to your pending-slot test, which still recovers the previously recorded buffer and texture words.
Your concurrent writer test passed on app-local SDK 620 and WARP 1.0.22. Full GPU diagnostics passed 249 tests with 1 ignored. Strict GPU Clippy passed in both configurations, and the repository asset policy passed.
Follow-up commit on your current head. Please retain the Git author if you cherry-pick it, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if you fold it into your commit.AI-assisted with Codex. Synthetic descriptors only.
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 18:27 UTC · original
I also tested the address-table retry together with #3276’s descriptor recovery. The combined result on #3276 keeps the original heads and adds a test that makes the two allocations fail independently. On WARP, the address table recovers while the descriptor slot is still null, and the next
make_readrecovers the actual texture with the expected view-address words. The focused test passed 3/3 and the full GPU suite passed 252 with one ignored.The follow-up to this PR is still
6ceee44if you want to review it separately. If you fold our change or test into another commit, please preserve its Git author or addCo-authored-by: andrewpozdnakov7-jpg <[email protected]>.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.