Convert more uops to leave their inputs on the stack to be cleaned up by `_POP_TOP`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Feature or enhancement
Proposal:
This is a follow up to https://github.com/python/cpython/issues/134584
We have, in the JIT, optimizations to eliminate many _POP_TOP operations. To take advantage of that we have converted many uops to leave their operands on the stack and added subsequent _POP_TOPs to remove them.
See https://github.com/python/cpython/issues/134584 for many examples of how to do this and why it works.
However, there are still a few uops yet to do. These are:
- LIST_EXTEND
- DICT_UPDATE @Sacul0457
- SET_UPDATE @Sacul0457
- DICT_MERGE @NekoAsakura
- CALL_INTRINSIC_1 @Sacul0457
- CALL_INTRINSIC_2 @KevinH15291
In addition, POP_ITER, END_FOR and END_SEND can be implemented as macro ops, using POP_TOP to gain the benefit of the the POP_TOP optimization.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Linked PRs
- gh-145964
- gh-145979
- gh-146170
- gh-146177
- gh-146185
- gh-146190
- gh-146262
- gh-146329
- gh-146383
- gh-148227
- gh-148477
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading follow-up issue 134584 for the described conversion pattern and review the listed remaining uops: LIST_EXTEND, DICT_UPDATE, SET_UPDATE, DICT_MERGE, CALL_INTRINSIC_1, and CALL_INTRINSIC_2. Also examine how POP_ITER, END_FOR, and END_SEND are represented; done means these operations use the proposed stack cleanup approach, but linked PRs show that work is already underway.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100