gpu/heap_worker: add race-safe opt-in VICTORY_HEAP_WORKER (#66) #257
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/TaynanGT--Vice-Tay!257
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-257"
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?
@mint17 on GitHub · 2026-11-27 12:38 UTC · original
mint17:feat/heap-worker-race-safe→main· +1172 −66 · 9 files · 1 commits · openAddresses the
VICTORY_HEAP_WORKERitem in #66 (portingfxceless/victory-fork's opt-in texture upload worker, off by default and gated byhost::late()) while closing the descriptor-publication TOCTOU race called out on #66 and preserving Vice-Tay's bake, residency, and relay guards.Key Changes
victory-heapworker (heap_worker.rs): Opt-in viaVICTORY_HEAP_WORKER=1(off by default), 128 MiB / 80 ms batch flush, fast-core pinning (cores::keep_on_fast_cores),AtomicUsizeurgent waiter guard with RAII decrement,Ready.list: Option<HostList>sosame-only batches publish cleanly without allocating an empty list, plus splittake_ready_for_late()anddrain_for_bake(gpu)(settling in-flight GPU work viasettle_for_fence()even on list-less batches).descriptor/host.rs): Refactorspublish_uploaded_slotaroundpublish_uploaded_slot_with(index, handle, key, ...)which re-verifiesrecord_key(handle) == keyunderself.made.lock(index)and resolvesViewstrictly fromkey(view_at) without re-readinghandleor callingmirror(). Fixes the latentnote_bufferre-queue loop with a RAIIPublishingGuardchecked inqueue_texture(), restores lock-freequick_isandresidency::upload_deferred_during, and preservesVICTORY_SHOW_AFTER=1,VICTORY_SHOW_NEW_LATER=1, andVICTORY_HELD_LEVELS=1shows_othermip-upgrade deferral inpublish_for_late().object.rs,resource.rs,draw.rs): Addsobject::add_ref_alive(AcqRel/AcquireCAS withchecked_add) andresource::hold/Heldto pin live texture and heap objects across worker execution, includingState::card_accounting.VICTORY_JOIN_PARTS&VICTORY_TEXTURE_ONCEcompatibility (host.rs,list.rs,texture.rs): Hookstake_ready_for_late()inHost::send_late()viaprepend_ahead_order()so joined-part split indices shift cleanly alongside prepended worker lists; addsStaging::refresh_ahead()usingself.read/digest(read)/keep_whole(read)while skipping write-watching onself.oncetextures.Verification
5b2dc68):descriptor::host::bake_flip_tests::publish_rejects_slot_replaced_between_readsdescriptor::host::bake_flip_tests::published_slot_stays_out_of_texture_queuedescriptor::host::bake_flip_tests::publish_for_late_same_after_combines_show_after_and_new_laterdescriptor::host::bake_flip_tests::publish_for_late_defers_shows_other_mip_upgradehost::submission_tests::prepend_ahead_lists_shifts_join_partsobject::tests::add_ref_alive_rejects_zero_refcountheap_worker::tests::urgent_stops_worker_and_ready_drains_cleanlycargo clippy -p victory-gpu --all-targets --locked -- -D warnings(default +--all-features) andcargo test --locked -p xtaskpassed with zero warnings.@TaynanGT on GitHub · 2026-11-27 12:42 UTC · original
@mint17 Rechecking the recorded key under the same slot lock is the important part of the publication fix. I’ll check the fence and resource lifetime alongside the replacement regression, especially when a batch has no command list and when joined parts shift. The opt-in path gives us a separate A/B once those checks are in place.
github-bot referenced this pull request2026-11-27 13:47:49 +00:00
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.