RingOut · recompiler performance · 12–13 Aug 2026

Thirty-One Claims, Measured

Six optimization documents, thirty-one suggestions, two days on an idle machine. Three shipped. Five did nothing the numbers could detect. The two biggest headline figures were measuring a build that did no work and a bottleneck that wasn't there. Shipping the ones that worked then turned up two packaging bugs and a shipped glibc fault, none of which came from any suggestion — and the one change that mattered was confirmed on the Deck at 56.9 fps. The next morning tested whether the winning change could be pushed further. It could not, and the attempt overturned one of this page's own findings. Then a slowdown reported from simply playing the game turned up the one suggestion here that was right all along, and that a day of careful single-variable testing had structurally hidden.

4Shipped or confirmed
14Refuted
10Already true
3Not tested

Document 1 — ThinLTO cache and lld

5 claims · 2 shipped

The most useful of the three. It identified the right change for the wrong reason, and both of its headline numbers were artifacts — but the underlying idea was sound and now ships.

Enable a persistent ThinLTO cache

Shipped

Correct, and the whole win. ThinLTO codegen runs inside the linker, so editing one generated chunk re-optimized all 132 modules. The cache reuses the 131 that didn't change.

one chunk changed, no cache 61.5s one chunk changed, warm cache 1.31s 47x fresh build dir, warm cache 83s (from 144s) nothing changed 0.013s

Merged in PR #1, with the cache at ~/.cache/ringout/thinlto, capped at 2 GB with a 7-day prune.

Link with lld

Shipped — different reason

Adopted, but not for the stated benefit. --thinlto-cache-dir is an lld option, so the cache needs it. As a speedup in its own right it is worth nothing: 144.3s against 144.5s over three alternating reps. It is now probed with check_c_source_compiles rather than assumed — lld ships as a separate package from clang on Arch, Debian and Fedora alike.

It does change codegen, since ThinLTO runs in the linker: .text differs from the ld.bfd build at identical size. That needed a parity gate, and passed one — byte-identical frame hashes across 24000 frames of gameplay.

Clean build 3m 04s → 2m 01s, a 33% speedup

Refuted

Does not exist. Measured idle, with the cache disabled on both sides so the linker is the only variable:

clean, ld.bfd, no cache 144.3s (143.9 - 145.1) clean, lld, no cache 144.5s (144.0 - 145.3)

A 0.1% gap inside a 1% spread. A clean build is 132 parallel clang invocations and the link is a fraction of the wall, so no linker swap can reach the rest. The original 3m 04s–3m 24s readings were a machine under load.

Incremental 1m 10s → 0.165s, a 420× speedup

Refuted as stated

Right direction, wrong measurement. Nothing recompiles a 1 MB chunk, re-runs the ThinLTO index over 132 modules and links a 40 MB shared object in 165 ms. That figure is a build that did no work — a true no-op here is 13 ms. A real one-chunk edit is 1.31s, so the honest speedup is 47×.

Still an excellent result. It just isn't 420×, and the difference matters because the wrong number is the one that gets quoted.

Put the cache in module-src/

Rejected

Would have shipped 42 MB of one developer's build artifacts inside every release. package-dist.sh copies that tree wholesale with cp -a. The instinct behind it was right — the cache must survive rm -rf work/ — but the location was the one directory it could not live in.

Document 2 — graphics and compiler flags

7 claims · 0 shipped

Written from reading config files rather than running anything. Its description of the current state was accurate; every conclusion drawn from it was not.

Internal resolution 8× → 3× for a 300–1000% frame rate increase

Refuted

Zero effect. Fixed work, 6000 frames, windowed with the GPU genuinely in the loop and MSAA off in all three so resolution was the only variable:

Internal resPixelsWallIn-game fps
8× — 5120×422421.6 MP57s~51
3× — 1920×15843.0 MP54s~51
1× — 640×5280.34 MP57s~51

A 64× swing in pixel load, and native ties 8× exactly. The setting really was applied — VRAM went 1872 MiB against 1658 MiB. The revealing number is GPU utilization moving the wrong way: 32–36% at 8×, 53–57% at native. The card is more idle when asked to draw 64× the pixels, because it finishes sooner and waits longer on the CPU thread.

These values also never reach a player. package-dist.sh hard-fails if userdata/Config reaches the release stage; the only archive containing a GFX.ini predates that script.

Disable 8× MSAA

Confirmed — the one that was right

Measured 13 August, and it is the only claim in this document that survived. MSAA was switched off in all three resolution runs so that resolution was isolated, which is exactly why its cost stayed invisible for a day — and the inference recorded here, that it was "plausibly also free", was wrong. On the Arcade final fight it is the difference between 56 fps and a locked 60.

8x res + 8x MSAA + CRT 56.23 fps min 45.3 GPU 95% 89W 8x res, no MSAA, CRT on 59.90 fps min 59.9 GPU 63% 64W

Full detail, and the three arms in between, in The final fight below.

Set config.ini target resolution to 2560×2112

Error found

This one is internally inconsistent. That key is not a window size — it maps to a Dolphin EFB scale, and any exact 640·N × 528·N string resolves to scale N. So 2560×2112 is scale 4, while the same document sets InternalResolution = 3. The two files are left disagreeing by a full step, and both feed the same setting.

Its own sentence — "InternalResolution from 8 to 3 (1080p equivalent, 2560x2112)" — pairs a scale-3 value with a scale-4 resolution. The matching pair for scale 3 is 1920×1584.

Add -O3 -fomit-frame-pointer -march=native

Already true

All three are no-ops, verified from the actual compile line rather than reasoned about:

-march=native -O3 -flto=thin

-march=native was already in setup.sh. -O3 comes from CMAKE_BUILD_TYPE=Release, and CMake emits CMAKE_C_FLAGS before the Release flags, so adding it there changes nothing — a trap this project already documented when it measured -O2 against -O3. -fomit-frame-pointer is default at -O2 and above; its only observable effect would be breaking perf's frame-pointer unwinding.

Pass --idle-pc to the recompiler

Already true

Present and documented as mandatory — without it the OS idle spin loop compiles to a native goto and idle-skip silently stops working.

Verify CPUThread and DSPThread

Already true

Both already True in Dolphin.ini. Nothing was applied.

ShaderCompilationMode = 2

Already true

Already set. The document lists it as a finding rather than a change.

Document 3 — affinity, underclocking, PGO

5 claims · 1 shipped

Contains the single best suggestion of the three, and the only one that would have caused damage.

Profile-guided optimization

Shipped — biggest win

The notes recorded PGO as dead here. That was true of GCC and only GCC — an instrumented module died with SIGBUS during boot, in a GCC-only container. clang 22 with -mllvm -runtime-counter-relocation, the flag that exists for instrumented shared libraries, clears it.

CyclesInstructionsIPCIn-game fps
base889.39 G2185.7 G2.45654.5
PGO783.57 G1970.0 G2.51459.6

−11.9% cycles, with the arms not overlapping across five reps each — the slowest PGO run beats the fastest baseline run by 94 Gcyc. The desktop now holds 60 where it dropped to ~54.

The mechanism is why it matters: −9.9% retired instructions plus 2.4% IPC. "Fewer host instructions per guest instruction" was the one lever the PMU work left open, and the per-opcode survey then closed on the grounds that no opcode class is both hot and wastefully emitted. Both were right — the saving is diffuse, invisible to inspection, and exactly what a profile-guided compiler finds.

Guest state is untouched: all ten runs hashed identically, so a PGO module and a plain one remain netplay peers. Costs are real — .text grows 20.69 → 37.47 MB and the module build goes 144s → 446s cold. Merged in PR #2 and verified through a real setup.sh run against the disc, which reproduced the benchmarked module byte for byte.

Underclock the guest CPU to 85%

Rejected on risk

The claim is that this "reduces guest CPU work by 15% without altering game physics or speed", which is self-contradictory: the emulated CPU is what runs the physics. Underclocking means fewer guest instructions per emulated second, so the CPU-heavy scenes already dropping frames run slower internally. The frames are not free; they are traded for guest execution.

Worse here specifically: it changes emulated timing, so frame hashes change and two peers with different values desync immediately. This project spent real effort making the module reproducible across compilers, linkers and -march. This setting breaks that from a config file.

Unpin the CPU thread with STATICRECOMP_CPU_AFFINITY=-1

Not tested

The mechanism is real — -1 genuinely disables pinning via a core >= 0 guard. The portability concern is fair in principle, but its specific examples are wrong: Intel hybrid parts enumerate P-cores first, so core 2 is a P-core thread, and on a 7950X3D cores 0–7 are CCD0, the V-cache die. On this 6-core single-CCD part there is no question to answer, and the Deck measurement already found placement optimal.

Set the CPU governor and EPP to performance

Refuted

Nothing to reclaim. Under the actual emulator load the pinned core already boosts to the top of its range:

EPP: balance_performance ceiling: 4762 MHz under emulation: 4573 / 3659 / 3638 MHz

An intermediate reading of 3552 MHz suggested otherwise, but that was a bash busy loop being a poor proxy for the real workload.

Rebuild with native SIMD and ThinLTO

Already true

Same no-op as Document 2. The module already compiles -march=native -O3 -flto=thin with hidden visibility and no semantic interposition. The suggested detail about LTO inlining mem_read32 is already happening — and hand-inlining those fast paths into the generated header was measured and rejected at +6.1% CPU.

Document 4 — advanced CPU techniques

5 claims · 0 shipped

The most technically literate of the four, and the one whose numbers are furthest from this engine. Every technique here is real and pays elsewhere; each was already measured here and found bounded well below what it claims.

Fastmem: mmap the guest address space, catch SIGSEGV — 15–30%

Bounded at ~8%

The technique is real and standard. The ceiling is not. Every memory and paired-single helper together — mem_read*, mem_write*, ppc_psq_load/store, slow paths included — is this much of the CPU thread on gameplay:

