gpu/heap_worker: add race-safe opt-in VICTORY_HEAP_WORKER (#66) #257
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from TaynanGT/Vice-Tay. Originally posted by mint17 on 2026-11-27T12:38:10Z.
Addresses 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.Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T12:42:03Z.
@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.
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:14:33Z.
mainhas moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the currentmainand open a new PR; I'll review it there.Pull request closed