Resource-aware Program Analysis via Online Abstraction Coarsening
Kihong Heo Hakjoo Oh Hongseok Yang
ICSE 2019
- 1
Resource-aware Program Analysis via Online Abstraction Coarsening - - PowerPoint PPT Presentation
Resource-aware Program Analysis via Online Abstraction Coarsening Kihong Heo Hakjoo Oh Hongseok Yang ICSE 2019 1 Motivation Deep semantic analysis for large software 30M 25M 20M Size (LOC) 15M 10M 5M 0M 1.0 2.0 2.6.16
Kihong Heo Hakjoo Oh Hongseok Yang
ICSE 2019
2
Size (LOC)
0M 5M 10M 15M 20M 25M 30M
Linux Kernel Version
1.0 2.0 2.6.16 (1st LTS) 2.6.34 (5th LTS) 3.10 (10th LTS) 4.1 (15th LTS) 4.19 (19th LTS) X *https://www.linuxcounter.net
2
Size (LOC)
0M 5M 10M 15M 20M 25M 30M
Linux Kernel Version
1.0 2.0 2.6.16 (1st LTS) 2.6.34 (5th LTS) 3.10 (10th LTS) 4.1 (15th LTS) 4.19 (19th LTS) X *https://www.linuxcounter.net
2
Size (LOC)
0M 5M 10M 15M 20M 25M 30M
Linux Kernel Version
1.0 2.0 2.6.16 (1st LTS) 2.6.34 (5th LTS) 3.10 (10th LTS) 4.1 (15th LTS) 4.19 (19th LTS) X *https://www.linuxcounter.net
3
3
4
X-sensitivity (knob)
4
X-sensitivity (knob) Low Precision Low Utilization
4
X-sensitivity (knob) Out of Resource
4
X-sensitivity (knob)
5
5
Sensitivity: 0% emacs-26.0.91 (503KLOC) Memory: 18GB
5
Sensitivity: 0% emacs-26.0.91 (503KLOC) Memory: 18GB Sensitivity: 5% emacs-26.0.91 (503KLOC)
5
Sensitivity: 0% emacs-26.0.91 (503KLOC) Memory: 18GB Sensitivity: 5% emacs-26.0.91 (503KLOC) Memory: > 128GB
5
Sensitivity: 0% emacs-26.0.91 (503KLOC) Memory: 18GB Sensitivity: 5% emacs-26.0.91 (503KLOC) Memory: > 128GB Sensitivity: 0% vim60 (227KLOC)
5
Sensitivity: 0% emacs-26.0.91 (503KLOC) Memory: 18GB Sensitivity: 5% emacs-26.0.91 (503KLOC) Memory: > 128GB Sensitivity: 0% vim60 (227KLOC) Memory: 51GB
6
Analysis Progress Resource Usage Precision Budget
6
Analysis Progress Resource Usage Precision Budget
Low-sensitivity
6
Analysis Progress Resource Usage Precision Budget
Low-sensitivity High-sensitivity
6
Analysis Progress Resource Usage Precision Budget
Low-sensitivity High-sensitivity Our approach
7
Analysis Progress Resource Usage Precision Budget
Low-sensitivity High-sensitivity Our approach
Offline Approach
(10% flow-sensitivity)
Online Approach
7
Analysis Progress Resource Usage Precision Budget
Low-sensitivity High-sensitivity Our approach
Offline Approach
(10% flow-sensitivity)
Online Approach
7
Analysis Progress Resource Usage Precision Budget
Low-sensitivity High-sensitivity Our approach
Offline Approach
(10% flow-sensitivity)
Online Approach
8
9
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
10
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
Line Flow-Sensitive Abstract State 1 {x = [0,0], y = [0,0], z = [1,1], v = ⊤, w = ⊤} 2 {x = [1,1], y = [0,0], z = [1,1], v = ⊤, w = ⊤} 3 {x = [1,1], y = [0,0], z = [2,2], v = ⊤, w = ⊤} 4 {x = [1,1], y = [1,1], z = [2,2], v = ⊤, w = ⊤}
12 Intervals 3 Intervals
11
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
Line Flow-Sensitive Abstract State 1 {x = [0,0], y = [0,0], z = [1,1], v = ⊤, w = ⊤} 2 {x = [1,1], y = [0,0], z = [1,1], v = ⊤, w = ⊤} 3 {x = [1,1], y = [0,0], z = [2,2], v = ⊤, w = ⊤} 4 {x = [1,1], y = [1,1], z = [2,2], v = ⊤, w = ⊤}
6 Intervals
12
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
Line Flow-Sensitive Abstract State 1 {x = [0,0], y = [0,0], z = [1,1], v = ⊤, w = ⊤} 2 {x = [1,1], y = [0,0], z = [1,1], v = ⊤, w = ⊤} 3 {x = [1,1], y = [0,0], z = [2,2], v = ⊤, w = ⊤} 4 {x = [1,1], y = [1,1], z = [2,2], v = ⊤, w = ⊤}
12 Intervals
13
Line Flow-Insensitive Abstract State * {x = [0,+∞], y = [0,+∞], z = [1,+∞], v = ⊤, w = ⊤}
3 Intervals
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
14
14
Input Result Analyzer
14
Input
Transfer Function
Result M0 Analyzer
14
Input
Transfer Function Fixpoint?
Result M0 Mi Analyzer
14
Input
Transfer Function
Y
Fixpoint?
Result M0 Mi Analyzer
14
Model Input
Transfer Function
Y N
Fixpoint? Controller
Result M0 Mi Mi Analyzer
14
Model Input
Transfer Function
Y N
Fixpoint? Controller
Result M0 Mi Mi+1 Mi Analyzer
15
15
*Learning a Strategy for Adapting a Program Analysis via Bayesian Optimisation, OOPSLA’15
15
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
*Learning a Strategy for Adapting a Program Analysis via Bayesian Optimisation, OOPSLA’15
15
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
> M(w)
*Learning a Strategy for Adapting a Program Analysis via Bayesian Optimisation, OOPSLA’15
15
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
M(x) > > M(w)
*Learning a Strategy for Adapting a Program Analysis via Bayesian Optimisation, OOPSLA’15
15
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
M(x) > > M(w) M(y) > M(z) > M(v)
*Learning a Strategy for Adapting a Program Analysis via Bayesian Optimisation, OOPSLA’15
16
16
16
16
that should be treated flow-insensitively
17
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
Model: M(x) > M(y) > M(z) > M(v) > M(w)
18
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
6 Intervals
Model: M(x) > M(y) > M(z) > M(v) > M(w)
Line Flow-Sensitive Abstract State 1 {x = [0,0], y = [0,0], z = [1,1], v = ⊤, w = ⊤} 2 {x = [1,1], y = [0,0], z = [1,1], v = ⊤, w = ⊤}
19
Line Flow-Sensitive Flow-Insensitive 1 {x = [0,0], y = [0,0], z = [1,1], v = ⊤} {w = ⊤} 2 {x = [1,1], y = [0,0], z = [1,1], v = ⊤}
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
6 Intervals
Model: M(x) > M(y) > M(z) > M(v) > M(w)
20
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
9 Intervals
Model: M(x) > M(y) > M(z) > M(v) > M(w)
Line Flow-Sensitive Flow-Insensitive 1 {x = [0,0], y = [0,0], z = [1,1], v = ⊤} {w = ⊤} 2 {x = [1,1], y = [0,0], z = [1,1], v = ⊤} 3 {x = [1,1], y = [0,0], z = [2,2], v = ⊤}
21
Line Flow-Sensitive Flow-Insensitive 1 {x = [0,0], y = [0,0]} {z = [1,+∞], v = ⊤, w = ⊤} 2 {x = [1,+∞], y = [0,0]} 3 {x = [1,+∞], y = [0,0]}
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
6 Intervals
Model: M(x) > M(y) > M(z) > M(v) > M(w)
22
Line Flow-Sensitive Flow-Insensitive 1 {x = [0,0], y = [0,0]} {z = [1,+∞], v = ⊤, w = ⊤} 2 {x = [1,+∞], y = [0,0]} 3 {x = [1,+∞], y = [0,0]} 4 {x = [1,+∞], y = [1,+∞]}
1: x = 0; y = 0; z = 1; v = input(); w = input(); 2: x = z; 3: z = z + 1; 4: y = x; 5: assert(y > 0); // Query 1 (hold) 6: assert(z > 0); // Query 2 (hold) 7: assert(v == w); // Query 3 (may fail)
8 Intervals
Model: M(x) > M(y) > M(z) > M(v) > M(w)
23
that should be treated flow-insensitively
23
that should be treated flow-insensitively
23
Q( f, a) ∑a′∈A Q( f, a′)
that should be treated flow-insensitively
24
Q : F × A → [0, 1]
24
Q : F × A → [0, 1]
24
Q : F × A → [0, 1]
25
25
25
26
26
s0 s1 s2 s3
R = 0.7 a0 a1 a2
27
s0 s1 s2 s3
R = 0.7 a0 a1 a2
D1 = {(<𝜷(s0), a0>, 0.7), (<𝜷(s1), a1>, 0.7), (<𝜷(s2), a2>, 0.7)}
*For brevity heuristics are omitted
28
s0 s1 s2 s3
R = 0.7 a0 a1 a2
Q = SupervisedLearning(D1)
29
s0 s1 s2 s3
R = 0.7 a0 a1 a2
Q( f, a) ∑a′∈A Q( f, a′)
𝛒Q(f)(a) =
30
s0 s1 s2 s3
R = 0.7 a0 a1 a2
30
s0 s1 s2 s3
R = 0.7 a0 a1 a2
s4
R = 1.0 a3
31
D2 = D1 ∪ {(<𝜷(s0), a0>, 1.0), (<𝜷(s4), a4>, 1.0)} s0 s1 s2 s3
R = 0.7
s4
R = 1.0 a0 a1 a2 a3
32
s0 s1 s2 s3
R = 0.7
s4
R = 1.0 a0 a1 a2 a3
Q = SupervisedLearning(D2)
33
s0 s1 s2 s3
R = 0.7
s4
R = 1.0 a0 a1 a2 a3
…
34
35
35
35
35
35
memory chunks
35
memory chunks
36
25 50 75 100 sendmail redis nethack git vim python R emacs
Offline Online (64GB) Online (128GB)
OOM OOM OOM
36
25 50 75 100 sendmail redis nethack git vim python R emacs
Offline Online (64GB) Online (128GB)
21% on average (out of memory for 3 programs)
OOM OOM OOM
37
25 50 75 100 sendmail redis nethack git vim python R emacs
Offline Online (64GB) Online (128GB)
79% on average
OOM OOM OOM
38
25 50 75 100 sendmail redis nethack git vim python R emacs
Offline Online (64GB) Online (128GB)
61% on average
OOM OOM OOM
39
25 50 75 100 sendmail redis nethack git vim python R emacs
Flow-insensitive Offline Online (64GB) Online (128GB)
Buffer Overrun Alarms
OOM OOM OOM
40
25 50 75 100 sendmail redis nethack git vim python R emacs
Flow-insensitive Offline Online (64GB) Online (128GB)
Buffer Overrun Alarms
OOM OOM OOM
40
25 50 75 100 sendmail redis nethack git vim python R emacs
Flow-insensitive Offline Online (64GB) Online (128GB)
Buffer Overrun Alarms
OOM OOM OOM
Reduced 27% of alarms (out of memory for 3 programs)
41
25 50 75 100 sendmail redis nethack git vim python R emacs
Flow-insensitive Offline Online (64GB) Online (128GB)
Buffer Overrun Alarms
OOM OOM OOM
28% on average
42
25 50 75 100 sendmail redis nethack git vim python R emacs
Flow-insensitive Offline Online (64GB) Online (128GB)
Buffer Overrun Alarms
OOM OOM OOM
32% on average
43
25 50 75 100 sendmail redis nethack git vim python R emacs
Flow-insensitive Offline Online (64GB) Online (128GB)
OOM OOM OOM
Null Dereference Alarms
43
25 50 75 100 sendmail redis nethack git vim python R emacs
Flow-insensitive Offline Online (64GB) Online (128GB)
OOM OOM OOM
Null Dereference Alarms
Reduced 30% of alarms (out of memory for 3 programs)
44
25 50 75 100 sendmail redis nethack git vim python R emacs
Flow-insensitive Offline Online (64GB) Online (128GB)
OOM OOM OOM
Null Dereference Alarms
33% on average
45
25 50 75 100 sendmail redis nethack git vim python R emacs
Flow-insensitive Offline Online (64GB) Online (128GB)
OOM OOM OOM
Null Dereference Alarms
41% on average
46
46
46