-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
GH-136410: Faster side exits #136411
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
base: main
Are you sure you want to change the base?
GH-136410: Faster side exits #136411
Conversation
// from being immediately detected as cold and invalidated. | ||
cold->vm_data.warm = true; | ||
if (_PyJIT_Compile(cold, cold->trace, 1)) { | ||
Py_DECREF(cold); |
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.
It's immortal. Decrefing won't do anything. I think you mean to call the dealloc function on it?
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.
Good spot. I think I need to move making it immortal to after it is fully created.
@pablogsal any ideas what this failure means? https://github.com/python/cpython/actions/runs/16140914160/job/45547999926?pr=136411 |
Is a race condition in the tests that will be fixed by #136347 |
Performance is in the noise:
However, I wouldn't expect much of a speedup by reducing the size of exits, so this seems reasonable. |
I think the benchmarking public mirror is down. Can you please share the link when it comes up again? |
This PR reinstates the
_COLD_EXIT
uop, but this time expects the exit to be passed, not the executor.This way we only need one jitted stub, not hundreds.
Using stubs hugely simplifies
_EXIT_TRACE
as all it needs to do is jump to the exit's executor.The x86-64 stencil for
_EXIT_TRACE
shrinks from 384 bytes to 36 bytes, although it does require one extra_CHECK_VALIDITY
(19 bytes) to be added to each trace.Since traces often contain multiple
_EXIT_TRACE
s this is a substantial space saving.