Repository navigation
Description
The -pgo release builds apply profiles that are committed to the repository (lichii-windows.profdata, eglantine.profdata). As nx2 moves, LLVM drops the profile of every function whose control flow changed since the profile was trained, and those are mostly the functions being worked on, which are the hot ones.
Windows, from the public CI log. Run 45106098730 (build 393, nx2 136b9a6, 23 Nov), job "windows-x86_64-pgo binary", prints 655 function control flow change detected (hash mismatch) … count discarded [-Wbackend-plugin] warnings; 334 of them discard a non-zero count. Run 45319474804 (build 399, nx2 107ce81, 24 Nov) prints 664, 336 non-zero. lichii-windows.profdata was last committed on 17 Nov (fb5f22f). The largest discarded counts in build 393:
| function | discarded count |
|---|---|
VideoCommon::GpuSplit::BackLoop |
1,095,161,927 |
Common::HostMemory::TrimZeroPages |
901,548,098 |
Tegra::Engines::Maxwell3D::FrontWrite |
424,244,671 |
VideoCommon::GpuSplit::WaitFor |
355,552,573 |
Tegra::DmaPusher::CallMethod |
226,627,270 |
Maxwell3D::WriteBoundConstantBuffer |
182,395,773 |
GpuSplit::Drain |
180,090,370 |
GpuSplit::Execute |
147,198,951 |
Maxwell3D::WriteStateRegisters |
136,704,435 |
RasterizerVulkan::FlushRegion |
76,692,825 |
By file: vk_rasterizer.cpp 91, vk_buffer_cache.cpp 24, vk_texture_cache.cpp 19, maxwell_3d.cpp 16, kepler_compute.cpp 14, vk_pipeline_cache.cpp 13, gpu_split.cpp 12. So the GPU command front end and the split's back loop are compiled without a profile in that build.
Linux: the same, but hidden. The Linux PGO step passes -Wno-backend-plugin (the Windows step uses -Wno-error=backend-plugin), so the log shows nothing. eglantine.profdata, which linux-x86_64-pgo and linux-aarch64-pgo use, was last committed on 31 October (919368b). Building nx2 107ce81 with the workflow's flags and the same compiler (Ubuntu clang 23.1.6 from apt.llvm.org), with only that warning turned back on, drops the profile of 1,231 functions, 621 of them with non-zero counts: src/video_core 415 (279 non-zero), src/core 400 (170), src/dynarmic 249 (78). The largest:
| function | discarded count |
|---|---|
Maxwell3D::FrontRunMacro |
41.93 G |
Maxwell3D::FrontWrite |
32.97 G |
Maxwell3D::CallMethod |
17.88 G |
DmaPusher::CallMethod |
16.25 G |
GpuSplit::BackLoop |
10.46 G |
Shader::Maxwell::Decode |
10.25 G |
BufferCacheRuntime::TickFrame |
8.67 G |
MemoryManager::GpuToCpuAddress |
7.64 G |
The profile's maximum function count is 37.2 G, so the two hottest functions in it are among the dropped. (Built without the Qt frontend, so its files are not counted. One file, vk_texture_cache.cpp, was compiled with #2478's two-line rename applied, because our configure had ENABLE_WERROR at its default and clang rejects the shadowed device there; 24 of the 1,231 come from that file.)
What it costs, measured. Steam Deck OLED (RADV), Ocarina of Time, Kokiri Forest, one tree (our fork's build 7, 81aaf9c), one compiler (clang 23.1.4), interleaved runs, standing / panning fps:
| profile | standing | panning | functions dropped (with counts) |
|---|---|---|---|
| trained that day on that tree | 19.51 | 15.69 | 5 (1) |
| trained 8 days earlier (15 Nov) | 18.57 | 15.41 | 770 (366) |
none (build.ninja has no fprofile) |
17.90 | 14.43 | – |
The first two rows are four rounds in rotated order in one session; the third is six runs of a no-profile build over two sessions the next morning, two of them interleaved with the fresh-profile build (16.85 / 14.46 and 17.96 / 14.50 against 19.78 / 15.99 and 19.46 / 15.93). So a profile that matches the code is worth about 10 % on this machine, standing and panning, and after eight days it had lost about half of that standing: 5.1 % against the fresh one. The dropped functions were the same family as in the lists above (FrontWrite, FrontRunMacro, GpuSplit::BackLoop, Backoff, Execute, Drain, WaitFor, DmaPusher::CallMethod).
Not measured: the fps cost on Windows or NVIDIA, and other games.
Suggestions.
- Make the count visible in both jobs:
-Wno-error=backend-plugininstead of-Wno-backend-pluginon Linux, then count thehash mismatchlines (and those not "up to 0 count") from the build output into the job summary, with a::warning::above a threshold. Our two data points: 5 after a retrain, several hundred after a week; about 50 with non-zero counts would be a reasonable alarm. - Retrain the profiles on the tree being released, or on a schedule; a profile older than a few days of nx2 no longer covers the GPU thread.
- We can send the workflow change as a PR, and release-binaries: give linux-x86_64-pgo a profile trained on Ocarina of Time #1909 (a Linux profile trained on Ocarina of Time) will need its profile retrained before it is worth merging: it is as old as the one measured above.
🤖 Generated with Claude Code
Activity
danieljesus commentedon Nov 24, 2026
A follow-up on the size of the gain. Above I wrote "about 10 %" for a profile that matches the code, from six no-profile runs spread over two sessions. A tighter measurement since then, on a newer tree of our fork with a profile trained on that tree (same Steam Deck, same scene, same clang 23.1.4, four interleaved pairs, standing / panning fps):
That is +6.0 % standing and +7.0 % panning, the profile ahead in all four pairs, with 5 dropped functions in that build (1 with a count). So "about 6 to 7 %" is the better figure for what a matching profile is worth on this machine; the comparison of a fresh profile against an eight-day-old one (5.1 % standing, 770 dropped) is as posted.
Thank you for #2527.
🤖 Generated with Claude Code
https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
capy-ai commentedon Nov 24, 2026
Which fork commit did you use for the four interleaved pairs in this follow-up? The issue already names the revision for the earlier comparison. The newer SHA would let us tie the 6–7% result to the exact build. No rerun needed.
danieljesus commentedon Nov 24, 2026
Both arms were built from the same commit of our fork, danieljesus/Lichii 753a5f3, with nothing local on top, using clang 23.1.4 and lld: one with no profile at all, the other with a profile trained on that commit. That profile is the
lichii-linux.profdatacommitted in e4c59be on the branchwip/deck/b8-linux-pgo, two commits further on; the commit in between changes a test file only.🤖 Generated with Claude Code
https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF