Optimize: format doc, README section and status rows, agent report
This commit is contained in:
1 parent
797bec73dd
commit
8d8fcfda42
3 files changed
+203
No files matched your search
@@ -85,6 +85,8 @@ What was really run: see [Status](#status) (a real install into a scratch prefix
|
||||
| Summit watermark over the picture | **Working** | `summit - git.molberg.cloud/alex/summit` (bottom left) is on screen in the engine's window. `--no-watermark` turns it off. Not drawn into saved clips. |
|
||||
| Session summary (JSON and text), `--benchmark`, result card | **Working on X11 with a video file; not tried elsewhere** | Written when the engine stops, on key P and from the overlay's Home tab; `--benchmark SECONDS` ran for real on the VM with the countdown and the card. Not checked: other sources, Windows, `--results` beside a test-mode report in a real launcher run. |
|
||||
| CSV frame log (`--frametime-log`) | **Experimental** | Written and read back here; the columns follow MangoHud's log as I remember it, not checked against MangoHud's own tools or a graphing program. |
|
||||
| Optimize: find settings for your minimums and one priority (`--optimize`, overlay's Optimize tab) | **Experimental** | New. Ran for real on the GPU test VM (RTX 3090 shared with another service, **software OpenGL** for the window, a 720p recording played as a 30 fps game): `--optimize` on a file measured 5-7 configurations per run, rejected the ones that dropped frames or queued, showed the countdown and the card, and wrote the result file; in a session, started, cancelled (settings back exactly) and applied (saved) through `--control`. The search logic is tested with a fake measurer. **The VM's numbers are not the owner's**: its window paces 60 fps unevenly, so no 60 fps minimum held there, and two runs with the same goal chose differently (2x vs no frame generation). Not run: a real game, Remote Play, RTX VSR, NVIDIA VFG, TensorRT, the keyboard on the card in a live session, Windows. See [Optimize](#optimize-find-my-settings). |
|
||||
| Headroom check in session summaries | **Experimental** | New. Each session summary gets `headroom` ("uses 41% of a 120 Hz frame budget: 3 changes could improve the picture", or the reverse when falling behind), a one-time message in the overlay, and a note on the Optimize tab. Suggestions only. It is an estimate from the stage timings; seen in a real summary on the VM. |
|
||||
| Instant replay clips: global save key (Ctrl+Alt+R), clip lengths from Settings | **Working on X11 and KDE Wayland** | **KDE Wayland**: Ctrl+Alt+R through the GlobalShortcuts portal saved clips while the game had the keys, **also while a native Wayland window (the launcher) had the keyboard instead of the game** (independent re-run, [docs/WAYLAND_VERIFY.md](docs/WAYLAND_VERIFY.md)). The portal accepted Summit in that run with no `summit.desktop` in any applications folder the portal reads; the earlier run on the same desktop was refused without one ("An app id is required"), so install it (`install.sh` does, under its prefix) and treat the no-file case as luck, not a guarantee. Without the portal, an X11 key grab through XWayland works while an XWayland game has the keys (run once, earlier). **X11**: Buffer 60 s, clip 30 s: Ctrl+Alt+R during play saved a 30.1 s H.264 1280x720 MP4 that ffprobe reads and ffmpeg decodes. **This run found a bug and fixed it**: the global key used to save the whole buffer (60 s) and ignore the configured clip length. |
|
||||
| `install.sh` | **Working (one machine)** / dry-run elsewhere | Real run into a scratch prefix (`SUMMIT_PREFIX`) on an Ubuntu 24.04 machine, with the checkout supplied through `SUMMIT_SRC_DIR` instead of the clone: built, copied the two binaries and the engine, made the venv; `import torch` there gave 2.11.0+cu128. **This run found a bug and fixed it**: with an NVIDIA GPU the venv got PyPI's torch 2.15+cu132 (CUDA 13.2; the test machine's driver stops at 13.0) and the cu128 step did nothing; torch is now installed from the cu128 index first. Not run on the neon test machine itself, not as a non-root user, not into `/usr/local`, and the engine on the test machine ran from its existing venv. **Second real run** (independent verifier, 2026-11-24, an earlier version of the script than the one now here): as a non-root user on the KDE Wayland desktop (Arch, RTX 5080), into a scratch prefix, with `--no-deps` (no sudo allowed there; every package the script would install was already present): built, installed both binaries and the engine, made the venv (`torch 2.11.0+cu128`, CUDA on the 5080), downloaded the RIFE model, and `summit doctor` / Play with Enhance then ran from the installed copy. That run found **four bugs, fixed with tests**: sudo was used even for a prefix in the user's home; the binaries were looked for in `<src>/target` and not where cargo put them (`CARGO_TARGET_DIR`); the dry-run showed the venv in the wrong place; running the installer again (an update) died in `uv venv`. The `pacman`/`sudo` step itself was **not** run, nor `/usr/local`, nor the release-package path; the merged script (update flow, icons, `--with-remote-play`) was only dry-run, not run for real. Other distros: `--dry-run` only. |
|
||||
| Steam scan (all library folders, installed or not), Steam playtime, "most played" | **Working** (owner's desktop) / **Tested** | Run against the owner's real Steam install (2026-11-24; Arch, 32 games over three library folders, eight accounts): every game gets a cover. Newer Steam clients cache the covers as `library_capsule.jpg` and `library_header.jpg` (in hash folders), which Summit missed before; it now reads those, and art you set yourself in Steam (`userdata/<user>/config/grid`) comes first. |
|
||||
@@ -344,6 +346,32 @@ The Overlay tab of the in-game menu (real, over the same run): the stats setting
|
||||
|
||||
Headless renders of every style with made-up numbers (labelled on the picture) come from `python engine/devtools/render_stats_samples.py OUT_DIR`; the tests use the same data.
|
||||
|
||||
## Optimize: find my settings
|
||||
|
||||
Pick your minimums (output resolution, frame rate, optionally the most added delay) and **one** priority: frame rate,
|
||||
resolution, quality or lowest delay. Optimize starts from the cheapest configuration that meets the minimums, measures it
|
||||
for a few seconds after a warm-up, then raises your priority one step at a time until a step fails. It then spends the rest
|
||||
of its time budget on the picture, never giving back the priority. A candidate passes only if its **1% low** (not the
|
||||
average) holds the minimum with about 10% to spare, it drops no frames, and the queue has drained. Only Summit's own
|
||||
settings are tried (frame multiplier, model, motion detail, AI engine, upscaler and its level, output resolution,
|
||||
anti-aliasing). **Summit can't change a game's own graphics options.** "Quality" has no live score: it follows a fixed
|
||||
ranking, shown on the card: the display's own resolution, then RTX VSR over FSR 1, then Full motion detail, then
|
||||
anti-aliasing, then supersampling.
|
||||
|
||||
```
|
||||
python run.py game.mp4 --display --optimize "min=1920x1080@60,priority=quality" --optimize-budget 120 --results out/opt.txt
|
||||
```
|
||||
|
||||
In a session: the overlay's **Optimize** tab, then **Find my settings**. A countdown with the current candidate shows at the
|
||||
top (Esc or the tab stops it and puts every setting back). The card at the end shows the best three with their numbers and
|
||||
why. Enter (or **Apply the result**) saves #1; Esc (or **Keep my settings**) puts yours back. The results go to
|
||||
`~/.local/share/smoovplay/optimize/` (format: [docs/optimizer.md](docs/optimizer.md)), for the launcher to offer them.
|
||||
|
||||

|
||||

|
||||
|
||||
Real engine output on the GPU test VM (software OpenGL window, shared RTX 3090): the numbers there are not a gaming PC's.
|
||||
|
||||
## The launcher
|
||||
|
||||
```sh
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
# Optimizer agent report (branch ap/optimizer)
|
||||
|
||||
Task: a benchmark that finds the engine settings for the owner's minimums and one priority, with an overlay entry,
|
||||
result files the launcher can read, and a cheap headroom check from session stats.
|
||||
|
||||
## What changed
|
||||
|
||||
| Area | Files |
|
||||
|---|---|
|
||||
| Search, verdict, result dict/file/text, measuring a span of the collector, headroom check, live Runner/Control, result card image | new `engine/framegen/optimize.py` |
|
||||
| Tests (no GPU, no window): parsing, verdict, search order, display ceiling, pruning, time budget, nothing-met report, delay priority, the result file, Runner with the real `Collector` and `Settings` (cancel restores exactly, apply saves, CLI quits), backlog wait, pipeline hook, Optimize tab, headroom | new `engine/tests/test_optimize.py` (24 tests) |
|
||||
| `Pipeline.driver`: stepped once a tick, may ask for a restart or the end; `optimize*` commands forwarded | `engine/framegen/pipeline.py` (+8 lines) |
|
||||
| Optimize tab rows (`opt_min_res`, `opt_min_fps`, `opt_max_delay`, `opt_priority`, `opt_budget`), `specs_json()["optimize"]` | `engine/framegen/settings.py` (added block before `_laid_out`, one line in `specs_json`) |
|
||||
| Optimize tab actions (Find my settings / Stop / Apply / Keep mine) and the headroom note | `engine/framegen/menu.py` (small additions) |
|
||||
| Countdown banner and result card drawn over the picture; Esc / Enter while it runs or the card is up; `display_mode()` | `engine/framegen/io.py` (+~50 lines) |
|
||||
| `--optimize`, `--optimize-budget`, Machine from the session, result files, `headroom` in session summaries, `--control` commands `optimize`, `optimize-cancel`, `optimize-apply` | `engine/run.py`, `engine/framegen/remote.py` (doc lines) |
|
||||
| Format for the launcher | new `docs/optimizer.md` |
|
||||
| README: status rows and an "Optimize: find my settings" section | `README.md` |
|
||||
|
||||
No Rust touched; nothing in compare.py or the launcher crates.
|
||||
|
||||
### How it works (short)
|
||||
* Candidates are engine settings only (`interp`/`hz`, `model`, `motion`, `engine`, `scaler`, `vsr_quality`, `output_res`, `aa`).
|
||||
Bilinear, no upscaler and CAS are not tried (stated in the result).
|
||||
* Order: the cheapest configuration that meets the minimums (smallest multiplier, minimum size, FSR 1, Half motion, AA off).
|
||||
If it fails: 2x when it was "no frame generation", then VFG / TensorRT if available. Then the priority's ladder, one step at a
|
||||
time until a step fails, then the quality ladder in ranking order. Priority "delay" refuses steps that add more than 2 ms.
|
||||
A candidate at least as heavy in every dimension as one that failed on performance is skipped, with the reason.
|
||||
Each step's cost is estimated (7 s live, about 20 s with a restart). The search stops when the budget can't cover the next
|
||||
step, and says so.
|
||||
* Restart settings (motion, engine, model) are changed one step at a time. A failed restart step means at most one restart back.
|
||||
"No frame generation" keeps the session's AI settings, so it needs no restart.
|
||||
* Pass rule: see `judge()` and docs/optimizer.md. One change from the task's wording: when the display's refresh rate is the minimum,
|
||||
no frame rate can be 10% above it, so the 1% low must reach 97% of the target and the 10% headroom moves to the frame budget
|
||||
(at most ~91% busy).
|
||||
* Live: settings are overrides (never saved) until Apply. Cancel and errors put back exactly the nine engine values as they
|
||||
were (tested with the real `Settings`, file untouched). At the end the best result is shown live under the card.
|
||||
|
||||
## Verified, and how
|
||||
* `cd engine && env -u PYTHONPATH /root/.cache/summit-venv/bin/python -m pytest tests -q`: **233 passed, 1 skipped**
|
||||
(main had 207 + 1 skipped). Each commit passed it.
|
||||
* GPU test VM, my own directory `/home/user/summit-optimizer` (engine venv; Pillow copied from the host venv into `pylib`),
|
||||
X11 :0, 1920x1080 at 120 Hz monitor, a 1280x720 window, software OpenGL, RTX 3090 shared with another service,
|
||||
`play60.mp4` (a 720p 60 fps recording) played as a 30 fps game, `--no-graph`:
|
||||
1. `--optimize "min=1280x720@60,priority=quality"`: **nothing met**. The base (2x, 720p, FSR, Half) measured an average of
|
||||
59.97 fps, a 1% low of 34-37 fps, 21 ms delay and 20% busy; the 1% low must be 58. Cause: the VM's window paces 60 fps unevenly
|
||||
(the session's frame-to-frame jitter was 12.6 ms; vsync on did not help, 37 fps). Kept as the real "not met" example.
|
||||
2. `--optimize "min=1280x720@30,priority=fps"`, three runs. Run A (screen locked, so no usable screenshots): 7 measured in 126 s.
|
||||
#1 2x + FXAA; 3x rejected (frames dropped); 900p rejected (only 3 frames, then a 10 s queue). Run B: same choice,
|
||||
6 measured. Run C (screen unlocked; screenshots and `real-result-fps.json`): 2x missed by 3 fps (1% low 30, needs 33),
|
||||
so #1 is no frame generation + SMAA. **The same goal gave different winners on this shared VM**: noise of the test
|
||||
machine, reported as measured.
|
||||
3. In-session path, through `--control` on stdin: `optimize` started a run (banner seen), `optimize-cancel` stopped it
|
||||
("settings put back", a cancelled result file written), `optimize` again ran to the card, and `optimize-apply` saved #1.
|
||||
The settings file afterwards had `output_res 1600x900`, `aa off` (was `cas`), `interp false`: exactly #1.
|
||||
4. Session summaries from these runs contain `headroom` (e.g. state `room`, 41% busy at 120 Hz).
|
||||
* The first VM run found a real bug: after a restart, a file played in real time keeps a backlog for seconds, and the warm-up
|
||||
(one capture-wait reading) measured inside it. The fix: wait until no frame queued 50 ms for a whole second. Unsettled
|
||||
measurements are rejected with the queue length.
|
||||
|
||||
## Screenshots (docs/media/optimizer/), all looked at
|
||||
Real engine output, VM window (1280x720) grabbed from the root window and cropped to 1180 px wide to cut out KDE
|
||||
"Memory shortage" popups on the right:
|
||||
* `real-cli-countdown.png`: `--optimize` running; banner "Optimizing: about 2:21 left, 2 tried / 720p, 2x (60 fps)… / settling".
|
||||
* `real-cli-card.png`: that run's card (run C, `real-result-fps.json`/`.txt`). It still says "card memory 20.9 GB" (all programs).
|
||||
The card now shows the engine's own memory; this screenshot is older than that change.
|
||||
* `real-cli-card-not-met.png`: run 1, "your minimums weren't reached" (`real-result-not-met.json`/`.txt`).
|
||||
* `real-overlay-running.png`, `real-overlay-card.png`: the in-session run started through `--control`
|
||||
(`real-result-overlay-applied.json`). The stats line shows a 6.5 s delay at that moment: the backlog left by the
|
||||
rejected 900p+FXAA step was still draining.
|
||||
* `headless-menu-optimize-tab.png`: the Optimize tab rendered headless by `Menu.render()`. The headroom note on it is sample text.
|
||||
* `real-session-summary-with-headroom.json`: a real summary with `headroom`. It was written before suggestions got their `set`
|
||||
field, and its first suggestion ("hz 60" with frame generation off) is the bug that change fixed.
|
||||
|
||||
## Not done / untested / to know
|
||||
* **Not run on a real game, Remote Play, a capture card, Windows or Wayland.** RTX VSR, NVIDIA VFG and TensorRT were not on the VM,
|
||||
so their steps (and VFG/TensorRT fallbacks) ran only in tests. Restart steps (Full motion) ran live only as the session's
|
||||
own motion "auto" -> "half" restarts. A climb that restarts to Full was not reached on the VM.
|
||||
* Keys on the card (Enter/Esc) and the menu rows were **not** pressed live. My first attempt with XTest keys went to the
|
||||
wrong windows: other agents' engine windows were open on the shared display, and some of my key presses (m, Tab, Down,
|
||||
Return, Escape, around 07:2x VM time) **probably reached another agent's test window**. I stopped and used `--control` instead.
|
||||
The menu rows and Enter/Esc handling are covered by tests and the headless render only.
|
||||
* "Most added delay" uses the pipeline's own real-frame delay (arrival to screen), not end-to-end input lag.
|
||||
* With frame generation off, the screen still gets 60 presents a second (each game frame twice), so "average 60 fps" shows for a
|
||||
"30 fps" configuration. The pass rule uses the game's rate there.
|
||||
* "Load" (pipeline busy) adds up AI-frame wall time and GL timer queries. On software OpenGL the upscaler's time is the CPU's.
|
||||
* The Optimize rows also appear in the launcher's Settings page (the registry test requires every setting in `specs_json`).
|
||||
The profiles agent can hide that section or use it to start a run (`set opt_... ` + `optimize` over `--control`).
|
||||
* The 1% low over 5 s is strict: one 25 ms hitch in 300 frames fails a 60 fps target on a 60 Hz display. That is deliberate (the owner asked for
|
||||
lows, not averages). If it proves too strict on the owner's PC, `MEASURE_S` or `AT_TARGET` are the knobs.
|
||||
@@ -0,0 +1,85 @@
|
||||
# Optimize: result file format (for the launcher)
|
||||
|
||||
The engine's Optimize (`engine/framegen/optimize.py`) writes one JSON file per run:
|
||||
|
||||
* `<data dir>/optimize/summit-optimize-<YYYYmmdd-HHMMSS>.json`, and the same content as `<data dir>/optimize/latest.json`.
|
||||
`<data dir>` is `oslayer.data_dir()`: `$XDG_DATA_HOME/smoovplay` (`~/.local/share/smoovplay`) on Linux, the settings folder on
|
||||
Windows. The folder sits next to `sessions/`, not inside it, because the launcher reads every `.json` in `sessions/` as a
|
||||
session summary.
|
||||
* With `--results FILE`: the same JSON also as `FILE` with a `.json` suffix, and the text report (`format_text`) in `FILE`.
|
||||
* `python -m framegen.settings` prints, under `"optimize"`: the `--optimize` grammar, the priorities, `format`, `version`,
|
||||
`dir` and `latest` (the paths on this machine) and the quality ranking.
|
||||
|
||||
A run that was cancelled also writes a file (`"cancelled": true`).
|
||||
|
||||
## Starting a run
|
||||
|
||||
* Command line: `run.py <file or source> --display --optimize "min=1920x1080@60,priority=quality[,delay=50][,display=2560x1440@144]" [--optimize-budget SECONDS] [--results FILE]`.
|
||||
Priorities: `fps`, `resolution`, `quality`, `delay`. `display=` stands in for the real screen (its size and refresh rate set the
|
||||
ceiling). The engine shows the countdown, then the card for `--result-card` seconds (default 8), then exits.
|
||||
Enter on the card applies and saves #1; Esc closes it.
|
||||
* In a session: the overlay's **Optimize** tab (its settings `opt_min_res`, `opt_min_fps`, `opt_max_delay`, `opt_priority`,
|
||||
`opt_budget` are in the registry like any other), row **Find my settings**. Through `--control` (stdin): `optimize`,
|
||||
`optimize-cancel`, `optimize-apply`, plus `set opt_... <value>` to choose the inputs first. When a run ends, the engine prints
|
||||
`[optimize] result -> <path>`.
|
||||
|
||||
## The file (`format: "summit-optimize"`, `version: 1`)
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"format": "summit-optimize", "version": 1, // check both; a later version adds fields, never renames
|
||||
"created": "2026-11-26T07:21:42", "created_unix": 1795670502,
|
||||
"game": "Voidrunner" | null, // SUMMIT_GAME, as the launcher sets it
|
||||
"goal": {"min_resolution": "1280x720", "min_fps": 30, "max_delay_ms": null, "priority": "fps", "text": "..."},
|
||||
"machine": {"display": "1920x1080", "display_hz": 120.0, "source": "1280x720", "src_fps": 30,
|
||||
"vsr": false, "vfg": false, "trt": false, "max_mult": 10, "motion_fixed": null, "model_fixed": null,
|
||||
"restarts": true, "text": "..."},
|
||||
"budget_s": 150.0, "elapsed_s": 70.4, "restarts": 0, "cancelled": false, "error": null,
|
||||
"met": true, // false: nothing held the minimums (see failures, closest)
|
||||
"top": [ // best first, at most 3; [] when met is false
|
||||
{"rank": 1, "label": "720p, 2x (60 fps), AMD FSR 1, ...",
|
||||
"settings": {"interp": true, "hz": 60, "model": "4.22.lite", "motion": "half", "engine": "auto",
|
||||
"scaler": "fsr", "vsr_quality": 2, "output_res": "1280x720", "aa": "off"},
|
||||
"measured": {"fps_avg": 60.0, "low1": 37.1, "frames": 300, "dropped": 0, "delay_ms": 22.0,
|
||||
"stages": {"capture": 0.2, "interp": 4.5, "upscale": 1.1, "present": 2.4}, // average ms
|
||||
"load": 0.24, // share of the time the pipeline worked (AI frames + upscaler + look)
|
||||
"vram_mb": 22789, // the whole card's memory in use, all programs (nvidia-smi), or null
|
||||
"engine_mb": 300, // what this engine had reserved (PyTorch), or null
|
||||
"seconds": 5.0, "took_s": 13.3, "queue_ms": 0.1, "settled": true},
|
||||
"why": "The highest frame rate that held: ..."}
|
||||
],
|
||||
"closest": null | {"label": "...", "settings": {...}, "measured": {...}}, // when met is false
|
||||
"failures": [ {"requirement": "low1", "need": 58.2, "got": 37.0, "unit": "fps", "text": "1% low 37 fps, needs 58",
|
||||
"short_by": 21.2, "short_pct": 36.4} ], // the closest one's, when met is false
|
||||
"tried": [ {"label": "...", "settings": {...}, "step": "a higher frame multiplier", "passed": false,
|
||||
"rejected": ["dropped 4 frames (0.9%)"], "measured": {...}} ], // in the order measured
|
||||
"skipped": [ {"label": "...", "settings": {...}, "why": "...", "reason": "at least as heavy as ..., which failed"} ],
|
||||
"quality_ranking": ["Output resolution, up to the display's own size ...", "..."], "not_ranked": "...",
|
||||
"rules": {"headroom": 1.1, "drop_limit": 0.005, "avg_share": 0.95, "at_target": 0.97, "load_limit": 0.909,
|
||||
"warm_s": 2.0, "warm_restart_s": 5.0, "measure_s": 5.0},
|
||||
"notes": ["...", "Summit changes only its own settings ... can't change the game's own graphics options."]
|
||||
}
|
||||
```
|
||||
|
||||
**Applying a result**: `top[i].settings` holds all nine engine settings Optimize chooses (`interp`, `hz`, `model`, `motion`,
|
||||
`engine`, `scaler`, `vsr_quality`, `output_res`, `aa`), each a valid registry value (`run.py --set KEY=VALUE` takes them, and so
|
||||
does a profile's `[engine]` table). Every other setting stays as the user has it. `model`, `motion` and `engine` take effect after a
|
||||
restart of the pipeline. Values that don't apply in that configuration are copied from the settings in use when the run started
|
||||
(e.g. `hz` with `interp: false`, `vsr_quality` with FSR).
|
||||
|
||||
## How a candidate passes (`judge`)
|
||||
|
||||
* The 1% low (mean of the slowest 1% of frametimes, at least 100 frames) clears the minimum by 10%. When the display's
|
||||
refresh rate leaves no room for that (a 60 Hz screen and 60 fps asked for), the 1% low must reach 97% of the target and
|
||||
the pipeline must be at most ~91% busy.
|
||||
* The average reaches 95% of the rate the multiplier makes; at most 0.5% of frames dropped.
|
||||
* The added delay (median, Summit's own) is under `max_delay_ms` when one is given.
|
||||
* The queue had drained before measuring (`settled`). After a change the engine waits 2 s (5 s after a restart), and then until
|
||||
no frame has queued 50 ms for a whole second (at most 20 s more). Each candidate is then measured for 5 s.
|
||||
|
||||
## Headroom (no run)
|
||||
|
||||
Session summaries (`sessions/summit-session-*.json`) get a `"headroom"` object: `state` (`room`, `fits`, `behind`, `unknown`),
|
||||
`load_pct`, `display_hz`, `output_fps`, `suggestions` (each `{"key", "value", "text", "set": {every setting the change needs}}`),
|
||||
`line` (the overlay's message), `short` and `note`. These are suggestions only: nothing is applied. The `load` is worked out from the stage
|
||||
times, so it is an estimate. Optimize is what measures.
|
||||
Reference in new issue
Block a user