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

Update Windows builds to use ClangCL #549

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Update Windows builds to use ClangCL #549

wants to merge 1 commit into from

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Mar 4, 2025

Adding the flag as described in python/cpython#129907

ClangCL looks to provide a 20% runtime performance and build times were purportedly better as well.

This also would let us turn on the tail-calling interpreter for another 10% performance boost.

Waiting to test this until the new CPython 3.14 alpha is out.

@zanieb zanieb added the ci:skip label Mar 4, 2025
@@ -653,6 +653,9 @@ def run_msbuild(
# This can also work around known incompatibilities with the Windows 11
# SDK as of at least CPython 3.9.7.
f"/property:DefaultWindowsSDKVersion={windows_sdk_version}",
# Use ClangCL for better build and runtime performance
# https://github.com/python/cpython/issues/130090
"/p:PlatformToolset=ClangCL",
Copy link

@Fidget-Spinner Fidget-Spinner Mar 5, 2025

Choose a reason for hiding this comment

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

Probably should guard only on 3.14. (It's the first version with Clang PGO, that will guarantee better performance).

Choose a reason for hiding this comment

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

Also, requires python/cpython#130040 to pass on CI. For some reason there's a one line patch required.

Choose a reason for hiding this comment

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

If you are using clang versions below 19, this will furthermore need a fix for python/cpython#130213, due to the problems with intrinsics.

Copy link
Member Author

@zanieb zanieb Mar 9, 2025

Choose a reason for hiding this comment

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

We're using LLVM 19 here (and presumably 20 soon — #553) actually, realized we're only setting up a LLVM toolchain on Unix right now. I will look into the version we're using on Windows.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should teach the build system to pull a pre-built LLVM toolchain from somewhere. The official releases from e.g. https://github.com/llvm/llvm-project/releases/tag/llvmorg-20.1.0 should be fine.

If we use the toolchain built into the GitHub Actions Runner, it will randomly be updated out from under us. Given some sensitivity we've seen around LLVM versions lately, this spooky-action-at-a-distance will likely randomly cause CI to fail.

Best to make CI as deterministic and reproducible as possible.

@zanieb
Copy link
Member Author

zanieb commented Mar 5, 2025

The latest benchmark is at python/cpython#129907 (comment) which shows some regressions, but an average 19% improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants