Follow-up to #68: final optimized setup for 8 GB laptops, 25-55 fps on screen with FG #361

Open
opened 2026-12-01 18:22:20 +00:00 by yagizakkaya01 · 2 comments
yagizakkaya01 commented 2026-12-01 18:22:20 +00:00 (Migrated from github.com)
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by yagizakkaya01 on 2026-12-01T18:22:20Z.


Hi, follow-up to #68.

I built the layer myself and spent a day tuning it for my laptop (RTX 4070 Laptop 8 GB, Ryzen 9 7940HS 8C/16T, 32 GB). This is the final optimized version I ended up with. I tested each change standing still in the same busy street for about 6 minutes and compared the preparing per frame lines.

With this version, the on-screen counter with Frame Generation moves between about 25 and 55 fps depending on the scene (55 was on my brother's laptop, same kind of machine, same build and settings). In my fixed test spot the base fps went from about 13 to about 15.5 (~31 on screen with FG), and the submitting thread went from ~66 to ~52-59 ms per frame.

Final optimized version

Launcher: Series S profile, DLSS Performance, Frame Generation On, 30 fps, Texture loading Auto. In the game menu: Motion Blur Strength 0, because blur plus FG looked bad.

Further switches:

WIDE_THREADS=4
THIN_THREADS=5
UNDER_THREADS=4
VIEW_THREADS=4
LAND_THREADS=2
PRIORITY_TIERS=2,1,0
JOURNAL_SHORT=1
SPARE_MOST_MB=512

What each one does and why:

  • WIDE_THREADS=4 (default 6 on 16 threads): refresh helpers. Fewer threads meant less fighting over cores and locks. 8 was worse, 3 made refreshes slower again.
  • THIN_THREADS=5 (default 8): list translators. Going from 8 to 5 cut the cost per list call from ~8 to ~5.9 µs. They were mostly getting in each other's way.
  • UNDER_THREADS=4, VIEW_THREADS=4 (default 6), LAND_THREADS=2 (default 4): these pools sit idle most of the time, so shrinking them just takes threads off the scheduler.
  • PRIORITY_TIERS=2,1,0 (new, my build only): submitting thread at highest, its helpers (refresh, ask, relay, heap sync) one step lower, list translators at normal. With HELPER_PRIORITY=1 they all got the same priority and lock holders kept getting preempted. Putting the translators below normal (2,1,-1) was worse, the title then waits for its lists.
  • JOURNAL_SHORT=1 (new, my build only): the checks for "this copy has nothing new" take the write watch journal's read lock per check instead of holding it for a batch of 32 or 256. In a timeline the helpers were stuck for several ms at a time behind a waiting writer. This cut refreshes from ~22 to ~17 ms and the write watch asking from ~11 to ~8 ms.
  • SPARE_MOST_MB=512 (new, my build only): the cap on spare scratch chunks. Under memory pressure it drops to 128 MiB and the list threads start creating write-back chunks again (~4% of their CPU in a profile).

Code changes in this version without a switch:

  • Texture read-backs used to create a new committed read-back buffer every time, ~13 per frame, ~11% of the list threads' CPU. I added a small pool by size. Buffers go back into it once their list has run. Texture glitches also seemed rarer after this.
  • I took your two later commits (in-flight range merge, waking only the waiters of a finished pipeline).
  • For my own machine I build with -C target-cpu=native (Zen 4). For my brother I used the usual x86-64-v3.

Things I tried that didn't make it into the final version

  • GUARD_HOT=250: refreshes went from 17 to 50 ms, 8 fps.
  • SUBMIT_FRAMES=2: the title stopped waiting at presents but fps didn't move and input lag got worse.
  • DLSS Ultra Performance: no change at all, so the GPU isn't the limit here.
  • libopus instead of opus-pure: same speed, decoding is still ~30% of the audio thread.
  • INPLACE=1: black tearing on my machine after a few minutes. INPLACE_PROBE=1 says the driver itself handles both private memory and a committed section fine, and the page pool would need SEC_COMMIT to cover view memory.
  • I checked whether translated lists repeat between frames so they could be reused. With the same arguments they basically never do (0% of calls).

With the final version the whole process uses ~8.6 logical cores (title's own code ~2.6, list translation ~2.2, wait/wake syscalls ~0.9), so on this CPU it's total CPU that limits now, not one thread.

One build thing that bit me

victory-gpu/build.rs hashes Cargo.lock into the translator fingerprint. Adding any dependency anywhere invalidates every shader translation, and I had to recompile ~89k pipelines (~2 hours). The paths are also sorted before hashing, so even a copy of the old lock at another path changes it. Hashing only what the translator depends on would avoid that.

All my changes are behind switches. Happy to send PRs or my measurement scripts if any of this is useful.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:issue:6727502063 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/361). Originally posted by [yagizakkaya01](https://github.com/yagizakkaya01) on 2026-12-01T18:22:20Z. --- Hi, follow-up to #68. I built the layer myself and spent a day tuning it for my laptop (RTX 4070 Laptop 8 GB, Ryzen 9 7940HS 8C/16T, 32 GB). This is the final optimized version I ended up with. I tested each change standing still in the same busy street for about 6 minutes and compared the `preparing per frame` lines. With this version, the on-screen counter with Frame Generation moves between about 25 and 55 fps depending on the scene (55 was on my brother's laptop, same kind of machine, same build and settings). In my fixed test spot the base fps went from about 13 to about 15.5 (~31 on screen with FG), and the submitting thread went from ~66 to ~52-59 ms per frame. ## Final optimized version **Launcher:** Series S profile, DLSS Performance, Frame Generation On, 30 fps, Texture loading Auto. In the game menu: Motion Blur Strength 0, because blur plus FG looked bad. **Further switches:** ``` WIDE_THREADS=4 THIN_THREADS=5 UNDER_THREADS=4 VIEW_THREADS=4 LAND_THREADS=2 PRIORITY_TIERS=2,1,0 JOURNAL_SHORT=1 SPARE_MOST_MB=512 ``` What each one does and why: - `WIDE_THREADS=4` (default 6 on 16 threads): refresh helpers. Fewer threads meant less fighting over cores and locks. 8 was worse, 3 made refreshes slower again. - `THIN_THREADS=5` (default 8): list translators. Going from 8 to 5 cut the cost per list call from ~8 to ~5.9 µs. They were mostly getting in each other's way. - `UNDER_THREADS=4`, `VIEW_THREADS=4` (default 6), `LAND_THREADS=2` (default 4): these pools sit idle most of the time, so shrinking them just takes threads off the scheduler. - `PRIORITY_TIERS=2,1,0` (new, my build only): submitting thread at highest, its helpers (refresh, ask, relay, heap sync) one step lower, list translators at normal. With `HELPER_PRIORITY=1` they all got the same priority and lock holders kept getting preempted. Putting the translators below normal (2,1,-1) was worse, the title then waits for its lists. - `JOURNAL_SHORT=1` (new, my build only): the checks for "this copy has nothing new" take the write watch journal's read lock per check instead of holding it for a batch of 32 or 256. In a timeline the helpers were stuck for several ms at a time behind a waiting writer. This cut refreshes from ~22 to ~17 ms and the write watch asking from ~11 to ~8 ms. - `SPARE_MOST_MB=512` (new, my build only): the cap on spare scratch chunks. Under memory pressure it drops to 128 MiB and the list threads start creating write-back chunks again (~4% of their CPU in a profile). **Code changes in this version without a switch:** - Texture read-backs used to create a new committed read-back buffer every time, ~13 per frame, ~11% of the list threads' CPU. I added a small pool by size. Buffers go back into it once their list has run. Texture glitches also seemed rarer after this. - I took your two later commits (in-flight range merge, waking only the waiters of a finished pipeline). - For my own machine I build with `-C target-cpu=native` (Zen 4). For my brother I used the usual x86-64-v3. ## Things I tried that didn't make it into the final version - `GUARD_HOT=250`: refreshes went from 17 to 50 ms, 8 fps. - `SUBMIT_FRAMES=2`: the title stopped waiting at presents but fps didn't move and input lag got worse. - DLSS Ultra Performance: no change at all, so the GPU isn't the limit here. - libopus instead of opus-pure: same speed, decoding is still ~30% of the audio thread. - `INPLACE=1`: black tearing on my machine after a few minutes. `INPLACE_PROBE=1` says the driver itself handles both private memory and a committed section fine, and the page pool would need `SEC_COMMIT` to cover view memory. - I checked whether translated lists repeat between frames so they could be reused. With the same arguments they basically never do (0% of calls). With the final version the whole process uses ~8.6 logical cores (title's own code ~2.6, list translation ~2.2, wait/wake syscalls ~0.9), so on this CPU it's total CPU that limits now, not one thread. ## One build thing that bit me `victory-gpu/build.rs` hashes `Cargo.lock` into the translator fingerprint. Adding any dependency anywhere invalidates every shader translation, and I had to recompile ~89k pipelines (~2 hours). The paths are also sorted before hashing, so even a copy of the old lock at another path changes it. Hashing only what the translator depends on would avoid that. All my changes are behind switches. Happy to send PRs or my measurement scripts if any of this is useful.
readmet3xt-lab commented 2026-12-01 19:02:19 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by readmet3xt-lab on 2026-12-01T19:02:19Z.


Thank you for this; it is the most careful measurement anyone has sent us. Your Cargo.lock finding is right: the translator's stamp covers the whole lock file, so a dependency change anywhere retranslates every shader. We are narrowing it to what decides the translator's output.

We would like your changes as pull requests, one change each, so each can be measured and reverted on its own:

  1. the texture read-back buffer pool (your ~13 new read-back buffers a frame), with its before and after "preparing per frame" figures;
  2. JOURNAL_SHORT;
  3. SPARE_MOST_MB;
  4. PRIORITY_TIERS.

Your measurement scripts would help too, as a separate PR or a gist. Please keep each change behind a switch as you did, and note the machine and the switches beside the figures. The thread counts are settings, not code; we will add them to our notes for 8 GB laptops, with credit to you.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7322050269 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/361#issuecomment-7322050269). Originally posted by [readmet3xt-lab](https://github.com/readmet3xt-lab) on 2026-12-01T19:02:19Z. --- Thank you for this; it is the most careful measurement anyone has sent us. Your Cargo.lock finding is right: the translator's stamp covers the whole lock file, so a dependency change anywhere retranslates every shader. We are narrowing it to what decides the translator's output. We would like your changes as pull requests, one change each, so each can be measured and reverted on its own: 1. the texture read-back buffer pool (your ~13 new read-back buffers a frame), with its before and after "preparing per frame" figures; 2. JOURNAL_SHORT; 3. SPARE_MOST_MB; 4. PRIORITY_TIERS. Your measurement scripts would help too, as a separate PR or a gist. Please keep each change behind a switch as you did, and note the machine and the switches beside the figures. The thread counts are settings, not code; we will add them to our notes for 8 GB laptops, with credit to you.
yagizakkaya01 commented 2026-12-02 11:40:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from readmet3xt-lab/foxhound. Originally posted by yagizakkaya01 on 2026-12-02T11:40:40Z.


Thanks for accepting us as contributors. To work on v0.8.3 I need the title profile: without it DLSS, frame generation and BCPack are off on my side, so I can't measure anything comparable to v0.8.2. How do contributors get it? I'll keep it local and never commit it.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7344252853 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/issues/361#issuecomment-7344252853). Originally posted by [yagizakkaya01](https://github.com/yagizakkaya01) on 2026-12-02T11:40:40Z. --- Thanks for accepting us as contributors. To work on v0.8.3 I need the title profile: without it DLSS, frame generation and BCPack are off on my side, so I can't measure anything comparable to v0.8.2. How do contributors get it? I'll keep it local and never commit it.
Sign in to join this conversation.
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
readmet3xt-lab/foxhound#361
No description provided.