340 likes | 448 Views
Prefetching for Mobile Computers Using Shape Graphs. Kristian Kvilekval and Ambuj Singh University of California, Santa Barbara. Cache. Prefetching for Mobile Applications. Application on Mobile Computer Access remote store objects Periodic interruption Object Oriented Databases
E N D
Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa Barbara Kristian Kvilekval UCSB
Cache Prefetching for Mobile Applications • Application on Mobile Computer • Access remote store objects • Periodic interruption • Object Oriented Databases • Distributed Object system Kristian Kvilekval UCSB
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 Kristian Kvilekval UCSB
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] Kristian Kvilekval UCSB
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 Kristian Kvilekval UCSB
part part connector right material Example shape classConnector{ 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; } Kristian Kvilekval UCSB
Construction of Shape Graphs x Kristian Kvilekval UCSB
Construction of Shape Graphs x.f = s; F Kristian Kvilekval UCSB
Construction of Shape Graphs x.f = s; t = x.f.g; F G Kristian Kvilekval UCSB
Construction of Shape Graphs x.f = s; x.f.g = t; x = x.n; N F ? G Kristian Kvilekval UCSB
N F G Construction of Shape Graphs x.f = s; x.f.g = t; if (x != null) x = x.n; Kristian Kvilekval UCSB
N F J F G K Combining Shape Graphs x = y; Kristian Kvilekval UCSB
N F J F G K Combining Shape Graphs • Unify graphs recursively Kristian Kvilekval UCSB
N F J F G K Unification of Shape Graphs • Unify graphs recursively N F J G K Kristian Kvilekval UCSB
Shape Analysis Algorithm • methods Interpret basic blocks • Create shapes for basic blocks • Run until fixed-point is reached • Propagate in static callgraph Kristian Kvilekval UCSB
Static Call Graphs main Static representation of calls m2 m3 m4 m3{ a.f = s; o.m4(a) } Class C { m4(F f) { … } Unify(a,f) f Kristian Kvilekval UCSB
Call Graphs m1 • Propagate bottom up • Merge polymorphic calls • Recursive Calls • Fixed point • Merge SCC[Ruf00] m2 B.m4 m3 m4 D1.m4 D2.m4 m1 m2 m1 Kristian Kvilekval UCSB
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 • Interpret shape graph on the actual object graph Kristian Kvilekval UCSB
Prefetching with Shape Graphs N:5 a1 N N o1:0 o4:5 o6:10 J:10 F:10 F J J o2:10 o5:15 a2 a4 K G:5 K:10 o3:20 a3 a5 (o1,a1) » (o4,a1) » (o2,a2) » (o6,a1) » (o5,a4) » (o3,a5) Kristian Kvilekval UCSB
Evaluation • Java specjvm benchmarks • Track all objects accesses • Disconnects • Poisson/Gaussian • Duration: 500 • Prefetching • Interval: 2 • Lookahead: 512 • Cache: 2048 Cache Kristian Kvilekval UCSB
mtrt cold-misses Kristian Kvilekval UCSB
OO7 all cold-misses Kristian Kvilekval UCSB
OO7 Startup cold-misses Kristian Kvilekval UCSB
Benchmarks Infinite lookahead with infinite cache Kristian Kvilekval UCSB
Effect of Varying Disconnect Cost Kristian Kvilekval UCSB
Effect of Varying Cache Size Kristian Kvilekval UCSB
Prefetcher Overhead Kristian Kvilekval UCSB
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. Kristian Kvilekval UCSB
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. Kristian Kvilekval UCSB
Conclusions • Code-based prefetching technique for complex pointer-based structures • Able to prefetch cold misses • Good accuracy kris@cs.ucsb.edu Kristian Kvilekval UCSB
New Style Applications Disconnections Sharing Distribution Network-topology Mobile Collaborative Serverless Dynamic Kristian Kvilekval UCSB
Collaborative Mobile Applications • Calendar, Whiteboard, Bibliographer • Cooperative Web cache • Emergency services • Games • Construction/Filming/Concerts Kristian Kvilekval UCSB
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 Kristian Kvilekval UCSB
Mobile Model Groups Wireless Portable Kristian Kvilekval UCSB