[論文レビュー] Canonicalization of Batched Einstein Summations for Tuning Retrieval
この論文は、バッチ化されたアインシュタイン総和表現のグラフベースの正規化を導入し、Feinsumという表形式ベースのシステムで再利用可能かつほぼ最適なコード変換を実現する。関連ベンチマークでJAXより幾何平均4.7xのスピードアップを達成。
We present an algorithm for normalizing \emph{Batched Einstein Summation} expressions by mapping mathematically equivalent formulations to a unique normal form. Batches of einsums with the same Einstein notation that exhibit substantial data reuse appear frequently in finite element methods (FEM), numerical linear algebra, and computational chemistry. To effectively exploit this temporal locality for high performance, we consider groups of einsums in batched form. Representations of equivalent batched einsums may differ due to index renaming, permutations within the batch, and, due to the commutativity and associativity of multiplication operation. The lack of a canonical representation hinders the reuse of optimization and tuning knowledge in software systems. To this end, we develop a novel encoding of batched einsums as colored graphs and apply graph canonicalization to derive a normal form. In addition to the canonicalization algorithm, we propose a representation of einsums using functional array operands and provide a strategy to transfer transformations operating on the normal form to \emph{functional batched einsums} that exhibit the same normal form; crucial for fusing surrounding computations for memory bound einsums. We evaluate our approach against JAX, and observe a geomean speedup of $4.7 imes$ for einsums from the TCCG benchmark suite and an FEM solver.
研究の動機と目的
- 科学計算ワークロードにおけるバッチ化されたeinsumsの再利用可能で高性能な実装の必要性を動機づけ、形式化すること。
- データ再利用を捉えるために、バッチ化einsumsとその同型を定義すること。
- タブ化最適化のためにバッチ化einsumsを一意の正規形へ写像する正規化手順を開発すること。
- 再利用可能なデータベースを通じて理想化されたバッチ化einsumsから実用的な機能的バッチ化einsumsへの最適化移行を可能にすること。
- 機能的バッチ化einsumsを実装(Feinsum)し、機能的なバッチ化einsumsを理想化された形に一致させ、コード変換へ写像すること。
提案手法
- 共有表記とバッチごとのオペランドを持つ無順序集合としてのバッチEinstein総和を定義すること。
- 単一のeinsumおよびバッチ化バリエーションの同型定義を用いて同等のバッチ化einsumsをモデル化すること。
- 色付き有向グラフ(誘導グラフ)へ写像する三段階の正規化を開発すること、グラフを正準化し、再びバッチ化einsumへ写像すること。
- グラフ正準化を用いて、同型のバッチ化einsumsが同一の表現を持つ正規形を生成すること。
- オペランドをラムダ式とする機能的バッチ化einsumsを導入し、変換知識の移行を促進すること。
- 正規化されたバッチ化einsumsの変換を格納し、実用プログラムへの適用と取得をサポートするデータベースを実装すること。
実験結果
リサーチクエスチョン
- RQ1バッチ化einsumsをどのように正準表示して構文的なばらつきを排除し、最適化の再利用を可能にできるか?
- RQ2グラフベースの正規化(彩色付きグラフ)はバッチ化einsumsとその同型の一意な正規形を生み出すか?
- RQ3理想化されたバッチ化einsumsに対して開発された最適化を、実アプリケーションで使用される機能的バッチ化einsumsへどのように移転できるか?
- RQ4正準形を用いた表形式アプローチは、従来の実装生成ベースの戦略と比較してメモリ制約のあるワークロードで性能を向上させるか?
- RQ5Feinsumのアプローチが実ベンチマークおよびソルバー上で実用的な性能影響を与えるか?
主な発見
- 三段階のグラフベースパイプラインを介して正準形を構築することで、同値クラスが単一の表現へ縮約されることが可能である。
- ラムダオペランドを持つ機能的バッチ化einsumsを用いて、再利用と変換知識の実用プログラムへの移行を促進できる。
- オープンソースのFeinsumシステムは正規化、理想化形へのマッチング、ハイパフォーマンスコード変換へ結びつくデータベース写像を実装している。
- FeinsumはTCCGベンチマーク集合およびFEMソルバーからJAXと比較してバッチ化einsumsの幾何平均4.7xのスピードアップを示す。
- 中間生成物の実体化を要求せずに変換を可能にすることで、メモリ帯域の利用を改善し、メモリ境界のあるレジームに対応している。
- タブ化と最適化知識の再利用によって、バッチ化einsumsのほぼピークに近いカーネルへの現実的な道筋を提供している。
この論文を読む
Nubintのビューアで原文を開き、読みながら気になる箇所をすぐに質問できます。
Nubintでこの論文を読むこのレビューはAIが論文の原文をもとに作成しました。引用する前に原文をご確認ください。