Proposal: reuse translated command lists across frames (structure hash plus relocations) #2588

Open
opened 2026-11-25 16:20:32 +00:00 by shawshanker18 · 1 comment
shawshanker18 commented 2026-11-25 16:20:32 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by shawshanker18 on 2026-11-25T16:20:32Z.


Idea

Consecutive frames record almost the same command lists: the same passes, pipelines, root signatures and barriers in the same order. What changes is mostly data: buffer addresses advance through ring buffers, constants differ, and the visible set changes indirect argument counts (which the GPU reads anyway).

Proposal: reuse translated command lists across frames:

  1. While recording, hash each segment of a list (for example between barriers) by its structure: method, pipeline, signature, and argument words with addresses replaced by (allocation, offset class) tokens.
  2. If a segment's hash matches the same segment last frame, and the resources it names are the same host objects, reuse last frame's translated host commands. Patch the few values that moved through a relocation table (root views, table bases), or keep them in a small per-segment buffer the commands read indirectly.
  3. Otherwise translate as today and store the result.

Bundles, or ExecuteIndirect with root-argument commands, are two ways to make patched replays cheap on the host.

Why

  • About 42,000 list calls a frame are translated at roughly 20 µs each (RTX 4050 Laptop, fxceless fork): the largest CPU cost of a frame.
  • Shader translation is already cached; command translation is redone from scratch every frame for nearly identical input.

Risks

  • The hard part is proving a segment really is "the same": state carried in from earlier segments, and descriptor contents the title writes as bytes. A conservative first version can memoize only segments that bind everything they use.
  • Memory for stored segments; eviction by age.

No game data in this proposal.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6608747228 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/2590). Originally posted by [shawshanker18](https://github.com/shawshanker18) on 2026-11-25T16:20:32Z. --- ## Idea Consecutive frames record almost the same command lists: the same passes, pipelines, root signatures and barriers in the same order. What changes is mostly data: buffer addresses advance through ring buffers, constants differ, and the visible set changes indirect argument counts (which the GPU reads anyway). Proposal: **reuse translated command lists across frames**: 1. While recording, hash each segment of a list (for example between barriers) by its *structure*: method, pipeline, signature, and argument words with addresses replaced by (allocation, offset class) tokens. 2. If a segment's hash matches the same segment last frame, and the resources it names are the same host objects, reuse last frame's translated host commands. Patch the few values that moved through a relocation table (root views, table bases), or keep them in a small per-segment buffer the commands read indirectly. 3. Otherwise translate as today and store the result. Bundles, or ExecuteIndirect with root-argument commands, are two ways to make patched replays cheap on the host. ## Why - About 42,000 list calls a frame are translated at roughly 20 µs each (RTX 4050 Laptop, fxceless fork): the largest CPU cost of a frame. - Shader translation is already cached; command translation is redone from scratch every frame for nearly identical input. ## Risks - The hard part is proving a segment really is "the same": state carried in from earlier segments, and descriptor contents the title writes as bytes. A conservative first version can memoize only segments that bind everything they use. - Memory for stored segments; eviction by age. No game data in this proposal.
Marvisak commented 2026-11-25 19:06:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T18:46:35Z.


Automated triage for the maintainers.

This is a performance proposal for the GPU layer: reuse translated command-list segments across frames, keyed by a structure hash, with relocations for the values that move. It fits the project's scope, and it is labelled and kept as a request. It builds on #2586, which proposes moving translation off the title's threads.

The cost figures quoted come from a fork, not from main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7171382790 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/2590#issuecomment-7171382790). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T18:46:35Z. --- <!-- victory-issue-triage v1 verdict=tracked seen=2026-11-25T16:20:32Z at=2026-11-25T19:11:00Z --> Automated triage for the maintainers. This is a performance proposal for the GPU layer: reuse translated command-list segments across frames, keyed by a structure hash, with relocations for the values that move. It fits the project's scope, and it is labelled and kept as a request. It builds on #2586, which proposes moving translation off the title's threads. The cost figures quoted come from a fork, not from main. --- _Generated by [Claude Code](https://claude.ai/code)_
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
Marvisak/VIctory#2588
No description provided.