주요 요점
DNN(Deep Neural Network)를 Mobile에서 구현하는 경우 사생활 보호와 인프라 독립적인 장점.
그러나, Nontrivial Solution으로 취급되어 왔고, Memory Blowup 등의 문제점. Sage로 해결 제안
소개
Additional Training으로 정확도 개선과 최적화 효과 가능.
외부 데이터 교환 최소화.
DNN Training - SAGE 제안
Motivation
SAGE Design
3.1 Automatic Differentiation
AD -> 그래프를 분리하면 최적화 부분에서 저해될 위험이 있으므로 graph optimization을 통합하기 위한 프레임워크(DO->CO graph로 변환)
3.2 Graph level optimization
1. Sym operation
2. Asym operation
3. opaque operation
Just-in time compilation
OpenCL
3.3 Operator Level Optimizations
행렬 연산, Convolution에 많은 메모리 footprint가 소모
모바일 환경에 맞게 Single-Kernal Implementation구현
Copy Operation에 있어서 메모리 용량 많이 소모.
Memory Copy하지 않고 index translation을 통한 메모리 사용량 감소
3.4 Run-time Memory Management
on-line checkpointing 방법 사용
메모리 "가치"를 평가하고, 메모리상에 보존할지 결정 (Latency/Memory)
Hybrid- GPU최적화가 저해될 수 있다 (왜냐하면 low-computing power 때문에 micro-batch size가 너무 작아질 수 있기 때문)
메모리 관리 알고리즘
Algorithm 1 Sage’s runtime memory management
Require: 𝐺 ⊲ List of gradient nodes in the graph
Require: 𝑏𝑎𝑡𝑐ℎ ⊲ Mini-batch size
1: 𝑄 ← BinaryHeap(𝐺) ⊲ Sorted in topological order
2: 𝐷 ← Set ⊲ Prevents infinite loop in checkpointing
3: 𝑚 ← 𝑏𝑎𝑡𝑐ℎ
4: while 𝑏𝑎𝑡𝑐ℎ ≥ 0 do
5: while 𝑛𝑜𝑑𝑒 ← Pop(𝑄) do
6: if 𝑛𝑜𝑑𝑒 ∈ 𝑚𝑒𝑚𝑜𝑟𝑦 then continue
7: Insert(𝐷, Parents(𝑛𝑜𝑑𝑒))
8: if Parents(𝑛𝑜𝑑𝑒) ⊂ 𝑚𝑒𝑚𝑜𝑟𝑦 then
9: while not sufficient memory do
10: if 𝑚 ≥ 𝑀𝑇 𝑃 then ⊲ Accumulation
11: free all last batches in memory
12: 𝑚 ← 𝑚 − 1
13: else ⊲ Checkpointing
14: 𝐶 ← 𝑚𝑒𝑚𝑜𝑟𝑦 ∩ 𝐷
𝐶
15: free 𝑐 ∈ 𝐶 with the smallest Latency(𝑐)
Memory(𝑐)
16: end if
17: end while
18: Compute(𝑛𝑜𝑑𝑒)
19: Remove(𝐷, Parents(𝑛𝑜𝑑𝑒))
20: else
21: Push(𝑄, 𝑛𝑜𝑑𝑒)
22: Push(𝑄, Parents(𝑛𝑜𝑑𝑒))
23: end if
24: end while
25: 𝑏𝑎𝑡𝑐ℎ ← 𝑏𝑎𝑡𝑐ℎ − 𝑚
26: end while