Improve macOS AArch64 JIT stencils by relaxing GOT loads
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- 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 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Tools/jit/_optimizers.py 中的 patch_aarch64_33rx() 开始,将现有的 Linux GOT-load 模式与此处描述的 Clang macOS 语法进行比较。更新匹配逻辑,使现有的 AArch64 优化能够应用,然后运行 pyperformance 套件或官方 benchmarking runner 来检查结果。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- macos, python
- 领域
- compilers, performance
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 活跃
- 描述清晰度
- 描述清楚
- 新手友好度
- 72/100