Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-130039: Tailcall for windows builds#130040

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

Fidget-Spinner
Copy link
Member

@Fidget-SpinnerFidget-Spinner commentedFeb 12, 2025
edited by bedevere-appbot
Loading

colesbury, Wulian233, and chris-eibl reacted with hooray emoji
@Fidget-Spinner
Copy link
MemberAuthor

@mdboom I'm baffled by the error in the CI. By any chance do you know how to fix it?https://github.com/python/cpython/actions/runs/13287244377/job/37098802007?pr=130040

@mdboom
Copy link
Contributor

@mdboom I'm baffled by the error in the CI. By any chance do you know how to fix it?https://github.com/python/cpython/actions/runs/13287244377/job/37098802007?pr=130040

I can try poking at this locally a bit later today, but my first guess is that it's because the equals sign is getting swallowed here:

/p:PlatformToolset clangcl

...soclangcl is just seen as another project name.

I don't really understand the quoting rules for PowerShell -- maybe"/p:PlatformToolset\=clangcl" is needed?

I think I ran into this same problem in bench-runner, and I ultimately gave up and usedcmd rather than PowerShell, which you can do by puttingshell: cmd above therun: ... in the yml file. Seehere for how I solved a similar problem in bench_runner.

Fidget-Spinner reacted with thumbs up emoji

@Fidget-Spinner
Copy link
MemberAuthor

That makes sense. Thanks. Applied the change to use cmd instead!

@Fidget-Spinner
Copy link
MemberAuthor

@chris-eibl I guess we're blocked on getting patches to makeclang-cl build CPython. Currently there's a few build errors which I assume you patched out on your branch? Do you mind upstreaming those patches? I can review them.

@Fidget-Spinner
Copy link
MemberAuthor

Nevermind, I will try to patch them into this PR as well, so that we can do an integration test.

@chris-eibl
Copy link
Member

chris-eibl commentedFeb 12, 2025
edited
Loading

I don't really understand the quoting rules for PowerShell -- maybe"/p:PlatformToolset\=clangcl" is needed?

Yeah, see this part ofbuild.bat -h:

If the argument contains an '=', theentire argument must be quoted (e.g. `build.bat "/p:PlatformToolset=v141"`).

Had a quick look at the PR and everything looks fine to me.

The build log of your latest commit7f91920 shows

  Performing Custom Build Tools   Assembling: D:\a\cpython\cpython\externals\mpdecimal-4.0.0\libmpdec\vcdiv64.asm  error: symbol 'AsyncioDebug' is already defined

I have never seen that error before.

For sure not during assembling, must come out of _asynciomodule.c:

GENERATE_DEBUG_SECTION(AsyncioDebug, Py_AsyncioModuleDebugOffsets AsyncioDebug)

That's the only occurence I've found.

Ah - you've found it yourself while I was typing :)

Interestingly: I cannot reproduce locally for the failing commit7f91920 using:

build.bat --tail-call-interp -p x64 -c Release "/p:PlatformToolset=clangcl" "/p:PreferredToolArchitecture=x64"

with Visual Studio 2022 17.13.0 Preview 5.0, which ships with cl.exe 19.43.34808 and clang 19.1.1.

Let's see whether your latest commit fixes CI - looks promising :)

@mdboom
Copy link
Contributor

Yeah, see this part ofbuild.bat -h:

If the argument contains an '=', theentire argument must be quoted (e.g. `build.bat "/p:PlatformToolset=v141"`).

I'm pretty sure this advice assumes using cmd, not PowerShell (which is the default on Github Actions). Overriding the shell used on Github Actions seems to be the easy solution. The harder solution is figuring out PowerShell's escaping rules...

chris-eibl reacted with thumbs up emoji

@Fidget-Spinner
Copy link
MemberAuthor

with Visual Studio 2022 17.13.0 Preview 5.0, which ships with cl.exe 19.43.34808 and clang 19.1.1.

Let's see whether your latest commit fixes CI - looks promising :)

That didn't fix it :(.

@chris-eibl
Copy link
Member

Ups - still the same error - very weird. No idea atm - sorry ...

Fidget-Spinner reacted with thumbs up emoji

@chris-eibl
Copy link
Member

chris-eibl commentedFeb 12, 2025
edited
Loading

Unfortunately I cannot reproduce locally. Have a different clang version, though. Did also use clang 19.1.6 a lot.

Will fire up a build for this commit ...

Update:
Commit7f91920 builds for me with clang 19.1.6, too:

build.bat --tail-call-interp -p x64 -c Release "/p:PlatformToolset=clangcl" "/p:LLVMToolsVersion=19.1.6" "/p:LLVMInstallDir=clang+llvm-19.1.6-x86_64-pc-windows-msvc"

Fidget-Spinner reacted with heart emoji

@Fidget-Spinner
Copy link
MemberAuthor

Ah.. I think I forgot to add parentheses :) my bad

@Fidget-Spinner
Copy link
MemberAuthor

Nevermind, that didn't fix it. Now that I look at the macros closer, it shouldn't fix it either.

@chris-eibl
Copy link
Member

Really strange why that happens on CI. Cannot reproduce with clang 19.1.1 and 19.1.6.
The CI seems to use 19.1.5 - but hard to believe this is the culprit.

Those macros have been touched recently#129223.
Yet, I never had an issue with clang-cl so far (and still have not).

@Fidget-Spinner
Copy link
MemberAuthor

Fixed it on CI!

chris-eibl, colesbury, AlexWaygood, and Eclips4 reacted with hooray emoji

@Fidget-Spinner
Copy link
MemberAuthor

