160 likes | 333 Views
Dynamic Instrumentation of Loops in Paradyn & Dyninst. Eli Collins eli@cs.wisc.edu Computer Sciences Department University of Wisconsin-Madison Madison, WI 53706 USA. Motivation. Function-level analysis common, insufficient Where in func is the bottleneck?. Motivation (cont.).
E N D
Dynamic Instrumentation of Loops in Paradyn & Dyninst Eli Collins eli@cs.wisc.edu Computer Sciences Department University of Wisconsin-Madison Madison, WI 53706 USA
Motivation • Function-level analysis common, insufficient • Where in func is the bottleneck?
Motivation (cont.) • Loops fundamental to program semantics • Sources of parallelism (OpenMP, unrolling) • Collect/associate perf. data at loop granularity • Loop bodies often dominate prog. runtime • Especially true for scientific apps • Exploit runtime knowledge of loops
How We Do It 110110 101011 101101 for (… int i; binary source code CFG • Compiling vs. Program Instrumentation CFG (instrumented)
Starting w/ the Binary • Compilers transform (optimize) loops • Some loops disappear • Short loops unrolled • Similar loops fused together • We analyze & operate on the binary • Binary determines program behavior: performance
Analysis • CFG creation (Laune Harris) • Detect loops in CFG (Mustafa Tikir) • Identify & instrument CFG points that map to loop execution semantics
Instrumenting Control Flow 1 entry exit start end 1 2 2 3 3 for (i = 0; i < N; i++) c[i] = a[i] + b[i]; for (i = 0; i < N; i++) c[i] = a[i] + b[i]; xor %ebx,%ebx lea 0x0(%esi),%esi lea 0x0(%edi),%edi L1 flds 0x98(%ebp,%ebx,4) fadds 0xc8(%ebp,%ebx,4) fstps 0x68(%ebp,%ebx,4) inc %ebx cmp $0x9,%ebx jle L1 xor %ebx,%ebx control flow graph
Abstractions • New instrumentation points (DyninstAPI) Vector<BPatch_basicBlockLoop *> oloops, iloops; func->getOuterLoops(oloops); loops[0]->getOuterLoops(iloops); BPatch_point *pt; pt = func->findPoint(BPatch_loopEntry, iloops[0]); thread->insertSnippet(snip, pt);
Loops in Paradyn “Where” axis displays program resources
Loops in Paradyn • Focus on resource, select program metric for visualization • Loop-granularity for metrics
Loops in Paradyn • CPU time metric with loop foci • Which part of the function is CPU intensive?
Loops in Paradyn • PC “walks” CG • Function-loop nesting
In Progress • Loop-aware Performance Consultant • What is an effective search policy? • How can we take advantage of control flow structure? • Loops in the Metric Description Language • Visualizations • Incorporate program structure • Correlate performance data with original program source
Loop-aware Visualization void func() { int i, j; for (i=0; i < N; i++) { calc(i,j); for(j=0; j < M; j++) A[i] = B[i]*C[j]; } } func loop 1 time loop 1.1
Summary • Function-level granularity insufficient • Identify & instrument loop points • DyninstAPI: abstractions for tool builders • Paradyn • Fine-grain metrics, bottleneck location • Visualization
Dynamic Instrumentation of Loops in Paradyn & Dyninst eli@cs.wisc.edu http://www.paradyn.org http://www.dyninst.org