-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Open
Labels
3.14bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedperformancePerformance or resource usagePerformance or resource usagetopic-JIT
Description
We currently remove _CHECK_VALIDITY
ops as part of a final linear pass over JIT code, with the heuristic being:
- If any op escaped since the last validity check, leave it in.
- Otherwise, remove it.
However, this is too strict. A looser, still correct heuristic would be:
- If any op escaped since the last validity check, and we have an optimization that relies on that validity before the next validity check, leave it in.
- Otherwise, remove it.
As a simple example: _POP_TOP
escapes. If we have two POP_TOP
instructions in a row, the JIT will check validity between them, which isn't necessary.
Since it's our optimizations that create a reliance on validity checks, the removal of validity checks and the tracking of validity should be done as part of the abstract interpretation. If could be as simple as calling require_validity(ctx);
whenever we perform a validity-requiring optimization. This helper would just re-insert the last seen _CHECK_VALIDITY
instruction.
Linked PRs
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedperformancePerformance or resource usagePerformance or resource usagetopic-JIT