mem + psq helpers, total 8.54% of the CPU thread

That is the entire budget the technique draws from, and fastmem does not empty it: the load and the byte swap remain, only the bounds check goes. 15–30% is not an optimistic estimate of this, it is 2–4× the whole memory path.

The architectural cost is the larger objection, and the document does not mention it. cpu.c exports ppc_set_mem_write_journal, and the chassis installs it to capture pre-images of flat-RAM writes. That journal is what the lockstep differential, determinism-localise, determinism-watch and rollback all run on. Under mmap + SIGSEGV, ordinary writes land straight in mapped pages with no hook at all — the journal goes silent and the tooling that proves netplay parity stops working. Not unsolvable, but a redesign of the determinism story rather than a build flag.

__restrict__ on CPUState — 3–7% fewer stores

Refuted, and misaimed

The premise was already measured and came back ordinary — this is what "Clang spills guest registers constantly" looks like when counted:

loads 363.72 G 26.3% of instructions stores 151.03 G 10.9% memops 514.75 G 37.2% ordinary compiled code is ~30-40%

Squarely in the normal band, which is why block-local register allocation was dropped as a lead.

The suggested form also would not do what it claims. Chunks are void func_8000D940(CPUState* ctx) and RAM is reached as cpu->ram + off — a pointer loaded through cpu. Marking the parameter restrict says nothing about whether cpu->ram overlaps cpu->gpr, because both are reached through the same pointer. The qualifier would have to go on the RAM pointer itself.

Dead CR field elision — 2–5%

Refuted

Measured directly, with counters compiled into the module over this same workload. 98.2% of condition-register writes are live:

field writes reads dead% cr0 3709434029 3708005333 1.9% cr1 42983253 50909638 0.4% cr7 6875012 32459319 2.4% TOTAL 3840285604 3910538440 1.8%

The upside is bounded twice over: CR computation is only ~2–3% of the instruction stream to begin with, and 1.8% of that is dead. Perfect elision — not achievable elision — saves ~0.05%. cr0 is 97% of all writes and is read essentially every time, because compilers emit .-forms precisely when they are about to branch on the result.

Transparent Huge Pages for .text — 2–4%

Above the ceiling

Only one counter measures real front-end starvation, and it caps every front-end fix including this one at 2.4% of cycles. The alarming-looking 55.9% ic_stall_any is dominated by benign back-pressure — what a machine at IPC 1.92 doing real work looks like. Two projects have already lost chasing that number: BOLT at −8.1% and -O2 at −9.1%, the latter with 12.5% less code.

The command is also backwards on this machine, which is already at the most aggressive setting:

/sys/kernel/mm/transparent_hugepage/enabled: [always] madvise never

echo madvise would make huge pages less likely here, not more.

Keep the pinned core's SMT sibling idle

Already true

Already the case. On this host core 2 pairs with core 8, and on the Deck it was measured directly during a match — cpu2 at 100%, its sibling cpu3 idle, the video thread on a different physical core. One thread saturated and seven near-idle is the whole picture: the guest is a single PowerPC and that work cannot be split.

Document 5 — recompiler flags and backends

7 claims · 0 shipped

The best-informed of the five. The flags it names mostly exist, which none of the earlier documents managed. But it reads flag names and infers what they must do: one of them only reports, one was built and abandoned, one is already on, and one is already merged. Three of the seven propose work that is finished or refuted, and they are the three carrying the most confident frame-rate claims.

Its file references also do not match this tree. module_export.c:L19-20 is cited for a ppc_fprf_flush(ctx) call; that file is 44 lines long and contains no fprf at all. cpu.h:L98-100 is cited for memory access and holds struct fields — the accessor is at line 186. cli.c:L100-109 is cited for flag parsing and holds an ASCII-uppercase helper.

Enable basic-block leader switch tables — --leader-cases

Built and rejected

The flag is real and the size claim is right: the module shrinks 19.5%, 38.76 → 31.20 MB. It was built end to end on 7 August, with an ABI-v3 entry-point table so the chassis knows which addresses are entrable. It is a catastrophe at runtime:

base3 (all labels) 23.6M native dispatches 0.48M interpreter steps leader2 (leaders) 18.9M native dispatches 82.4M interpreter steps

81% of execution leaves the recompiled code. Block leaders do not cover indirect-branch targets, so every guest jump-table target and mid-block resume lands on a non-leader and is handed to the interpreter. The ICache argument is sound in isolation and worth nothing against an 80× increase in interpretation. The flag stays in DolRecomp, off by default, pending indirect-target discovery.

XER carry dead-code elimination — --ca-liveness

Flag does not do this

Its own help text: "Report provably-dead XER[CA] writes (codegen unchanged)". The implementation is three atomic_fetch_add calls into stat counters. It is a measuring instrument — and it is the instrument that produced this project's carry-liveness numbers. Enabling it removes nothing.

The underlying idea was then tested and is blocked. RECOMP_NO_CA hangs the game — zero frames against 16000 for the same tree with CA on. Unlike FPRF, whose reads only observe wrong bits, CA's 20.2 M reads are load-bearing: some early addc/adde loop depends on the carry to terminate. There is no semantically inert version to measure against.

XER.CA 1.255 G writes 20.2 M reads 98.4% dead stub removes 181,786 bytes of .text (0.61%) -> ~1% of the instruction stream

So the ceiling is ~1%, only the dead fraction is recoverable, and it needs a backward liveness pass over 3769 write sites. FPRF was the same idea with a 3.1% ceiling and no dataflow, which is why it went first.

Zero-mask direct base pointer RAM access

Premise false

There is no addr & 0x01FFFFFF in this codebase to remove. The accessor is already the reduced form the suggestion is arguing towards:

u32 off = addr - GC_RAM_BASE; return off <= cpu->ram_size - size ? cpu->ram + off : (u8*)0;

One subtract, one compare — the comment above it reads "Kept to a single compare". Uncached 0xC0… addresses fall through to the slow path deliberately, because they have different semantics; folding them into a shared mask is a correctness change, not an optimization. And the entire memory plus paired-single path is 8.54% of the CPU thread, so the ceiling is small even where the premise holds.

Tune the LLVM object backend for Zen 2

Knob does not exist

The most substantial item, and the only one with anything left in it. --backend llvm, DOLRECOMP_LLVM_TARGET and DOLRECOMP_LLVM_CHUNK_INSTRUCTIONS (128–4096, default 1024) are all real. But DolLLVMOptions carries exactly target_triple, optimization_level, verify, emit_ir, ir_path and the function ranges. There is no -mcpu or -mattr, so the znver2 tuning has nothing to attach to and would need new code before it could be tried.

The backend itself is blocked on ~11 float helpers our C backend inlines instead of calling, needs LLVM 19–20 exactly, and takes ~2 h to emit 526 objects at 736 MB. When it did run it made 43% fewer dispatches and was still 4% slower.

Hard-coding znver2 would also be a regression rather than a tune. This desktop is Zen 3, and setup.sh builds the module on the player's own machine with -march=native — which already selects the right target for whatever hardware runs it, Deck included.

Native MOVBE byte swapping — -mmovbe

Already true

Already in effect. setup.sh passes -march=native, which defines __MOVBE__ on both this host and the Deck. Compiling the actual access pattern confirms the fusion has been happening all along:

movbel (%rdi), %eax

One instruction, load and byte-swap merged, no bswap emitted anywhere. The same no-op as Document 2's -O3 -march=native claim, found the same way — by reading the generated code rather than the source.

Lazy FPRF updates

Already shipped

Merged three days before the document was written — commit 68aea54d, 10 August, −2.45% cycles, hash-identical. FPRF was measured 100% dead with a 3.1% ceiling, and it is the one status-bit win this project found. The suggestion describes completed work.

High-intensity combat PGO profile

Already true

The committed profile is 6000 frames of a single Arcade match — already "pure combat, no menus, no FMVs". The document's recommendation is the status quo, and widening it was benchmarked the morning the document arrived: adding attract mode cost +2.18% cycles and the narrow profile won.

Two details do not survive contact with the game. It asks for "a 4-player Arcade match" — SOULCALIBUR II's Arcade mode is 1v1, there is no 4-player mode. And its stated goal, frame-rate retention under peak load, is the symptom traced the same day to 8× MSAA, which no profile can touch.

Document 6 — what is left for the Deck

2 claims · 0 shipped

Written after reading this page, and its opening premise is the right one: the CPU side is tuned out, and what remains is at hardware boundaries rather than in code generation. That is the conclusion two days of measurement support. It then picks the boundary that was already handled, and misses the one sitting next to it.

Force MSAA = 0 in the Deck package

Already true

The Deck package has never shipped MSAA. Its config, unchanged since packaging:

InternalResolution = 7 MSAA = 0x00000001 (off) SSAA = False PostProcessingShader = (none)

So MSAA is not what caps the Deck at 56.9 fps, and the recommended fix is the current state. The suggested value is also wrong in detail — the setting is a sample count, where 1 means off; 0 is not the off value either package uses.

The question underneath it is real, and it is now the better one. The Deck ships 7× internal resolution — 4480×3696, 16.6 megapixels on an RDNA2 iGPU. Resolution was measured free on 12 August, but every one of those runs had MSAA off and an RTX 3050 with headroom to spare. Neither condition holds on the Deck. That is untested, costs a config change and no rebuild, and it is on the machine where the frame rate is actually tight.

Inline monomorphic cache at the chassis dispatcher

Refuted — and unsafe as written

The first suggestion across six documents to name a code site that exists and does what it says. chassis_dispatch really is a one-line wrapper around dolrecomp_call. Three things go wrong after that.

