-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
gh-111786: Turn off optimize for speed for _PyEval_EvalFrameDefault on MSVC #111794
Conversation
mdboom
commented
Nov 6, 2023
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: PGO build broken on Windows #111786
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.
LGTM. @markshannon or @brandtbucher can merge if they agree.
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.
3-10% faster and fixes the build. Sounds good to me 🙂
I'd like @zooba's approval though, in case we missed something.
My only question would be whether we know that turning The results seem to be okay for PGO builds, but regular builds may suffer a regression if optimisation is just turned off. (For debug builds we have it off deliberately, and would want to avoid turning it on.) |
Converting to draft -- I'm seeing some non-determinacy to this fix, so we should hold off on merging until I get to the bottom of it. |
I see this has been re-opened. Did you figure out the issue? If so, it looks like it's ready to merge (assuming we aren't seeing a regression on non-PGO builds). |
I couldn't find a way to directly introspect this. However, I decided to try to forcibly turn "s" on after turning "t" off and compare the results to this PR, e.g.:
Using SizeBench, I was able to confirm that both that and this PR generate the same size code for So that (might be) indirect evidence at least that we still get size optimization this way. |
Yes, it was entirely me not seeing the difference between
I just fired off some benchmarking runs to test the effect of this on non-PGO builds. It will take a few hours to get the results back. |
I blame "that's a rough API design". |
Unoptimised code will be huge by comparison - 2x or more. Sounds like we're still getting the optimization. |
And some level of PGO is still happening, as evidenced by the split into hot and cold paths.
Unfortunately, it seems this causes an 11% regression on non-PGO builds. (This is comparing non-PGO or this PR vs. a non-PGO build of its base 9f33ede). If we care about this (I'm not sure we do -- that's a question for someone with more knowledge of the history of Windows builds). We can probably disable this |
FYI, I'd suggest |
I have updated this to only disable the optimization when doing a PGO build.
EDIT: I take that back -- with a clean build this works, and is simpler. |
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.
LGTM. Let me know when you're ready for this to be merged.
@gvanrossum: As far as I know this is ready, but maybe @zooba should have one more quick look. |
I'm just going to merge it, it looks great. |
…SVC for PGO (python#111794) In PGO mode, this function caused a compiler error in MSVC. It turns out that optimizing for space only save the day, and is even faster. However, without PGO, this is neither necessary nor slower.
…SVC for PGO (python#111794) In PGO mode, this function caused a compiler error in MSVC. It turns out that optimizing for space only save the day, and is even faster. However, without PGO, this is neither necessary nor slower.