Skip to content
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-120619: Tier 2 partial evaluation pass foundations #123652

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

Fidget-Spinner
Copy link
Member

@Fidget-Spinner Fidget-Spinner commented Sep 3, 2024

This PR sets up a tier 2 partial evaluation pass' foundations. It does the following:

  1. Introduce binding-time analysis of instructions and locals.
  2. Virtualized stack values (This was why we need a local slot now to indicate if the stack value is virtualized).
  3. A new abstract interpreter -- one for partial evaluation.
  4. Symbolic stack reification -- reconstructing the stack when we need to/hit a non-static instruction.
  5. It removes most pure annotations -- we need to reimplement those in the partial evaluator for every one we introduce. Otherwise it will do arbitrary optimizations on them.

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 PR does not yet have full shadow stack reconstruction on side-exits. Because that first requires a principled design of side-exits. Thus after this PR lands, that needs to be worked on.

@Fidget-Spinner
Copy link
Member Author

No slowdown which is great to see. Since this pass currently does no optimizations at all https://github.com/faster-cpython/benchmarking-public/tree/main/results/bm-20240904-3.14.0a0-a6bc1a0-JIT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant