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
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.7k
PLDI '21論文読み会: Specification Synthesis with Constrainted Horn Clauses
ideininc
0
1.6k
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.6k
PLDI '21論文読み会: Quantum Abstract Interpretation
ideininc
0
1.6k
PLDI '21論文読み会: Provable Repair of Deep Neural Networks
ideininc
2
1.8k
会社紹介資料/Idein株式会社
ideininc
0
53k
Other Decks in Research
See All in Research
「車1割削減、渋滞半減、公共交通2倍」を 熊本から岡山へ@RACDA設立30周年記念都市交通フォーラム2026
trafficbrain
1
580
Dwangoでの漫画データ活用〜漫画理解と動画作成〜@コミック工学シンポジウム2025
kzmssk
0
110
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
120
説明可能な機械学習と数理最適化
kelicht
2
980
20年前に50代だった人たちの今
hysmrk
0
160
Collective Predictive Coding and World Models in LLMs: A System 0/1/2/3 Perspective on Hierarchical Physical AI (IEEE SII 2026 Plenary Talk)
tanichu
1
260
Sat2City:3D City Generation from A Single Satellite Image with Cascaded Latent Diffusion
satai
4
700
Earth AI: Unlocking Geospatial Insights with Foundation Models and Cross-Modal Reasoning
satai
3
530
Grounding Text Complexity Control in Defined Linguistic Difficulty [Keynote@*SEM2025]
yukiar
0
120
[IBIS 2025] 深層基盤モデルのための強化学習驚きから理論にもとづく納得へ
akifumi_wachi
19
9.7k
湯村研究室の紹介2025 / yumulab2025
yumulab
0
310
Satellites Reveal Mobility: A Commuting Origin-destination Flow Generator for Global Cities
satai
3
550
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.4k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
270
Game over? The fight for quality and originality in the time of robots
wayneb77
1
120
Fireside Chat
paigeccino
41
3.8k
The Cost Of JavaScript in 2023
addyosmani
55
9.5k
Thoughts on Productivity
jonyablonski
75
5.1k
How to Talk to Developers About Accessibility
jct
2
140
Navigating Team Friction
lara
192
16k
Abbi's Birthday
coloredviolet
2
4.9k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
120
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
840
A Tale of Four Properties
chriscoyier
162
24k
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