A Data-Mining-Based Prefetching Approach to Caching For Network
Data Flow Analysis for Software Prefetching Linked Data Structures in Java
description
Transcript of Data Flow Analysis for Software Prefetching Linked Data Structures in Java
![Page 1: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/1.jpg)
Data Flow Analysis for Software Prefetching Linked Data
Structures in Java
Brendon Cahoon
Dept. of Computer Science
University of Massachusetts
Amherst, MA
Kathryn S. McKinley
Dept. of Computer Sciences
University of Texas at Austin
Austin, TX
![Page 2: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/2.jpg)
Motivation
• Object-oriented languages are mainstream
• Key performance issues– Same old: processor-memory gap, parallelism
Combination of modern processors and languages results in poor memory performance
![Page 3: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/3.jpg)
RSIM PerformanceCompiled Java (Vortex) – no GC
0
20
40
60
80
100
Health M
st
Perim
eter
Treea
dd BH
Bisort
Tsp
Voronoi
Em3d
Power
% E
xe
cu
tio
n T
ime
Busy Data Memory Stalls
![Page 4: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/4.jpg)
Prefetching Arrays vs. Objects
• Most prior work concentrates on arrays– Compilers directly prefetch any element– Loop transformations enable effective scheduling– Successful results using both hardware and software
• Cannot use same techniques on linked data structures– Objects are small and disjoint– Access patterns are less regular and predictable– Only know the address of directly connected objects
![Page 5: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/5.jpg)
Software Data Prefetching for Java
Hide memory latency from linked structure traversals
• Introduced by Luk and Mowry for C programs:– We add data flow and interprocedural analysis
– Identify pointer structures from declaration
– Find pointer chasing in loops and self recursive calls
• Challenges introduced by Java– Dynamically allocated objects make analysis difficult
– Small methods obscure context
![Page 6: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/6.jpg)
Outline
• Data flow analysis for identifying linked structures– New intra and interprocedural analysis
• Greedy prefetching
• Jump-pointer prefetching
• Experimental results
![Page 7: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/7.jpg)
Identifying Linked Structure Traversals
We define a data flow solution:– Intraprocedural for loops
– Interprocedural for recursion
Benefits:– Independent of program representation
– Many compilers use data flow frameworks
– May be composed with other analyses
Loopwhile (o != null) { t = o; … o = t.next;}
Recursionmethod visit() { …. if (this.next != null) visit(this.next);}
![Page 8: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/8.jpg)
Data Flow Analysis
• Data flow information– Sets of tuples: <variable, field name, statement, status>
• Status values: not recurrent, possibly, recurrentNot recurrent : initial valuePossibly : first use of a field referenceRecurrent : an object accessed in linked structure traversal
• Intraproceedural: forward, flow-sensitive, may analysis• Interprocedural: bidirectional, context-sensitive
![Page 9: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/9.jpg)
Analysis Examples
while (o != null) {s1: t = o.next;s2: o = t;
}
while (o != null) {s1: o = o.next;s2: o = bar();
}
s1: o = o.next;s2: o = o.next;
1st Iteration s1: o is not recurrent, set t to possibly s2: t is possibly, set o to possibly
s1: set o to possiblys2: set o to possibly
1st Iteration s1: set o to possibly s2: set o to not recurrent
2nd Iteration s1: o is possibly, set t to recurrent s2: t is recurrent, set o to recurrent
![Page 10: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/10.jpg)
Analysis Extensions for Common Idioms
• Track objects in fields or arrays– Class based field assignments
– Arrays are monolithic
• Indirect recurrent objects– Unique objects referenced by linked structures
while (e.f != null) { o = e.f; e.f = o.next; o.compute();}
while (e.hasMoreElements()) { o = (ObjType)e.nextElement(); o.compute();}
![Page 11: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/11.jpg)
Greedy Prefetching
• Prefetch directly connected objects
• Algorithm consists of two steps:– Detect accesses to linked structures
– Schedule prefetches• When object is not null
• Completely hiding latency is difficult
![Page 12: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/12.jpg)
Greedy Prefetching Example
Doubly linked list
int sum (Dlist l) { int s = 0; while (l != null) { s =+ l.data; l = l.next; } return s;}
![Page 13: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/13.jpg)
Greedy Prefetching Example
Doubly linked list
Greedy prefetching
int sum (Dlist l) { int s = 0; while (l != null) { prefetch(l.next); s += l.data; l = l.next; } return s;}
![Page 14: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/14.jpg)
Jump-Pointer Prefetching
• Prefetch indirectly connected objects– Tolerates more latency than greedy prefetching
• Algorithm contains three steps: – Find linked data structure traversal and creation sites
– Create jump-pointers• When creating or traversing the linked structure
– Schedule prefetches• Prefetch special jump-pointer field
![Page 15: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/15.jpg)
Inserting Jump-Pointers at Creation Time
Void add(ObjType o) { ListNode n = new ListNode(o); jumpObj = jumpQueue[i]; jumpObj.jmp = n; jumpQueue[i++%size] = n; if (head == null) {
head = n; } else { tail.next = n; } tail = n;}
jumpObj n
1 2 3 4 5
![Page 16: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/16.jpg)
Jump-Pointer Prefetching Example
int sum (Dlist l) { int s = 0; while (l != null) { prefetch(l.jmp); s += l.data; l = l.next; } return s;}
Doubly linked list
Jump-pointer prefetching
![Page 17: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/17.jpg)
Experimental Results
• Object-oriented Olden benchmarks in Java
• Simulation using RSIM– Out-of-order, superscalar processor
• Compile programs using Vortex– Translate Java programs to Sparc assembly– Contains object-oriented, traditional optimizations– Linked structure analysis, greedy and jump-pointer
prefetching
![Page 18: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/18.jpg)
Prefetching Performance
0
20
40
60
80
100
No
rmal
ized
exe
cuti
on
tim
e (%
)
N G J N G J N G J N G J N G J N G J N G J N G J N G J N G J
Busy Data Memory Stalls
health mst perimtr treeadd bh bisort tsp voronoi em3d power
![Page 19: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/19.jpg)
Prefetch Effectiveness
0
20
40
60
80
100
Per
cen
tag
e o
f P
refe
tch
es
G J G J G J G J G J G J G J G J G J G J
Useful Late Early Unnec.
health mst perimtr treeadd bh bisort tsp voronoi em3d power
![Page 20: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/20.jpg)
Static Prefetch Statistics
Program Interprocedural Intra-
Procedural
Fields
Mono Poly
Health 8 1 5
Mst 3
Perimeter 9 8
Treeadd 2
BH 16 8 10
Bisort 4 4
Tsp 6 14
Voronoi 14 1
Em3d 20
Power 4
![Page 21: Data Flow Analysis for Software Prefetching Linked Data Structures in Java](https://reader036.fdocuments.net/reader036/viewer/2022062409/568147e5550346895db51c35/html5/thumbnails/21.jpg)
Contributions and Future Work
• New interprocedural data flow analysis for Java• Evaluation of prefetching on Java programs
Prefetching hides latency, butRoom for improvement
Other uses for analysis (work in progress)– Garbage collection: prefetching, object traversal
– Prefetching arrays of objects