Skip to content

Replace the autotune rules with one governor that holds the frame rate at the lowest TDP - #179

Open
anaveto wants to merge 168 commits into
IHulkSmashI:mainfrom
anaveto:fix/autotune-target-keeps-your-target
Open

anaveto wants to merge 168 commits into
IHulkSmashI:mainfrom
anaveto:fix/autotune-target-keeps-your-target

Conversation

@anaveto

@anaveto anaveto commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Change: one governor holds the target frame rate with the lowest TDP.

  • Autotune off: the TDP setting is the limit. Autotune on: a target frame rate and a maximum TDP apply, and the TDP slider is greyed out.
  • A loss of frames gets the maximum TDP in approximately 1 s. No target, or a target out of reach: less TDP at the same frames.
  • A step down that loses frames goes back immediately.
  • A learned TDP is never saved as the TDP setting.
  • Menus, loading screens and videos do not change the TDP. Autotune stays out of xemu.

Commit: 71397cb. Fixes for 15 reviews, the cloud fuzz test and daily use.

Claw, a9aa3b4: 6 tests: 7 frames missing against 44 of the installed build. 2 tests out of reach: 1158 against 940.

Follow-ups:

  • Short heavy bursts every 10 s can stay at a low TDP.
  • Frame times that spread 3 to 9 %: up to 1 % fewer frames.
  • More TDP changes where the need of an emulator jumps.
  • Tests for 13 rules that no test holds.

🤖 model: claude-fable-5-2 | effort: xhigh

anaveto and others added 4 commits November 15, 2026 13:10
… them

Autotune was tuned on the device, one play session at a time, and no two sessions show it the same scenes, so nothing
could say afterwards whether a change made it better. tools/autotune_sim.py runs it against games as a Claw 8 EX
measured them (2026-11-14/15), with no Claw:

- A scene is the frame rate at each power limit, measured level by level: Enshrouded at 30 to 8 W, Midnight Club: Los
  Angeles on RPCS3 (it draws the whole limit at every limit), Need for Speed: Most Wanted (60 fps at 8 W).
  tests/data/autotune/ has the frame logs behind the first two, and tests compare the tables with them. The chip
  follows a new limit with a 0.15 s lag: recorded frames were slower 0.35 s after a step down and back 0.28 s after a
  step up.
- The simulator knows the lowest limit that costs no frames in every scene, so it scores a run: watts over that need,
  the share of time the limit cost frames, the longest such stretch, changes a minute.
- Today's Autotune runs in it unchanged (Autotune._step once a second on a simulated clock), in both modes. A replay
  feeds a recording's frames to it as they came.

Two tests are expected failures and say what target mode doesn't do yet: after a jump of the need it is under the
frame rate for 6-7 s (raises of +2 to +6 W, 2 s apart), and a target out of reach keeps the full limit (30 W where
22 W gives the same frames).

Not modelled: the PL1 time window and PL2, temperature, the CPU/GPU levers, frame generation, loading screens.

Co-Authored-By: Claude <noreply@anthropic.com>
…une.csv

A limit that is just too low doesn't show in the frame rate. Midnight Club: Los Angeles on RPCS3 at 15 W showed 29.7
of its 30 fps with the median frame on pace, and 6.4 % of the frames more than 10 % slow; at 20 W, 1 % (Claw 8 EX,
2026-11-14). mangoapp's log has a row for every frame, so for a game read from it the Sampler now keeps the frame
times of each read (Sampler.frames_ms) and the sample carries their number, median, 95th percentile and the share
more than 10 % over the pace (the median of the 60 frames before). autotune.csv gets the four as new columns.

Nothing Autotune decides on changed: it still gets one frame rate a second. A game with its own MangoHud log (one row
a second) leaves the columns empty. An autotune.csv with the earlier columns is kept as autotune.csv.1 and a new one
starts.

Co-Authored-By: Claude <noreply@anthropic.com>
@anaveto
anaveto force-pushed the fix/autotune-target-keeps-your-target branch from 0e8d7fe to dd369ab Compare November 15, 2026 13:45
…or the guard's

