GPU: stage HostHeap descriptor updates until submission flush #2046
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2048"
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?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T04:06:45Z.
Refs #1348.
Summary
HostHeapdescriptor writes (mirror,make_at,make_null,raw_view_at,raw_pair_at) into CPU-only staging chunks and publish each slot atomically alongside itsstrides,marks, andaddressesside-table entries inHostHeap::flush, called underHost::execute's submission lock right beforeExecuteCommandListsand again after the submission finishes waiting, beforerelease_retired.HostHeap::view_addressessynchronized withHostHeap::flushviaStaged::published_addresses(under thestagedmutex) rather than readingself.madedirectly, so unflushedmadeupdates never leak into the view-address buffer ahead of their staged descriptors.alloc_staged(CreateDescriptorHeap) fails instead of dropping slot updates.Verification
descriptor::host::tests::concurrent_slot_rewrites_do_not_corrupt_in_flight_32_list_submissiondescriptor::host::tests::staged_slots_publish_descriptors_and_side_tables_atomicallydescriptor::host::tests::view_addresses_stays_synchronized_with_staged_flushesdescriptor::host::tests::alloc_staged_failure_falls_back_to_direct_writescargo clippy -p victory-gpu --tests --locked -- -D warningsandcargo xtask policy: passed.Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T04:17:29Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
HostHeap descriptor writes staged until GPU idle — fixes a descriptor-tearing race; perf cost on every heap write, check how often the idle wait triggers.
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-25T04:14:56Z.
Triage verdict — Keep the staging approach, publish each slot atomically (
da8574b)Evidence
Checks and limits
Next step
This verification was AI-assisted.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T04:50:19Z.
Updated in
cdc6fbd0— thanks @jeremygold02 for catching the split staging window:StagedOpqueue pushes with compositeStagedSlot { index, descriptor, stride, mark, address }records committed in a singlecommit_stagedlock scope acrossmirror,make_at,make_null,raw_pair_at(both pair slots together), andraw_view_at(..., mark)(eliminating the separateset_markcall inState::root_view).staged_slots_publish_descriptors_and_side_tables_atomicallytesting deterministic pre/post-flush isolation, 4,000 interleaved flushes against concurrent slot rewrites, and 16 GPU compute dispatches readingHostHeapand all three side tables simultaneously across RTX 5090, AMD RDNA2, and WARP.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T09:20:16Z.
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-gpu/src/descriptor.rs,crates/victory-gpu/src/descriptor/host.rs,crates/victory-gpu/src/host.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs-work) was for an older state ofmain.Generated by Claude Code
[PR #2048] GPU: stage HostHeap descriptor writes until the GPU is idleto [PR #2048] GPU: stage HostHeap descriptor updates until submission flushImported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T10:34:31Z.
Updated in
40d0bcecper triage feedback:view_addressessynchronization:HostHeap::view_addressesnow initializes fromStaged::published_addressesunder thestagedlock (and updatespublished_addresses+addresses_dataatomically insidewrite_side_tablesduringflush), rather than readingself.madedirectly ahead of staged descriptors. Covered byview_addresses_stays_synchronized_with_staged_flushes.alloc_stagedfallback & warning: WhenCreateDescriptorHeapfails inalloc_staged, it now logs a one-timetracing::warn!and falls back (target_handles+finish_slots(..., false)) to writing descriptors and side tables directly instead of dropping the update. Covered byalloc_staged_failure_falls_back_to_direct_writes.descriptor.rs,descriptor/host.rs,host.rs, andmemory.rsto state accurately that staged updates are published underHost::execute's submission lock beforeExecuteCommandListsand again after completion beforerelease_retired, and changedCloses #1348toRefs #1348.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T13:15:17Z.
Updated in
dfb80933(rebased onto940d32f) to fix the fallback-ordering issue noted above:target_handles/finish_slots(.., false): Whenalloc_stagedfalls back to direct writes, queuedStagedSlotentries for those slot indices are dropped underself.stagedbefore writing directly and before updating side tables, so a subsequentflushcannot overwrite the newer direct descriptor or side-table entries.direct_fallback_drops_older_queued_updates_for_the_same_slotcovering queued staged writes followed byfail_allocdirect writes andflush.Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T13:20:26Z.
I verified the updated
dfb8093on Windows app-local WARP. All 10descriptor::host::testspassed, includingdirect_fallback_drops_older_queued_updates_for_the_same_slot. The readbacks cover both the direct replacement in slot 0 and the unrelated staged update in slot 1. I also reproduced the stale replay on the previous40d0bcewith an independent two-slot fixture.AI-assisted with Codex. Synthetic buffers only.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T16:11:24Z.
Closing for now:
da82e444refactoredHostHeapdescriptor creation/eviction and 16-byte view-address side tables (42ea09f,f809521,52d14b1,e790217), and we do not have an in-title A/B run past#1348to justify rebasing this core-path staging layer.Pull request closed