Skip to content

Switch: turn on and distribute PGO profiles (follow-up to #87) #90

Open

Description

@Pulpparty

PR #87 adds profile-guided optimisation for the Switch build (-DWWHD_PGO=GEN|USE, tools/switch/pgo_train.py, docs/pgo.md), but it stays off by default and no release ships a PGO build for now. On a console at stock clocks it gave a further +2.6% to +7.5% fps on top of the recompiler changes (main thread -4.7% to -6.1%), measured at GPU 307 MHz (see docs/pgo-progress.md).

This issue is for turning it on for players later.

Why it is not on yet

  • A profile only fits the exact sources it was made from. Those sources are each player's own recompile (from their own dump), so a profile depends on the recompiler version, the region (USA/EUR) and the runtime files it covers.
  • GCC ignores the profile of any function whose flow graph changed (-Wno-coverage-mismatch), so a stale profile silently gives nothing, or only part of the gain.
  • The .gcda files come from the game's code, so how they could be distributed (release asset, private pinned repo like the shader template in Ship a shader state manifest with releases so setup builds the shader cache before the first start #88, or not at all) needs the same care as any game-derived data.
  • The GCC version used to build must match the one that made the profile.

To decide / do

  • Whether a profile made by the maintainers on a reference recompile fits players' recompiles closely enough (same recompiler + same region should give identical generated code; check).
  • How the profile is stored, pinned to a commit and fetched by build.sh / the installers (and checked against the toolchain version), or a clean fallback to a normal build.
  • Per-region profiles or one shared profile.
  • A release step that retrains after any change to the recompiler or a profiled runtime file (pgo_train.py, ~30 min on a console), in docs/release-checklist.md.
  • Re-time PGO on current main at GPU 384 MHz (perf_test.py ab) to confirm the gain is still worth it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions