Skip to content

PGO Tweaks#1022

Merged
jjhelmus merged 3 commits intomainfrom
gps-pgo-tweaks
Mar 23, 2026
Merged

PGO Tweaks#1022
jjhelmus merged 3 commits intomainfrom
gps-pgo-tweaks

Conversation

@indygreg
Copy link
Copy Markdown
Collaborator

@indygreg indygreg commented Mar 21, 2026

See commit messages and inline comments for more details.

Some of these are good candidates for up-streaming. Although we make assumptions about availability of [modern] LLVM. So upstream patches may require configure work to sniff toolchain capabilities. It was vastly easier to implement the simple patches in PBS first.

@indygreg indygreg marked this pull request as ready for review March 21, 2026 04:46
LLVM has some utilities to print statistics about PGO data. Let's
print a few views so we can better debug PGO instrumentation.
This is more reliable. See comment in added patch for context.
Contrary to popular belief, the system doesn't need to be "idle" to
collect profiling data. See inline comment +
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
for the PGO implementation for the evidence.
Comment on lines +8 to +9
%p expands to the process ID. While unlikely, PID collisions can occur,
leading to loss of data.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you actually run into a collision? Especially in our CI runners we shouldn't have so many things running to trigger PID reuse, and it's easy to bump the max PID number (the kernel default is low for human friendliness but I think it can go up to at least 2^31). But no actual objection to this patch, especially if it's upstreamed at some point.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. But I plan to enable PGO training against the full test harness in the near future and this will increase probability of a collision.

PID based naming alone isn't reliable and I wanted to change this out of principle.

@jjhelmus jjhelmus merged commit 62384e8 into main Mar 23, 2026
539 of 540 checks passed
@jjhelmus jjhelmus deleted the gps-pgo-tweaks branch March 23, 2026 21:55
@zanieb
Copy link
Copy Markdown
Member

zanieb commented Mar 23, 2026

Can we create some issues for upstreaming per #886

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants