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

Unify branches and deopts in the tier 2 IR. #111848

Closed
markshannon opened this issue Nov 8, 2023 · 2 comments
Closed

Unify branches and deopts in the tier 2 IR. #111848

markshannon opened this issue Nov 8, 2023 · 2 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@markshannon
Copy link
Member

markshannon commented Nov 8, 2023

The basic premise of optimizing traces is that most branches are highly biased.
So we use DEOPT_IF to branch in the uncommon case.
However in the optimizer we may want to move work to exit branches, which needs jumps.
Unifying branches and jumps also simplifies the tier 2 interpreter and the JIT compiler.

So, let's merge jumps and branches, as follows:

  • Convert most, if not all jumps in the tier 2 code to DEOPT_IFs in bytecodes.c
  • Convert deopts into jumps internally to allow work like SET_IP to be sunk into exit branches.

See also #111610

Linked PRs

@brandtbucher
Copy link
Member

Yes please! :)

@Eclips4 Eclips4 added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Nov 13, 2023
markshannon added a commit that referenced this issue Nov 15, 2023
* Replace jumps with deopts in tier 2

* Fewer special cases of uop names

* Add target field to uop IR

* Remove more redundant SET_IP and _CHECK_VALIDITY micro-ops

* Extend whitelist of non-escaping API functions.
gvanrossum added a commit that referenced this issue Nov 20, 2023
Also avoid compiler warnings about unused 'reserved' variable.
@gvanrossum
Copy link
Member

Do you expect more to happen here? It looks complete. :-)

aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
* Replace jumps with deopts in tier 2

* Fewer special cases of uop names

* Add target field to uop IR

* Remove more redundant SET_IP and _CHECK_VALIDITY micro-ops

* Extend whitelist of non-escaping API functions.
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
Also avoid compiler warnings about unused 'reserved' variable.
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
Projects
None yet
Development

No branches or pull requests

4 participants