lcr'02kristian kvilekval ucsb 1 prefetching for mobile computers using shape graphs kristian...
Post on 21-Dec-2015
215 views
TRANSCRIPT
LCR'02 Kristian Kvilekval UCSB 1
Prefetching for Mobile Computers Using Shape Graphs
Kristian Kvilekval and Ambuj SinghUniversity of California, Santa Barbara
LCR'02 Kristian Kvilekval UCSB 2
Prefetching for Mobile Applications
Cache
•Application on Mobile Computer
•Access remote store objects
•Periodic interruption
•Object Oriented Databases
•Distributed Object system
LCR'02 Kristian Kvilekval UCSB 3
Our Approach
Code-based prefetching Prefetch only those objects accessed by the code Extract program access patterns Provide runtime system with future accesses
Advantages Complex pointer-based structures Prefetches cold misses Good accuracy
LCR'02 Kristian Kvilekval UCSB 4
Capturing Access Pattern Statically
Shape Analysis Represents runtime data structures at compile
time as graphs
Applications: extracts properties of programs Synchronization[Bogda99][Ruf00] Parallelization[Corbera99] Safety[Ghiya96][Nurit98][Wilhem00]
LCR'02 Kristian Kvilekval UCSB 5
Basic Shape Analysis
Graph Abstract locations (heap cells) Edges labeled with with field names
Abstract interpretation Extend graph through field references Combine graphs when heap location is shared
LCR'02 Kristian Kvilekval UCSB 6
Example shape
class Connector{ Part a,b; }class Part { Connector left,right,up,down; Material m Supplier s; … int volume();}
weight=0;while (part) { weight+=(part.material.density *part.volume()); part=part.right.b;}
part connector
part
right
material
LCR'02 Kristian Kvilekval UCSB 7
Construction of Shape Graphs
x
LCR'02 Kristian Kvilekval UCSB 8
Construction of Shape Graphs
F
x.f = s;
LCR'02 Kristian Kvilekval UCSB 9
Construction of Shape Graphs
F
G
x.f = s;t = x.f.g;
LCR'02 Kristian Kvilekval UCSB 10
Construction of Shape Graphs
F
G
x.f = s;x.f.g = t; x = x.n;
N
?
LCR'02 Kristian Kvilekval UCSB 11
Construction of Shape Graphs
F
G
N
x.f = s;x.f.g = t;if (x != null) x = x.n;
LCR'02 Kristian Kvilekval UCSB 12
Combining Shape Graphs
F
G
N
F
K
J
x = y;
LCR'02 Kristian Kvilekval UCSB 13
Combining Shape Graphs
F
G
N
F
K
J
Unify graphs recursively
LCR'02 Kristian Kvilekval UCSB 14
Unification of Shape Graphs
F
G
N
F
K
J
G K
F J
N
Unify graphs recursively
LCR'02 Kristian Kvilekval UCSB 15
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 16
Static Call Graphs
mainm2m3
m4
m3{a.f = s;o.m4(a)}Class C { m4(F f) { … }
Static representation of calls
f
Unify(a,f)
LCR'02 Kristian Kvilekval UCSB 17
Call Graphs
Propagate bottom up Merge polymorphic calls
Recursive Calls Fixed point Merge SCC[Ruf00]
m1m2m3
m4B.m4
D1.m4
D2.m4
m1
m2
m1
LCR'02 Kristian Kvilekval UCSB 18
Prefetching with shape graphs
Compile Time Generate shapes for method references
Self, arguments, and global variablesLabel shape edges with earliest access
Annotate programs to pass visible references and method ID to runtime
Runtime Interpret shape graph on the actual object graph
LCR'02 Kristian Kvilekval UCSB 19
Prefetching with Shape Graphs
a1
a2
a5
a4
a3
G:5 K:10
F:10 J:10
N:5
o1:0 o4:5N
o6:10N
o2:10 o5:15
o3:20
F
K
JJ
(o1,a1) » (o4,a1) » (o2,a2) » (o6,a1) » (o5,a4) » (o3,a5)
LCR'02 Kristian Kvilekval UCSB 20
Evaluation
Java specjvm benchmarks Track all objects accesses
Disconnects Poisson/Gaussian Duration: 500
Prefetching Interval: 2 Lookahead: 512 Cache: 2048
Cache
jess Expert System
db Address DB
mtrt ray tracer
OO7 OO database
LCR'02 Kristian Kvilekval UCSB 21
mtrt cold-misses
LCR'02 Kristian Kvilekval UCSB 22
OO7 all cold-misses
LCR'02 Kristian Kvilekval UCSB 23
OO7 Startup cold-misses
LCR'02 Kristian Kvilekval UCSB 24
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 25
Effect of Varying Disconnect Cost
LCR'02 Kristian Kvilekval UCSB 26
Effect of Varying Cache Size
LCR'02 Kristian Kvilekval UCSB 27
Prefetcher Overhead
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
benchmark jess mtrt
objects 26462 209630
cache 1024 2048 4096 10240 20480 40960
Discards cache 34386 10941 6707 24132 21073 30748
Discards pre 73350 5335 1243 48432 16496 13213
LCR'02 Kristian Kvilekval UCSB 28
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 29
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] Extract I/O related variables and execute in separate thread.
LCR'02 Kristian Kvilekval UCSB 30
Conclusions
Code-based prefetching technique for complex pointer-based structures
Able to prefetch cold misses Good accuracy
LCR'02 Kristian Kvilekval UCSB 31
New Style Applications
Mobile
Collaborative
Serverless
Dynamic
Disconnections
Sharing
Distribution
Network-topology
LCR'02 Kristian Kvilekval UCSB 32
Calendar, Whiteboard, Bibliographer Cooperative Web cache Emergency services Games Construction/Filming/Concerts
Collaborative Mobile Applications
LCR'02 Kristian Kvilekval UCSB 33
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]
Access patterns applied to object structure
LCR'02 Kristian Kvilekval UCSB 34
Mobile Model
Groups
Portable
Wireless