Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa Barbara LCR'02 Kristian Kvilekval UCSB.
Download
Report
Transcript Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa Barbara LCR'02 Kristian Kvilekval UCSB.
Prefetching for Mobile Computers
Using Shape Graphs
Kristian Kvilekval and Ambuj Singh
University of California, Santa Barbara
LCR'02
Kristian Kvilekval UCSB
1
Prefetching for Mobile
Applications
•Application on Mobile Computer
•Access remote store objects
•Periodic interruption
Cache
•Object Oriented Databases
•Distributed Object system
LCR'02
Kristian Kvilekval UCSB
2
Our Approach
Code-based prefetching
Prefetch only those objects accessed by the code
Extract program access patterns
Provide runtime system with future accesses
Advantages
LCR'02
Complex pointer-based structures
Prefetches cold misses
Good accuracy
Kristian Kvilekval UCSB
3
Capturing Access Pattern
Statically
Shape Analysis
Represents runtime data structures at compile
time as graphs
Applications: extracts properties of programs
LCR'02
Synchronization[Bogda99][Ruf00]
Parallelization[Corbera99]
Safety[Ghiya96][Nurit98][Wilhem00]
Kristian Kvilekval UCSB
4
Basic Shape Analysis
Graph
Abstract locations (heap cells)
Edges labeled with with field names
Abstract interpretation
LCR'02
Extend graph through field references
Combine graphs when heap location is shared
Kristian Kvilekval UCSB
5
Example shape
class Connector{ Part a,b; }
class Part {
Connector left,right,up,down;
Material m
Supplier s;
…
int volume();
}
part
right
part
connector
material
weight=0;
while (part) {
weight+=(part.material.density
*part.volume());
part=part.right.b;
}
LCR'02
Kristian Kvilekval UCSB
6
Construction of Shape Graphs
x
LCR'02
Kristian Kvilekval UCSB
7
Construction of Shape Graphs
x.f = s;
F
LCR'02
Kristian Kvilekval UCSB
8
Construction of Shape Graphs
x.f = s;
t = x.f.g;
F
G
LCR'02
Kristian Kvilekval UCSB
9
Construction of Shape Graphs
x.f = s;
x.f.g = t;
N
F
?
x = x.n;
G
LCR'02
Kristian Kvilekval UCSB
10
Construction of Shape Graphs
N
x.f =
x.f.g
if (x
x =
s;
= t;
!= null)
x.n;
F
G
LCR'02
Kristian Kvilekval UCSB
11
Combining Shape Graphs
x = y;
N
LCR'02
F
F
G
K
J
Kristian Kvilekval UCSB
12
Combining Shape Graphs
Unify graphs recursively
N
LCR'02
F
F
G
K
J
Kristian Kvilekval UCSB
13
Unification of Shape Graphs
Unify graphs recursively
N
LCR'02
N
F
F
G
K
J
F
G
J
K
Kristian Kvilekval UCSB
14
Shape Analysis Algorithm
methods Interpret basic blocks
Create shapes for basic blocks
Run until fixed-point is reached
Propagate in static callgraph
LCR'02
Kristian Kvilekval UCSB
15
Static Call Graphs
Static representation of calls
m3{
a.f = s;
o.m4(a)
}
Class C {
m4(F f) {
…
}
LCR'02
main
m2
m3
m4
Unify(a,f)
f
Kristian Kvilekval UCSB
16
Call Graphs
Propagate bottom up
Merge polymorphic calls
m1
m2
m3
m4
B.m4
D1.m4
D2.m4
Recursive Calls
Fixed point
Merge SCC[Ruf00]
m1
m2
m1
LCR'02
Kristian Kvilekval UCSB
17
Prefetching with shape graphs
Compile Time
Generate shapes for method references
Self, arguments, and global variables
Label shape edges with earliest access
Annotate programs to pass visible references and
method ID to runtime
Runtime
LCR'02
Interpret shape graph on the actual object graph
Kristian Kvilekval UCSB
18
Prefetching with Shape Graphs
N:5
a1
F:10
J:10
a2
G:5
a3
o1:0
a4
K:10
F
o2:10
K
N
o4:5
J
o5:15
N
o6:10
J
o3:20
a5
(o1,a1) » (o4,a1) » (o2,a2) » (o6,a1) » (o5,a4) » (o3,a5)
LCR'02
Kristian Kvilekval UCSB
19
Evaluation
Java specjvm benchmarks
Track all objects accesses
Disconnects
Cache
Poisson/Gaussian
Duration: 500
Prefetching
LCR'02
Interval: 2
Lookahead: 512
Cache: 2048
Kristian Kvilekval UCSB
jess
Expert System
db
Address DB
mtrt
ray tracer
OO7
OO database
20
mtrt cold-misses
LCR'02
Kristian Kvilekval UCSB
21
OO7 all cold-misses
LCR'02
Kristian Kvilekval UCSB
22
OO7 Startup cold-misses
LCR'02
Kristian Kvilekval UCSB
23
Benchmarks
Benchmark
Initialized
INF:cold
PRE:cold
Time INF
Time PRE
jess
11196
1182
27
328K
310K
Db
528
51
1
11002
3982
mtrt
179527
2498
3
1803K
1222K
OO7
228535
107550
1
3133K
2547K
Infinite lookahead with infinite cache
LCR'02
Kristian Kvilekval UCSB
24
Effect of Varying Disconnect
Cost
LCR'02
Kristian Kvilekval UCSB
25
Effect of Varying Cache Size
LCR'02
Kristian Kvilekval UCSB
26
Prefetcher Overhead
benchmark
jess
objects
LCR'02
mtrt
26462
2048
209630
cache
1024
4096
10240
20480
40960
Discards cache
34386 10941 6707
24132
21073
30748
Discards pre
73350 5335
48432
16496
13213
1243
Jess \ Lookahead
0
64
256
512
1024
2048
Runtime
401K
375K
358K
357K
346K
346K
Discards
0
10K
6K
7K
7K
8.4K
wait
0
79
82
83
83
83
Kristian Kvilekval UCSB
27
Future Extensions
Accuracy and Overhead
Dynamic runtime values (hashtable)
Find high-payoff points (callgraph,history)
Balancing prefetching with
cache, bandwidth, and power.
Tuning prefetcher to link stability
And phase behavior of programs
Extend shape analysis to work at runtime
Apply to non-mobile systems.
LCR'02
Kristian Kvilekval UCSB
28
Similar Approaches
Classfiles [Krintz98]
Earliest method invocation through callgraph and block analysis
Slices for multithreaded processors [Collins01][Zilles01]
Preexecute data operations ahead of program
I/O extraction[Mitra00]
LCR'02
Extract I/O related variables and execute in separate thread.
Kristian Kvilekval UCSB
29
Conclusions
Code-based prefetching technique for
complex pointer-based structures
Able to prefetch cold misses
Good accuracy
[email protected]
LCR'02
Kristian Kvilekval UCSB
30
New Style Applications
LCR'02
Mobile
Disconnections
Collaborative
Sharing
Serverless
Distribution
Dynamic
Network-topology
Kristian Kvilekval UCSB
31
Collaborative Mobile
Applications
Calendar, Whiteboard, Bibliographer
Cooperative Web cache
Emergency services
Games
Construction/Filming/Concerts
LCR'02
Kristian Kvilekval UCSB
32
Prefetching for availability
File Systems
Explicit or Structured
Coda [Kistler92], Ficus/Rumor/Roam [Guy98]
Prediction (SEER[Keunning97])
Cluster based on file opens
Databases
Attributes [Phatak99]
Checkout [Holliday00]
Object Bases[Knafla99]
LCR'02
Access patterns applied to object structure
Kristian Kvilekval UCSB
33
Mobile Model
Groups
Wireless
Portable
LCR'02
Kristian Kvilekval UCSB
34