gh-130090: Support PGO for clang-cl#129907
Merged
zooba merged 24 commits intopython:mainfrom Mar 4, 2025
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per encouragement from @Fidget-Spinner in faster-cpython/ideas#690 (comment) opened as a draft PR:
Support PGO for clang-cl on Windows using a similar approach as done in the Linux makefiles for clang.
I separate the clang-cl profiles into e.g.
obj\314amd64_PGInstrument\__clang_profiles, so that they don't clash with different build configurations.Since pythoncore is built first and not in parallel, this was the easiest spot for me.
Fore sure room for improvements, I am definitely far from being an msbuild / vcxproj expert :)
BTW, clang-cl PGO takes far less time to build compared to MSVC, because
Some thoughts:
-flto-thinto improve build time over execution time. Tried it, doesn't cost much in run time, but speeds up the build a lot._Py_HOT_FUNCTION, etc. Most probably in follow up PRs (very simple and small)