mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-18 23:07:07 -05:00
At the Minecraft Dungeons II title the queue-0 worker, the draw committer and the compute worker hand work to each other 49,000 times per 10 s through the GPU mutex, the committer's condition variable and DrawPipeline::Drain, and each hand-off that has to wait costs a kernel wake-up. The three workers are busy 21-34 % of the time: the GPU idles because the chain of hand-offs is slow, not because a thread runs out of CPU. GpuMutexType::lock retries try_lock for a window before it blocks, the committer polls its item count for the window before it waits on its condition variable, and Drain polls for twice the window before it waits for the committer. A hand-off that completes within the window costs no wake-up. The window is 150 us on machines with at least 8 logical processors and 0 below that; APS5_HANDOFF_SPIN_US sets it (0 turns it off). Ordering and the lock's semantics are unchanged. The test agc_handoff_spin covers the window policy, the spin helpers and contended locks, and docs/dev/ARCHITECTURE.md describes the spin.