-
-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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-118093: Remove invalidated executors from side exits #121885
Conversation
I'm worried about performance here. If a program has ~10_000 traces, checking all of them to invalidate only a few is bad enough. Having to traverse all the exits in all the executors would be considerably worse. If checking for validity at the start of every trace is too expensive, we can modify the trace when invalidated instead:
Can you make an issue for this? This seems like a bug, rather than just a performance issue. Regarding performance: |
After our discussion: I'll punt on iterating over all side exits (we can save this for proper GC of cold traces). Instead, I'll just modify |
LGTM. |
When we invalidate executors, they get removed from the bytecode, but not from side exits. This is unfortunate, since:
_START_EXECUTOR
instructions fail right now).This changes the invalidation machinery to walk over all side exits on valid traces and wipe out affected executors when they are invalidated. It should be impossible to enter an invalid executor now.
As a related cleanup:
_Py_Executors_InvalidateDependency
currently does some gymnastics to do the right thing in the face of memory pressure. I've replaced this with a fallback path that just wipes out all executors, since this is correct, simpler, and arguably the right thing to do anyways in this rare case.No perf impact, minor improvements to stats (1% fewer tier one instructions, 1% more uops executed, and slight increases in traces created and optimizations attempted with no change in number of traces executed).