@zooba gentle ping for a review please. Thanks again for reviewing that other PR on getting PGO working on clang-cl. This should be relatively tame in comparison :).

Fidget-Spinnerand others added2 commitsMarch 5, 2025 17:14
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
@@ -23,7 +23,7 @@ extern "C" {
declaration \
_GENERATE_DEBUG_SECTION_LINUX(name)

#if defined(MS_WINDOWS)
#if defined(MS_WINDOWS) && !defined(__clang__)
Copy link
Member

Choose a reason for hiding this comment

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

Does this need an alternate definition for Windows + clang?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

No, below there's a default that it uses is we're not one of the supported platforms. And that default works for Clang Windows.

@@ -2,12 +2,14 @@ name: Tail calling interpreter
on:
pull_request:
paths:
- '.github/workflows/tail-call.yml'
Copy link
Member

Choose a reason for hiding this comment

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

This feels wrong to me, but if it's needed, then sure. Hopefully someone else can sign off on this part of the change.

Copy link
Member

Choose a reason for hiding this comment

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

This is fine: when changing this file, it's good to run it as well to make sure we didn't break it -- which is rather too easy with YAML.


(And let's strip the trailing spaces.)

Suggested change
-'.github/workflows/tail-call.yml'
-'.github/workflows/tail-call.yml'

(We should addyaml to this list, feel free to include it in the PR if you like:)

types_or:[c, inc, python, rst]

We can't specify the minor version as the apt script doesn't recognize it.
@zooba
Copy link
Member

Looks fine to me.

I hope we can justify (one day) taking options out ofbuild.bat without deprecation periods and warnings. Ithink we probably can. In any case, this PR isn't the cause of sprawling options, so no harm in merging it.

@chris-eibl
Copy link
Member

@zooba: I understand. But doing that options inbuild.bat is the only way to get it configurable without modifying/hardcoding it inpythoncore.vcxproj. Which I manually had to do when tryingcomputed gotos builds in#130090, and thus always had a "dirty repo".

Would it be okay for you if I create a similar PR forcomputed gotos?

Or is there a better way?

@Fidget-SpinnerFidget-Spinner merged commita8ee1e1 intopython:mainMar 11, 2025
47 checks passed
@Fidget-SpinnerFidget-Spinner deleted the tailcall_for_windows branchMarch 11, 2025 02:53
@zooba
Copy link
Member

Environment variables pass through into the build just fine, and are exposed as MSBuild properties (provided we don't immediately overwrite them). I have no problem (well, fewer problems) with enabling a feature by environment variable, it's just the batch file option that worries me.

The main difference is that if we remove the setting and it was only used by environment variable, the build will still succeed. If we remove abuild.bat option, builds will break. So arguably a good dividing line is whether builds ought to break if/when we remove the option - most optimisations and experimental features aren't in that category, IMHO.

Fidget-Spinner and chris-eibl reacted with thumbs up emoji

@chris-eibl
Copy link
Member

That would be fine with me, too. IIUC, e.g. just add

<PreprocessorDefinitions Condition="'$(HAVE_COMPUTED_GOTOS)' == 'true'">HAVE_COMPUTED_GOTOS;%(PreprocessorDefinitions)</PreprocessorDefinitions>

and leave it to the user to

  • either add"/p:HAVE_COMPUTED_GOTOS=true" when invoking build.bat
  • or just set the environment variableHAVE_COMPUTED_GOTOS=true before invoking build.bat

up to their liking.

Either way, build.bat does not have to "learn" all of that things. Might have been better for some of the existing switches, too - but it's too late for that. Maybe not for tailcall, since this is new?

And if it is really important to warn or fail if a variable does not make sense any longer, we could do something like

<Message Text="HAVE_COMPUTED_GOTOS are no longer supported" Condition="$(HAVE_COMPUTED_GOTOS) == "true" Importance="high" />

or

<Error Text="HAVE_COMPUTED_GOTOS are no longer supported" Condition="$(HAVE_COMPUTED_GOTOS) == "true" Code="1" />

Regarding documentation: shall this still be available viabuild.bat -h (still less clutter) or only via PCbuild/readme.txt?

PS: we even could do some meaningful defaults like enabling tail calling if not given andLLVMToolsVersion indicates clang-cl >= 19.x.x.

Likewise, we could enable cg ifHAVE_COMPUTED_GOTOS is not given (or true) but disable it ifHAVE_COMPUTED_GOTOS=false, etc ...

@chris-eibl
Copy link
Member

Ah, and the "switch" shall maybe be namedWITH_COMPUTED_GOTOS in analogy to--with-computed-gotos in the configure script and the other--with things, where build.bat tries to mimic configure.

Naming is always hard :(

@zooba
Copy link
Member

IIUC, ...

Yeah, though I'd test for!= '' rather than a specific value. And it only really needs mentioning inPCbuild\README.txt, probably with a note that they are subject to change at any time.

I'm okay with meaningful defaults, but do be very careful about the checks. It's very easy to break unrelated builds, because basically everything gets evaluated all the time and there's not much in the way of error handling.

seehwan pushed a commit to seehwan/cpython that referenced this pull requestApr 16, 2025
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@hugovkhugovkhugovk left review comments

@ezio-melottiezio-melottiAwaiting requested review from ezio-melottiezio-melotti is a code owner

@AA-TurnerAA-TurnerAwaiting requested review from AA-TurnerAA-Turner is a code owner

@mdboommdboomAwaiting requested review from mdboom

@zoobazoobaAwaiting requested review from zooba

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@Fidget-Spinner@mdboom@chris-eibl@zooba@hugovk

[8]ページ先頭

©2009-2025 Movatter.jp