_CHECK_FUNCTION interferes with partial evaluation
未关闭
还没有人认领这个 Issue。
interpreter-core
type-feature
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Feature or enhancement
Proposal:
A reminder of how _CHECK_FUNCTION looks like:
tier2 op(_CHECK_FUNCTION, (func_version/2 -- )) {
assert(PyStackRef_FunctionCheck(frame->f_funcobj));
PyFunctionObject *func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj);
DEOPT_IF(func->func_version != func_version);
}
frame->f_funcobj becomes invalid once we start inlining functions. Thus we should "burn in" the function object version to be checked whenever possible, to not interfere with inlining and partial evaluation.
An added benefit is that the "burned in" version is also cheaper as it doesn't have to read from the frame struct, rather reading from the instruction itself in the JIT.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
- gh-126856
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中所示的 _CHECK_FUNCTION tier2 操作开始,检查函数被内联时如何使用 frame->f_funcobj。查看关联的 PR gh-126856,并确定是否可以将函数版本固化到指令中,而不干扰部分求值;完成的标准是,在可能的情况下,版本检查不再依赖已失效的 frame 引用。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, python
- 领域
- backend, compilers, performance
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100