Proposal: translate repeating command lists once (list templates): 75 % of list calls repeat in shape, only descriptor-table bases change (measurements, looking for collaborators) #447
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD#447
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@JFIREonFIRE on GitHub · 2026-11-27 02:18 UTC · original
Proposal: translate repeating command lists once ("list templates") instead of every frame
Is anyone already working on something like this? Looking for collaborators and for objections before building it.
Why
On an RTX 3090 / i9-9900K / 32 GB (cool_fox-based tree, Series S, renderer port 1), the card is busy ~4 ms a frame while a frame takes ~70–80 ms in steady play. Most of the rest is on the CPU side of the layer: ~29,000 list calls a frame translated by
VICTORY_THIN's threads, plus the memory sync. Shaders and pipelines are already done ahead of time (victory shaders,warm --used, 0.0 ms a frame waiting for pipelines), so the per-frame list translation is the largest piece of "emulation" left that a native port would not have.Measurement
A local switch fingerprints each title list as
VICTORY_THINwrites its stream (every word = "exact"; the op sequence only = "shape") and compares with the lists of the frame before. 4-minute runs in the prison, 5-second windows:Within lists of the same shape, which calls' arguments differ from the frame before (one 5-second window):
thin.rsop)COMPUTE_TABLEGRAPHICS_TABLECOMPUTE_CONSTANTSGRAPHICS_CONSTANTSBARRIER_GROUPSEXECUTE_INDIRECTDRAW/DISPATCHGRAPHICS_VIEWWRITE32,WRITE64,COMPUTE_VIEW,COPY_BUFFER(Corrected: an earlier version of this table had the op numbers of the second half off by three.)
So plain caching of identical lists gives nothing (~1 % of calls), but three quarters of the calls sit in lists whose structure repeats, and what changes in them is almost only where each descriptor table starts: the title writes its tables into a ring, so the same draw points at another slot each frame.
Idea
ResourceDescriptorHeap); a table base then becomes a number, not a GPU handle.ExecuteIndirect(root constants + draw/dispatch arguments), split at pipeline changes since a command signature cannot change the PSO. Lists that differ elsewhere translate as today.Open questions (the reasons to ask before building)
VICTORY_PORT_DESCRIPTORS/VICTORY_PORT_JOURNAL, the heap sync, and the shader-written ranges each list declares.The measurement switch (
VICTORY_LIST_REPEATS=1, ~120 lines inlist/thin.rs, off by default) can come over as a small PR againsta-publierif it is useful to others.Measured and written with Claude Code (AI). No game files.
@JFIREonFIRE on GitHub · 2026-11-27 02:26 UTC · original
The two open questions, measured (same PC and switch, 4 minutes, five 5-second windows):
How table bases move. For each list of the same shape as one in the frame before, the distinct differences between this frame's and that frame's
COMPUTE_TABLE/GRAPHICS_TABLEhandles, weighted by calls:So the bases do not move independently per draw: a list's tables come from a few rings (2–16 offsets), so a handful of root constants per list would carry what changes.
Pipeline changes. 9.0–11.9
SET_PIPELINEper repeated list, 7–9 calls between two. That makesExecuteIndirectthe wrong tool (each batch would hold a draw or two). D3D12 bundles fit better: a bundle may set pipelines itself and inherits the root arguments the calling list set, so a repeated stretch (~10 pipelines, ~100 calls) could replay as oneExecuteBundleafter setting its few offsets as root constants. Bundles cannot hold barriers, render-target changes or clears, so lists would be cut there.The cost moves to the shader translator: a table read becomes "heap index = a root constant + a fixed index" instead of a descriptor-table base. Anyone who knows that part of
emit/lower.rswell: does that look reachable, given how views picked from the heap are already lowered?AI-assisted (Claude Code).
@JFIREonFIRE on GitHub · 2026-11-27 02:57 UTC · original
Where the CPU goes, for this proposal's scope (RTX 3090 / i9-9900K 8C/16T,
VICTORY_PROFILE=150,210,5,...over one minute of steady play in the prison, symbolized with the diag build's PDB; same tree as above):victory-list-*(8,VICTORY_THIN)victory-submit,-wide,-land,-relay,-aside,-heap-sync7.6 cores busy on average on an 8-core CPU, i.e. this CPU is the limit at ~13 fps, the card being ~4 ms busy a frame. The title's two busiest threads use ~38 % of a core each; most of the rest of its time is short jobs waking and sleeping.
Inside
victory-list-*(inclusive, of all samples; ~58 % of samples are idle waits):draw::State::bind32 %,State::execute_indirect19 %,State::prepare_for18 %,HostList::scratch_at→take_chunk→upload_buffer10 %,HostHeap::make_listed7 %,heap_textures5 %,draw::readable5 %, contended mutexes 6 %.The
upload_bufferpart was new 4 MiB scratch chunks: on 32 GB PCs the scratch pool keepsSPARE_MOST(128 MiB) instead ofSPARE_KEPT(1 GiB) (limited_host_ram, see #455). With a local switch keeping 1 GiB it leaves the profile and the list threads' CPU drops 124 → 108 s a minute. Worth a look by anyone on a 32 GB PC.So for list templates the target is
State::bindandprepare_for(per-draw binding and bookkeeping), not the D3D12 calls themselves (nvwgf2umx + D3D12Core ~7 % of the list threads' samples).AI-assisted (Claude Code).