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
分支
36k
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 摘要。