Repository navigation
sync_heaps 21.7 -> 8.2 ms a frame (ideas of fxceless#1043 ported): 15.1 -> 16.8 fps - #8
Merged
dkdknight merged 8 commits intoNov 25, 2026
Conversation
…EAP_WORKER=1, off) The pass over textures picked by index asks what of each due texture is mapped, makes the host texture, makes a staging buffer and records the copy, on whichever thread of the title records the frame's first shader that picks textures by index. With a backlog that is up to 250 ms of a frame, and the threads waiting for that list wait with it. With VICTORY_HEAP_WORKER=1 (needs VICTORY_LATE_WAIT) the pass runs on a thread of its own and the recording thread only wakes it. Its uploads go into host lists of our own, which the next late submission runs ahead of the title's lists; a texture's host slot is given its view at that submission, not before; the title's texture and heap are held while the worker uses them; the uploads before the decoration bake stay on the recording thread. Off by default; the numbers go in the pull request. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
On WARP the second group's draws can win the budget; the test asserts what holds either way, that the record that is no draw runs empty. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…x uploaded on a thread of their own (VICTORY_HEAP_WORKER=1, off) Conflicts: both list helpers kept (defer_texture_upload and refresh_textures_ahead); a staging texture keeps both its last change and its ahead read, hashed when either says so; this branch's indirect budget test, bench field and resource cfg kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(VICTORY_COPY_PLAIN=1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… per source write VICTORY_ALIAS_ONCE=1 (off by default). The title writes R9G9B9E5 targets as R32_UINT and reads them through views placed in the same memory, and every list that read one copied it again through a buffer: 78 copies a frame, 26-31 ms of the card's time on an RTX 4050 Laptop. A copy a list needs before it touches the source or the placed texture is now recorded in the list's prelude at submission (preludes are recorded in the queue's order, with both textures already in the copy states the list starts with). Each submission gets a number; lists mark the host copies they put in a writing state; a prelude leaves a copy out if it ran in a submission after the source's last write. Copies later in a list stay where they were. Series X, lit world, with the window, 1080p, copy-queue fetch and rehash runs switches: 358 -> 333 ms a frame (2.8 -> 3.0 fps); 26 alias copies made and 20 left out a frame in preludes. The picture looked the same.
…e line What changed: - The fingerprint lock is taken once per heap (default path, HostHeap::mirror_copied_all) and once per page for the choice of slots (HostHeap::slots_to_look_at), not once per slot. Same slots mirrored in the same order: making a slot changes no fingerprint and no table stamp. - The choice of a page's slots no longer looks each slot up in a Vec of the moved ones (quadratic per page); it walks the page's slots in order. - The page copy kept in seen_pages is overwritten in place instead of a new 64 KiB Vec per changed page; the slot and due lists are reused. - HostHeap::mirror: no view_at(0, 0) for a slot with nothing made (it is always none: generations start at 1); a buffer view left for later in a slot that already holds the null buffer view, written by the same path and untouched since (SLOT_NULL_BUFFER, cleared by HostHeap::cpu, which every write goes through), skips writing that null again and keep(None). - Per-slot flags (SLOT_IN_TEXTURES / SLOT_IN_PLACED / SLOT_IN_BUFFERS), changed under the set's own lock with every insert and removal, let note_buffer skip the texture queue, placed spans and buffer set locks for a slot that is not in them (or already in, for buffers). New test slot_flags_follow_the_sets. - Timing: SYNCED gains mirror-call and lock-wait microseconds (host::lock_timed: try_lock first, the wait timed only when contended); the frame line now says total ms, reading and walking pages, mirror calls, and lock waits. Ported by hand from fxceless#1043 (author UwUCammie): the slot flags, skipping view_at(0, 0), the null-over-null skip, buffer reuse across pages, one lock per page. Kept this branch's mirror design (fast key without the lock, made lock dropped while the view is made). Skipped: - Taking the made lock once per page: this branch drops it while views are made so recording threads do not wait behind the sync; holding it for a page would bring that wait back. - Null-over-null for every view kind: upstream skips any null; here only when the slot is known to hold the very same null (buffer view), so a texture slot's null keeps its dimension. - Batching `changed` inserts per page: needs the batch threaded through mirror and note_buffer for one uncontended lock per buffer mirror. - heap_buffers (draw.rs): not re-queuing slots it mirrors and reusing the shadow found by make() change when the buffer pass looks at a slot again and need make() to return the copy through every view kind; not on the sync_heaps path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Built on #4 (so #3 and #2); one commit,
240d464.descriptor::sync_heapswas the largest piece of the submitting thread here: 21.7 ms a frame (~68,000 slots looked at, ~10,000 mirrored, ~150 changed heap pages), while the card sat ~18 ms a frame waiting on that thread. This ports the ideas of fxceless#1043 (UwUCammie) by hand onto this branch'sHostHeap::mirror(its lock-freefastkey and the made-lock dropped while a view is made are kept):note_bufferskips a set's lock when the slot is not in it (a test checks flags and sets agree);view_at(0,0)when nothing was made in the slot (generations start at 1);containsper slot (quadratic, up to 2,048 a page): now one ordered walk.Skipped from fxceless#1043: holding
madefor a whole page (you release it on purpose), batchingchangedinserts, theheap_bufferschanges (they change when a slot is looked at again).The sync line now also says where the time goes (reading/walking pages, mirror calls, lock waits).
Measured (RTX 4090, i9-13900K, release, settings of #7 incl.
VICTORY_BIG_CARD-sized memory, same scene, mean of 11-12 lines once whole, one run):No device loss; behavior meant to be unchanged (only fewer locks, allocations and redundant writes). Checks: release and diagnostics builds,
cargo test -p victory-gpu --lib182 passed, clippy no new warnings.🤖 Generated with Claude Code