Uh oh!
There was an error while loading. Please reload this page.
GH-144651: Optimize the new uops added when recording values during tracing. - #144948
Conversation
* Handle dependencies in the optimizer, not the tracer * Strengthen some checks to avoid relying on optimizer for correctness
Fidget-Spinner
left a comment
There was a problem hiding this comment.
This is a really good simplification. Thanks for doing it. Just two comments.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| int delta = (int)(new_stack_pointer - current_sp); | ||
| assert(delta >= 0); | ||
| if (delta) { | ||
| /* Shift existing stack elements up */ |
There was a problem hiding this comment.
Hmm this is suspicious. How safe is this?
There was a problem hiding this comment.
I'll add a guard above that new_stack_pointer is within the limits of the array.
Uh oh!
There was an error while loading. Please reload this page.
Fidget-Spinner
commented
Feb 18, 2026
CI is failing because unoptimized traces can now just execute through invalidated code objects. That's intentional right? As the guard now handles those. I think you can just add |
Uh oh!
There was an error while loading. Please reload this page.
…ring tracing. (pythonGH-144948) * Handle dependencies in the optimizer, not the tracer * Strengthen some checks to avoid relying on optimizer for correctness
…ring tracing. (pythonGH-144948) * Handle dependencies in the optimizer, not the tracer * Strengthen some checks to avoid relying on optimizer for correctness
This PR adds optimizations for the new uops added in #144179 and also removes dependencies tracking from the front-end.
By splitting the optimizer stack into two parts, one for locals and one for the evaluation stack, we are able to use the stack before knowing the size of the frame. This is necessary as guards can happen after we set local or stack values, e.g in
_FOR_ITER_GEN_FRAMEAlso includes some small fixes to ensure that the code emitted by the front-end is stand-alone, meaning that it does not depend on watchers or the optimizer for correctness.
Also add a couple of missing invalidations for instrumentation.