watch::guard re-protection (~75 ms/frame) & CPU prep: hot-block pinning + pipelined frame prep #1238

Open
opened 2026-11-26 04:00:08 +00:00 by github-bot · 0 comments
Owner

@⁠Marukooh on GitHub · 2026-11-26 01:28 UTC · original

Summary & Measurements (RTX 5070 Ti + Linux/Proton)

In heavy prologue windows (2,500–6,000 draws/frame, zero pipelines compiling), CPU preparing + copy-back still dominate frametime even after VICTORY_HOIST_CLAMPS=1 and VICTORY_VIDEO_BUDGET_MB=10500 (~127–148 ms/frame total, ~41–46 ms GPU).

Adding per-frame instrumentation on watch::guard (watch::ASKS / watch::WALKS) showed where the CPU time goes across ~60 submissions/frame:

  • Journal answers: 11,000–23,000 / frame
  • Kernel GetWriteWatch calls: 1,400–3,100 / frame (1.7–3.9 ms total — the syscall itself is cheap)
  • Guard walks: 7,800–14,900 / frame (87–110 ms summed across threads)
  • Re-protection phase: ~74.8 ms / frame (with ~67,190 absent blocks/frame and only ~0.8 ms lock wait)

Batching contiguous blocks under a single lock and tracking absent ranges (guard-bake + guard-light + VICTORY_BACK_OWN_VIEW=1) already cut our synthetic memory benchmark from 25.04 → 6.94 ms (alias views) and 1.22 → 0.033 ms (reserves), bringing Series X prologue median down to 127.25 ms/frame (copy-back 63.3 → 42.95 ms, CPU preparing 79.6 → 59.95 ms).

Proposals to cut CPU overhead further (toward < 10 ms)

  1. Hot-block pinning (skip per-frame re-protection):
    Many blocks touched by watch::guard are rewritten by the title every single frame. Pinning blocks that were dirtied for N consecutive frames (leaving them unprotected / treated as dirty until idle for a few frames) directly eliminates most of the ~74.8 ms re-protection churn without changing the overall memory model.
  2. Pipelined / async CPU frame prep:
    Currently preparing, copy-back, and Present run synchronously in sequence (framelog shows waits inside submission/completion handling while actual Present + final copy is ~0.1–0.2 ms). Moving list/descriptor prep and landing-buffer staging to a worker with double/triple-buffered landing rings lets CPU prep overlap with the ~45 ms GPU execution.
  3. Combine with AVX2 dirty scanning (#1233) and the readback coalescing work (#1229, #1230, #1232) once hot-block pinning removes the VirtualProtect floor.
**@⁠Marukooh** on GitHub · 2026-11-26 01:28 UTC · [original](https://github.com/fxceless/victory-fork/issues/1238) ### Summary & Measurements (RTX 5070 Ti + Linux/Proton) In heavy prologue windows (2,500–6,000 draws/frame, zero pipelines compiling), CPU `preparing` + `copy-back` still dominate frametime even after `VICTORY_HOIST_CLAMPS=1` and `VICTORY_VIDEO_BUDGET_MB=10500` (~127–148 ms/frame total, ~41–46 ms GPU). Adding per-frame instrumentation on `watch::guard` (`watch::ASKS` / `watch::WALKS`) showed where the CPU time goes across ~60 submissions/frame: - **Journal answers:** 11,000–23,000 / frame - **Kernel `GetWriteWatch` calls:** 1,400–3,100 / frame (**1.7–3.9 ms** total — the syscall itself is cheap) - **Guard walks:** 7,800–14,900 / frame (**87–110 ms** summed across threads) - **Re-protection phase:** **~74.8 ms / frame** (with ~67,190 absent blocks/frame and only ~0.8 ms lock wait) Batching contiguous blocks under a single lock and tracking absent ranges (`guard-bake` + `guard-light` + `VICTORY_BACK_OWN_VIEW=1`) already cut our synthetic memory benchmark from `25.04 → 6.94 ms` (alias views) and `1.22 → 0.033 ms` (reserves), bringing Series X prologue median down to **127.25 ms/frame** (copy-back 63.3 → 42.95 ms, CPU preparing 79.6 → 59.95 ms). ### Proposals to cut CPU overhead further (toward < 10 ms) 1. **Hot-block pinning (skip per-frame re-protection):** Many blocks touched by `watch::guard` are rewritten by the title *every single frame*. Pinning blocks that were dirtied for N consecutive frames (leaving them unprotected / treated as dirty until idle for a few frames) directly eliminates most of the ~74.8 ms re-protection churn without changing the overall memory model. 2. **Pipelined / async CPU frame prep:** Currently `preparing`, `copy-back`, and `Present` run synchronously in sequence (`framelog` shows waits inside submission/completion handling while actual `Present` + final copy is ~0.1–0.2 ms). Moving list/descriptor prep and landing-buffer staging to a worker with double/triple-buffered landing rings lets CPU prep overlap with the ~45 ms GPU execution. 3. **Combine with AVX2 dirty scanning (`#1233`)** and the readback coalescing work (`#1229`, `#1230`, `#1232`) once hot-block pinning removes the `VirtualProtect` floor.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:00:08 +00:00
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/fxceless--victory-fork#1238
No description provided.