Performance: an efficiency-first frame budget - governor on the frame clock, read-only redundant-pass profiler on replay #2249
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#2249
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?
@itsonewi on GitHub · 2026-11-25 11:18 UTC · original
What I am proposing (the two-line version, as CONTRIBUTING asks): measure where frames are wasted before anyone optimises. A read-only profiler that logs, per frame, the present interval and how much of the replayed command stream is identical to the previous frame's - then, only if the numbers justify it, a frame-budget governor that spends the surplus on idle time instead of frames, and shading-rate on the main scene pass.
This is a design question first: is efficiency/perf policy in scope for XCL at all, now or later? If the answer is "not now", the rest of this issue is still useful as a record of where the hooks are.
Why it fits XCL in particular
XCL is in an unusual position: it owns the three things an efficiency controller needs, which a Vulkan-based layer (DXVK, VKD3D-Proton) does not all own.
crates/xcl/src/hle/d3d12x/frame.rsruns the console frame clock on its own high-resolution timer thread, releases the origin semaphore per interval, hands out tokens and tracks flips forGetFrameStatisticsX, and already clamps the interval throughXCL_FRAME_INTERVAL_US(including0/uncapped). A title blocks inWaitFrameEventX, so when the layer releases that token is a frame-pacing decision the layer can make without a latency SDK. Most layers cannot pace a title this way; this one can.hle/d3d12x/list_x.rs; README "graphics"; design §5.7). Skipping redundant work therefore means not recording it, not intercepting already-compiled commands. That is the cheapest possible place to drop a pass - provided the pass really is pure.What already exists and would be reused rather than rebuilt: the timer thread and its 0.6 ms spin, frame tokens with origin and flip timestamps,
d3d12.presentsinreport.json, theXCL_ACTIVITYcounters inframe.rs, the translated-shader disk cache and the--precompile --pipelinesblobs. The gap is not measurement plumbing; it is a policy on top, and the evidence to justify one.Step 1 - the only thing I would ask to build: a read-only profiler
No behaviour change, no quality change, no skipped work. A diagnostic behind an environment variable, in the shape
report.jsonalready uses:The kill criterion, stated before the work so it cannot be moved afterwards: if the median across a representative set of titles is under ~10 % savable GPU time, stop and do not build the skipping logic. The one piece of hard evidence I have found for this class of idea is mobile (Arnau et al., ISCA 2014: 38 % of fragment shader executions redundant across frames on Android games, ~60 % of those removed). Mobile titles are often 2D or mostly static; that number will not transfer to a third-person 3D title with a moving camera, and menus will flatter it badly.
Step 2 - only if step 1 passes: the governor
A target p95 frame time with a PID-style budget, rate-limited (small change per frame), hysteresis (cut fast, restore slowly after N stable frames), and the surplus converted into idle time rather than more frames - that is where watts actually fall; an uncapped frame rate saves nothing per frame. Two XCL-specific cautions:
Step 3 - quality knobs, safe class only
Applying detail where it is not visible is the part of this idea I trust least in a blind layer, because a title often reads its render size from constants and resizing render targets from outside breaks it. The one pixel-cost knob that does not need those constants is variable-rate shading on the main scene pass, driven by the previous frame's local contrast, applied only where the pass can be recognised (render-target size/format, shader hashes) and excluded from UI, text, alpha-tested foliage and anything with MSAA or depth-writing pixels. I found no
SetShadingRate/shading-rate-image path in the tree today (code search; the only "shading rate" match is ingpu/dxil/graphics.rs), so this would be new. Render-scale injection outside the title's own upscaler is off the table for me; XCL already runs the title's FSR 4 pass, which is the cooperative version of that knob.Honest limits of the source brief
The document I am condensing was written for Vulkan translation layers, and most of its vendor half does not survive the translation to a native-D3D12 layer on Windows: NVML gives device-level energy, not per-process, so "joules per frame" is not attributable to one title; Reflex and
VK_NV_low_latency2have no role because there is no swap chain to pace - the frame clock replaces them; optical-flow interpolation and DLSS need inputs a blind layer cannot supply; NTC needs re-encoded assets. NVIDIA-specific fast paths are also premature here: on 32-lane-wave hardware console wave64 programs run as two halves with mask exchange (docs/wave64-on-wave32.md, #42), which is the bigger NVIDIA cost.Where it probably does not pay yet
README puts the retail title at "steady 30 fps, menus, gameplay not reached". A redundancy profiler run on menus would show a wonderful hit rate and say nothing about gameplay. That is the strongest argument against doing this now, and the reason I am asking rather than opening a PR.
Questions
crates/xcl/src/hle/d3d12x/frame.rs+ the replay path, no behaviour change.Related
I searched for
memoization,redundant pass,shading rate,frame pacing,energy,telemetry,Reflex,NVML,dynamic resolutionand found no existing issue for this, so I am not duplicating one; tell me if it should live inside #103 or #1269 instead and I will move it.Scope: read through the GitHub API on 2026-11-25 (main as of 11:04Z);
frame.rsread in full,list_x.rsandgraphics.rsonly by search and size. Nothing was cloned, built or run, so no number here is a measurement.