wait_fence waits for the card without holding the submission lock (#163) #258
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/258"
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 Belobug/VIctory-Belobug-AMD. Originally posted by ySKELLETONX on 2026-11-26T13:41:10Z.
Host::wait_fencetooksubmittedand then blocked inWaitForSingleObjectuntil the card reached the value. Lists reset or dropped on the title's recording threads (HostList::reset,Drop) and the timeline's signals (wait_in_flight) come here, so while one of them waited, every other submission, and theprewarmthat is meant to overlap the card, stood atexecute_inner's lock for as long as the card ran. The profile in #163 put 12% of the submitting thread inMutex::lock_contendedon it.What changes (
crates/victory-gpu/src/host.rsonly)submitted.submittedis taken afterwards only forreap_completed, so what a caller sees whenwait_fencereturns is the same: the submissions up to the value are finished.FINISHED_FENCE >= target), the lock is not taken at all.SetEventOnCompletionfails), the wait falls back to the shared event under the lock, as before.execute_inneranddrain_in_flight_lockedstill wait under the lock on the shared event; nothing there changes.Test
host::tests::waiting_for_the_card_leaves_submitted_free(WARP, no game data): the card signals the value only after the processor opens a gate fence, and another thread must takesubmittedwhile the wait goes on. It fails on the old code (`submitted` stayed held while a thread waited for the card) and passes 20/20 with this change.cargo test -p victory-gpu --lib --locked, 20 full runs: 114 passed, apart from two flaky tests that don't touch this code:watch::written_pages_are_reported_to_every_asker(also fails onmain, #102, fixed by #115) and onceframe::waits_end_on_ticks_and_count_frames(asserts a wait ends within 50 ms;frame.rsdoesn't use the host).cargo xtask policy --staged: okTested on Ryzen 7 5700X3D + RX 7600 XT, Windows 11. I can't measure it in the world; @ThiagoTodeschini, if you get the chance, the same spot as in #163 with and without this would show how much of the 12% it gives back. Independent of #253.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.