python / python/cpython

Improving trace quality by tracking "fitness" and "exit quality"

未关闭
#146,073 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

3.15 performance topic-JIT type-feature
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

Feature or enhancement

Proposal:

The performance of the JIT depends heavily on the quality of the traces that the front-end produces. If traces are too short, very long, overlap a lot, or drop into the interpreter too often, performance suffers.

To avoid those cases of poor performance, we should track two values during tracing:

  • The fitness of the current trace
  • The quality of the end of the trace as a point to stop the trace.

If fitness < exit_quality we should stop the trace.

Fitness:

Fitness should:

  • start high
  • be reduced by branches, how much depending on the bias of branch
  • be reduced (by quite a lot) by backward edges
  • be reduced a small amount by each instruction (to discourage excessively long traces)
  • start lower for non-branch side exits to reduce code replication
Exit quality

Exit quality should be high for:

  • The starting point of the trace (very high for this)
  • ENTER_EXECUTOR instructions
  • Merge points in the control flow graph (will need the bytecode compiler to generate this data)

Exit quality should be low for:

  • Specializable instructions
Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs
  • gh-147966
  • gh-148082
  • gh-148089
  • gh-148301
  • gh-148840
  • gh-148959

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先检查提案的适应度和退出质量标准,然后检查链接的 PR gh-147966、gh-148082、gh-148089、gh-148301、gh-148840 和 gh-148959。当适应度低于退出质量时跟踪停止,并且列出的跟踪、分支、后向边、指令和合并点行为都得到覆盖时,工作即告完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
compilers, performance
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。