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

Tier 2 abstract interpreter for the optimizer #107557

Closed
3 tasks
Fidget-Spinner opened this issue Aug 2, 2023 · 1 comment
Closed
3 tasks

Tier 2 abstract interpreter for the optimizer #107557

Fidget-Spinner opened this issue Aug 2, 2023 · 1 comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage type-feature A feature request or enhancement

Comments

@Fidget-Spinner
Copy link
Member

Fidget-Spinner commented Aug 2, 2023

Feature or enhancement

(Mega issue) Start doing optimization passes on tier 2 bytecode.

Pitch

The target of tier 2 optimizations is tier 2 bytecode. Abstract interpretation is a natural way to analyze and optimize tier 2 bytecode. We can generate the abstract interpreter from the bytecode DSL

Previous discussion

See faster-cpython/ideas#611

Todo list:

  • Generate a barebones tier 2 abstract interpreter from the DSL.
  • Set up the abstract interpreter. This requires that we pass in the runtime state at the point of entering the executor.
  • Perform partial evaluation. For now, all static comes from LOAD_CONST. Assume everything else is dynamic.

The initial partial evaluation will be bad because it does not have that much static information (we need watchers for methods, functions, global, etc., to make them effectively static). However, that phase can be done in the region formation step before partial evaluation. Someone else can pick them up as a parallel workstream.

Linked PRs

@Fidget-Spinner Fidget-Spinner added the type-feature A feature request or enhancement label Aug 2, 2023
Fidget-Spinner added a commit to Fidget-Spinner/cpython that referenced this issue Aug 2, 2023
@Fidget-Spinner Fidget-Spinner added the performance Performance or resource usage label Aug 2, 2023
Fidget-Spinner added a commit that referenced this issue Aug 15, 2023
Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com>
Co-authored-by: Jules <57632293+juliapoo@users.noreply.github.com>
gvanrossum added a commit that referenced this issue Aug 29, 2023
Also remove NOP instructions.

The "stubs" are not optimized in this fashion (their SAVE_IP should always be preserved since it's where to jump next, and they don't contain NOPs by their nature).
@iritkatriel iritkatriel added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Nov 27, 2023
@Fidget-Spinner
Copy link
Member Author

I now have a clearer idea of what I'm going to do. I'm abandoning this issue and re-creating a new one since most of the description is outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants