Improve macOS AArch64 JIT stencils by relaxing GOT loads
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Proposal:
The AArch64 JIT has support for optimising pairs of instructions that load an address through the global offset table (GOT).
On Linux, the JIT optimiser recognises assembly like:
adrp x9, :got:__PyRuntime
ldr x9, [x9, :got_lo12:__PyRuntime]
On macOS, Clang uses a different syntax recognised by the Mach-O linker:
adrp x9, __PyRuntime@GOTPAGE
ldr x9, [x9, __PyRuntime@GOTPAGEOFF]
We can add support for this using the existing patch_aarch64_33rx() function just by adjusting the regex which would enable the same optimisation we already use on Linux:
adrp x9, <__PyRuntime page>
add x9, x9, <page offset>
This is a natural followup to #157040. I have a small patch ready once jit development is unblocked.
Benchmark:
On my M5 MacBook Pro this shows a 1.16% improvement on the pyperformance suite though results are very noisy. Probably best to re-run with the official benchmarking runners.
Expand for full benchmarking results
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:
#148598, #148501, #157040 /cc @diegorusso
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Tools/jit/_optimizers.py の patch_aarch64_33rx() から始め、既存の Linux GOT-load パターンと、ここで説明されている Clang の macOS 構文を比較します。既存の AArch64 最適化が適用されるようにマッチングロジックを更新し、その後 pyperformance スイートまたは公式のベンチマークランナーを実行して結果を確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- macos, python
- 領域
- compilers, performance
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 活発
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 72/100