Reduce CPU work preparing GPU constant buffers #175

Closed
TaynanGT wants to merge 496 commits from upstream-pr/175 into main
TaynanGT commented 2026-11-27 06:09:04 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T06:09:04Z.


Most GPU-assisted steps on Series S are constant-buffer fills. The fill-only path uses a single dependency level and still checks the ordering of positioned copies. The complete dependency planner handles batches with writes.

Collect fill destinations while scanning the recorded list, index the in-flight ranges for fill-only batches, and group descriptor writes in their original order by worker. Claim adjacent small shadow refreshes together and accumulate their counters locally.

Both Clippy configurations and the focused card-step and worker tests passed. A standalone fixture with 7,488 fills in 36 groups measured the planner at 0.528 ms before and 0.075 ms after. The old and new planners agreed on 14,000 mixed inputs. The Series S playtest and video comparison are pending.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5522113984 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/175). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T06:09:04Z. --- Most GPU-assisted steps on Series S are constant-buffer fills. The fill-only path uses a single dependency level and still checks the ordering of positioned copies. The complete dependency planner handles batches with writes. Collect fill destinations while scanning the recorded list, index the in-flight ranges for fill-only batches, and group descriptor writes in their original order by worker. Claim adjacent small shadow refreshes together and accumulate their counters locally. Both Clippy configurations and the focused card-step and worker tests passed. A standalone fixture with 7,488 fills in 36 groups measured the planner at 0.528 ms before and 0.075 ms after. The old and new planners agreed on 14,000 mixed inputs. The Series S playtest and video comparison are pending.
NotADonky43 commented 2026-11-27 07:26:55 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by NotADonky43 on 2026-11-27T07:26:55Z.


Independent RTX 5070 Ti / Series X check

Compared stock bcbb7959 with the two commits from dfcddbbe applied to the same tree (bd12c469 locally). Both used the same saved-profile copy, stock placement and worker settings, 25,692 offline DXIL cache entries, and the same loaded D3D12 host library with 1,625 early keys. Both rendered heavy workloads and closed with exit 0 after their 240-second watchdog requested close; neither logged device loss or a refused host PSO.

Medians of heavy telemetry windows (>1,000 draws/frame) with no in-process PSOs pending:

Stock (14 windows) #175 (16 windows)
Frame (ms) 438.2 293.9
CPU preparation (ms/frame) 198.4 125.6
Buffer refresh (ms/frame) 47.6 36.2
Card-step planning (ms/frame) 12.5 10.0
Waiting for earlier flights (ms/frame) 3.5 20.9
Fills routed through the card per frame 5,987 7,332
Draws/frame 3,373 3,641

This is directional: the windows aren't scene-matched and no visual comparison was performed. The larger preparation improvement cannot be assigned to the fill planner alone, and the flight wait moved in the opposite direction. Peak shared/private memory was essentially unchanged in this pair.

The focused planner/host/recipe tests passed on both sides. In the documented relay test mode, the held-flight fixture checks the final bytes and completed 48/48 GPU copies on both builds; the PR's grouped-refresh test also passed. With GPU-based validation added, the stock fixture hit its scheduling-coverage assertion (5/48 went through the card, but its byte assertions passed), so that extra configuration does not demonstrate full relay-path coverage.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7212480873 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/175#issuecomment-7212480873). Originally posted by [NotADonky43](https://github.com/NotADonky43) on 2026-11-27T07:26:55Z. --- <!-- independent-5070ti-bcbb795-dfcddbbe --> ### Independent RTX 5070 Ti / Series X check Compared stock `bcbb7959` with the two commits from `dfcddbbe` applied to the same tree (`bd12c469` locally). Both used the same saved-profile copy, stock placement and worker settings, 25,692 offline DXIL cache entries, and the same loaded D3D12 host library with 1,625 early keys. Both rendered heavy workloads and closed with exit 0 after their 240-second watchdog requested close; neither logged device loss or a refused host PSO. Medians of heavy telemetry windows (>1,000 draws/frame) with no in-process PSOs pending: | | Stock (14 windows) | #175 (16 windows) | |---|---:|---:| | Frame (ms) | 438.2 | 293.9 | | CPU preparation (ms/frame) | 198.4 | 125.6 | | Buffer refresh (ms/frame) | 47.6 | 36.2 | | Card-step planning (ms/frame) | 12.5 | 10.0 | | Waiting for earlier flights (ms/frame) | 3.5 | 20.9 | | Fills routed through the card per frame | 5,987 | 7,332 | | Draws/frame | 3,373 | 3,641 | This is directional: the windows aren't scene-matched and no visual comparison was performed. The larger preparation improvement cannot be assigned to the fill planner alone, and the flight wait moved in the opposite direction. Peak shared/private memory was essentially unchanged in this pair. The focused planner/host/recipe tests passed on both sides. In the documented relay test mode, the held-flight fixture checks the final bytes and completed 48/48 GPU copies on both builds; the PR's grouped-refresh test also passed. With GPU-based validation added, the stock fixture hit its scheduling-coverage assertion (5/48 went through the card, but its byte assertions passed), so that extra configuration does not demonstrate full relay-path coverage.
TaynanGT commented 2026-11-27 07:41:39 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T07:41:39Z.


@NotADonky43 Thanks for pinning the revisions and cache. The 48/48 held-flight copies give us a useful check on the bytes, and CPU prep fell from 198.4 ms to 125.6 ms in those heavy windows. Waiting for flights grew in the same pair. The next gameplay comparison should use a matched scene and recording so we can check the end-to-end gain and image together.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7212724214 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/175#issuecomment-7212724214). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T07:41:39Z. --- @NotADonky43 Thanks for pinning the revisions and cache. The 48/48 held-flight copies give us a useful check on the bytes, and CPU prep fell from 198.4 ms to 125.6 ms in those heavy windows. Waiting for flights grew in the same pair. The next gameplay comparison should use a matched scene and recording so we can check the end-to-end gain and image together.
TaynanGT commented 2026-11-30 17:16:21 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:16:21Z.


Superseded: main has moved to a new line of the code (see #468). Whatever is still worth having from this will come back as a new PR on the current main.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7285998578 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/175#issuecomment-7285998578). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-30T17:16:21Z. --- Superseded: `main` has moved to a new line of the code (see #468). Whatever is still worth having from this will come back as a new PR on the current `main`.

Pull request closed

Sign in to join this conversation.
No reviewers
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
TaynanGT/Vice-Tay!175
No description provided.