Convert more uops to leave their inputs on the stack to be cleaned up by `_POP_TOP`
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读后续 issue 134584,了解其中描述的转换模式,并检查列出的剩余 uops:LIST_EXTEND、DICT_UPDATE、SET_UPDATE、DICT_MERGE、CALL_INTRINSIC_1 和 CALL_INTRINSIC_2。还要检查 POP_ITER、END_FOR 和 END_SEND 的表示方式;完成意味着这些操作使用提议的栈清理方案,但链接的 PR 表明这项工作已经在进行中。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- compilers, performance
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100