FPS reduced to exactly 5 after about 5 minutes of gameplay #3260

Open
leonida/mandy
opened 2026-12-02 23:08:18 +00:00 by krasnykid · 2 comments
krasnykid commented 2026-12-02 23:08:18 +00:00

was running a build from 2 days before with 0 issues

today, after i pulled and built from master, after about 5 minutes of ordinary gameplay frames tank to about half.

more precisely, the fps drop from about 7-16 to a pretty much constant 5 fps indefinitely, i need to rerun the game to get the old framerate back and again, after 5 minutes, i'm met with the fps drop.

commit i built from is 8a9235d, from wed dec 2 20:36:50

log:

play-1202-234222.log

i've conducted some research of my own, output of gemini argon:

Yes, the log (play-1202-234222.log) captures the exact moment and root cause of what happened.

What the log shows

  1. The exact timeline of the drop:

    • From 22:43:56 to 22:46:40 (about 4.5 minutes into the session), the game was rendering at 10–15 FPS (upscaled by 2x DLSS Frame Generation to 20–30 shown FPS).
    • At 22:46:41.58, a single stutter/resolution change caused one frame to miss its G-buffer tag or take over 100 ms, which caused Streamline (dlssg_get_state) to report numFramesActuallyPresented = 1 for that poll (index = 3120).
    • Immediately after that, at 22:46:46.26, the new auto-frame-limiter (LEONIDA_FG_LIMIT_FPS=auto, merged today in PR #3062) logged:
      22:46:41.581288Z INFO leonida_gpu::fg: frame generation: the frame limit follows the rendered rate (LEONIDA_FG_LIMIT_FPS=auto) rendered_fps=13.4 shown_fps=13.4
      22:46:42.849828Z INFO leonida_gpu::fg: frame generation: the frame limit follows the rendered rate (LEONIDA_FG_LIMIT_FPS=auto) rendered_fps=11.6 shown_fps=11.6
      22:46:46.263568Z INFO leonida_gpu::fg: frame generation: the frame limit follows the rendered rate (LEONIDA_FG_LIMIT_FPS=auto) rendered_fps=10.0 shown_fps=10.0
      
    • Starting at 22:46:48 and continuing for the rest of the log until you quit at 22:47:30, every single frame time report locked onto exactly 200.0 ms (5.0 rendered FPS):
      frame times over 5.6 s, 28 frames: median 200.0 ms, 95th percentile 200.0, 99th 200.0, longest 200.0
      
  2. Why it locked at 5 FPS (and why the world slowed down):

    • The 5 FPS lock (New in today's build, PR #3062): Today's build introduced LEONIDA_FG_LIMIT_FPS=auto (d3d12/crates/leonida-gpu/src/fg.rs). It measures your rendered frame rate and sets a Reflex frame limit (frameLimitUs = rendered_us / shown).
      • When a hitch or untagged frame happens on a POLL boundary (every 10 frames), Streamline temporarily reports SHOWN = 1 instead of 2.
      • fg.rs sees SHOWN drop from 2 to 1 and immediately sends frameLimitUs = 100,000 us (10 FPS total) to Reflex.
      • However, on the very next frame, DLSS Frame Generation resumes generating 2 frames per rendered frame, while Reflex is still enforcing a 10 FPS limit on all shown frames (rendered + generated).
      • Because 2 shown frames are produced per rendered frame under a 10 shown-FPS cap, Reflex sleeps the render thread until each rendered frame takes 200.0 ms (5 FPS).
      • And because every frame is now taking 200 ms (> 100 ms), Streamline spams Frame rate over 100.00ms, reseting frame timer on every present, keeping SHOWN = 1 or keeping Follow clamped at its SLOWEST_US (100 ms) floor—creating a permanent 5 FPS deadlock that can never recover!
    • Why the whole world slowed down: As documented in d3d12/crates/leonida-loader/src/hooks.rs, the game's internal simulation clock clamps frame delta-time to a maximum of 1/15 s (66.7 ms, or 15 FPS) by default. When rendered FPS is forced down from ~12 FPS to 5 FPS (200 ms per frame), each frame only advances game time by 66.7 ms instead of 200 ms—making the entire game world run at 1/3rd real-time speed.
    • (Note: Your NVIDIA shader cache setting did not cause this; the pipeline library loaded cleanly at startup with 0 pipeline stalls during the lag).

How to work around it right now (or we can patch it in code)

You can bypass this bug immediately via environment variables / launcher settings:

  1. Disable the broken auto-Reflex limiter:
    Set LEONIDA_FG_LIMIT_FPS=0 (or pass -FgLimitFps 0 / set it in your environment before launching). This disables the new auto Reflex limiter and restores the previous build's behavior.
  2. Optional — Prevent world slow-motion at low FPS:
    Set LEONIDA_SIM_MAX_STEP_MS=200 (or 250). This raises the game timer's maximum simulation step from 66.7 ms (15 FPS) to 200 ms (5 FPS), so even if FPS dips below 15, the game world and physics continue running at real-time speed.

Would you like me to fix this bug in d3d12/crates/leonida-gpu/src/fg.rs (and/or adjust your local launch script)?

prompt was:

C:\Users\krasnykid\AppData\Local\Leonida\logs\play-1202-234222.log

this is my last play log

i had the same issue happen to make thrice on the newest build already.

game runs at 10fps, upscaled by 2x is 20, completetly playable

about 5 minutes in, the game fps reduce to about 5, and whole world seems to literally slow down.

this didn't happen on previous build

i set nvidia shader cache to unlimited for this build

do logs provide any useful information?

the lag began about a minute prior to quitting game, the same issue happened thrice already

was running a build from 2 days before with 0 issues today, after i pulled and built from master, after about 5 minutes of ordinary gameplay frames tank to about half. more precisely, the fps drop from about 7-16 to a pretty much constant 5 fps indefinitely, i need to rerun the game to get the old framerate back and again, after 5 minutes, i'm met with the fps drop. commit i built from is 8a9235d, from wed dec 2 20:36:50 log: [play-1202-234222.log](https://github.com/user-attachments/files/35770076/play-1202-234222.log) i've conducted some research of my own, output of gemini argon: > Yes, the log (`play-1202-234222.log`) captures the exact moment and root cause of what happened. > > ### What the log shows > > 1. **The exact timeline of the drop:** > * From `22:43:56` to `22:46:40` (about 4.5 minutes into the session), the game was rendering at **10–15 FPS** (upscaled by 2x DLSS Frame Generation to **20–30 shown FPS**). > * At **`22:46:41.58`**, a single stutter/resolution change caused one frame to miss its G-buffer tag or take over 100 ms, which caused Streamline (`dlssg_get_state`) to report `numFramesActuallyPresented = 1` for that poll (`index = 3120`). > * Immediately after that, at **`22:46:46.26`**, the new auto-frame-limiter (`LEONIDA_FG_LIMIT_FPS=auto`, merged today in PR #3062) logged: > ```text > 22:46:41.581288Z INFO leonida_gpu::fg: frame generation: the frame limit follows the rendered rate (LEONIDA_FG_LIMIT_FPS=auto) rendered_fps=13.4 shown_fps=13.4 > 22:46:42.849828Z INFO leonida_gpu::fg: frame generation: the frame limit follows the rendered rate (LEONIDA_FG_LIMIT_FPS=auto) rendered_fps=11.6 shown_fps=11.6 > 22:46:46.263568Z INFO leonida_gpu::fg: frame generation: the frame limit follows the rendered rate (LEONIDA_FG_LIMIT_FPS=auto) rendered_fps=10.0 shown_fps=10.0 > ``` > * Starting at **`22:46:48`** and continuing for the rest of the log until you quit at `22:47:30`, every single frame time report locked onto **exactly 200.0 ms (5.0 rendered FPS)**: > ```text > frame times over 5.6 s, 28 frames: median 200.0 ms, 95th percentile 200.0, 99th 200.0, longest 200.0 > ``` > > 2. **Why it locked at 5 FPS (and why the world slowed down):** > * **The 5 FPS lock (New in today's build, PR #3062):** Today's build introduced `LEONIDA_FG_LIMIT_FPS=auto` (`d3d12/crates/leonida-gpu/src/fg.rs`). It measures your rendered frame rate and sets a Reflex frame limit (`frameLimitUs = rendered_us / shown`). > * When a hitch or untagged frame happens on a `POLL` boundary (every 10 frames), Streamline temporarily reports `SHOWN = 1` instead of `2`. > * `fg.rs` sees `SHOWN` drop from `2` to `1` and immediately sends `frameLimitUs = 100,000 us` (10 FPS total) to Reflex. > * However, on the very next frame, DLSS Frame Generation **resumes generating 2 frames per rendered frame**, while Reflex is still enforcing a 10 FPS limit on *all shown frames* (rendered + generated). > * Because 2 shown frames are produced per rendered frame under a 10 shown-FPS cap, **Reflex sleeps the render thread until each rendered frame takes 200.0 ms (5 FPS)**. > * And because every frame is now taking 200 ms (> 100 ms), Streamline spams `Frame rate over 100.00ms, reseting frame timer` on every present, keeping `SHOWN = 1` or keeping `Follow` clamped at its `SLOWEST_US` (100 ms) floor—creating a permanent **5 FPS deadlock** that can never recover! > * **Why the whole world slowed down:** As documented in `d3d12/crates/leonida-loader/src/hooks.rs`, the game's internal simulation clock clamps frame delta-time to a maximum of `1/15 s` (`66.7 ms`, or 15 FPS) by default. When rendered FPS is forced down from ~12 FPS to 5 FPS (200 ms per frame), each frame only advances game time by 66.7 ms instead of 200 ms—making the entire game world run at **1/3rd real-time speed**. > * *(Note: Your NVIDIA shader cache setting did not cause this; the pipeline library loaded cleanly at startup with 0 pipeline stalls during the lag).* > > --- > > ### How to work around it right now (or we can patch it in code) > > You can bypass this bug immediately via environment variables / launcher settings: > > 1. **Disable the broken auto-Reflex limiter:** > Set `LEONIDA_FG_LIMIT_FPS=0` (or pass `-FgLimitFps 0` / set it in your environment before launching). This disables the new `auto` Reflex limiter and restores the previous build's behavior. > 2. **Optional — Prevent world slow-motion at low FPS:** > Set `LEONIDA_SIM_MAX_STEP_MS=200` (or `250`). This raises the game timer's maximum simulation step from 66.7 ms (15 FPS) to 200 ms (5 FPS), so even if FPS dips below 15, the game world and physics continue running at real-time speed. > > Would you like me to fix this bug in `d3d12/crates/leonida-gpu/src/fg.rs` (and/or adjust your local launch script)? prompt was: > C:\Users\krasnykid\AppData\Local\Leonida\logs\play-1202-234222.log > > this is my last play log > > i had the same issue happen to make thrice on the newest build already. > > game runs at 10fps, upscaled by 2x is 20, completetly playable > > about 5 minutes in, the game fps reduce to about 5, and whole world seems to literally slow down. > > this didn't happen on previous build > > i set nvidia shader cache to unlimited for this build > > do logs provide any useful information? > > the lag began about a minute prior to quitting game, the same issue happened thrice already
boludoz commented 2026-12-02 23:35:57 +00:00
image

Performance has worsened significantly over the last 24 hours or so (a little less).

image

RTX 3080, Ryzen 7 9850X3D, 32 GB of RAM.

<img width="2460" height="1385" alt="image" src="https://github.com/user-attachments/assets/8900fc66-09c8-4b83-8397-ea719f1ccddd" /> Performance has worsened significantly over the last 24 hours or so (a little less). <img width="708" height="437" alt="image" src="https://github.com/user-attachments/assets/8a7afe7e-f910-45c7-aeb6-9e6a658a9058" /> RTX 3080, Ryzen 7 9850X3D, 32 GB of RAM.

A read-only code audit (no game run) found the exact-5 path. It is the FG auto-limiter’s shown-frame divisor, latched at its 100 ms floor — not load.

Mechanism. fg.rs keeps the number of shown frames per rendered frame (SHOWN) and sends Reflex frameLimitUs = rendered_us / shown (fg.rs:1366, 1382, 1387). The poll that updates SHOWN treats any dlssg_get_state sample with per != 1 as a real generation stop and forces shown = 1 (fg.rs:1539-1544, 1558). One bad sample therefore makes the code divide by 1 while DLSS‑G is still showing 2, so Reflex paces two shown frames per rendered frame. SLOWEST_US = 100_000 (fg.rs:170) then gives exactly 200 ms = 5.0 fps.

The attached log fits arithmetically, present-to-present times being measured (host/frametime.rs:114):

  • rendered 13.4 / shown 13.4 for one window, then rendered 11.6 / shown 11.6 → sent limit 86,207 µs, measured rendered 172.2 ms = 2 × 86,207.
  • next send 100,000 µs (the floor) → measured 200.0 ms flat, and 2 × 100,000 = 200,000 µs.
  • no further frame limit follows line afterwards, while Streamline repeats its >100.00ms, reseting frame timer warning: once a frame is over 100 ms the poll keeps agreeing with per = 1, so it never climbs back.

Correction to the premise in the report: for the first ~90 s the log shows presented=1 per=1; FG only reports per=2 from ~1m40s, so the latch can only start after that. There is no 5-minute timer in the code; the drop is at 4m19s, and the only 300 s constant (host.rs:468) is an idle timeout gated on ≥12 GiB free, which is inactive under this log’s commit pressure.

One-run falsification, no rebuild: relaunch the same save/settings with LEONIDA_FG_LIMIT_FPS=0 (or LEONIDA_FRAME_GEN=0). If the 200.0 ms flatline disappears while the hitches remain, the limiter is confirmed; if it still appears with FG off, this diagnosis is wrong.

Smallest probe: in present_end, log index, status, presented, per, max, tagged whenever the polled per differs from the stored value; in present_start, log sent_shown, shown, rendered_us, frameLimitUs when again fires. H1 predicts exactly one 2→1 just before the first doubled send, then no further sends while frames are 200 ms.

Safe fix, unit-testable without a GPU: do not change the arithmetic; make the divisor adopt a new value only after two consecutive polls agree (a tiny pure state machine, e.g. polled(per)), so a one-frame per=2→1 hitch cannot double the limit while a sustained FG stop is still followed. Preferred later: derive the divisor from the configured generator count while status == 0, using the poll only to detect a sustained stop.

Not covered by #3278 or #3387/#3389: they change the Follow warm/cold and retry paths, not the shown divisor or the again send. Unproven: why the poll read 1 at that instant (dropped generated frame vs status), and that memory pressure caused that particular hitch — the pressure/hitch correlation is strong, not causal.

A read-only code audit (no game run) found the exact-5 path. **It is the FG auto-limiter’s shown-frame divisor, latched at its 100 ms floor** — not load. **Mechanism.** `fg.rs` keeps the number of shown frames per rendered frame (`SHOWN`) and sends Reflex `frameLimitUs = rendered_us / shown` (`fg.rs:1366, 1382, 1387`). The poll that updates `SHOWN` treats **any** `dlssg_get_state` sample with `per != 1` as a real generation stop and forces `shown = 1` (`fg.rs:1539-1544, 1558`). One bad sample therefore makes the code divide by 1 while DLSS‑G is still showing **2**, so Reflex paces two shown frames per rendered frame. `SLOWEST_US = 100_000` (`fg.rs:170`) then gives exactly **200 ms = 5.0 fps**. **The attached log fits arithmetically**, present-to-present times being measured (`host/frametime.rs:114`): - rendered 13.4 / shown 13.4 for one window, then rendered 11.6 / shown 11.6 → sent limit 86,207 µs, measured rendered **172.2 ms** = 2 × 86,207. - next send 100,000 µs (the floor) → measured **200.0 ms flat**, and 2 × 100,000 = 200,000 µs. - no further `frame limit follows` line afterwards, while Streamline repeats its `>100.00ms, reseting frame timer` warning: once a frame is over 100 ms the poll keeps agreeing with `per = 1`, so it never climbs back. Correction to the premise in the report: for the first ~90 s the log shows `presented=1 per=1`; FG only reports `per=2` from ~1m40s, so the latch can only start after that. There is **no 5-minute timer** in the code; the drop is at **4m19s**, and the only 300 s constant (`host.rs:468`) is an idle timeout gated on ≥12 GiB free, which is inactive under this log’s commit pressure. **One-run falsification, no rebuild:** relaunch the same save/settings with `LEONIDA_FG_LIMIT_FPS=0` (or `LEONIDA_FRAME_GEN=0`). If the 200.0 ms flatline disappears while the hitches remain, the limiter is confirmed; if it still appears with FG off, this diagnosis is wrong. **Smallest probe:** in `present_end`, log `index, status, presented, per, max, tagged` whenever the polled `per` differs from the stored value; in `present_start`, log `sent_shown, shown, rendered_us, frameLimitUs` when `again` fires. H1 predicts exactly one `2→1` just before the first doubled send, then no further sends while frames are 200 ms. **Safe fix, unit-testable without a GPU:** do not change the arithmetic; make the divisor adopt a new value only after **two consecutive polls agree** (a tiny pure state machine, e.g. `polled(per)`), so a one-frame `per=2→1` hitch cannot double the limit while a sustained FG stop is still followed. Preferred later: derive the divisor from the configured generator count while `status == 0`, using the poll only to detect a sustained stop. Not covered by #3278 or #3387/#3389: they change the `Follow` warm/cold and retry paths, not the `shown` divisor or the `again` send. Unproven: *why* the poll read 1 at that instant (dropped generated frame vs status), and that memory pressure caused that particular hitch — the pressure/hitch correlation is strong, not causal.
Sign in to join this conversation.
No assignees
No project
No milestone
Dependencies

No dependencies set

Notifications
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
leonida/mandy#3260
No description provided.