The numbers are the rejected experiment's, with their meaning inverted. "81% of execution stays inside native recompiled chunks and dispatches are down to 18.9M" describes the --leader-cases arm, where 81% of execution left the recompiled code — 82.4M interpreter steps against the baseline's 0.48M — and 18.9M was that arm's dispatch count. It is the failure configuration quoted as the current state.

The lookup being bypassed is not a lookup. dolrecomp_find_original is generated as uniform-stride runs: a range check and index arithmetic, then an indirect call. An inline cache adds a load, a compare and a branch to every dispatch to skip that arithmetic, and still ends in an indirect call through the cached pointer — so it does not remove the misprediction that actually costs. Against arithmetic that cheap it is plausibly a net loss.

And it would be incorrect. dolrecomp_call is not only a lookup:

ctx->pc = address; if (dolrecomp_dispatch_replacement(ctx, address)) return 1; if (ctx->host_call && ppc_host_call(ctx, address)) return 1; if (dolrecomp_call_original(ctx, address)) return 1;

Returning early on an address match skips the replacement check and the host-call hook — the HLE path, which this game uses for FMV playback. It also caches a function pointer across the module's SMC ranges and chunk hashes, so self-modifying code could execute stale entries; the chassis reports smc_failed on shutdown precisely because that path is live.

The headroom is largely spent in any case. PR #3 removed a double lookup from this exact path for −1.23% instructions, and the evidence against dispatch count being the lever still stands: the LLVM backend made 43% fewer dispatches and was 4% slower.

Beyond the suggestions

3 shipped · 1 dismissed

None of these came from a suggestion document. The first was an item the profiling turned up; the next two were found by shipping the work and watching what the release scripts did — or failed to do.

The dispatcher looked the same address up twice

Shipped

FastDispatchableAt runs once per dispatch — roughly 970M times over a 24000-frame match — and was composed from ChunkIndexOf + IsModuleEntry. Both call GetAddressLookupIndex, so every dispatch derived the same index from the same address twice and discarded one. Four FMV env flags were also declared inside the loop, each paying a static-init guard check per dispatch.

base 1969.68 Ginsn (1968.83-1970.05, spread 0.06%) new 1945.38 Ginsn (1944.41-1945.94, spread 0.08%) -1.23% instructions, arms do not overlap

That is ~25 host instructions off every dispatch. No cycle claim is made — cycles came out −0.76% but with a 3.7–4.7% per-arm spread, because the machine was no longer idle. The instruction count is immune to that, which is why it is the number quoted. Below the 1–2% originally estimated, and nowhere near PGO. Merged in PR #3.

Worth recording what was wrong going in: the hypothesis was that per-burst state syncing was the hidden cost. SyncIn is 0.13%. And the older note claiming ~15% headroom here is contradicted by the LLVM backend doing 43% fewer dispatches and still losing 4%.

The Deck package shipped a three-day-old runtime

Fixed

Found by walking into it. With a merged chassis change sitting in the tree, package-deck.sh completed in four seconds and produced a clean 21 MB zip built around a binary from 9 August. It rebuilt only when the runtime was absent, never when it was stale.

==> runtime: build-deck/moderngekko-run ==> checks glibc floor: GLIBC_2.36 ==> forbidden files none ==> personal identifiers none privacy scan clean

Every gate passed, because none of them look at age — and this is the package where it matters most, since the prebuilt runtime is the payload and there is no on-machine rebuild to paper over it. Now rebuilds when stale, and refuses to package a stale one even via the SKIP_BUILD / RUNTIME= override paths. Merged in PR #4.

The desktop package couldn't see a stale recompiler

Fixed

The same class, but quieter. A stale runtime fails loudly at dlopen; a stale recompiler ships old codegen in silence — setup runs, the module builds, the game plays, just slower. It already happened here: tools/dolrecomp predated lazy FPRF, so desktop players would have built the eager path and missed a measured −2.45%, with every check passing.

The runtime had a freshness guard against the ABI header; the recompiler now has the matching one against DolRecomp/src. Merged in PR #5.

A document made of these results

Derivative

It arrived quoting this page's numbers verbatim — 889.39 → 783.57, the 8.1% dispatcher split, the 32%-versus-53% GPU utilization — as if independently established. It is the same measurement counted twice, and evaluating it as corroboration would be a feedback loop.

Its printed PGO recipe also does not run. Executed verbatim:

configure exit=1 No SOURCES given to target: g_recomp

It omits every required cache variable, omits -DMODULE_LTO=OFF (the documented 21 KB-stub trap), drops -march=native, and globs for .profraw files in a directory they are never written to. It is also obsolete: setup.sh now does PGO automatically from a committed profile.

On the Deck

the hardware that matters · 4 results

The desktop was never the point — it was already fast enough. The Deck sat at 45–49 fps against a 60 target, and everything above was staged so this could be measured on the device rather than extrapolated to it.

The profile transfers to Zen 2 unchanged

−12.55%

The open question was whether a profile trained on a Zen 3 desktop means anything on the Deck's Zen 2. It does — slightly more, in fact, than it was worth here. Same runtime, two -march=znver2 modules differing only by -fprofile-use, 12000 frames, 3 reps alternating, idle Deck:

base 531.77 Gcyc 1083.0 Ginsn IPC 2.036 (spread 0.20%) pgo 465.04 Gcyc 983.3 Ginsn IPC 2.115 (spread 0.19%) -12.55% cycles -9.2% instructions +3.9% IPC

So retraining per microarchitecture is unnecessary. A profile records which branches and blocks are hot, which is a property of the game and the input script — not of the chip. Retrain when the emitter's codegen changes, not when the CPU does.

One detail worth more than the headline: on the Deck wall time tracks cycles (−10.7% against −12.55%), where on the desktop it did not (−4.8% against −11.9%). That is the signature of a machine genuinely bound by its CPU thread, and it means the gain lands as frames rather than being absorbed.

In a real match: 45–49 → 56.9 fps

Confirmed on hardware

Measured in Game Mode, on the device, by the person playing it. Above what the cycle figure alone predicted (50–54) — but the honest attribution is that the remembered 45–49 baseline came from a module dated 5 August, so this is today's build against a months-old one, not PGO alone. The clean PGO-only number remains the −12.55% measured with everything else held constant.

Nothing here is graphics-assisted: the Deck renders at native 640×528 with MSAA off and VSync off. The gain is entirely CPU-side, which is where the work went.

PC↔Deck netplay parity survives PGO

Byte-identical

The real risk in the day's work: the two machines now run different binaries — desktop -march=native, Deck -march=znver2 — and netplay requires identical guest state. With starting state matched, 6000 frames:

desktop -march=native PGO md5=da2ace4b4d3c2cf0 deck -march=znver2 PGO md5=da2ace4b4d3c2cf0

Different compilers, CPU generations and glibc versions. -ffp-contract=off holds with the largest codegen change this project has made layered on top.

The first attempt appeared to diverge at frame 241 — and the frame number is the diagnostic. All 240 boot frames matched, then it split at the first START: the signature of different starting state, not codegen. Both SRAM.raw and the memory-card save differed between machines. Copying the desktop's GC/ directory across made it vanish. Frame 0 would have meant the module; a split at first input means state.

The CPU governor, again — and the snapshot that lied

No gain

The Deck looked more promising than the desktop: under load on powersave the busiest core sat at 3204 MHz against a 3501 ceiling, 8.5% short. On performance it hit 3499.7 — apparently recovered headroom worth crossing 60 fps for. It was not:

cycles wall effective clock powersave 465.04 G 142s 3.275 GHz performance 468.12 G 141s 3.320 GHz -0.7% +1.4%

Same frames, same module, identical hashes. The instantaneous reading was a snapshot of a boosting core; sustained, the Deck is TDP-limited and averages ~3.3 GHz under either governor. Cycles ÷ wall is the honest clock — and it was free, because both numbers were already being recorded. Revert it: performance costs battery on a handheld and returns nothing.

A crash that was not the new code

Diagnosed

Worked in Desktop Mode, then Game Mode was tried, then Desktop Mode stopped working too — the exact shape of "the thing you just changed broke it". The backtrace said otherwise in one screen:

#0 libvulkan_radeon.so <- Mesa RADV #5 Vulkan::VKPipeline::Create #6 VKGfx::CreatePipeline(config, const void*, size_t) <- cache blob #7 ShaderCache::QueueUberPipelineCompile #8 AsyncShaderCompiler::WorkerThreadRun

Frame 6 takes a cache pointer and size: Dolphin replaying a stored pipeline cache into the driver, which walked off the end of it. Nothing in that stack touches recompiled guest code, and a headless run — which never creates pipelines — passed on the same binaries. The fix was moving Vulkan-*.cache aside; they regenerate.

The mechanism is worth remembering because it is self-perpetuating: a crash leaves the blob truncated, so every subsequent launch crashes replaying it and re-corrupts it. It never wears off, which is precisely why it looks like a code regression. Get the backtrace before theorising — coredumpctl info needs no reproduction and answers it in one screen.

The next morning — can PGO be pushed further?

13 Aug · 1 refuted · 1 correction

PGO was the one change that paid. The obvious follow-up is that its profile is narrow — 6000 frames of a single match on a single stage — so a broader training set ought to do better. Three modules were built and benchmarked against each other on an idle machine.

A broader PGO training set

Refuted

More representative training data should produce better codegen than one match on one stage.

Three arms, five reps each, 24000 frames, order reversed on even reps. All fifteen runs produced the identical guest hash, so every arm did identical work.

ProfileCyclesvs baseInstructionsIPC
base — 6000 frames, one match756.30 G—1931.11 G2.556
+ 39988-frame match752.11 G−0.55%1932.34 G2.569
+ match and attract mode772.79 G+2.18%1952.58 G2.527

Adding attract mode made it worse — more instructions and lower IPC together. The reason is specific: attract mode opens with the intro movie, which is the game's software MPEG decoder, and the project deliberately bypasses that code in normal play. Twenty thousand frames of it pulled the profile's weights toward a workload the player never runs.

