perf_jit activated from a subinterpreter publishes JIT executors with the trampoline's unwind info
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
- 領域
- compilers, performance
調査の方向性
sys.activate_stack_trampoline()、perf_jit オプション、および issue にある subinterpreter の再現手順から始め、PYTHON_JIT=1 を設定した experimental-JIT Linux build 上で実行して、生成された /tmp/jit-.dump を調べます。JIT executor がどのように unwind 情報を受け取るかを追跡し、executor frame に 8-byte perf trampoline の unwind data が付与されなくなった時点で issue は解決したものとみなします。
索引モデルが issue の本文から書いたものです。
説明
Bug report
Bug description:
sys.activate_stack_trampoline() refuses to run while the JIT is active, but it only checks the current interpreter, and the perf state is process-wide. A subinterpreter can activate perf_jit while the main interpreter keeps its JIT.
import sys
from concurrent import interpreters
interpreters.create().exec("import sys; sys.activate_stack_trampoline('perf_jit')")
def hot(n):
t = 0
for i in range(n):
t += i & 3
return t
for _ in range(50):
hot(100000)
With PYTHON_JIT=1 ./python buggy_stuff.py on a --enable-experimental-jit build, the resulting /tmp/jit-.dump holds the JIT's executors (records named py::jit:executor), and every one of them is tagged with the unwind information of the 8-byte perf trampoline. Executor frames look different, so perf produces wrong stacks for samples inside JIT code.
Found while working on https://github.com/python/cpython/pull/157246
CPython versions tested on:
CPython main branch, 3.16
Operating systems tested on:
Linux
Linked PRs
- gh-157258
- gh-157324
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 558
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python/cpython のほかの issue
-
docs pending
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
stdlib type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
stdlib type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
build type-bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
stdlib topic-email type-feature
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
似ている issue
-
🐛 Bug 🔔 Pending processing
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
jumpserver/jumpserver#17584 ·
-
link-check link-check:sphinx-theme
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
modelscope/DiffSynth-Studio#1702 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenHands/extensions#626 · コメント 1 件 ·