CPU → GPU: the write-watch round trip (catch → upload → re-lock) #1307

Open
opened 2026-11-26 13:36:53 +00:00 by github-bot · 2 comments
Owner

@⁠liuycsbxbxn on GitHub · 2026-11-26 13:32 UTC · original

Split out of #1273.

Suggested labels: performance / memory
Verification cost: [GPU]

What the meta-issue points at

  • Catch the page write: watch.rs (the exception path — writes_as / writing).
  • Upload the page: shadow.rs — refresh_check, copy_stale, copy, copy_changed (meta-issue cites L3411–L3487 on 988aa41).
  • Lock the page again: watch.rs — open / open_here / protect_here.

Acceptance

  1. A per-frame breakdown of the three phases (catch / upload / re-protect) printed with an opt-in switch, so the next person can see which phase dominates.
  2. State whether the upload can reuse a mapped staging window instead of re-locking per page.
  3. Measured send-and-hash bytes and submit-thread time, one switch per comparison.

**@⁠liuycsbxbxn** on GitHub · 2026-11-26 13:32 UTC · [original](https://github.com/fxceless/victory-fork/issues/1307) Split out of #1273. **Suggested labels:** performance / memory **Verification cost:** `[GPU]` ### What the meta-issue points at - Catch the page write: `watch.rs` (the exception path — `writes_as` / `writing`). - Upload the page: `shadow.rs` — `refresh_check`, `copy_stale`, `copy`, `copy_changed` (meta-issue cites L3411–L3487 on `988aa41`). - Lock the page again: `watch.rs` — `open` / `open_here` / `protect_here`. ### Acceptance 1. A per-frame breakdown of the three phases (catch / upload / re-protect) printed with an opt-in switch, so the next person can see which phase dominates. 2. State whether the upload can reuse a mapped staging window instead of re-locking per page. 3. Measured send-and-hash bytes and submit-thread time, one switch per comparison. ---
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 13:36:53 +00:00
Author
Owner

@⁠JayFoxRox on GitHub · 2026-11-26 16:37 UTC · original · edited 2026-11-26 16:45 UTC

Some information was lost in transition from #1273.

When the CPU writes to (the read-only system-RAM copy of) a GPU resource, currently a read-only page exception occurs which eventually triggers a reupload of the CPU side memory to the GPU. However, page-exceptions are slow and the current approach requires unlocking and relocking pages.

The idea is to use #1305 to handle this (avoiding page exception and page re-locking, which takes 1000x than doing it the proposed way)

**@⁠JayFoxRox** on GitHub · 2026-11-26 16:37 UTC · [original](https://github.com/fxceless/victory-fork/issues/1307#issuecomment-7197897631) · edited 2026-11-26 16:45 UTC Some information was lost in transition from #1273. When the CPU writes to (the read-only system-RAM copy of) a GPU resource, currently a read-only page exception occurs which eventually triggers a reupload of the CPU side memory to the GPU. However, page-exceptions are slow and the current approach requires unlocking and relocking pages. The idea is to use https://git.gtahub.st/github/fxceless--victory-fork/issues/1305 to handle this (avoiding page exception and page re-locking, which takes 1000x than doing it the proposed way)
Author
Owner

@⁠liuycsbxbxn on GitHub · 2026-11-26 17:04 UTC · original

Same for the write side - restoring the background the split dropped: the CPU writes into the read-only system-RAM copy, the fault wakes the uploader, and the unlock/relock is what makes it expensive. If #1305 lands, both directions can drop the exception path; #1306 is the read-side counterpart, so the two are one chain rather than two independent tasks.

**@⁠liuycsbxbxn** on GitHub · 2026-11-26 17:04 UTC · [original](https://github.com/fxceless/victory-fork/issues/1307#issuecomment-7198446033) Same for the write side - restoring the background the split dropped: the CPU writes into the read-only system-RAM copy, the fault wakes the uploader, and the unlock/relock is what makes it expensive. If #1305 lands, both directions can drop the exception path; #1306 is the read-side counterpart, so the two are one chain rather than two independent tasks.
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#1307
No description provided.