-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
GH-131521: fix clangcl build on Windows for zlib-ng #131526
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
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1852ff4
fix clangcl build on Windows for zlib-ng
chris-eibl 335009b
use -msse4.2 for adler32_sse42.c
chris-eibl 4bdf82f
Do not use AdvancedVectorExtensions2 for all *.c files,
chris-eibl 3ad6eb2
Merge branch 'main' into fix_clangcl_zlibng, because
chris-eibl b651937
// DO NOT MERGE - just triggering Windows tail-call CI)
chris-eibl 5d423d5
fix clang-cl PGO build
chris-eibl 123e047
remove trigger comment from ceval_macros.h
chris-eibl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since zlib-ng is compiled into a static lib, it won't produce any profile data. It is the first target that is built (after the
_freeze_module
)cpython/PCbuild/pcbuild.proj
Lines 49 to 51 in 9962469
But since there is no
\$(TargetName)_*.profraw
for itcpython/PCbuild/pyproject-clangcl.props
Lines 16 to 18 in 9962469
MergeClangProfileData
won't createprofdata.profdata
:cpython/PCbuild/pyproject-clangcl.props
Lines 26 to 28 in 9962469
IMHO, this is the best fix (instead of just setting
SupportPGO=false
for it):-fprofile-instr-generate
python314.dll
and (hopefully?) happily contribute its part topython314.profraw
zlib-ng!1.pgc
andzlib-ng.pgd
either. No idea whether it gets PGOed there, but the same idea applies? The difference is just, that MSVC does not produce a hard error if the profile data isn't there, whereas clang does (TRACKEDEXEC : error : Error in reading profile profdata.profdata: no such file or directory
), and I still have found no way to make that a warning :(There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about it again, instead of doing the
-fno-profile-instr-use
trick in thePGUpdate
phase, it would be better, to just create the lib once instead of twice (like I've recently done for the_freeze_module
).There is no need to build the lib twice (same holds true for the MSVC case)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it a quick try:
StaticLibProjects
likeFreezeProjects
inpcbuild.proj
is simple and straight forward.ProjectReference Include="zlib-ng.vcxproj
conditional (otherwise it would still be built in thePGUpdate
phase) - ok, doable.zlib.h
is no longer found, because it is generated into$(IntDir)zlib.h
- likewise$(IntDir)zlib-ng.h
. So stopping here :)So turns out to be not so easy and I'd like to keep that for a follow-up PR (if at all).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed the call counts for PGO are going straight into each project that references it, since a static lib is essentially just a bundle of .obj files and so the link-time optimisation happens in the referencing project, not the static lib project.
Which means yes, it's participating in PGO, and it doesn't require rebuilding. Though it's not going to hurt that badly, so I'd tend towards decoupled build configuration (it would be easy to fix by moving the header file regeneration into pythoncore.vcxproj, but that's bad coupling).
Possibly we could make
SupportsPGO
choose the definition ofIntDir
and then it would usually be a quick rebuild?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but let's do that in a follow-up PR, since it is not really related to clang-cl.
Technically, the
/arch
changes so that the resulting binary can run on legacy CPUs aren't either, but IMHO they are a nice fit here.It would just put some rebase burden onto this PR, if we'd do it in a separate one.