Dynamic Instrumentation of Loops in Paradyn & Dyninst Eli Collins [email protected] Computer Sciences...
-
Upload
joseph-townsend -
Category
Documents
-
view
216 -
download
0
Transcript of Dynamic Instrumentation of Loops in Paradyn & Dyninst Eli Collins [email protected] Computer Sciences...
Dynamic Instrumentation of Loops in Paradyn & Dyninst
Computer Sciences DepartmentUniversity of Wisconsin-Madison
Madison, WI 53706USA
Loop Instrumentation-2-
Motivation
• Function-level analysis common, insufficient
•Where in func is the bottleneck?
Loop Instrumentation-3-
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
Loop Instrumentation-4-
How We Do It
• Compiling vs. Program Instrumentation
for (… int i;
source code
CFG
110110101011101101
binaryCFG (instrumented)
Loop Instrumentation-5-
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
Loop Instrumentation-6-
Analysis
• CFG creation (Laune Harris)
• Detect loops in CFG (Mustafa Tikir)
• Identify & instrument CFG points that
map to loop execution semantics
Loop Instrumentation-7-
Instrumenting Control Flow 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
for (i = 0; i < N; i++) c[i] = a[i] + b[i];
control flow graph
3
2
1
1
2
3
entry
exit
start
end
Loop Instrumentation-8-
Abstractions• New instrumentation points
(DyninstAPI)
BPatch_point *pt;
pt = func->findPoint(BPatch_loopEntry,
iloops[0]);
thread->insertSnippet(snip, pt);
Vector<BPatch_basicBlockLoop *> oloops, iloops;
func->getOuterLoops(oloops);
loops[0]->getOuterLoops(iloops);
Loop Instrumentation-9-
Loops in Paradyn
“Where” axis displays program resources
Loop Instrumentation-10-
Loops in Paradyn
• Focus on resource, select program metric for visualization
• Loop-granularity for metrics
Loop Instrumentation-11-
Loops in Paradyn
• CPU time metric with loop foci• Which part of the function is CPU intensive?
Loop Instrumentation-12-
Loops in Paradyn
• PC “walks” CG • Function-loop nesting
Loop Instrumentation-13-
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 Instrumentation-14-
Loop-aware Visualization
func
loop 1
tim
e
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];
}
}
loop 1.1
Loop Instrumentation-15-
Summary
• Function-level granularity insufficient
• Identify & instrument loop points
• DyninstAPI: abstractions for tool
builders
• Paradyn
– Fine-grain metrics, bottleneck location
– Visualization
Loop Instrumentation-16-
Dynamic Instrumentation of Loops in Paradyn & Dyninst
http://www.paradyn.org
http://www.dyninst.org