The broader profile without attract mode came in 0.55% ahead, against per-arm spreads of 0.7–1.3% — t≈2.0, p≈0.08. That is under the resolution of this instrument, so it is a wash rather than a win, and not a reason to churn a committed 11 MB profile. The shipped profile stays.

"Coverage was never the problem"

Own finding overturned

Every profile reported the same 180 functions and the same 1,426,365 blocks, so the extra 60000 frames reached no new code — only different weights.

Wrong, and wrong in an avoidable way. Those are static totals: llvm-profdata prints every instrumented function and block in the binary whether or not it ever executed, so three profiles of the same module were always going to agree. Counting non-zero counters instead gives the real picture:

shipped 259,449 of 1,426,365 blocks 18.19% + match 302,564 21.21% + attract 346,983 24.33%

Broadening reached 87,534 more blocks — a third more covered code. Coverage varies enormously with the training set. It simply did not help, and the arm with the most coverage was the slowest.

That inverts the intuition worth carrying forward: coverage is not the goal, representative weighting is. Extra training data pays only when the extra content is content the player runs.

The final fight

13 Aug · reported from play · solved

Reported from actually playing the game: the Arcade final fight slows down, and it is a special stage carrying visual effects that appear nowhere else. This is the only item on this page that did not come from a document or a profiler — and it is the one that found a real problem.

8× MSAA on a 5K target, not recompiled code

Solved

The final fight has effects that occur nowhere else, so the code that draws them is cold to a profile trained on ordinary matches.

Plausible, and wrong. The shipped profile really does cover only 18% of the module, and the input script really does stop at Arcade stage 2 — but the symptom has nothing to do with either. Five configurations of the same fight, sampled once a second:

Configurationnfpsmin<58 fpsGPUPower
everything off — 1× res, no CRT52359.9058.00%41%37 W
8× res + 8× MSAA + CRT29256.2345.360%95%89 W
8× res + 8× MSAA, no CRT44257.2850.156%96%91 W
8× res, no MSAA, no CRT18659.9059.90%62%65 W
8× res, no MSAA, CRT on53459.9059.90%63%65 W

8× MSAA is the entire cost. Remove it and the fight holds a locked 60 with 8× internal resolution still fully on. The recommended configuration is the last row — 8× resolution, CRT on, MSAA off — which gives up nothing but the anti-aliasing. That arm ran nearly nine minutes of continuous play without a single sample below 59.9.

The CRT post-processing shader was the wrong suspect, twice over. It costs about 1 fps when the card is already saturated and is free once MSAA is gone — 59.90 either way. The guest CPU thread sat between 66% and 80% of a core in every one of the five arms, so the recompiled module always had headroom. No codegen change, PGO included, could ever have moved this number.

Why a whole day of resolution testing missed it

Method

Document 2's resolution claim was refuted on 12 August because 8×, 3× and 1× tied exactly. That result stands. But every one of those runs had MSAA switched off — deliberately, to isolate resolution — and MSAA's own cost was written down as "Not tested, plausibly also free". The two settings are not separable that way: MSAA multiplies per-sample work on whatever target resolution gives it. Isolating one variable measured it correctly and hid the interaction completely.

Single samples were actively misleading here in a way averages were not. One 8-second reading taken at a menu showed the video thread at 99% of a core and pointed squarely at a host-CPU bottleneck — a conclusion that inverted the moment real geometry appeared on screen. Recording a continuous 1 Hz timeline and finding the slow stretch afterwards was what made this tractable.

One more caution, from getting it wrong in writing: the first draft of this section explained the saturation as a low-wattage memory-bandwidth stall. That came from reading 37 W off the 1× control arm and attributing it to the MSAA arms, which actually drew the most power of any configuration at 89–91 W. There is no subtlety in the mechanism — the card is simply full.

Left on the table

6 open items

Things worth doing that this session did not do, in rough order of value.

The Deck runs the same enhancement stack

Open — likely worse

MSAA is not the item — that was checked and the Deck already ships it off. What the Deck does ship is 7× internal resolution, 4480×3696: 16.6 megapixels on an RDNA2 iGPU that holds 56.9 fps rather than 60.

Resolution was measured free on 12 August, which is the reason to doubt it matters — and the reason that reassurance does not transfer. Those runs had MSAA off and an RTX 3050 with headroom to spare, and the desktop result only held because the card was never the constraint. On the Deck it plainly is something.

This is the cheapest remaining win on the page: a config change, no rebuild, on the machine where the frame rate is actually tight. The same 1 Hz timeline works there — only the GPU counters need swapping, since nvidia-smi has no equivalent on RADV.

Two guest faults from the Action Replay codes

Unexplained

Enabling the unlock codes to reach the final fight produced two warnings during boot, immediately after the intro FMV starts:

[alert] Invalid read from 0x0000005a, PC = 0x80009dc0 [alert] Invalid read from 0x0000005a, PC = 0x80032ca4

