Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PLDI '21論文読み会: DNNFusion: Accelerating Deep Neu...
Search
Idein
June 08, 2022
Research
1
1.9k
PLDI '21論文読み会: DNNFusion: Accelerating Deep Neural Networks Execution with Advanced Operator Fusion
Idein
June 08, 2022
Tweet
Share
More Decks by Idein
See All by Idein
PLDI '21論文読み会: AKG: Automatic Kernel Generation for Neural Processing Units using Polyhedral Transformations
ideininc
0
1.6k
PLDI '21論文読み会: Specification Synthesis with Constrainted Horn Clauses
ideininc
0
1.5k
PLDI '21論文読み会: Cyclic Program Synthesis
ideininc
0
1.6k
PLDI '21論文読み会: High Performance Correctly Rounded Math Libraries for 32-bit Floating Point Representations
ideininc
0
1.5k
PLDI '21論文読み会: Quantum Abstract Interpretation
ideininc
0
1.5k
PLDI '21論文読み会: Provable Repair of Deep Neural Networks
ideininc
2
1.8k
会社紹介資料/Idein株式会社
ideininc
0
50k
Other Decks in Research
See All in Research
病院向け生成AIプロダクト開発の実践と課題
hagino3000
0
440
論文紹介: ReGenesis: LLMs can Grow into Reasoning Generalists via Self-Improvement
hisaokatsumi
0
140
EarthDial: Turning Multi-sensory Earth Observations to Interactive Dialogues
satai
3
410
EcoWikiRS: Learning Ecological Representation of Satellite Images from Weak Supervision with Species Observation and Wikipedia
satai
3
430
[IBIS 2025] 深層基盤モデルのための強化学習驚きから理論にもとづく納得へ
akifumi_wachi
15
8.1k
Pythonでジオを使い倒そう! 〜それとFOSS4G Hiroshima 2026のご紹介を少し〜
wata909
0
1.2k
Satellites Reveal Mobility: A Commuting Origin-destination Flow Generator for Global Cities
satai
3
200
離散凸解析に基づく予測付き離散最適化手法 (IBIS '25)
taihei_oki
PRO
1
620
国際論文を出そう!ICRA / IROS / RA-L への論文投稿の心構えとノウハウ / RSJ2025 Luncheon Seminar
koide3
10
6.3k
POI: Proof of Identity
katsyoshi
0
120
IMC の細かすぎる話 2025
smly
2
780
単施設でできる臨床研究の考え方
shuntaros
0
3.3k
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
18k
GitHub's CSS Performance
jonrohan
1032
470k
How to Think Like a Performance Engineer
csswizardry
28
2.4k
Context Engineering - Making Every Token Count
addyosmani
9
520
Producing Creativity
orderedlist
PRO
348
40k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Site-Speed That Sticks
csswizardry
13
1k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
BBQ
matthewcrist
89
9.9k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Statistics for Hackers
jakevdp
799
230k
Transcript
DNNFusion: Accelerating Deep Neural Networks Execution with Advanced Operator Fusion
Wei Niu1, Jiexiong Guan1, Yanzhi Wang2, Gagan Agrawal1, and Bin Ren1 1: William & Mary 2: Northeastern University 一言でまとめると: Operator Fusionのパターンを一般化すること で 汎用性と最適化性能を上げた 担当:bonotake 2021/9/17, PLDI2021読み会@Idein 2022/06/08 PLDI2021読み会@Idein 1
背景:Operator Fusion • DNNコンパイルでは一般的な最適化パスの1つ • 著者らの経験から、DNN実行時間にはレイヤー数が 極めてクリティカルに効く → operator fusion
は効果的 しかし、従来手法は汎用性の低さに問題があった • Polyhedral analysis → 抽象度が低い • 特定のパターンによるパターンマッチ(TVMなど) → パターンが極めて限定的 2022/06/08 PLDI2021読み会@Idein 2
提案手法:DNNFusion 1. GenericなパターンでFusionするかを判断 • 各オペレータにmapping typeという型を導入 • 組み合わせの “収益性” (profitability)
を導入 • 型の組み合わせ+収益性のあるなしでfusionするかを判断 2. Extended Computational Graph (ECG) の導入 • 普通のCG + mapping type 3. 代数的な性質に基づいたグラフ書き換え 4. Mapping type に基づいた fusion plan generation 実験の結果 • モバイル端末(Galaxy S20)上でTVMの1.5~3.5倍、TFLiteの1.4~3.3倍高速化 • 従来のコンパイラでは非対応だったネットワーク(Faster R-CNNなど)も モバイル端末で動かせるように 2022/06/08 PLDI2021読み会@Idein 3
Mapping type とは • 入力/出力の組が1対1か、1対多か、多対多かで分類したもの • 多対1(convなど)は多対多に分類 • 他に Reorganlize,
Shuffle が存在 2022/06/08 PLDI2021読み会@Idein 4
Mapping type analysis • 接続されている2オペレータの組み合わせをmapping type を基に解析 • 緑:無条件にfusion •
赤:fusionしない • オレンジ:収益性があればfusion Table 3 より 2022/06/08 PLDI2021読み会@Idein 5
収益性 • Mapping typeの組み合わせによっては、fusionするとレイテ ンシが落ちるものがある • そういう場合、fusionすると収益性がある(profitable)かど うかで実際にfusionするかを判断する • 収益性はコストを実測してのプロファイルベースに判断
• Profiling database をあらかじめ持っておくことで効率化可能 • 例:多対多オペレータの後ろにConv(多対1)がある場合 • Expandの場合、1次元の拡張だけなので恐らく悪い影響はない • Resizeの場合、入力を違う次元にコピーするので悪影響があり得る 2022/06/08 PLDI2021読み会@Idein 6
DNNFusionの処理 1. ECGを作成 2. グラフ書き換え 3. Fusion plan の探索・生成 4.
ブロック内最適化 5. コード生成 6. ブロック間最適化 2022/06/08 PLDI2021読み会@Idein 7
グラフ書き 換え • 基本的な代数的性質(結合則、分配則、可換則)に 基づいたグラフの書き換え • strength reduction (のテンソル版)によって書 き換えを判断
2022/06/08 PLDI2021読み会@Idein 8 Figure 2 より
Fusion Plan の探索 • アルゴリズム 1. ECG上で、起点となるオペレータ(seed)を1つ決める • one-to-one オペレータのうち、生成する中間結果のサイズが最小のものを選ぶ
2. 後続のオペレータ(successor)とfusionできるか考える 1. Mapping type で判断できるならそれで 2. 判断できないなら収益性で 3. Fusionできる場合、更に後続ともfusionできるか、再帰的に判定 4. 前につながるオペレータ(predecessor)ともfusion可能か再帰的 に判定 • ただし、successorとは違って複数の候補の1つとだけしかfusionしない 5. unfusedなオペレータがあったら、その中で1からまたやる 2022/06/08 PLDI2021読み会@Idein 9
最適化とコード生成 1. ブロック内最適化 • Shuffle、Reorganizeは大抵 消せるし、それも後続のオペ レータ1つだけ見れば判断がつ く 2022/06/08 PLDI2021読み会@Idein
10 2. コード生成 3. ブロック間最適化 • データレイアウトはここでやる • ブロック内は、その中で“支配的”なオペレータのレイアウトに合わせる
評価1: レイヤー数 • Sumsung Galaxy S20で、レイヤー数をどこまで削減できるかを他のコンパイラ/フ レームワークと比較 • 結果、 •
TVMの1/1.3~1/8.1に削減 • TFLiteの1/1.3~1/8.8に削減 • PyTorch mobileの1/1.6~1/9.3に削減 2022/06/08 PLDI2021読み会@Idein 11
評価2: レイテンシ • 速度が • TVMの1.5~2.5倍 • TFLiteの1.4~3.3倍 • PyTorch
mobileの1.6~9.3倍 • TransformerベースはTVMと比較して特に効果大 • TVMのパターンがハマらないものが多い 2022/06/08 PLDI2021読み会@Idein 12 その他の結果は論文読んでね
まとめ • Operator Fusionのパターンを一般化することで 汎用性と最適化性能を上げた • Mapping type の導入とパターンの整理 •
収益性の導入 • 代数的なグラフ書き換え規則 など 所感 • 特別凄いことはやってないが、みんな悩んでたところをちゃんと整理してまと めたのがエライ • 方向性は正しいように思える • 一部なんかようわからんところがあったけど • ちゃんと結果も出てるしすごい 2022/06/08 PLDI2021読み会@Idein 13