Skip to content

Add support for SamplePGO #76532

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

Merged
merged 2 commits into from
Nov 2, 2024
Merged

Add support for SamplePGO #76532

merged 2 commits into from
Nov 2, 2024

Conversation

kavon
Copy link
Member

@kavon kavon commented Sep 17, 2024

Adds the following flags to swift-frontend:

  • -debug-info-for-profiling, matching clang's -fdebug-info-for-profiling. It includes DWARF discriminators to the debug info so that PC samples can be mapped back to individual basic blocks.
  • -profile-sample-use=<FILE>, matching clang's -fprofile-sample-use=. It takes a sampling-based profile file emitted from llvm-profdata.

Currently, these are "frontend only" flags, so you'd need to use swiftc -Xfrontend -profile-sample-use=... to trigger their functionality.

rdar://135443278

@kavon kavon force-pushed the samplepgo branch 3 times, most recently from e28ddc1 to da65ed4 Compare October 28, 2024 23:13
@kavon kavon marked this pull request as ready for review October 28, 2024 23:13
@kavon
Copy link
Member Author

kavon commented Oct 28, 2024

@swift-ci test

@kavon
Copy link
Member Author

kavon commented Oct 31, 2024

@swift-ci smoke test

@kavon kavon force-pushed the samplepgo branch 2 times, most recently from cc2ab0b to 7773ced Compare November 1, 2024 18:50
kavon added 2 commits November 1, 2024 11:59
This is meant to match clang's `-fprofile-sample-use=` and accepts a
file with the same format.

rdar://135443278
This achieves the same as clang's `-fdebug-info-for-profiling`, which
emits DWARF discriminators to aid in narrowing-down which basic block
corresponds to a particular instruction address. This is particularly
useful for sampling-based profiling.

rdar://135443278
@kavon
Copy link
Member Author

kavon commented Nov 1, 2024

@swift-ci test

@kavon kavon enabled auto-merge November 1, 2024 19:06
@kavon kavon merged commit 86601fc into swiftlang:main Nov 2, 2024
5 checks passed
@kavon kavon deleted the samplepgo branch November 5, 2024 19:30
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.

1 participant