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

Open
opened 2026-11-26 13:32:32 +00:00 by liuycsbxbxn · 2 comments
liuycsbxbxn commented 2026-11-26 13:32:32 +00:00 (Migrated from github.com)
Contributor

Imported from fxceless/victory-fork. Originally posted by liuycsbxbxn on 2026-11-26T13:32:32Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6627763006 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/issues/1307). Originally posted by [liuycsbxbxn](https://github.com/liuycsbxbxn) on 2026-11-26T13:32:32Z. --- 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. ---
JayFoxRox commented 2026-11-26 16:37:57 +00:00 (Migrated from github.com)
Author
Contributor

Imported from fxceless/victory-fork. Originally posted by JayFoxRox on 2026-11-26T16:37:57Z.


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://github.com/fxceless/victory-fork/issues/1305 to handle this (avoiding page exception and page re-locking, which takes 1000x than doing it the proposed way)

<!-- greyfinch-sync:fxceless/victory-fork:comment:7197897631 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/issues/1307#issuecomment-7197897631). Originally posted by [JayFoxRox](https://github.com/JayFoxRox) on 2026-11-26T16:37:57Z. --- 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://github.com/fxceless/victory-fork/issues/1305 to handle this (avoiding page exception and page re-locking, which takes 1000x than doing it the proposed way)
liuycsbxbxn commented 2026-11-26 17:04:03 +00:00 (Migrated from github.com)
Author
Contributor

Imported from fxceless/victory-fork. Originally posted by liuycsbxbxn on 2026-11-26T17:04:03Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7198446033 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/issues/1307#issuecomment-7198446033). Originally posted by [liuycsbxbxn](https://github.com/liuycsbxbxn) on 2026-11-26T17:04:03Z. --- 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.
Sign in to join this conversation.
No labels
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.

Reference
fxceless/victory-fork#1304
No description provided.