leonida-gpu: a stall at the start no longer leaves the followed frame limit crawling back (D3D12-FG-FOLLOW-COLD-STALL) #3278

Open
eipastel wants to merge 6 commits from upstream-pr/3278 into main
eipastel commented 2026-12-03 02:06:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by eipastel on 2026-12-03T02:06:28Z.


Claimed in the coordination issue as: D3D12-FG-FOLLOW-COLD-STALL (claim; aurelienclosson's finding)

What and why

The followed frame limit (Follow in d3d12/crates/leonida-gpu/src/fg.rs, on whenever frames are generated and LEONIDA_FG_LIMIT_FPS is unset or auto) could take more than 40 windows (80 s or more) to come back after a stall at the start of a run, instead of a few.

  • The stall became best. A window whose frames came slower than 10 a second settles at SLOWEST_US (100 ms). Before any best was known, that settle became best. far then stayed false (100 ms is not 15 % slower than 100 ms), so the limit came back only 5 % every 3 windows.
    • Fix: a settle at the slowest bound is left out of best, as settles near the fastest bound (menus) already are.
    • Fix: while there is no best yet, the limit counts as far, so the faster tries grow and come every window while they hold.
  • A try that did not move still counted (found in review). In the menus at the 60 fps clamp, a faster try is swallowed by the bound or by KEEP, so the limit does not move, yet probed stayed set. The load's stall that follows then counted as a failed try and armed BACKOFF, so the limit waited 10 windows at 100 ms. The same happened on main in about one window out of three.
    • Fix: a try that did not move the limit is not a try.
  • A stall counted as a try failing (found in review). With exactly 4 menu windows, the fourth makes a real try (18,020 to 17,119 µs), and the stall right after it armed BACKOFF the same way. This holds for any stall right after a try, in the world too.
    • Fix: a window that settles at the slowest bound does not count as the try failing. A real try that moved the limit and failed at a normal rate still waits BACKOFF.
  • A start screen just under the bound became best (found in game, MoonEyes's run on an RTX 3090, and in merzleckeier's sweep). The start screen rendered about 92 ms apart, which settles at about 97.5 ms, just under the 100 ms bound, so it was not a stall and became best. The limit, never slower than 100 ms, can then never be 15 % slower than best, so it climbed back 5 % every 3 windows for the rest of the start, as on main (242 s against 236 s to reach 28 fps). In merzleckeier's sweep, a slow window of 94,339 µs or less still crawled on the earlier head, and 94,340 µs or more did not.
    • Fix: a window that settles slower than SLOWEST_US / FAR_FROM_BEST (about 87 ms) is left out of best, since the limit could never be far from it. Such a window is not a try failing either, and it ends the wait of an earlier one: after 6 menu windows at 18 ms, a real try had already armed BACKOFF before the slow window, and the wait was carried into the world (merzleckeier's review).
Start of the run, then the machine renders 38 ms apart main this pull request
a stall (150 ms) 48 windows 6
0 to 10 menu windows (17 or 18 ms), then a stall 48 to 55 6
0 to 10 menu windows, then one slow window of 90 to 95 ms 91.6 to 113 s (merzleckeier's sweep, cold or after 4 menu windows) 6
a start screen at 92 ms for 45 windows, then two loading stalls crawls (MoonEyes's run) 6

The windows counted are those needed for the limit to come back to 45 ms or less. These counts come from the unit tests' sequences and from merzleckeier's port of Follow::next, not from a game run of this head.

One side effect, left on purpose: a machine that renders slower than about 12 frames a second never gets a best, so it tries faster every few windows instead of every 12. A limit faster than the machine only stops limiting for that window, so this costs nothing.

A later slow window or stall, once best is known, no longer raises best toward 100 ms either. Nothing else in the rules changes, and the existing follow tests pass unchanged.

Not in this pull request: the finding's second half (!fresh pause and loading frames still feed Follow). Keeping DLSS-G off until its inputs arrive is #3216 (D3D12-FG-DEFER-ENABLE-UNTIL-INPUTS), which touches other parts of fg.rs and merges with this one without conflict.

Tested

  • cargo test -p leonida-gpu --locked: 718 passed, 0 failed (59 ignored as on main).
  • New tests in fg::follow_tests. a_stall_before_any_best_does_not_leave_the_limit_crawling covers a slow window of 90,000, 94,339, 95,000 or 150,000 µs after 0 to 10 windows of menus at 17 or 18 ms. a_slow_start_screen_and_its_loads_do_not_leave_the_limit_crawling replays MoonEyes's start (92 ms for 45 windows, then stalls of 700 ms and 2 s).
  • python -I scripts/red_green.py fg-follow-cold-stall --crate leonida-gpu --no-python: red then green on both new tests, 725 pass on both (base origin/main fba6f09ce).
  • Each review fix reverted alone, with the tests kept, fails: without the swallowed-try fix, 5 menus give 13 windows to climb back; without the stall fix, 4 menus give 13 windows to climb back; with only the 100 ms bound left out of best (the earlier head's rule), both new tests fail (a window this slow is not a rate the frames settled at).
  • The in-game runs on this pull request (MoonEyes, on 63eb3d6e2) were made before the last two commits, so they no longer cover this head.
  • python -I scripts/check_no_game_data.py on the changed file: clean.
  • cargo fmt and clippy were not re-run beyond the crate's own state: fg.rs already differs from cargo fmt on main, and CI reports both without gating.

GPUs tested: n/a (unit tests only, no GPU or game files; built on Windows 11 with an NVIDIA RTX 5060 8 GB)

AI-assisted: yes. Written with Claude Opus 5.5 (Claude Code). It was reviewed by a separate read-only Claude Opus 5.5 reviewer agent, which found the swallowed-try case above; that fix and the start-screen rule were re-reviewed.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5618385323 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3278). Originally posted by [eipastel](https://github.com/eipastel) on 2026-12-03T02:06:28Z. --- Claimed in the coordination issue as: D3D12-FG-FOLLOW-COLD-STALL ([claim](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7364941935); aurelienclosson's [finding](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7357229376)) ### What and why The followed frame limit (`Follow` in `d3d12/crates/leonida-gpu/src/fg.rs`, on whenever frames are generated and `LEONIDA_FG_LIMIT_FPS` is unset or `auto`) could take more than 40 windows (80 s or more) to come back after a stall at the start of a run, instead of a few. - **The stall became `best`.** A window whose frames came slower than 10 a second settles at `SLOWEST_US` (100 ms). Before any `best` was known, that settle became `best`. `far` then stayed false (100 ms is not 15 % slower than 100 ms), so the limit came back only 5 % every 3 windows. - Fix: a settle at the slowest bound is left out of `best`, as settles near the fastest bound (menus) already are. - Fix: while there is no `best` yet, the limit counts as far, so the faster tries grow and come every window while they hold. - **A try that did not move still counted (found in review).** In the menus at the 60 fps clamp, a faster try is swallowed by the bound or by `KEEP`, so the limit does not move, yet `probed` stayed set. The load's stall that follows then counted as a failed try and armed `BACKOFF`, so the limit waited 10 windows at 100 ms. The same happened on `main` in about one window out of three. - Fix: a try that did not move the limit is not a try. - **A stall counted as a try failing (found in review).** With exactly 4 menu windows, the fourth makes a real try (18,020 to 17,119 µs), and the stall right after it armed `BACKOFF` the same way. This holds for any stall right after a try, in the world too. - Fix: a window that settles at the slowest bound does not count as the try failing. A real try that moved the limit and failed at a normal rate still waits `BACKOFF`. - **A start screen just under the bound became `best` (found in game, MoonEyes's run on an RTX 3090, and in merzleckeier's sweep).** The start screen rendered about 92 ms apart, which settles at about 97.5 ms, just under the 100 ms bound, so it was not a stall and became `best`. The limit, never slower than 100 ms, can then never be 15 % slower than `best`, so it climbed back 5 % every 3 windows for the rest of the start, as on `main` (242 s against 236 s to reach 28 fps). In merzleckeier's sweep, a slow window of 94,339 µs or less still crawled on the earlier head, and 94,340 µs or more did not. - Fix: a window that settles slower than `SLOWEST_US / FAR_FROM_BEST` (about 87 ms) is left out of `best`, since the limit could never be far from it. Such a window is not a try failing either, and it ends the wait of an earlier one: after 6 menu windows at 18 ms, a real try had already armed `BACKOFF` before the slow window, and the wait was carried into the world (merzleckeier's review). | Start of the run, then the machine renders 38 ms apart | `main` | this pull request | |---|---|---| | a stall (150 ms) | 48 windows | 6 | | 0 to 10 menu windows (17 or 18 ms), then a stall | 48 to 55 | 6 | | 0 to 10 menu windows, then one slow window of 90 to 95 ms | 91.6 to 113 s (merzleckeier's sweep, cold or after 4 menu windows) | 6 | | a start screen at 92 ms for 45 windows, then two loading stalls | crawls (MoonEyes's run) | 6 | The windows counted are those needed for the limit to come back to 45 ms or less. These counts come from the unit tests' sequences and from merzleckeier's port of `Follow::next`, not from a game run of this head. One side effect, left on purpose: a machine that renders slower than about 12 frames a second never gets a `best`, so it tries faster every few windows instead of every 12. A limit faster than the machine only stops limiting for that window, so this costs nothing. A later slow window or stall, once `best` is known, no longer raises `best` toward 100 ms either. Nothing else in the rules changes, and the existing follow tests pass unchanged. Not in this pull request: the finding's second half (`!fresh` pause and loading frames still feed `Follow`). Keeping DLSS-G off until its inputs arrive is #3216 (D3D12-FG-DEFER-ENABLE-UNTIL-INPUTS), which touches other parts of `fg.rs` and merges with this one without conflict. ### Tested - `cargo test -p leonida-gpu --locked`: 718 passed, 0 failed (59 ignored as on `main`). - New tests in `fg::follow_tests`. `a_stall_before_any_best_does_not_leave_the_limit_crawling` covers a slow window of 90,000, 94,339, 95,000 or 150,000 µs after 0 to 10 windows of menus at 17 or 18 ms. `a_slow_start_screen_and_its_loads_do_not_leave_the_limit_crawling` replays MoonEyes's start (92 ms for 45 windows, then stalls of 700 ms and 2 s). - `python -I scripts/red_green.py fg-follow-cold-stall --crate leonida-gpu --no-python`: `red then green` on both new tests, 725 pass on both (base `origin/main` `fba6f09ce`). - Each review fix reverted alone, with the tests kept, fails: without the swallowed-try fix, 5 menus give `13 windows to climb back`; without the stall fix, 4 menus give `13 windows to climb back`; with only the 100 ms bound left out of `best` (the earlier head's rule), both new tests fail (`a window this slow is not a rate the frames settled at`). - The in-game runs on this pull request (MoonEyes, on `63eb3d6e2`) were made before the last two commits, so they no longer cover this head. - `python -I scripts/check_no_game_data.py` on the changed file: clean. - `cargo fmt` and `clippy` were not re-run beyond the crate's own state: `fg.rs` already differs from `cargo fmt` on `main`, and CI reports both without gating. GPUs tested: n/a (unit tests only, no GPU or game files; built on Windows 11 with an NVIDIA RTX 5060 8 GB) AI-assisted: yes. Written with Claude Opus 5.5 (Claude Code). It was reviewed by a separate read-only Claude Opus 5.5 reviewer agent, which found the swallowed-try case above; that fix and the start-screen rule were re-reviewed. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change)
merzleckeier commented 2026-12-03 02:11:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T02:11:28Z.

Review: COMMENTED


Independently checked 63eb3d6e merged onto d15e048a. I compiled Follow directly from both trees with the same eight tests. Seven passed on both trees, and the new cold-stall test failed on main and passed on the PR. I also drove present() with synthetic timestamps. After a 150 ms-per-frame stall, feeding max(limit, 38 ms) reached a limit of 45 ms or less in 97.96 s of simulated time on main and 12.19 s on the PR.

One cold-start case still carries a pending backoff through the stall (fg.rs:249–256). With six 18 ms menu windows, then one 150 ms window, the earlier menu probe has already armed hold = 10 while best = 0. The stall leaves that hold in place, and the same recovery takes 13 windows instead of six. In a disposable variant, clearing a pending hold on a clamped stall only while best == 0 brought that sequence back to six windows. All eight tests still passed, including the normal failed-probe backoff. This gives another fixture if you want the cold-start recovery to cover a backoff carried in from menus.

Synthetic timing only. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6162513560 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3278#pullrequestreview-6162513560). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T02:11:28Z. **Review:** COMMENTED --- Independently checked `63eb3d6e` merged onto `d15e048a`. I compiled `Follow` directly from both trees with the same eight tests. Seven passed on both trees, and the new cold-stall test failed on `main` and passed on the PR. I also drove `present()` with synthetic timestamps. After a 150 ms-per-frame stall, feeding `max(limit, 38 ms)` reached a limit of 45 ms or less in 97.96 s of simulated time on `main` and 12.19 s on the PR. One cold-start case still carries a pending backoff through the stall (`fg.rs:249–256`). With six 18 ms menu windows, then one 150 ms window, the earlier menu probe has already armed `hold = 10` while `best = 0`. The stall leaves that hold in place, and the same recovery takes 13 windows instead of six. In a disposable variant, clearing a pending hold on a clamped stall only while `best == 0` brought that sequence back to six windows. All eight tests still passed, including the normal failed-probe backoff. This gives another fixture if you want the cold-start recovery to cover a backoff carried in from menus. Synthetic timing only. AI-assisted with OpenAI Codex.
fiestorra commented 2026-12-03 02:28:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T02:28:16Z.


VERIFY-3278 — Windows nativo: el control es exactamente la línea que cambia, y muerde

Tres commits, fg.rs (+39/−9), y corre en esta máquina:

cargo test -p leonida-gpu --lib fg     17 passed; 0 failed
cargo test -p leonida-gpu --lib pool   26 passed; 0 failed

Control (sintético): puse de vuelta la condición de main en la única línea que decide —

-  let far = self.best == 0 || f64::from(self.limit) > f64::from(self.best) * FAR_FROM_BEST;
+  let far = self.best != 0 && f64::from(self.limit) > f64::from(self.best) * FAR_FROM_BEST;

y volvió a fallar el test del commit:

test result: FAILED. 16 passed; 1 failed
failures:
    fg::follow_tests::a_stall_before_any_best_does_not_leave_the_limit_crawling

Un || contra un && sobre best == 0, con un test que lo distingue: es el tipo de control que no deja dudas, porque el cambio entero está en esa expresión.

Y lo que el cambio dice, que merece el comentario que trae: sin un best todavía, nada dice lo rápido que rinde la máquina, así que los intentos crecen — antes, un stall como primer best dejaba el límite arrastrándose y subiendo un 5 % cada PROBE_AFTER ventanas, cuando lo correcto es que el primer tramo rápido no marque el resto de la sesión. El doc-comment lo nombra y cita la revisión de Kal0s-design.

Lo que no probé: frames generados de verdad — follow_tests mueve el seguidor con cuentas de fps sintéticas, así que lo verificado es la política, no la imagen.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7365496128 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3278#issuecomment-7365496128). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T02:28:16Z. --- ## VERIFY-3278 — Windows nativo: el control es exactamente la línea que cambia, y muerde **Tres commits, `fg.rs` (+39/−9), y corre en esta máquina**: ``` cargo test -p leonida-gpu --lib fg 17 passed; 0 failed cargo test -p leonida-gpu --lib pool 26 passed; 0 failed ``` **Control (sintético)**: **puse de vuelta la condición de `main` en la única línea que decide** — ```rust - let far = self.best == 0 || f64::from(self.limit) > f64::from(self.best) * FAR_FROM_BEST; + let far = self.best != 0 && f64::from(self.limit) > f64::from(self.best) * FAR_FROM_BEST; ``` **y volvió a fallar el test del commit**: ``` test result: FAILED. 16 passed; 1 failed failures: fg::follow_tests::a_stall_before_any_best_does_not_leave_the_limit_crawling ``` **Un `||` contra un `&&` sobre `best == 0`, con un test que lo distingue: es el tipo de control que no deja dudas**, **porque el cambio entero está en esa expresión.** **Y lo que el cambio dice, que merece el comentario que trae**: **sin un `best` todavía, nada dice lo rápido que rinde la máquina, así que los intentos crecen** — **antes, un *stall* como primer `best` dejaba el límite arrastrándose y subiendo un 5 % cada `PROBE_AFTER` ventanas**, **cuando lo correcto es que el primer tramo rápido no marque el resto de la sesión.** **El doc-comment lo nombra y cita la revisión de Kal0s-design.** **Lo que no probé**: **frames generados de verdad** — **`follow_tests` mueve el seguidor con cuentas de fps sintéticas**, **así que lo verificado es la política, no la imagen.** Written with an AI assistant.
MoonEyes commented 2026-12-03 03:00:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T03:00:30Z.


RUN (in game, batch of two pull requests), each head merged with git merge --no-ff onto main d15e048a7, in one build: #3256 a3ab0a50f, #3278 63eb3d6e2. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, -PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (48 samples) median 16.5, mean 16.6
Rendered fps, last 120 s median 16.1
Time under 5 fps in the world 0 %

For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain.

Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.

Limits: one run; arrival in the world was driven by keys and not checked on pictures; -PrecompileUsed was used, so the default start (every known pipeline precompiled) was not exercised. #3256 was also run in a batch on its earlier head e7aad1d4c; this run covers its current head. #3278 changes what happens after a stall at the start; this run had no such stall (0 hang watchdog or GPU stall lines), so it shows the change leaves the usual start as it was, not that it mends the stalled one.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7366097488 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3278#issuecomment-7366097488). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T03:00:30Z. --- RUN (in game, batch of two pull requests), each head merged with `git merge --no-ff` onto main `d15e048a7`, in one build: #3256 `a3ab0a50f`, #3278 `63eb3d6e2`. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, `-PrecompileUsed`, the same walking route as the other runs on this machine, 330 s after reaching the world. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (48 samples) | median 16.5, mean 16.6 | | Rendered fps, last 120 s | median 16.1 | | Time under 5 fps in the world | 0 % | For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain. Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it. Limits: one run; arrival in the world was driven by keys and not checked on pictures; `-PrecompileUsed` was used, so the default start (every known pipeline precompiled) was not exercised. #3256 was also run in a batch on its earlier head `e7aad1d4c`; this run covers its current head. #3278 changes what happens after a stall at the start; this run had no such stall (0 hang watchdog or GPU stall lines), so it shows the change leaves the usual start as it was, not that it mends the stalled one. AI-assisted (Claude Code).
merzleckeier commented 2026-12-03 12:52:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T12:52:42Z.


While following the x6 comparison for #3328, I found a separate error-handling case in present_start. It reproduces on main (b053a181) and with #3278 (63eb3d6e), #3216 (2fd1da8a), and #3295 (af01c295) combined.

I compiled the exact Follow rules and the present-time Reflex block with a deterministic clock and a stub that returned eErrorInvalidState once. The existing code made one call and skipped the next 15 presents in each case:

  • When the reported multiplier went from 1 to 6, the stub kept the previous 40,000 µs interval after the request for 6,666 µs was rejected.
  • At a steady x6, a new timing window wanted 8,833 µs and the stub kept 6,666 µs.
  • On disable, the request for 0 failed and the stub kept 6,666 µs. The runtime resets Follow immediately, so it loses the reason to retry even with FG off.

In a local comparison, tracking the last successful Reflex interval separately from the pacing state retried each change on the next eligible present. Successful changes still made one call. This is a CPU-only check with a simulated SDK error. For the live comparison, result= on the followed-limit lines shows whether Reflex accepted the update, and per= and status= on the state lines report what DLSS-G actually presented.

AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7378975656 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3278#issuecomment-7378975656). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T12:52:42Z. --- While following the x6 comparison for #3328, I found a separate error-handling case in `present_start`. It reproduces on `main` (`b053a181`) and with #3278 (`63eb3d6e`), #3216 (`2fd1da8a`), and #3295 (`af01c295`) combined. I compiled the exact `Follow` rules and the present-time Reflex block with a deterministic clock and a stub that returned `eErrorInvalidState` once. The existing code made one call and skipped the next 15 presents in each case: - When the reported multiplier went from 1 to 6, the stub kept the previous 40,000 µs interval after the request for 6,666 µs was rejected. - At a steady x6, a new timing window wanted 8,833 µs and the stub kept 6,666 µs. - On disable, the request for 0 failed and the stub kept 6,666 µs. The runtime resets `Follow` immediately, so it loses the reason to retry even with FG off. In a local comparison, tracking the last successful Reflex interval separately from the pacing state retried each change on the next eligible present. Successful changes still made one call. This is a CPU-only check with a simulated SDK error. For the live comparison, `result=` on the followed-limit lines shows whether Reflex accepted the update, and `per=` and `status=` on the state lines report what DLSS-G actually presented. AI-assisted (Codex).
Headache3318 commented 2026-12-03 14:02:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Headache3318 on 2026-12-03T14:02:11Z.


Setup facts from the cross-builds for this check, before any run numbers — one of them is a gotcha worth telling Linux testers.

Both arms are built on this box (Arch, Rust 1.98.1 pinned by rust-toolchain.toml, cargo-xwin 0.24.2, --profile diag, --target x86_64-pc-windows-msvc, -j 2, nice -n 19 so the other run on this machine keeps its cores):

arm A  origin/main            b053a1813   leonida.exe 21,760,512 B  md5 a9a001dff6cfaab776e5a1a348a72abe
arm B  #3278 (63eb3d6) onto    e208203da   leonida.exe 21,760,512 B  md5 a66732ca195070b9c14104be67e1f345
       current main, merge commit e208203da

Three things that decide whether an FG run on Linux is even testing frame generation, and one of them is not written in docs/switches.md in the form a tester needs:

  • LEONIDA_FRAME_GEN=2|3|4 does nothing in a binary built without the dlss feature. crates/leonida-gpu/Cargo.toml lists dlss = [] and crates/leonida-gpu/build.rs says the dlss feature needs LEONIDA_DLSS_SDK (the NVIDIA/DLSS checkout) and only then adds cargo:rustc-link-search=native=<sdk>/lib/Windows_x86_64/x64. So the build line has to be --features diagnostics,mimalloc,dlss with LEONIDA_DLSS_SDK pointing at a tree with lib/Windows_x86_64/x64 — and the Streamline package I have on this box puts nvsdk_ngx_d.lib in lib/Windows_x86_64/, no x64 subfolder, so I had to make .../lib/Windows_x86_64/x64/nvsdk_ngx_d.lib myself. A tester who does not notice that either builds without dlss or gets a link error. I made the sizes match: 21,760,512 bytes with dlss against 21,678,592 without it, so the feature really is in there.
  • LEONIDA_UPSCALE=dlss and LEONIDA_DLSS_DIR are separate: LEONIDA_DLSS_DIR is where nvngx_dlss.dll is looked for (catalog line 30), the DLLs for generation go through LEONIDA_STREAMLINE_DIR (line 528), and my launcher was setting LEONIDA_OWN_UPSCALER=1 by default — that is the runtime's own upscaler, which is not what #3278's follow-limit logic runs against. I now pass LEONIDA_OWN_UPSCALER=0 with LEONIDA_UPSCALE=dlss for these arms.
  • The instrument you want from a run of #3278 does not need screenshots: LEONIDA_FRAME_TIMES=<file> writes every present's number and its microsecond time (docs/switches.md:282), so the recovery from the cold stall is measurable from that file plus the runtime's own line frame generation: the frame limit follows the rendered rate (LEONIDA_FG_LIMIT_FPS=auto) (fg.rs:1335). I also keep LEONIDA_FG_LIMIT_FPS unset rather than empty, because fg.rs:102 warns LEONIDA_FG_LIMIT_FPS is neither a number nor auto; no frame limit for an empty value, which is a different state from unset and would quietly turn the limit off in both arms.

Runs pending: this machine currently has another tester's run going (broadside-rt/victory.exe, 1 h 34 min, 95 % of one core, 19,080 MiB on its card, 30 GB of the 60 GB in use), so I will run arm A then arm B with the same environment — --console series-x, SCALE=1.0, capture off, LEONIDA_FRAME_GEN=4, LEONIDA_FG_WITH_RT=1, limit unset — and post the present-rate numbers from the frame-times files rather than mixing them with that contention. LEONIDA_FG_LIMIT_FPS=0 as a third arm against #3328's table is the follow-up if the first two come out clean.

AI-assisted (Hermes Agent) with the builds, the source lines and the toolchain versions above. posted by Headache3318

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7380784574 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3278#issuecomment-7380784574). Originally posted by [Headache3318](https://github.com/Headache3318) on 2026-12-03T14:02:11Z. --- Setup facts from the cross-builds for this check, before any run numbers — one of them is a gotcha worth telling Linux testers. Both arms are built on this box (Arch, `Rust 1.98.1` pinned by `rust-toolchain.toml`, `cargo-xwin 0.24.2`, `--profile diag`, `--target x86_64-pc-windows-msvc`, `-j 2`, `nice -n 19` so the other run on this machine keeps its cores): arm A origin/main b053a1813 leonida.exe 21,760,512 B md5 a9a001dff6cfaab776e5a1a348a72abe arm B #3278 (63eb3d6) onto e208203da leonida.exe 21,760,512 B md5 a66732ca195070b9c14104be67e1f345 current main, merge commit e208203da Three things that decide whether an FG run on Linux is even testing frame generation, and one of them is not written in `docs/switches.md` in the form a tester needs: - `LEONIDA_FRAME_GEN=2|3|4` does nothing in a binary built without the `dlss` feature. `crates/leonida-gpu/Cargo.toml` lists `dlss = []` and `crates/leonida-gpu/build.rs` says `the dlss feature needs LEONIDA_DLSS_SDK (the NVIDIA/DLSS checkout)` and only then adds `cargo:rustc-link-search=native=<sdk>/lib/Windows_x86_64/x64`. So the build line has to be `--features diagnostics,mimalloc,dlss` with `LEONIDA_DLSS_SDK` pointing at a tree with `lib/Windows_x86_64/x64` — and the Streamline package I have on this box puts `nvsdk_ngx_d.lib` in `lib/Windows_x86_64/`, no `x64` subfolder, so I had to make `.../lib/Windows_x86_64/x64/nvsdk_ngx_d.lib` myself. A tester who does not notice that either builds without `dlss` or gets a link error. I made the sizes match: 21,760,512 bytes with `dlss` against 21,678,592 without it, so the feature really is in there. - `LEONIDA_UPSCALE=dlss` and `LEONIDA_DLSS_DIR` are separate: `LEONIDA_DLSS_DIR` is where `nvngx_dlss.dll` is looked for (catalog line 30), the DLLs for generation go through `LEONIDA_STREAMLINE_DIR` (line 528), and my launcher was setting `LEONIDA_OWN_UPSCALER=1` by default — that is the runtime's own upscaler, which is not what #3278's follow-limit logic runs against. I now pass `LEONIDA_OWN_UPSCALER=0` with `LEONIDA_UPSCALE=dlss` for these arms. - The instrument you want from a run of #3278 does not need screenshots: `LEONIDA_FRAME_TIMES=<file>` writes every present's number and its microsecond time (`docs/switches.md:282`), so the recovery from the cold stall is measurable from that file plus the runtime's own line `frame generation: the frame limit follows the rendered rate (LEONIDA_FG_LIMIT_FPS=auto)` (`fg.rs:1335`). I also keep `LEONIDA_FG_LIMIT_FPS` **unset rather than empty**, because `fg.rs:102` warns `LEONIDA_FG_LIMIT_FPS is neither a number nor auto; no frame limit` for an empty value, which is a different state from unset and would quietly turn the limit off in both arms. Runs pending: this machine currently has another tester's run going (`broadside-rt/victory.exe`, 1 h 34 min, 95 % of one core, 19,080 MiB on its card, 30 GB of the 60 GB in use), so I will run arm A then arm B with the same environment — `--console series-x`, `SCALE=1.0`, capture off, `LEONIDA_FRAME_GEN=4`, `LEONIDA_FG_WITH_RT=1`, limit unset — and post the present-rate numbers from the frame-times files rather than mixing them with that contention. `LEONIDA_FG_LIMIT_FPS=0` as a third arm against #3328's table is the follow-up if the first two come out clean. AI-assisted (Hermes Agent) with the builds, the source lines and the toolchain versions above. posted by Headache3318
merzleckeier commented 2026-12-03 14:06:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T14:06:15Z.


I checked where the cold-start recovery changes on 63eb3d6e merged onto b053a1813 (tree dc68873d) using the production Follow::present with a deterministic clock. After one slow window the fixture could render every 38 ms and obeyed the current limiter. I measured elapsed fixture time to the first limit of 45 ms or less.

Slow-window median main, cold / after 4 menu windows #3278, cold / after 4 menu windows
90,000 µs 91.6 s / 105.6 s 91.6 s / 105.6 s
94,339 µs 98.3 s / 113.0 s 98.3 s / 113.0 s
94,340 µs 98.0 s / 112.0 s 12.2 s / 12.2 s

At 94,339 µs, round(1.06 × median) yields 99,999 µs, which still sets best and, after four menu windows, arms BACKOFF. One microsecond higher reaches the 100,000 µs clamp, so the PR skips both and reaches the target in six windows. The 95 ms and 150 ms controls also took six windows with the PR. This confirms the fix for the clamped case and shows the remaining slow recovery for a slightly faster cold start. CPU-only synthetic comparison; all eight included PR unit tests passed. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7380893430 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3278#issuecomment-7380893430). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T14:06:15Z. --- I checked where the cold-start recovery changes on `63eb3d6e` merged onto `b053a1813` (tree `dc68873d`) using the production `Follow::present` with a deterministic clock. After one slow window the fixture could render every 38 ms and obeyed the current limiter. I measured elapsed fixture time to the first limit of 45 ms or less. | Slow-window median | `main`, cold / after 4 menu windows | #3278, cold / after 4 menu windows | |---|---:|---:| | 90,000 µs | 91.6 s / 105.6 s | 91.6 s / 105.6 s | | 94,339 µs | 98.3 s / 113.0 s | 98.3 s / 113.0 s | | 94,340 µs | 98.0 s / 112.0 s | 12.2 s / 12.2 s | At 94,339 µs, `round(1.06 × median)` yields 99,999 µs, which still sets `best` and, after four menu windows, arms `BACKOFF`. One microsecond higher reaches the 100,000 µs clamp, so the PR skips both and reaches the target in six windows. The 95 ms and 150 ms controls also took six windows with the PR. This confirms the fix for the clamped case and shows the remaining slow recovery for a slightly faster cold start. CPU-only synthetic comparison; all eight included PR unit tests passed. AI-assisted (Codex).
MoonEyes commented 2026-12-03 16:45:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T16:45:34Z.


In-game gate run: PASS for stability, no device lost (head 63eb3d6e2, merge 3df01983b, DLSS FG 2x through a third-party unlocker, default auto frame limit, 602 s), but no visible effect on this case.

  • World at 96 s. The limit climbs back to 28 at 242 s (main: 236 s). Rendered over 150-530 s: 26.71 fps (main: 27.29).
  • Read in the code, not verified: the first window, on the start screen, renders at ~92 ms, just under the 100 ms bound, so it is not treated as a stall and seems to become best. The limit then stays in FAR_FROM_BEST (×1.15) and moves in 5 % steps, and two stalls during loading (1.4 then 0.5 fps) send it back to the floor of 10. A rule for a slow first best taken during start or loading seems to be missing.

Run and measured by Enlighted's agent on an RTX 3090 24 GB (NVIDIA 621.40, 64 GB RAM), posted here by MoonEyes' agent (AI-assisted, Claude Opus 5.5). One run per side, PR merged locally (--no-ff) on main acb0657e2 and compared with that main alone; DLSS quality 1706x960 → 2560x1440, Series X profile, LEONIDA_WINDOWS_BAR_MB=8192.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7385397907 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3278#issuecomment-7385397907). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T16:45:34Z. --- In-game gate run: **PASS** for stability, no device lost (head `63eb3d6e2`, merge `3df01983b`, DLSS FG 2x through a third-party unlocker, default auto frame limit, 602 s), but **no visible effect on this case**. - World at 96 s. The limit climbs back to 28 at 242 s (main: 236 s). Rendered over 150-530 s: 26.71 fps (main: 27.29). - Read in the code, not verified: the first window, on the start screen, renders at ~92 ms, just under the 100 ms bound, so it is not treated as a stall and seems to become `best`. The limit then stays in FAR_FROM_BEST (×1.15) and moves in 5 % steps, and two stalls during loading (1.4 then 0.5 fps) send it back to the floor of 10. A rule for a slow first `best` taken during start or loading seems to be missing. Run and measured by Enlighted's agent on an RTX 3090 24 GB (NVIDIA 621.40, 64 GB RAM), posted here by MoonEyes' agent (AI-assisted, Claude Opus 5.5). One run per side, PR merged locally (--no-ff) on main `acb0657e2` and compared with that main alone; DLSS quality 1706x960 → 2560x1440, Series X profile, `LEONIDA_WINDOWS_BAR_MB=8192`.
eipastel commented 2026-12-03 17:27:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by eipastel on 2026-12-03T17:27:19Z.


New head 64b5e6622, after the in-game run that showed no visible effect.

@MoonEyes your run pointed at the cause: the start screen at about 92 ms settles just under the 100 ms bound, so it became best, and the limit could never be far from it again. A window that settles slower than SLOWEST_US / FAR_FROM_BEST (about 87 ms) is now left out of best, and it does not count as a faster try failing. This also covers @merzleckeier's sweep (90 to 94,339 µs) and the 18 ms menu case with its carried BACKOFF.

In the unit tests, your start sequence (92 ms for 45 windows, then stalls of 700 ms and 2 s, then 38 ms) now reaches 45 ms or less in 6 windows. red_green.py gives red then green on both new tests (base fba6f09ce).

The earlier in-game runs were on 63eb3d6e2, so they do not cover this head. Could you run the same route again when you have time? 242 s to reach 28 fps on the earlier head and 236 s on main are the numbers to compare against.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7386535639 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3278#issuecomment-7386535639). Originally posted by [eipastel](https://github.com/eipastel) on 2026-12-03T17:27:19Z. --- New head `64b5e6622`, after the in-game run that showed no visible effect. @MoonEyes your run pointed at the cause: the start screen at about 92 ms settles just under the 100 ms bound, so it became `best`, and the limit could never be far from it again. A window that settles slower than `SLOWEST_US / FAR_FROM_BEST` (about 87 ms) is now left out of `best`, and it does not count as a faster try failing. This also covers @merzleckeier's sweep (90 to 94,339 µs) and the 18 ms menu case with its carried `BACKOFF`. In the unit tests, your start sequence (92 ms for 45 windows, then stalls of 700 ms and 2 s, then 38 ms) now reaches 45 ms or less in 6 windows. `red_green.py` gives `red then green` on both new tests (base `fba6f09ce`). The earlier in-game runs were on `63eb3d6e2`, so they do not cover this head. Could you run the same route again when you have time? `242 s` to reach 28 fps on the earlier head and `236 s` on `main` are the numbers to compare against. AI-assisted (Claude Code).
merzleckeier commented 2026-12-03 17:30:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T17:30:59Z.


I retested the current head 64b5e6622 merged with 09273248, using the production Follow::present with a deterministic clock. For the reported workload (92 ms start screen for 45 windows, then two slow load windows, then a machine that can render every 38 ms), the first interval of 45 ms or less comes after 6 windows / 12.19 synthetic seconds. Both current main and the earlier PR head 63eb3d6e took 48 windows / 97.45 synthetic seconds. The 90 ms and 94.339 ms cases from my previous review now also recover in six windows. All nine extracted Follow tests passed.

The new cutoff has a sharp boundary after HEADROOM: I varied only the start-screen interval in the same fixture. At 82,034 µs the limiter still remembers the slow start and needs 48 windows (97.96 s). At 82,035 µs it needs six (12.19 s). This narrows the remaining slow-recovery case to start intervals below the new cutoff. The measurements are from the clock fixture. No game or GPU was used. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7386635201 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3278#issuecomment-7386635201). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T17:30:59Z. --- I retested the current head `64b5e6622` merged with `09273248`, using the production `Follow::present` with a deterministic clock. For the reported workload (92 ms start screen for 45 windows, then two slow load windows, then a machine that can render every 38 ms), the first interval of 45 ms or less comes after **6 windows / 12.19 synthetic seconds**. Both current `main` and the earlier PR head `63eb3d6e` took **48 windows / 97.45 synthetic seconds**. The 90 ms and 94.339 ms cases from my previous review now also recover in six windows. All nine extracted `Follow` tests passed. The new cutoff has a sharp boundary after `HEADROOM`: I varied only the start-screen interval in the same fixture. At 82,034 µs the limiter still remembers the slow start and needs 48 windows (97.96 s). At 82,035 µs it needs six (12.19 s). This narrows the remaining slow-recovery case to start intervals below the new cutoff. The measurements are from the clock fixture. No game or GPU was used. AI-assisted with OpenAI Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3278:upstream-pr/3278'
git switch 'upstream-pr/3278'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3278'
git switch 'upstream-pr/3278'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3278'
git switch 'upstream-pr/3278'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3278'
git switch 'main'
git merge --squash 'upstream-pr/3278'
git switch 'main'
git merge --ff-only 'upstream-pr/3278'
git switch 'main'
git merge 'upstream-pr/3278'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
ProjectLeonida/mandy!3278
No description provided.