inplace_elemwise retries an input it already rejected, once per Elemwise output
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 半日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
- 領域
- compilers, performance
調査の方向性
The retry loop is in InplaceGraphOptimizer.try_inplace_on_node, which calls tried_inputs.discard(i) after an InconsistencyError; the inplace_elemwise rewrite in pytensor/tensor/rewriting/elemwise.py drives it. Run the 400-output snippet with the py linker and time it, then compare against the excluded-rewrite run. Done when compile time drops substantially and the in-place node count in the test suite is unchanged.
索引モデルが issue の本文から書いたものです。
説明
inplace_elemwise, the rewriter that lets Elemwise nodes overwrite their inputs, takes time close to cubic in the number of outputs of a fused Elemwise whose inputs can't be destroyed. When an attempt raises InconsistencyError, InplaceGraphOptimizer.try_inplace_on_node calls tried_inputs.discard(i) and offers the same input to the next output. Every reason DestroyHandler rejects a destroy depends on the input, not the output, so each retry fails, and each one replaces and reverts all of the node's outputs.
import time
import pytensor
import pytensor.tensor as pt
from pytensor.compile.mode import Mode
x = pt.matrix("x", shape=(7, 7))
X = x @ x
outputs = [pt.exp(X + k) for k in range(400)] # fused into one Elemwise with 400 outputs
y = pt.join(0, X, *outputs) # reads X and every output, so X can't be destroyed
start = time.perf_counter()
pytensor.function([x], y, mode=Mode(linker="py", optimizer="fast_run"))
print(f"{time.perf_counter() - start:.1f} s") # 13.1 s
# workaround: Mode(linker="py", optimizer="fast_run").excluding("inplace_elemwise") compiles in 0.4 s
inplace_elemwise alone takes 0.07, 0.38, 2.15 and 13.8 s at 50, 100, 200 and 400 outputs. In a real graph with a 364-output Elemwise feeding a 1114-input Scan, rewriting took 66 s. With the retry removed it took 30 s, and the compiled graph had the same 1369 nodes and 210 in-place nodes.
- 主要言語
- Python
- スター
- 655
- フォーク
- 266
- 平均マージ
- 3日 23時間
- マージ済み PR(30日)
- 43
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pymc-devs/pytensor のほかの issue
-
BUG: cumsum and cumprod keep bool and small integer dtypes, so cumsum(x > 0) is wrong対応中かも @rishabhsai が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
Docs of mode still mentions C/CVM as the default with FAST_RUN対応中かも @ADITYASINGH1206 が 13 日前に担当しました。 オープンdocs
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
pymc-devs/pytensor#2641 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Update conditions page in docs対応中かも @caxaxa が 3 日前に担当しました。 オープンdocs
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
BUG: geomspace returns wrong sign for the endpoints when start and stop are negative対応中かも @mayuriphad が 32 日前に担当しました。 オープン
難易度 2/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
Reciprocal.impl computes np.float32(1.0) / x: float32 precision for float64 scalars under NEP 50 (Python linker)再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
pymc-devs/pytensor#2430 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
pymc-devs/pytensor の issue をすべて見る
似ている issue
-
triage
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
kornia/kornia-rs#1416 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
ui
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
PolicyEngine/ai-inequality#64 ·
メンテナーはふだん 1 日以内に返信
-
LinearGaussianStateSpace.dist splits states and observations wrongly when the transition varies over time対応中かも @PabloRoque が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
pymc-devs/pymc-extras#839 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信