-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-120619: Tier 2 partial evaluator foundations #124910
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
Conversation
This reverts commit 4361821.
@markshannon I split it out into its own files, and own symbols, so it doesn't share the type information too. This simplifies the lattice quite a bit. |
if (length <= 0) { | ||
return length; | ||
} |
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.
if (length <= 0) { | |
return length; | |
} |
We'll anyway return length
in line 310
@@ -0,0 +1,303 @@ | |||
"""Generate the cases for the tier 2 partial evaluator. | |||
Reads the instruction definitions from bytecodes.c, optimizer_bytecodes.c and partial_evaluator_bytecodes.c | |||
Writes the cases to partial_evaluator_cases.c.h, which is #included in Python/optimizer_analysis.c. |
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.
Writes the cases to partial_evaluator_cases.c.h, which is #included in Python/optimizer_analysis.c. | |
Writes the cases to partial_evaluator_cases.c.h, which is #included in Python/partial_evaluator.c. |
I have a different approach in mind. |
This PR sets up a tier 2 partial evaluation pass' foundations. It does the following:
As a litmus test, it does simple dead store elimination by tracking locals. For example, the code
x = x
is now optimized to a nop.This is different than the previous PR at #123652. The main difference is that we create the residual in-place. By "looking backwards" at the originating instruction and marking that as virtual/non-virtual. If you want a visualization of how this will work. See Mark's talk at EuroPython 2023 here https://youtu.be/dgrtgtT-UXM?t=1198.
Also up for discussion: the generator for the partial evaluator is exactly the same as the specializer. Should I just remove it?