Skip to content

DM_PCORE=1 (opt-in, not yet measured): the busiest guest threads get a time-constraint declaration, to keep them on the performance cores - #1699

Closed
oliverames wants to merge 1 commit into
seedds:mainfrom
oliverames:pcore-declare
Closed

oliverames wants to merge 1 commit into
seedds:mainfrom
oliverames:pcore-declare

Conversation

@oliverames

@oliverames oliverames commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Not fully tested; opt-in. Filed so the change is reviewable while the measurement is open.

What and why

Mario Kart World 1.8.0 (#1383's build) on a physical iPhone runs at 60 fps for about a minute, then, in some runs, the process leaves the fast cores with thermal state nominal: mean clock 3.8 to 1.65 GHz and 55% to 12% of CPU time on performance cores, with the main thread's real-time declaration still in effect. cheemu21/plumber-racer-2 reports a slow state of the same kind on 1.0.0. iOS has no core affinity and every guest thread is already user-interactive, so the one lever left is a time-constraint declaration, which is what the scheduler places on a fast core and what the performance controller raises the clock for.

With DM_PCORE=1, the three busiest guest threads without a declaration (60 ms/s or more in the CPU sampler's 300-frame window) get a 60 Hz declaration of 1.5 times their measured per-frame CPU (1 to 6 ms), once each (pcore_declare in hle_thread.c, log line DM_PCORE: thread ... declared). The main and acquire threads keep their own declarations. Off by default: with the variable unset the code runs as before.

Checked

  • Tests: hle_thread.c compiles on this base with a generated profile header (clang syntax-only; this caught a missing <mach/mach_time.h>, now included); dm/tools/tests/test_docs.py passes; the new switch is in docs/env_switches.tsv with its meaning (env_switches.py --check still reports DM_NVN_BC_ALIAS, which is missing from the table on main too).
  • Games run, with title ID and version: Mario Kart World (0400C3F00006E000) 1.8.0, built from WIP: Mario Kart World 1.8.0 on iOS - rendering, memory and presentation #1383's tree, on the phone: the declarations were set (6.00 / 4.96 / 2.37 ms for the three busiest threads).
  • Devices and OS: iPhone 19,4 (2 Performance + 4 Efficiency cores), iOS 27.3; Apple-silicon Mac, macOS 27.3
  • scripts/regress.py check --games: not run: off by default, so every game runs as before without the variable.
  • Not checked: whether it keeps the game on the fast cores. The one run with it started hot (thermal 2, 1.5 to 2.4 GHz before the declarations took effect) and logged GPU error discards, so no effect is established either way; later HDR-off runs had a healthy CPU with or without it. No unit test (nothing observable on the Mac), no Mac run. A cooled-phone A/B is the next step.

Front ends

None: no front end has to act on this.

Docs

  • The mechanism is in docs/development.md and the switch in docs/env_switches.tsv
  • A chain tool changed: dmsh_chain.py --header was run and dm/gfx/nvn/dmsh_chain.h is part of the change. Not applicable: no chain tool changed.
  • No game files, keys or data extracted from a game in the change or the attachments

@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) docs Documentation labels Nov 7, 2026
…declaration, to keep them on the performance cores

Off by default and not yet shown to help: a Mario Kart World run on an iPhone left the performance
cores about a minute in with thermal state nominal (mean clock 3.8 to 1.65 GHz, 55% to 12% of CPU time on
performance cores). iOS has no core affinity; a time-constraint declaration is what the scheduler places on
a fast core. The three busiest guest threads without one get a 60 Hz declaration of 1.5x their measured
per-frame CPU, once each, from the CPU sampler's window.
@oliverames

Copy link
Copy Markdown
Contributor Author

Combined into #1713 with the other two pacing switches; same commit, same tests. Closing this one.

@oliverames oliverames closed this Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation host The Horizon host: SVCs, services, threads, memory (dm/host)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant