Skip to content

gh-130090: Support PGO for clang-cl#129907

Merged
zooba merged 24 commits intopython:mainfrom
chris-eibl:clang-pgo
Mar 4, 2025
Merged

gh-130090: Support PGO for clang-cl#129907
zooba merged 24 commits intopython:mainfrom
chris-eibl:clang-pgo

Conversation

@chris-eibl
Copy link
Member

@chris-eibl chris-eibl commented Feb 9, 2025

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

  • running the instrumented pgo tests is much faster
  • the PGO step is faster

Some thoughts:

  • Linux uses -flto-thin to improve build time over execution time. Tried it, doesn't cost much in run time, but speeds up the build a lot.
  • There are still many warnings. I've fixed many of them, if interested, we can do them in follow-up PRs. IMHO, some of them are not benign, e.g.
..\PC\launcher2.c(1081,34): warning : result of comparison of constant 191 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare] [e:\cpython_clang\PCbuild\pywlauncher.vcxproj]
..\PC\launcher2.c(1081,18): warning : result of comparison of constant 187 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare] [e:\cpython_clang\PCbuild\pywlauncher.vcxproj]
  • let clang-cl benefit from _Py_HOT_FUNCTION, etc. Most probably in follow up PRs (very simple and small)

Loading
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.

5 participants