Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: add intra-line discrimination to PGO profiles #59612

Open
prattmic opened this issue Apr 13, 2023 · 1 comment
Open

cmd/compile: add intra-line discrimination to PGO profiles #59612

prattmic opened this issue Apr 13, 2023 · 1 comment
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Performance
Milestone

Comments

@prattmic
Copy link
Member

Currently the CPU pprof profiles used for PGO can only break down samples to the source line level. PCs are also included and more precise, but without the original binary they aren't very useful.

This places artificial limitations on the accuracy of optimizations. e.g., if there are two calls to the same function on the same line, we cannot distinguish which one is hot and which one is cold.

This is even more problematic for some potential optimizations. e.g., basic block level optimizations need basic block weights, but there may be multiple basic blocks on the same line.

There are two obvious choices for this: column numbers or "discriminators".

Column numbers have the advantage of being intuitive and with a stable meaning, but have the downside that some constructs that we'd like to differentiate may still share a column number. e.g., I believe that bounds check comparison, success, and failure (panic) cases all share the same column number.

Discriminators have the advantage of flexibility. The compiler can assign them arbitrarily to every construct we care about. The main downside is potential instability. If two compiler versions generate different discriminator values, then profiles aren't fully compatible across the upgrade.

The pprof format itself does not support either column numbers or discriminators, so they will need to be added somehow.

cc @cherrymui @aclements @rajbarik @jinlin-bayarea

@prattmic prattmic added Performance NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Apr 13, 2023
@prattmic prattmic added this to the Go1.22 milestone Apr 13, 2023
@prattmic prattmic self-assigned this Apr 13, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Apr 13, 2023
@gopherbot
Copy link

Change https://go.dev/cl/560781 mentions this issue: PROTOTYPE: cmd/compile,runtime: add discriminator, plumb to pprof

@gopherbot gopherbot modified the milestones: Go1.22, Go1.23 Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Performance
Projects
Development

No branches or pull requests

2 participants