PACT'13
Parallel Flow-Sensitive Pointer Analysis by Graph-Rewriting
Vaivaswatha Nagaraj
- R. Govindarajan
Indian Institute of Science, Bangalore
Parallel Flow-Sensitive Pointer Analysis by Graph-Rewriting - - PowerPoint PPT Presentation
Parallel Flow-Sensitive Pointer Analysis by Graph-Rewriting Vaivaswatha Nagaraj R. Govindarajan Indian Institute of Science, Bangalore PACT 2013 PACT'13 2 Outline Introduction Background Flow-sensitive graph-rewriting formulation
PACT'13
Indian Institute of Science, Bangalore
Vaivaswatha Nagaraj (IISc, Bangalore)
2
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
3
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
4
PACT'13
1 3 2 4
Vaivaswatha Nagaraj (IISc, Bangalore)
5
PACT'13
x points-to a y points-to b
1 2 3 4 x points-to a y points-to b z points-to b x points-to a y points-to b z points-to a
Vaivaswatha Nagaraj (IISc, Bangalore)
6
PACT'13
x points-to a y points-to b x points-to a y points-to b z points-to {a,b} x points-to a y points-to b z points-to {a,b}
1 2 3 4
Vaivaswatha Nagaraj (IISc, Bangalore)
7
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
8
PACT'13
[Flow-sensitive pointer analysis for millions of lines of code – Ben Hardekopf. et al. - CGO'11]
Vaivaswatha Nagaraj (IISc, Bangalore)
9
PACT'13
[Flow-sensitive pointer analysis for millions of lines of code – Ben Hardekopf. et al. - CGO'11]
Vaivaswatha Nagaraj (IISc, Bangalore)
10
PACT'13
1 2 3 [Flow-sensitive pointer analysis for millions of lines of code – Ben Hardekopf. et al. - CGO'11]
Vaivaswatha Nagaraj (IISc, Bangalore)
11
PACT'13
1 2 3
[Flow-sensitive pointer analysis for millions of lines of code – Ben Hardekopf. et al. - CGO'11]
Vaivaswatha Nagaraj (IISc, Bangalore)
12
PACT'13
1 2 3
Points-to info of only b is required here
Points-to info of only a is required here
[Flow-sensitive pointer analysis for millions of lines of code – Ben Hardekopf. et al. - CGO'11]
Vaivaswatha Nagaraj (IISc, Bangalore)
13
PACT'13
1 2 3 4
(1) Use a fast analysis to get less precise points-to information
[Flow-sensitive pointer analysis for millions of lines of code – Ben Hardekopf. et al. - CGO'11]
Vaivaswatha Nagaraj (IISc, Bangalore)
14
PACT'13
1)
0)
0)
1 2 3 4
(2) Use the less precise info to find variables potentially referenced at indirections (1) Use a fast analysis to get less precise points-to information
[Flow-sensitive pointer analysis for millions of lines of code – Ben Hardekopf. et al. - CGO'11]
Vaivaswatha Nagaraj (IISc, Bangalore)
15
PACT'13
1)
0)
0)
1 2 3 4
[Flow-sensitive pointer analysis for millions of lines of code – Ben Hardekopf. et al. - CGO'11] Flow-sensitivity - All variables in SSA form
Vaivaswatha Nagaraj (IISc, Bangalore)
16
PACT'13
1)
0)
0)
1 2 3 4
(3) Build def-use chains and propagate only along these chains Propagation of information is thus optimized [Flow-sensitive pointer analysis for millions of lines of code – Ben Hardekopf. et al. - CGO'11] Flow-sensitivity - All variables in SSA form
Vaivaswatha Nagaraj (IISc, Bangalore)
17
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
18
PACT'13
#[Parallel Inclusion-based Points-to Analysis - Mario Mendez-Lojo, et al. - OOPSLA'10]
Vaivaswatha Nagaraj (IISc, Bangalore)
19
PACT'13
#[Parallel Inclusion-based Points-to Analysis - Mario Mendez-Lojo, et al. - OOPSLA'10]
Vaivaswatha Nagaraj (IISc, Bangalore)
20
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
21
PACT'13
[Parallel Inclusion-based Points-to Analysis - Mario Mendez-Lojo, et al. - OOPSLA'10] x = &a x a p Points-to constraint Constraint graph y = x x y c
Vaivaswatha Nagaraj (IISc, Bangalore)
22
PACT'13
x = &a x a p Points-to constraint Constraint graph y = x x y c x a p y c Apply rewrite-rule x a p y c p [Parallel Inclusion-based Points-to Analysis - Mario Mendez-Lojo, et al. - OOPSLA'10] Example: copy rewrite rule
Vaivaswatha Nagaraj (IISc, Bangalore)
23
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
24
PACT'13
1)
0)
0)
1 2 3 4
Vaivaswatha Nagaraj (IISc, Bangalore)
25
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
26
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
27
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
28
PACT'13
Points-to constraints
Vaivaswatha Nagaraj (IISc, Bangalore)
29
PACT'13
y1 a p x1 l Formulate graph
Points-to constraints
Vaivaswatha Nagaraj (IISc, Bangalore)
30
PACT'13
y1 a p x1 l y1 a p x1 c l Apply load rule Formulate graph
Points-to constraints
Vaivaswatha Nagaraj (IISc, Bangalore)
31
PACT'13
y1 a p x1 l y1 a p x1 c l Apply load rule Formulate graph
x1 = *y1
µ(a1)
z1 = *y1
µ(a2)
Points-to constraints
Vaivaswatha Nagaraj (IISc, Bangalore)
32
PACT'13
y1 a p x1 l y1 a p x1 c l Apply load rule Formulate graph y1 a1 x1 l p
Points-to constraints x1 = *y1
µ(a1)
z1 = *y1
µ(a2)
Vaivaswatha Nagaraj (IISc, Bangalore)
33
PACT'13
y1 a p x1 l y1 a p x1 c l Apply load rule Formulate graph y1 a1 x1 l p a2 z1 l p x1 = *y1
µ(a1)
z1 = *y1
µ(a2)
Points-to constraints
Vaivaswatha Nagaraj (IISc, Bangalore)
34
PACT'13
y1 a p x1 l y1 a p x1 c l Apply load rule Formulate graph y1 a1 x1 l p a2 z1 l p x1 = *y1
µ(a1)
z1 = *y1
µ(a2)
Points-to constraints
Vaivaswatha Nagaraj (IISc, Bangalore)
35
PACT'13
y1 a p x1 l y1 a p x1 c l Apply load rule Formulate graph y1 a1 x1 l p a2 z1 l p x1 = *y1
µ(a1)
z1 = *y1
µ(a2)
y1 a1 x1 l p a2 z1 l p c c
Points-to constraints
Vaivaswatha Nagaraj (IISc, Bangalore)
36
PACT'13
y1 a p x1 l y1 a p x1 c l Apply load rule Formulate graph y1 a1 x1 l p a2 z1 l p x1 = *y1
µ(a1)
z1 = *y1
µ(a2)
y1 a1 x1 l p a2 z1 l p c c
Spurious edge
Points-to constraints
Vaivaswatha Nagaraj (IISc, Bangalore)
37
PACT'13
y1 a p x1 l y1 a p x1 c l Apply load rule Formulate graph y1 a1 x1 l p a2 z1 l p x1 = *y1
µ(a1)
z1 = *y1
µ(a2)
y1 a1 x1 l p a2 z1 l p c c
Spurious edge
Points-to constraints
Vaivaswatha Nagaraj (IISc, Bangalore)
38
PACT'13
y1 a p x1 l y1 a p x1 c l Apply load rule Formulate graph y1 a1 x1 l p a2 z1 l p x1 = *y1
µ(a1)
z1 = *y1
µ(a2)
y1 a1 x1 l p a2 z1 l p c c
Spurious edge
c
Points-to constraints
Vaivaswatha Nagaraj (IISc, Bangalore)
39
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
40
PACT'13
y1 a p x1 l Formulate graph p_c y1 a p x1 c l Modified load rule
Vaivaswatha Nagaraj (IISc, Bangalore)
41
PACT'13
y1 a p x1 l Formulate graph p_c y1 a p x1 c l Modified load rule
y1 a1 x1 l p a2 z1 l p x1 = *y1
µ(a1)
z1 = *y1
µ(a2)
p_c p_c
Vaivaswatha Nagaraj (IISc, Bangalore)
42
PACT'13
y1 a p x1 l Formulate graph p_c y1 a p x1 c l Modified load rule y1 a1 x1 l p a2 z1 l p x1 = *y1
µ(a1)
z1 = *y1
µ(a2)
p_c p_c y1 a1 x1 l p a2 z1 l p c c
Vaivaswatha Nagaraj (IISc, Bangalore)
43
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
44
PACT'13
0)
0)
Vaivaswatha Nagaraj (IISc, Bangalore)
45
PACT'13
0)
0)
How to update a1?
Vaivaswatha Nagaraj (IISc, Bangalore)
46
PACT'13
0)
0)
How to update a1?
Vaivaswatha Nagaraj (IISc, Bangalore)
47
PACT'13
0)
0)
How to update a1?
Vaivaswatha Nagaraj (IISc, Bangalore)
48
PACT'13
0)
0)
How to update a1?
Vaivaswatha Nagaraj (IISc, Bangalore)
49
PACT'13
0)
0)
How to update a1?
Vaivaswatha Nagaraj (IISc, Bangalore)
50
PACT'13
0)
0)
Vaivaswatha Nagaraj (IISc, Bangalore)
51
PACT'13
0)
0)
Points-to set of a1 depends
Vaivaswatha Nagaraj (IISc, Bangalore)
52
PACT'13
0)
0)
Points-to set of a1 depends
Connect a1 and b1
Vaivaswatha Nagaraj (IISc, Bangalore)
53
PACT'13
0)
0)
1-1
Vaivaswatha Nagaraj (IISc, Bangalore)
54
PACT'13
0)
0)
if x1 points-to a then a1 ↵ u1 end if if x1 points-to b then a1 ↵ a0 end if
Vaivaswatha Nagaraj (IISc, Bangalore)
55
PACT'13
0)
0)
if x1 points-to a then a1 ↵ u1 end if if x1 points-to b then a1 ↵ a0 end if Rewrite rule to update a1:
x1 a1 p u1 s p_c x1 a1 p u1 s c
Vaivaswatha Nagaraj (IISc, Bangalore)
56
PACT'13
0)
0)
if x1 points-to a then a1 ↵ u1 end if if x1 points-to b then a1 ↵ a0 end if
Vaivaswatha Nagaraj (IISc, Bangalore)
57
PACT'13
0)
0)
if x1 points-to a then a1 ↵ u1 end if if x1 points-to b then a1 ↵ a0 end if Rewrite rule to update a1: (2 steps)
x1 b1 p
Note: The rewrite rule shown here is not complete.
k1 b1
Vaivaswatha Nagaraj (IISc, Bangalore)
58
PACT'13
0)
0)
if x1 points-to a then a1 ↵ u1 end if if x1 points-to b then a1 ↵ a0 end if Rewrite rule to update a1: (2 steps)
x1 b1 p
Note: The rewrite rule shown here is not complete.
k1 b1 k1 b1 a0 a1 c k1
Vaivaswatha Nagaraj (IISc, Bangalore)
59
PACT'13
0)
0)
if x1 points-to a then a1 ↵ u1 end if if x1 points-to b then a1 ↵ a0 end if
Vaivaswatha Nagaraj (IISc, Bangalore)
60
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
61
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
62
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
63
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
64
PACT'13
Larger (lines of code) programs from SPEC2006 13k - 414k Ex – text processor 19k Nethack – text based game 222k Sendmail – email server 71k SVN – revision control system 6439k Vim – text editor 1265k
Vaivaswatha Nagaraj (IISc, Bangalore)
65
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
66
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
67
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
68
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
69
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
70
PACT'13
ex 254.gap 176.gcc nethack 253.perl 197.parser sendmail vim svn 255.vortex 0.5 1 1.5 2 2.5 3 3.5 4 4.5 1 thread 2 threads 4 threads 6 threads 8 threads
speedup
6 . 8 x 5 . 3 8 x
Vaivaswatha Nagaraj (IISc, Bangalore)
71
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
72
PACT'13
Vaivaswatha Nagaraj (IISc, Bangalore)
73
PACT'13
(a) .. (h) are worklists for each rewrite rule
Vaivaswatha Nagaraj (IISc, Bangalore)
74
PACT'13