Instance-wise Points-to Analysis for Loop- based Dependence Testing - - PowerPoint PPT Presentation

instance wise points to analysis for loop based
SMART_READER_LITE
LIVE PREVIEW

Instance-wise Points-to Analysis for Loop- based Dependence Testing - - PowerPoint PPT Presentation

Instance-wise Points-to Analysis for Loop- based Dependence Testing Peng Wu 1 , Paul Feautrier 2 , David Padua 3 , Zehra Sura 3 IBM TJ Watson Research Center 1 INRIA, France 2 University of Illinois, Urbana-Champaign 3 What is Pointer Analysis? !


slide-1
SLIDE 1

Instance-wise Points-to Analysis for Loop- based Dependence Testing

Peng Wu1, Paul Feautrier2, David Padua3, Zehra Sura3 IBM TJ Watson Research Center1 INRIA, France2 University of Illinois, Urbana-Champaign3

slide-2
SLIDE 2

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

What is Pointer Analysis?

! Two flavors of Pointer Analysis

! Relations between pointers

! Alias analysis, shape analysis

! Relations between pointers and memory

! Points-to analysis

a c b

unalias(a,b), unalias(a,c),alias(b,c) Points-to(a)= { grey} Points-to(b,c)= Points-to= { red}

slide-3
SLIDE 3

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

for (i=0; i<n; i++){ a = new (); b = new (); s: … = a.x; t = a; a = b; b = t; t:b.x = …; }

Points-to Analysis for Dependence Test

a b a b

i

(i) at statement s (ii) at statement t

i

slide-4
SLIDE 4

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

for (i=0; i<n; i++){ a = new (); b = new (); s: … = a.x; t = a; a = b; b = t; t:b.x = …; }

Points-to Analysis for Dependence Test

a b a b

i-

(i) at statement s (ii) at statement t

i- i

slide-5
SLIDE 5

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

for (i=0; i<n; i++){ a = new (); b = new (); s: … = a.x; t = a; a = b; b = t; t:b.x = …; }

Points-to Analysis for Dependence Test

a b a b

i-

(i) at statement s (ii) at statement t

i- i i

slide-6
SLIDE 6

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

Arrays of Pointers

a

Another source of pointers

  • Java multidimensional arrays
  • Dynamic arrays in C/C+ +
slide-7
SLIDE 7

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

Degree of Alias Information

a[x] at (s,i) vs. b[y] at (t,j) alias(a,b) at s a at s vs. b at t a at (s,i) vs. b at (t,j) I nstance-wise Element-wise alias(a.ptr, a.ptr.ptr) at s points-to analysis alias analysis shape analysis

slide-8
SLIDE 8

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

j i

Representing Points-to Information

0:a = new Complex[n]; for (i=0; i≤ ≤ ≤ ≤n; i++){ 1: a[i]=new Complex(); } a

N1[i] N1

after statement 1, iteration i

a→ → → →{N0} a[x]→ → → →{null,(N1[x],x≤ ≤ ≤ ≤i)}

N0

slide-9
SLIDE 9

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

Unusual aspects of the representation

! Heap objects named by allocation statement

instances

! runtime variables appear in heap names

! Summarize points-to sets of multiple pointers as

a mapping

! Mapping from array indices to heap names

! Conditions are imposed on heap names

slide-10
SLIDE 10

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

Overview of the Algorithm

! An iterative data flow analysis ! Handles Java pointer semantics but not

pointer arithmetic

! Context-sensitive, flow-sensitive, and

inter-procedural

slide-11
SLIDE 11

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

An Intuitive Flavor of the Analysis

1: Complex[] a = new Complex[n]; for(i = 0;i ≤ ≤ ≤ ≤ n;i++){ 2: a[i] = new Complex(); } 4:

1+

a[x]→ → → →{null}

2+

a[x]→ → → →{null,(N2[i],x=i)} → → → →{null,(N2[x],x=i)}

2-

a[x]→ → → →{null,(N2[x],x=i-)}

2+

a[x]→ → → →{null,(N2[x],x=i-), (N2[x],x=i)} → → → →{null,(N2[x],x={i-,i})}

2-

a[x]→ → → →{null,(N2[x],x=i-)}

4

a[x]→ → → →{null,(N2[x],x≤ ≤ ≤ ≤n)}

slide-12
SLIDE 12

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

Aging of Different Depths

0: q = new obj(); 1: for(i = 0; i<n; i++){ 2: a[i] = q; 3: q = new Obj(); 4: } 2 1 q n-1

Iterations

a

Aging depth 0 (i→

→ → → i-): p[x] → → → → N3[i-],x≤ ≤ ≤ ≤i

Aging depth 1 (i→

→ → → i-1): p[x]→ → → → N3[x-1],x1≤ ≤ ≤ ≤i

slide-13
SLIDE 13

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

q if addr(r[x][y])=addr(a[i]) r[x][y]

  • therwise

Transfer Function for a[i]= q

a q

i

r

r[x][y] =

r[x] = a & y = i

r[x][y]=r[x][y]∪ ∪ ∪ ∪q,r[x]∩ ∩ ∩ ∩a ≠ ≠ ≠ ≠ ∅ ∅ ∅ ∅|{null} & y = i

slide-14
SLIDE 14

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

Application of Points-to Information

! Dependence test

! traditional loop transformations (loop interchanging,

blocking, parallelization, vectorization)

! Heap analysis

! null pointer, array bounds checking

slide-15
SLIDE 15

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

Experiment and Evaluation

! 8 numerical Java programs using

multidimensional arrays

! Points-to analysis implemented in javac ! Uses Omega library for dependence test after

  • btaining points-to information

! Applied to dependence testing and null-

pointer exception elimination

slide-16
SLIDE 16

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

Analysis Cost

Analysis Time Program Prog. Points

time (ms)

  • urs/javac

Line (inline) listtable 10 9 0.1% 15 cmatmul 25 162 2.1% 47 cshallow 73 259 3.4% 197 (218) cholesky 19 195 2.6% 38 sor 18 184 2.5% 40 lufact 40 168 2.9% 287 (153) moldyn 53 77 1.0% 234 euler 299 2440 25% 915 (2028)

  • prog. points : # of program points considered
  • urs/javac : pointer analysis time/javac time
slide-17
SLIDE 17

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

Dependence Test and Parallelization

# of Dependences # of Parallel Loops Program type

  • urs

flat type

  • urs

actual listtable 5 2 3 1 1 cmatmul 8 3 3 3 7 7 cholesky 10 4 4 5 6 6 shallow 1092 152 152 6 17 17 sor 6 5 5 3 4 4 lufact 72 45 45 9 11 11 moldyn 2 17 19 19 euler 12559 2489 2489 36 55 55

type : type-based pointer analysis + Omega flat : flat array + Omega

  • ur : our pointer analysis + Omega

Lower is better Higher is better

slide-18
SLIDE 18

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

Summary

! A unified algorithm to capture both instance-wise and

element-wise points-to information

! Finer-grained heap naming scheme ! Richer points-to mapping representation ! Complete coverage of Java pointer semantics

! Reasonable cost for regular array programs, but still

more expensive than traditional pointer analysis

! Points-to information applied to loop-based

dependence analysis and array exception elimination

slide-19
SLIDE 19

ICS 2002 Instance-wise Points-to Analysis for Loop-based Dependence Testing

Pointer Analysis Road Map

a[x] at (s,i) vs. b[y] at (t,j) alias(a,b) at s a at s vs. b at t a at (s,i) vs. b at (t,j) I nstance-wise Element-wise alias(a.ptr, a.ptr.ptr) at s points-to analysis alias analysis shape analysis