Retired objects dropped by a thread of their own, after the landing is told #2007
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!2007
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2007"
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?
@binarycleric on GitHub · 2026-11-29 07:07 UTC · original
up/bury-off-relay→main· +808 −52 · 3 files · 1 commits · closed without mergingWhat it changes
With the relay on, the thread that lands finished submissions spends about 16.8 ms a frame landing (play log, RTX 5070 Ti, Ryzen 7900X, about 17 fps in the first gameplay area, 2026-11-28). The landing line puts 6.99 ms of that in "the rest": the time from the last item to the end of the landing. That stretch is
FINISHED.store,bury(last)andlog_messages(), andlog_messages()does nothing unless the debug layer is on.bury()releases what the title and the host let go once the submissions that might use it are 64 submissions behind one that has finished: descriptor slots' old resources, host copies, host textures, command allocators. It ran on the relay after the finished count and before the line's ranges were updated andLINE_LANDEDwas signalled. So every relay wait on the submitting thread, and every present waiting for the line, waited for those releases too.What changes
bury()takes what is due out ofRETIREDexactly as before (same selection, samebury_lag()) and hands it, through a channel, tovictory-bury: a below-normal-priority thread that only drops what it is given (host/grave.rs).FINISHED, the line'swritten/settling,LINE_MOVEDandLINE_LANDEDare published (tell_and_bury).bury()too, and also hand off.VICTORY_BURY_ASIDE=0restores the old behaviour: released on the thread that buries, and on the relay before the line is told. It's atoggled!switch, soVICTORY_ABcan flip it while the title runs.Tests
what_is_handed_is_dropped_on_the_thread: objects handed over are dropped on the grave's thread, and counted.dropping_the_grave_drops_all_it_holds_and_ends_its_thread: when the grave is dropped, everything still queued is dropped and the thread ends without hanging.a_grave_behind_hands_back_and_stays_bounded: past the bound, the caller drops the batch itself. Once the thread catches up, it takes batches again.nothing_is_dropped_before_its_submission_and_the_lag: only objects whose submission islagbehind the finished count are due, and an object retired out of order holds back the ones after it.bury_drops_on_the_grave_with_the_switch_and_here_without:bury_fromdrops on the grave with the switch, and on the calling thread before it returns without it.a_landing_tells_before_it_buries_only_with_the_grave: tells, then buries, with the switch; buries, then tells, without it; buries nothing when no flight landed. Swapping the order makes it fail.a_resource_a_running_submission_uses_goes_only_after_its_fence_and_the_lag, on the software adapter:lagmore have finished;acceptance_burying_aside: 20,000 references to live textures, 100 buffers (64 KiB to 2 MiB) and 20 textures of 1024×1024 retired a frame, burying inline against handing to the grave, in alternating runs.VICTORY_ACCEPTANCE=1in a release build, it fails unless both are at least ten times as short with the grave.Measured, RTX 5070 Ti, release, 10 alternating runs of 30 frames, medians:
VICTORY_BURY_ASIDE=0VICTORY_BURY_ASIDE=1The cost is in the frees, about 0.1 ms per committed resource, not in the references. The grave's own dropping took 22.8 ms a frame. That's more than the 13.9 ms inline: it runs below normal priority and alongside the next frame's resource creation.
Run again on this branch, with
VICTORY_ACCEPTANCE=1, on a machine whose processors other jobs held fully, the frees were far slower, but the ratio held:That last figure is what the bound and the relay line's "behind" count are for.
How it was tested
bury)VICTORY_BURY_ASIDE=1on our integration branch (26–28 fps), the relay lands in 10.9–11.0 ms a frame; the burying thread drops 45,600–48,500 objects a frame in about 12 batches, 6.4–11.3 ms, and nothing waits behind it ("0 waiting for them now"). Other changes are in that build toocargo testpassed for the crates it touches: yes. Rebased onto maine1f2eb60:cargo test --release -p victory-gpu --lib, 597 passed, 0 failed, 44 ignoredChecked for overlap
bury()'s drops to avictory-burythread, and batches dynamic slot releases as well. This one differs in where the hand-off happens (afterFINISHED, the line's ranges,LINE_MOVEDandLINE_LANDEDare published), its bound (past 131,072 objects the burying thread catches up itself), the settle path and synchronous submissions handing off too, and its counters and tests. Happy to fold the good parts of either into the other.Pull request closed