Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PLDI '21論文読み会: DNNFusion: Accelerating Deep Neu...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Idein
June 08, 2022
Research
2k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PLDI '21論文読み会: DNNFusion: Accelerating Deep Neural Networks Execution with Advanced Operator Fusion
Idein
June 08, 2022
More Decks by Idein
See All by Idein
会社紹介資料/Idein株式会社
ideininc
0
380
会社紹介資料/Idein株式会社 ※URLが変わりました
ideininc
0
63k
PLDI '21論文読み会: AKG: Automatic Kernel Generation for Neural Processing Units using Polyhedral Transformations
ideininc
0
1.7k
PLDI '21論文読み会: Specification Synthesis with Constrainted Horn Clauses
ideininc
0
1.6k
PLDI '21論文読み会: Cyclic Program Synthesis
ideininc
0
1.7k
PLDI '21論文読み会: High Performance Correctly Rounded Math Libraries for 32-bit Floating Point Representations
ideininc
0
1.6k
PLDI '21論文読み会: Quantum Abstract Interpretation
ideininc
0
1.6k
PLDI '21論文読み会: Provable Repair of Deep Neural Networks
ideininc
2
1.9k
Other Decks in Research
See All in Research
研究室単位での自律的 IPv6接続性確立に向けたAS共同運用モデルの提案と実証
reokashiwa
PRO
0
170
NLP colloquium: AI Safety Survey
kanekomasahiro
0
880
Unified Audio Source Separation (Defense Slides)
kohei_1979
1
630
AGI4OPT:自然言語から数理最適化を導くエ ージェントスキル Translating Human Intent into Mathematical Optimization
mickey_kubo
0
160
シングルチャネルマルチトーカー音声認識の進展
ryomasumura
0
200
260624_NLP-colloquium: Hubness
de9uch1
1
150
羽田新ルート運用6年の検証
1manken
0
180
LINEヤフー データサイエンス Meetup「三井物産コモディティ予測チャレンジ」の舞台裏-AlpacaTechパート
gamella
1
620
SOTAのさらに先へ:厳しい推論制約下での高性能モデルのPost-Training
analokmaus
0
1.4k
The Landscape of Agentic Reinforcement Learning for LLMs: A Survey
shunk031
4
1.1k
ScoreMatchingRiesz for Automatic Debiased Machine Learning and Policy Path Estimation with an Application to Japanese Monetary Policy Evaluation
masakat0
0
310
[Fishers] DIVER OSINT CTF 2026 特化AIエージェントハーネスで挑戦するOSINT CTF
analokmaus
0
400
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
Designing Experiences People Love
moore
143
24k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
400
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.7k
Side Projects
sachag
455
43k
RailsConf 2023
tenderlove
30
1.5k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
440
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.7k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
The Invisible Side of Design
smashingmag
301
52k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
200
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