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

Open
opened 2026-11-26 05:09:52 +00:00 by github-bot · 1 comment
Owner

@⁠shawshanker18 on GitHub · 2026-11-25 16:20 UTC · original

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.

**@⁠shawshanker18** on GitHub · 2026-11-25 16:20 UTC · [original](https://github.com/Marvisak/VIctory/issues/2590) ## 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:09:52 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 18:46 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 18:46 UTC · [original](https://github.com/Marvisak/VIctory/issues/2590#issuecomment-7171382790) <!-- 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)_
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/Marvisak--VIctory#2590
No description provided.