python / python/cpython

Relax memory ordering of shared refcount atomics

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

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

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

説明

Feature or enhancement

Proposal:

In the free-threaded build, all operations on ob_ref_shared use sequentially consistent atomics. Full ordering is stronger than the biased reference counting protocol requires, and on ARM64 the ordered instructions are measurably slower under contention. Instead, we could (and I think should) match what C++ shared_ptr implementations do which is relaxed increfs and acquire/release decrefs ^1 ^2 ^3 ^4.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs
  • gh-156135

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

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

はじめの一歩

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

調査の方向性

まず ob_ref_shared の free-threaded 実装を見つけ、リンクされた gh-156135 の作業を確認します。現在の atomic ordering を提案およびそこで引用されている shared_ptr 実装と比較します。ordering の変更が正しく、競合時のパフォーマンスへの影響が検証されれば完了です。

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

評価

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

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

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