python / python/cpython

Convert more uops to leave their inputs on the stack to be cleaned up by `_POP_TOP`

オープン
#145,866 コメント 21 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

3.15 interpreter-core performance topic-JIT type-feature
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Feature or enhancement

Proposal:

This is a follow up to https://github.com/python/cpython/issues/134584

We have, in the JIT, optimizations to eliminate many _POP_TOP operations. To take advantage of that we have converted many uops to leave their operands on the stack and added subsequent _POP_TOPs to remove them.
See https://github.com/python/cpython/issues/134584 for many examples of how to do this and why it works.

However, there are still a few uops yet to do. These are:

  • LIST_EXTEND
  • DICT_UPDATE @Sacul0457
  • SET_UPDATE @Sacul0457
  • DICT_MERGE @NekoAsakura
  • CALL_INTRINSIC_1 @Sacul0457
  • CALL_INTRINSIC_2 @KevinH15291

In addition, POP_ITER, END_FOR and END_SEND can be implemented as macro ops, using POP_TOP to gain the benefit of the the POP_TOP optimization.

Has this already been discussed elsewhere?

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

Linked PRs
  • gh-145964
  • gh-145979
  • gh-146170
  • gh-146177
  • gh-146185
  • gh-146190
  • gh-146262
  • gh-146329
  • gh-146383
  • gh-148227
  • gh-148477

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、説明されている変換パターンについて follow-up issue 134584 を読み、残っている uops として列挙されている LIST_EXTEND、DICT_UPDATE、SET_UPDATE、DICT_MERGE、CALL_INTRINSIC_1、CALL_INTRINSIC_2 を確認してください。さらに、POP_ITER、END_FOR、END_SEND がどのように表現されているかも調べてください。完了とは、これらの操作が提案されたスタッククリーンアップのアプローチを使用することを意味しますが、リンクされている PR から、その作業がすでに進行中であることが分かります。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
compilers, performance
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。