Skip to content

core, video_core: cap Dynarmic JIT cache, NUP cache, and FFmpeg threads on low-RAM hosts - #931

Open
nowhere02 wants to merge 3 commits into
nx2-experimentalfrom
perf/nx2-low-ram-subsystem-caps
Open

nowhere02 wants to merge 3 commits into
nx2-experimentalfrom
perf/nx2-low-ram-subsystem-caps

Conversation

@nowhere02

@nowhere02 nowhere02 commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Caps three caches whose defaults are sized for large hosts, only on machines with 18 GiB of RAM or less. Standalone, no dependency on the other PRs in this series (part 3 of 4).

  • src/core/arm/dynarmic/arm_dynarmic_64.cpp: x86-64 code cache 96 MiB per core at 18 GiB or less, 64 MiB at 10 GiB or less (was 512 MiB). EDEN_NX2_JIT_CACHE_MIB (16..512) overrides it.
  • src/core/file_sys/nup_container.{h,cpp}: NupDecompressCache::DefaultCapForHost() gives 48 MiB (32 MiB at 10 GiB or less). EDEN_NX2_NUP_CACHE_MIB overrides it.
  • src/video_core/host1x/ffmpeg.cpp: decoder thread_count is clamp(hardware_concurrency / 3, 2, 4) at 18 GiB or less.

I first tried 64 MiB per core on an 18 GiB host. On Ocarina of Time all 6 cores sat at ~62 of 64 MiB and the cache was flushed repeatedly (frame time minus GPU fence wait went from 3-4 ms to 22-52 ms, with 71-114 frames over 100 ms per 600). At 96 MiB that went away, so 96 MiB is the value in this PR. The 64 MiB value stays only for hosts at 10 GiB or less, which I could not test.

Assisted-by: Antigravity (RAM profiling, implementation, and verification)

Type of change

  • Bug fix
  • Game compatibility / game-support
  • Performance
  • New feature
  • Refactor / cleanup
  • CI / build
  • Documentation

Related issues

N/A

Testing

  • Tested on Windows
  • Tested on Linux
  • Tested on macOS
  • Tested on NVIDIA
  • Tested on AMD
  • Tested on Intel

Standalone branch: ninja -C build -j10 yuzu eden-cli tests builds; ./build/bin/tests "[nup]" passes (398 assertions in 21 test cases). The <= 10 GiB values were not run on a real 10 GiB host. Testers with 8 or 16 GiB machines are especially welcome.

Games tested:

Ocarina of Time and Mario Kart World on Linux (Ryzen 5, Vega iGPU, 15.4 GiB RAM), with all 4 PRs of the series applied together. 6 Dynarmic cores at 96 MiB each ended at ~94 MiB used each in Ocarina of Time (240 s) with no cache flushes.

Checklist

  • I built it locally and it compiles without new warnings
  • I did not add any copyrighted game data, keys or firmware
  • Docs updated if needed
  • I added AI Disclosure if one was used

Screenshots / logs

Whole series, Ocarina of Time, 240 s in game: host heap + anonymous memory (excluding JIT) 3,141 MiB before, 1,362 MiB after. Not attributable to this PR alone.

Summary by CodeRabbit

  • Improvements
    • Memory use for JIT code caching and file decompression caches now adjusts to the detected amount of host RAM, with configurable limits available.
    • Video decoding now adjusts its thread count based on host memory; frame threading remains disabled.

PastaLaPate and others added 3 commits November 22, 2026 00:19
A manual dispatch gains a linux_arch choice (both, x86_64 or aarch64) that narrows the base Linux legs and the Nix linux systems, and a build_nix tick that skips the Nix job entirely. Defaults keep pushes, dailies, PR builds and untouched manual runs building both architectures with Nix on.

Cherry-picked verbatim onto nx2 and nx2-experimental so a rebase of nx2-experimental onto nx2 drops it as already applied.
`no` keeps the skip the boolean could express. `only` runs the Nix job for
the systems the Linux/macOS ticks (and linux_arch) select, and skips the
Linux, Windows and macOS jobs -- plus the release job, whose assets all come
from those legs, so publishing there would only fail on an empty artifact
set. Default stays `yes`: pushes, dailies, PR builds and untouched manual
runs are unchanged.
…ds on low-RAM hosts

On hosts with 18 GiB of RAM or less, the defaults reserved more than a title
needs:

- Dynarmic x86-64 code cache: 96 MiB per core (64 MiB at 10 GiB or less)
  instead of 512 MiB. EDEN_NX2_JIT_CACHE_MIB overrides it. 64 MiB filled up on
  Ocarina of Time and emptied the whole cache over and over, so 96 MiB is the
  floor for 18 GiB hosts.
- NupDecompressCache: 48 MiB (32 MiB at 10 GiB or less).
  EDEN_NX2_NUP_CACHE_MIB overrides it.
- FFmpeg decoder threads: clamp(hardware_concurrency / 3, 2, 4).

Assisted-by: Antigravity (RAM profiling, implementation, and verification)
@github-actions
github-actions Bot changed the base branch from nx2 to nx2-experimental November 22, 2026 03:37
@github-actions

Copy link
Copy Markdown

Retargeted to nx2-experimental for pre-build testing. It will be promoted to nx2 after validation.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f1c31247-8d52-480d-82cd-16be9b8b6b47

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants