lcr'02kristian kvilekval ucsb 1 prefetching for mobile computers using shape graphs kristian...

34
LCR'02 Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa Barbara

Post on 21-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 1

Prefetching for Mobile Computers Using Shape Graphs

Kristian Kvilekval and Ambuj SinghUniversity of California, Santa Barbara

Page 2: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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

Page 3: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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

Page 4: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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]

Page 5: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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

Page 6: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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

Page 7: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 7

Construction of Shape Graphs

x

Page 8: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 8

Construction of Shape Graphs

F

x.f = s;

Page 9: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 9

Construction of Shape Graphs

F

G

x.f = s;t = x.f.g;

Page 10: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 10

Construction of Shape Graphs

F

G

x.f = s;x.f.g = t; x = x.n;

N

?

Page 11: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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;

Page 12: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 12

Combining Shape Graphs

F

G

N

F

K

J

x = y;

Page 13: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 13

Combining Shape Graphs

F

G

N

F

K

J

Unify graphs recursively

Page 14: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 14

Unification of Shape Graphs

F

G

N

F

K

J

G K

F J

N

Unify graphs recursively

Page 15: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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

Page 16: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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)

Page 17: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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

Page 18: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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

Page 19: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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)

Page 20: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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

Page 21: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 21

mtrt cold-misses

Page 22: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 22

OO7 all cold-misses

Page 23: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 23

OO7 Startup cold-misses

Page 24: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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

Page 25: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 25

Effect of Varying Disconnect Cost

Page 26: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 26

Effect of Varying Cache Size

Page 27: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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

Page 28: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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.

Page 29: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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.

Page 30: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 30

Conclusions

Code-based prefetching technique for complex pointer-based structures

Able to prefetch cold misses Good accuracy

[email protected]

Page 31: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 31

New Style Applications

Mobile

Collaborative

Serverless

Dynamic

Disconnections

Sharing

Distribution

Network-topology

Page 32: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 32

Calendar, Whiteboard, Bibliographer Cooperative Web cache Emergency services Games Construction/Filming/Concerts

Collaborative Mobile Applications

Page 33: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

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

Page 34: LCR'02Kristian Kvilekval UCSB 1 Prefetching for Mobile Computers Using Shape Graphs Kristian Kvilekval and Ambuj Singh University of California, Santa

LCR'02 Kristian Kvilekval UCSB 34

Mobile Model

Groups

Portable

Wireless