-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-119258: Eliminate Type Guards in Tier 2 Optimizer with Watcher #119365
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-119258: Eliminate Type Guards in Tier 2 Optimizer with Watcher #119365
Conversation
Looks like a print statement was left in there somewhere. I can try rerunning the benchmarks once you remove it! |
Hey @brandtbucher I may have removed it yesterday but just after you started the benchmark. I looked through the current diff and didn't see anymore. Thanks! Sorry about that. |
to match `typ_version_tag` suggested by @brandtbucher
suggested by @brandtbucher
suggested by @brandtbucher
suggested by @brandtbucher
As per comment by @brandtbucher: > One that performs the mutation partway through execution like this. However, maybe change Foo.attr to 2 so we know it keeps running, but can see the effect of the changed value? I'd also make xxx just another class Bar, since I'm worried that our function watcher branch might invalidate this or something weird since it's just a function.
Thank you @brandtbucher for the review! I resolved most of the comments and left a few responses for ones I was unclear about. |
(You can’t assert it like that, since everything inside the assert is removed in debug builds.) |
Heh, now you’ll get an unused variable warning for It’s probably fine to just omit the assert. If you want to keep it, adding a |
I am not sure if the JIT aarch64 Linux failure is real or spurious:
|
JIT aarch64 errors happen on the other PRs as well. So it's not this PR. Will merge this PR in 24 hours or so. |
Sweet! Were the benchmarks ever re-run on comparing this, or is it not worth it b/c it's probably similar the first time? |
The benchmarks the second time reported no speedup. But the noise range of a bench run is like 1%, so for all we know this couldve sped things up 0.5% but we cant tell. |
Congrats @saulshanabrook ! |
…er (pythonGH-119365) Co-authored-by: parmeggiani <[email protected]> Co-authored-by: dpdani <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Brandt Bucher <[email protected]> Co-authored-by: Ken Jin <[email protected]>
…er (pythonGH-119365) Co-authored-by: parmeggiani <[email protected]> Co-authored-by: dpdani <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Brandt Bucher <[email protected]> Co-authored-by: Ken Jin <[email protected]>
This PR replaces #119259 to more accurately remove
_GUARD_TYPE_VERSION
.With help and guidance from @brandtbucher, I added a global type version watcher to the interpreter, so that we can look at types by their versions.
Then, whenever we see a
_GUARD_TYPE_VERSION
we can add a watcher to that type, and if it isn't changed, the next time we see that type version we can omit the guard.We should see if the performance is improved compared to the other PR, or at least see if it removes more guard type versions.