The game played normally and the measurements were unaffected, but nobody has checked whether these predate the codes. One launch with the codes disabled answers it. A GFX FIFO unknown-opcode warning also appeared once during a fight without causing the hang it threatens.

What Exhibition mode actually is

Never looked

Still unanswered from the PGO work above. If Exhibition runs CPU-vs-CPU fights it is the ideal hands-off profile training source — real gameplay, no intro FMV, no controller — and with Infinite Time plus both Infinite Health codes it would run indefinitely. There is no CPU-vs-CPU Action Replay code in the game ini, so it is the only known route to an unattended fight. It is a two-minute look at a menu that nobody has taken.

Worth weighing against the result above, though: broadening the training set was measured and lost, so this only matters if the goal is reaching the cold 82% of the module rather than reweighting the 18% already covered.

PGO's true headroom

Open

The 59.6 fps reading is clipped by the 60 fps limiter, so the fps gain is a floor, not a measurement. Unlocking the frame limiter would show how much is actually there. The −11.9% cycle figure is the unclipped one.

The dispatcher's cycle cost

Half open

The change shipped on its instruction count, which was unambiguous. What it is worth in cycles is still unresolved — the A/B ran with the machine no longer idle and a per-arm spread several times the effect. Expect somewhere near half a percent; confirming it needs the machine quiet again and roughly 8 reps per arm.

Two cheap disproofs

Open

An affinity A/B on this machine would close the pinning question by measurement rather than argument. And a single 6000-frame run at Overclock = 0.85 with a hash diff would turn the underclocking rejection from reasoning into evidence.

The pattern

why so many were wrong

Every wrong number came from the same place

All three documents were written by reading configuration files and build scripts and reasoning about what the settings ought to cost. Not one of their headline figures survived contact with a counter. The 33% clean build, the 420× incremental, the 300–1000% frame rate — each is what the change would be worth if the thing it targets were the bottleneck.

The machine itself produced two more false results, and those are the instructive ones because they were mine. With a browser and a 4 GB Windows VM running, per-arm spread was 12–16% and clean builds varied by 25 seconds. That noise had structure: it produced clean-looking, confidently non-overlapping readings twice — "lld is 7% faster to build" and "ld.bfd is 8% cheaper in-game" — in opposite directions, from adjacent run pairs that looked properly controlled. Both evaporated on an idle machine, where the same instrument resolves 0.15%.

The one suggestion that paid was the one nobody could have reasoned their way to. PGO's benefit is spread thinly across the entire instruction stream — no hot spot, no single wasteful opcode class, nothing a person finds by reading code. It took a compiler with a profile to see it, and a benchmark that resolves a fifth of a percent to prove it.

The two real bugs of the day were found the same way, by doing rather than reading: a package that built in four seconds and a release script that had no concept of a binary being older than its sources. Neither is visible from the source, and both passed every check that existed.

The fourth document is the sharpest illustration, because nothing in it is wrong in general. Fastmem, restrict qualifiers, dead-flag elision and huge pages are all real techniques that pay real money in engines where memory access or the front end is the bottleneck. Every one of them was already measured here and found bounded — 8.54%, 37.2% normal, 1.8% dead, 2.4% starvation. A technique's reputation is not a measurement of your workload.

The fifth document fails differently, and more interestingly, because it is the only one that read the code. Its flags exist. But a flag's name is not its behaviour: --ca-liveness reports rather than eliminates, --leader-cases was built and abandoned for a reason recorded in this repository, -mmovbe has been on since the first build, and lazy FPRF was merged three days earlier. Knowing the codebase moved the failure from "wrong about the workload" to "wrong about what has already happened" — and the second kind is harder to catch, because the suggestions look specific enough to be true.

The next morning added a fourth false result to the tally, and it was mine again. "All three profiles report the same 1,426,365 blocks, so no new code was reached" was a number read without checking what it counted — a static total that could not have come out any other way. The executed figure was 18% against 24%, a completely different fact. The failure mode is the same one this page keeps documenting, one level further in: not reasoning instead of measuring, but reading an instrument without asking what it measures.

What shipped

5 merged to main
PRChangeMeasured
#1ThinLTO cache + probed lldedit loop 61.5s → 1.31s
#2Profile-guided optimization−11.9% cycles · 54.5 → 59.6 fps
#3Dispatcher single lookup−1.23% instructions
#4Deck stale-runtime guardstale binaries now refuse to package
#5Desktop stale-recompiler guardsilent codegen staleness now caught
#6fmod symbol version pinneddesktop modules now load on a Deck
#7setup.sh glibc floor warningthe class closed, not just the instance

On the Deck this lands as 45–49 → 56.9 fps, with PC↔Deck netplay parity proven byte-identical afterwards. Both packages were rebuilt and verified — the desktop one through a real setup.sh run against the disc, which reproduced the benchmarked module byte for byte, and the Deck one by running its Debian 12 binary against the determinism harness for 6000 frames with matching hashes.