A power source change in a game started the new slot at held_w(): in
a step down being watched that is the level tried (13 W where the
game held 15 W: 52 fps where it held 60), and under the temperature
guard it is the guard's cap, though the restart resets the guard. A
resume after the charger came out during a sleep started the slot
mid-range. Now the carry is the level before a step down, nothing
under the guard's cap, and a resume carries the level as Steam's
report does.
Three checks for the maintainer: the start where the game held after
an unplug or plug-in (also during a sleep), the slider, profiles and
PL2 on the power source the panel shows before Steam reports a
change, and Autotune's start with the game process, not at Steam's
shader dialog.
…limit

A game that dips at every limit every 20 to 30 s (40 fps, the package
at the limit in the dip, 6 W out of it) lost the level at each dip
that came before the level had held for HOME_S, or within RETRY_S of
its last try: the full limit stayed, and the next dip caught its
steps down (240 to 826 s over 8 W in 840 s). When the frame rate
climbed at the full limit (it lost the frames too) and the package
then draws less than all of the level, the level is tried once more.
A loss that the full limit answers at once stays the limit's: a
second every 10 s that needs 12 W is not taken for a dip of the
game's own (that gave 82 s under 57 fps in 840 s at 8 W).
…e full limit

In the look at the full limit after a loss, the carry was the level
that just lost frames (15 W where the place needed 26 W: 34.6 fps
for 60). Now it is the full limit on the chip.
A 30 fps video at 6 W held at the 8 W floor, the band free. The game
after it lost at 8 W: not booked (a free band), but 8 W stayed the
level held in this scene, and the step down 5 s later went to 8 W
again and lost again (1.5 s under 28.5 fps, fuzz seed 78: 1.07 s).
Such a level is no longer the level to go back to.
… of them

The wait after a failed step is 5 s times 2 to the count of failed
steps in a row, at most 300 s. The power came before the cap: at
1025 failed steps in one scene (a steady game, after 7 days) it was
past a float, and the governor stopped. The count in the power now
stops at 7 (5 s times 64 is over 300 s already).
A dip of the game's own at 30 s, which the full limit had too, then
a second every 10 s that needs 12 W: with the mark kept past its look,
each burst was tried at 8 W once more and booked as the game's own dip
(83 s under 57 fps in 840 s).
… back

A loss at a limit that can not be its cause ends as a dip of the game when
the last frames are back over the line. The band takes the lower pace in
during the loss, so that line went down to the frames. Now the end of the
loss is judged against the line that the frames fell under.

A fall of 4 to 4.5 % that stays was booked as a dip. Now no fall from 0 to
12 % is booked.
…ne scene

A jump on the last 20 frames starts a look at the full limit. Both halves
of these frames had to agree within 3 %, so one frame of the scene before
could stay in them: 38.4 fps against the 39 fps of a menu. Now the halves
must agree within the small margin, and the look starts one look later.
With Auto FPS on and the target out of reach, the goal was what the full
limit gives less 5 %. The limit held where it lost 1.6 to 2.0 % of the
frames. The user's decision: when the target can not be held, the maximum
TDP applies, and no watts are saved with fewer frames.

Now the goal is what the full limit gives less 1 %. A lower limit holds
only where it gives the frames of the full limit (a game on its own frame
limit, a scene that the limit does not hold back). With Auto FPS off, the
target out of reach gets the full limit, as before.

Simulator, against e2df986: target out of reach, 0.4 to 0.7 % of the
frames lost (was 1.7 to 2.0 %), 2 W more; uncapped, 0.0 % (was 1.6 %),
0.9 W more.
The wait after many failed steps reaches 320 s before the cap of 300 s. The
test accepted 270 to 300 s left after a 30 s run, so a cap of 600 s also
passed (cloud mutation run 44369505901). Now the test measures the wait
from the write back: the watch of that write and 300 s.
…er 1 %

With the target out of reach, a step down holds only where it gives the
frames of the full limit, within 1 %. A watch of 2.5 s can not tell 1 % in
a frame rate that moves more than that by itself: in the simulator an
emulator held 28 W for 20 s at 3 % under the full limit. Now the step down
out of reach needs a wobble of the game within 1 %. A game on its own
frame limit steps down; a game that wobbles keeps the full limit.

Simulator, emulator with need jumps, 12 seeds: the longest time under the
frames of the full limit is 1.7 s (was 21.6 s).
Auto FPS was the switch for a target out of reach: on, Autotune held what
the full limit gives; off, the full limit. The user's decision replaces
both. This commit removes the switch, its setting and its argument in
set_autotune_target. A target out of reach gets what the full limit gives
for every user, as an unset target did before.
…s frames

With the target out of reach, a step down held where it gave the frames
of the full limit within 1 %. In a game where each watt gives a few more
frames, that cost frames: in the simulator, the heavy place held 29 W at
0.7 % under the full limit. The user's decision (D11, option b): full
power only where more power gives more frames, and a game on its own
frame limit gets the lowest limit that keeps its frame rate.

Now the margin out of reach is 0.3 % (SAME), about two times the spread
of the frame rate of one watch. Simulator, 6 seeds, 1 % then 0.3 %:
- heavy place, target 60 out of reach: 0.65 % then 0.00 % of the frames
  lost; limit 29.1 W then 29.9 W;
- Midnight Club on its 30 fps lock, target 60: 17.0 W then 17.9 W, no
  frames lost;
- a game on a 60 fps lock with no target: 8.3 W then 9.2 W, no frames
  lost.

The second clause of the band's need gave the band's lower edge in every
case; it is removed.
When the frame rate climbed during the look at the full limit, the level
was tried once more as a dip of the game's own. A burst where the full
limit gives more frames than the level, but not all, also climbs when it
ends: every 10 or 20 s, a 1.5 s burst at 45 fps at the level and 55 fps
at the full limit kept the level, with 56 to 123 s of the bursts at
45 fps in 14 minutes (review round 14, finding 2).

Now the climb marks the full limit's loss only where two of its frames
in a row were as slow as the level's. The same game: 0.9 to 6.3 s at
45 fps. A game's own dips at every limit keep the floor as before.
…it too

When the full limit gives 95 to 99 % of the target, the steps took the
target as out of reach, but the held limit did not: a pace within 5 % of
the target set the reference to the target, and the held limit had to
give the target less 5 % only. A place that made the held limit give
1.5 to 2.5 % less than the full limit kept that limit: 590 of 590 s in
the reviewer's test (review round 14, finding 3).

Now a pace within 5 % of the target raises the reference to that pace,
not to the target (to the target only while nothing is known), and out
of reach the held limit has to give its band. The same test: 3 s.
Out of reach, a step down held only where it gave the full limit's
frames less 0.3 %. At a 60 fps frame limit, a step that cost no frames
measured up to 0.4 % under that estimate, so steps failed that cost
nothing: a light game on its frame limit ended at 9.2 W (installed
8.3 W) and Midnight Club with a 60 fps target at 17.9 W (installed
16.6 W), with the same frames.

Now the margin is 0.5 %. Simulator, six seeds: the light game 8.3 W,
Midnight Club 17.1 W, Enshrouded with a 60 fps target 0.30 % of the
frames under the full limit's (installed: 1.95 %).
Out of reach, every comparison with the full limit's frames had a
0.5 % margin, and a step down was judged against the high of the
game's own wobble (the larger of the last pace and the band's lower
edge). With no target set (the most frames) and frame times that
spread 3 % by themselves, steps that cost no frames failed: a game on
its 60 fps frame limit stayed at 10 to 21 W (installed: 8 W), and a
game with 48 fps from 20 W up at 22 to 30 W. The wobble gate of
0d5121b (no step down out of reach where the game wobbles over 1 %)
kept such games at their start or at the full limit (review round 14,
findings 8 and 9).

Now a step is judged against the pace of the 3 s the step waited for;
out of reach, the goal is the full limit's frames less 0.5 % or less
the game's own wobble of ten frames where that is more, for the held
limit too; a step gives the full limit's frames where it is within
that wobble over the frames of the watch. The gate is removed.
Simulator, 12 games: the 60 fps frame limit at the floor in 9, 6 and
7 of 10 games at 2, 3 and 4 % spread (installed: 10); the 48 fps game
at 20 W; Midnight Club 16.9 W; Enshrouded with a 60 fps target 0.09 %
of the frames under the full limit's. The emulator whose need jumps:
at most 22 s under the full limit's frames less 0.5 % and 0.5 % of
the frames lost (installed: 38 s and 1.0 %), the same watts.
…D11 b

Both still said 5 % for the most frames the max TDP gives (review round 14, finding 15); the
governor holds them within 0.5 %, or the game's own wobble where that is more.
Steps down that failed minutes before, while the level held, made the wait at the full limit after a failed second try 160 s (15 minutes of failed tries at the level under it). A failed look waits 5 s.
A limit held in a place at your target kept the goal of your target
less 5 % in a heavier place where the full limit gives 95 to 99 % of
the target: the held limit gave 1.5 to 2.5 % fewer frames than the
full limit for 590 of 590 s (review round 15, finding A2). A game with
no history that starts mid-range at your target less 5 % stayed there
for the whole game, with 1.4 to 3 % of the frames under the full
limit's (finding B3).

Now a pace over the ratio 1 % or more under your target, at a limit
the package draws all of, gets a look at the full limit. The same
games: 0.4 % of the frames lost, at 22 W.
…st watts

With no target set, the target is the screen's highest refresh rate
(120 Hz on the Claw). Where the full limit gave 119 fps or more, the
rules of a target in reach held 120 fps less 5 %: 2.1 % of the shown
frames lost at 125 fps (review round 15, finding B5). Where it gave
over 120 fps, steps were judged against frames the screen does not
show: 3 W more than the 120 shown frames need.

Now the governor knows that no target is set, and holds the most
frames the limit gives up to the screen's rate, less 0.5 %, as for a
target out of reach. 125 fps at the full limit: no shown frames lost,
at 26 W (the installed Autotune: 26.3 W).
With no target set, a game whose first frames came at the full limit
took the screen's rate as reached: 130 fps at the full limit, 19 W
held for the whole game with 3.6 % of the shown frames lost (review
round 15, finding B5 at the start of finding B3).

Now a pace under 99 % of your target gets one look at the full limit
while the full limit was never measured: 0.34 % lost, at 22 W.
With the target just out of reach (the full limit 58.5 of 60 fps), the
band took in a pace that fell a little at a time while it stayed over
your target less 5 %, and the held limit was never raised: 291 to
576 s at levels under the full limit's frames less 1 %, 1.2 to 2.3 %
of the frames lost (review round 15, finding B2).

Now, out of reach, a pace under the band's lower edge at a limit that
holds the game back is not taken in: 11 to 21 s, 0.04 to 0.06 %.
Out of reach, the goal was the full limit's frames less the game's own
wobble of ten frames, and a step started from a pace that stood still
within that wobble. A game whose frame rate moves in a rhythm of its
own (10 % lower every other second) lost 4.5 to 8.7 % of its frames to
lower limits; a game whose frame times spread 9 % lost 1.06 % (review
round 15, findings A3 and B1, from e933a15).

Now the wobble moves the goal 1 % at most, and at a limit the package
draws all of, a step starts from a pace steady within 2 %. The rhythm:
no frames lost; the 9 % spread: 0.21 %. A game on its own frame limit
keeps the floor as before.
The level that held in a scene was the level to go back to unless a
level over it failed in the same scene. A heavier moment every 10 s
failed 8 W at each moment, against another reference: 8 W was written
again 5 s later, 16 times in 3 minutes, and 104 to 106 of the 126 s
of the moments were at limits under the 22 W they need (review round
15, finding A1).

Now a level that failed twice counts in any scene: 1.9 to 2.8 s of
the moments under 22 W (the installed Autotune: 6 s).
Auto FPS was removed, but its saved setting stayed in settings.json,
and a test helper still called the removed start function (review
round 15, findings B7 and B8). The setting is now dropped at start, as
the Dry run setting is, and the helper is deleted.
With the looks of this round, three rules came to change only how often
Autotune looks and writes, and their tests passed without them. Taken
out, the rule that a met pace does not raise a measured reference
gives 338 writes in 590 s (169 looks) in place of 11; the reference
raised to your target gives a look that finds what is known; a watch
the guard's watts end keeps 3.4 to 3.7 s under the goal in place of
0.4 s. The tests now hold these figures.
…DP setting at start

STATUS.md: both notes kept under "Needs the maintainer", upstream's first.
@anaveto
anaveto marked this pull request as ready for review November 21, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant