Efficient path profiling

54
Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results Paper Presentation: Efficient Path Profiling Paper Author: Thomas Ball, James R. Larus Aakriti Gupta Topics in software bug detection Instructor: Prof. M. K. Ramanathan Indian Institute of Science [email protected] January 20, 2014

description

My presentation of the 1996 Ball-Larus paper on Path Profiling.

Transcript of Efficient path profiling

Page 1: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Paper Presentation: Efficient Path ProfilingPaper Author: Thomas Ball, James R. Larus

Aakriti Gupta

Topics in software bug detectionInstructor: Prof. M. K. Ramanathan

Indian Institute of Science

[email protected]

January 20, 2014

Page 2: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Path Profiling

How often does a control flow path execute?

Used in program performance tuning, profile-directedcompilation and software test coverage etc.

Before this, basic block and control flow edge profiling wereused. Path profiling was assumed to be much more costly.

This paper shows that accurate path profiling overhead is onlytwice as compared to efficient edge profiling.

Page 3: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Path Profiling

How often does a control flow path execute?

Used in program performance tuning, profile-directedcompilation and software test coverage etc.

Before this, basic block and control flow edge profiling wereused. Path profiling was assumed to be much more costly.

This paper shows that accurate path profiling overhead is onlytwice as compared to efficient edge profiling.

Page 4: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Path Profiling

How often does a control flow path execute?

Used in program performance tuning, profile-directedcompilation and software test coverage etc.

Before this, basic block and control flow edge profiling wereused. Path profiling was assumed to be much more costly.

This paper shows that accurate path profiling overhead is onlytwice as compared to efficient edge profiling.

Page 5: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Path Profiling

How often does a control flow path execute?

Used in program performance tuning, profile-directedcompilation and software test coverage etc.

Before this, basic block and control flow edge profiling wereused. Path profiling was assumed to be much more costly.

This paper shows that accurate path profiling overhead is onlytwice as compared to efficient edge profiling.

Page 6: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Path Profiling vs. Edge Profiling

A

B C

D

E F

120

150

100

20

250

160

110

160

270

Path Prof1 Prof2

ACDF 90 110ACDEF 60 40ABCDF 0 0ABCDEF 100 100ABDF 20 0ABDEF 0 20

Can’t uniquely identify path profile using edge profile

Vice versa is possible.

Page 7: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Edge Profiling Instrumentation

A

B C

D

E F

v++

u++

t++

w++

Edge Value

AC vBC uBD tDE wAB u+tCD u+vDF u+v+t-wEF wFA u+v+t

Many variables need to be stored; causes increased memoryaccesses.

Page 8: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Path Profiling Instrumentation

A

B C

D

E F

r=0

r=2

r=4

r+=1count[r]++

Path Encoding

ACDF 0ACDEF 1ABCDF 2ABCDEF 3ABDF 4ABDEF 5

Each path from A to F produces a unique state in register r, whichhave been used as an index into an array of counters in block F.

Page 9: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Optimal Path Profiling

A

B C

D

E F

0

2

4

+1

Optimal

4 instrumentededges

Max 2 along apath

A

B C

D

E F

5

1

-2

-1

4 instrumentededges

Max along apath can bemore than 2(ABCDF)

A

B C

D

E F

1

0

+1

+3

+1

5 instrumentededges

Page 10: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Step 1: Edge Assignment

Assign a non-negative constant value to each edge, such thatthe sum of values along any path from ENTRY to EXIT isunique.

Path sums should lie in the range 0 to (number of paths - 1).

Page 11: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Edge Assignment Algorithm

Algorithm 1 for assigning values toedges in a DAG.

1: for each vertex v in reverse topolog-ical order do

2: if v is a leaf vertex then3: NPaths[v ] = 14: else5: NPaths[v ] = 06: for each edge e from v to w do7: val(e) = NPaths[v ]8: NPaths[v ]+ = NPaths[w ]9: end for

10: end if11: end for

A

B C

D

E F

2

0

0

2

0

1

0

0

Edge Assignment Output

Page 12: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Step 2: Edge Selection (Maximal Spanning Tree)

Weigh edges byexecution frequency(Edge Profiling is apre-requisite?)

Find maximal costspanning tree

This gives minimalcost set of the chords

Maximal spanningtree instruments leasttraveled edges

A

B C

D

E F

Page 13: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Step 2: Edge Selection (Event Counting Algorithm)

In the tree found, put the edge assignments as per step 1. Nowone by one add a chord and note the weight of the cycle thusformed. This will serve as the given chord’s instrumentation value.

A

B C

D

E F

2

0

0

2

0

1

0

0

Graph from step 1

A

B

D

F

2

2

0

Cycle weight = 4,therefore BD isinstrumented withvalue 4

A

B C

D

E F

0

2

4

1

Final result afterstep 2

Page 14: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Step 3: Instrumentation

PRELUDE :- Array of counters allocated and initialized to 0

POSTLUDE :- Array is written out to permanent storage

ENTRY node :- Initialize r := 0

CHORDS :- Update r += Inc(chord)

EXIT node :- Increment path counter count[r]++

To avoid ENTRY node initialization

A chord ’c’ may initialize iff it is the first chord in every path fromENTRY to EXIT containing ’c’.

To avoid EXIT node updation

A chord ’c’ may update count[r+Inc(c)]++ iff it is the last chordin every path from ENTRY to EXIT containing ’c’.

Page 15: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Step 3: Instrumentation

PRELUDE :- Array of counters allocated and initialized to 0

POSTLUDE :- Array is written out to permanent storage

ENTRY node :- Initialize r := 0

CHORDS :- Update r += Inc(chord)

EXIT node :- Increment path counter count[r]++

To avoid ENTRY node initialization

A chord ’c’ may initialize iff it is the first chord in every path fromENTRY to EXIT containing ’c’.

To avoid EXIT node updation

A chord ’c’ may update count[r+Inc(c)]++ iff it is the last chordin every path from ENTRY to EXIT containing ’c’.

Page 16: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Step 3: Instrumentation

PRELUDE :- Array of counters allocated and initialized to 0

POSTLUDE :- Array is written out to permanent storage

ENTRY node :- Initialize r := 0

CHORDS :- Update r += Inc(chord)

EXIT node :- Increment path counter count[r]++

To avoid ENTRY node initialization

A chord ’c’ may initialize iff it is the first chord in every path fromENTRY to EXIT containing ’c’.

To avoid EXIT node updation

A chord ’c’ may update count[r+Inc(c)]++ iff it is the last chordin every path from ENTRY to EXIT containing ’c’.

Page 17: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Step 3: Instrumentation

PRELUDE :- Array of counters allocated and initialized to 0

POSTLUDE :- Array is written out to permanent storage

ENTRY node :- Initialize r := 0

CHORDS :- Update r += Inc(chord)

EXIT node :- Increment path counter count[r]++

To avoid ENTRY node initialization

A chord ’c’ may initialize iff it is the first chord in every path fromENTRY to EXIT containing ’c’.

To avoid EXIT node updation

A chord ’c’ may update count[r+Inc(c)]++ iff it is the last chordin every path from ENTRY to EXIT containing ’c’.

Page 18: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Step 3: Instrumentation

PRELUDE :- Array of counters allocated and initialized to 0

POSTLUDE :- Array is written out to permanent storage

ENTRY node :- Initialize r := 0

CHORDS :- Update r += Inc(chord)

EXIT node :- Increment path counter count[r]++

To avoid ENTRY node initialization

A chord ’c’ may initialize iff it is the first chord in every path fromENTRY to EXIT containing ’c’.

To avoid EXIT node updation

A chord ’c’ may update count[r+Inc(c)]++ iff it is the last chordin every path from ENTRY to EXIT containing ’c’.

Page 19: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Step 3: Instrumentation

PRELUDE :- Array of counters allocated and initialized to 0

POSTLUDE :- Array is written out to permanent storage

ENTRY node :- Initialize r := 0

CHORDS :- Update r += Inc(chord)

EXIT node :- Increment path counter count[r]++

To avoid ENTRY node initialization

A chord ’c’ may initialize iff it is the first chord in every path fromENTRY to EXIT containing ’c’.

To avoid EXIT node updation

A chord ’c’ may update count[r+Inc(c)]++ iff it is the last chordin every path from ENTRY to EXIT containing ’c’.

Page 20: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Step 3: Instrumentation

PRELUDE :- Array of counters allocated and initialized to 0

POSTLUDE :- Array is written out to permanent storage

ENTRY node :- Initialize r := 0

CHORDS :- Update r += Inc(chord)

EXIT node :- Increment path counter count[r]++

To avoid ENTRY node initialization

A chord ’c’ may initialize iff it is the first chord in every path fromENTRY to EXIT containing ’c’.

To avoid EXIT node updation

A chord ’c’ may update count[r+Inc(c)]++ iff it is the last chordin every path from ENTRY to EXIT containing ’c’.

Page 21: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Step 3: Instrumentation Output

A

B C

D

E F

r=0

r=2

r=4

count[r+1]++

count[r]++

Page 22: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Step 4: Path Generation

Given ’r’ and the control flow graph from step 1, start from entryvertex and choose the next edge ’e’ such that largest val(e) is lessthan or equal to r. Make r = r - val(e) and proceed.

A

B C

D

E F

2

0

0

2

0

1

0

0

Suppose r = 3.

AB: r = 3-2 = 1

AB: r = 1

CD: r = 1

DE: r = 1-1 = 0

EF: r = 0

Hence, path corresponding to r=3 isABCDEF.

Page 23: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Dealing with Arbitrary Control Flow Graphs

The algorithm discussed is capabale of dealing only withDAGs (Directed Acyclic Graphs)

But control flow graphs generally contains cycles

With unbounded number of paths, which path to track?

Approach: Break cycles at loop backedge.

Instrument each backedge with [count[r]++; r=0], whichrecords the path upto the backedge and prepares to record thepath after the backedge.

Page 24: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Dealing with Arbitrary Control Flow Graphs

The algorithm discussed is capabale of dealing only withDAGs (Directed Acyclic Graphs)

But control flow graphs generally contains cycles

With unbounded number of paths, which path to track?

Approach: Break cycles at loop backedge.

Instrument each backedge with [count[r]++; r=0], whichrecords the path upto the backedge and prepares to record thepath after the backedge.

Page 25: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Dealing with Arbitrary Control Flow Graphs

The algorithm discussed is capabale of dealing only withDAGs (Directed Acyclic Graphs)

But control flow graphs generally contains cycles

With unbounded number of paths, which path to track?

Approach: Break cycles at loop backedge.

Instrument each backedge with [count[r]++; r=0], whichrecords the path upto the backedge and prepares to record thepath after the backedge.

Page 26: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Dealing with Arbitrary Control Flow Graphs

The algorithm discussed is capabale of dealing only withDAGs (Directed Acyclic Graphs)

But control flow graphs generally contains cycles

With unbounded number of paths, which path to track?

Approach: Break cycles at loop backedge.

Instrument each backedge with [count[r]++; r=0], whichrecords the path upto the backedge and prepares to record thepath after the backedge.

Page 27: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Dealing with Arbitrary Control Flow Graphs

The algorithm discussed is capabale of dealing only withDAGs (Directed Acyclic Graphs)

But control flow graphs generally contains cycles

With unbounded number of paths, which path to track?

Approach: Break cycles at loop backedge.

Instrument each backedge with [count[r]++; r=0], whichrecords the path upto the backedge and prepares to record thepath after the backedge.

Page 28: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Possible Paths

ENTRY

EXIT

ENTRY toEXIT

ENTRY

LOOPHEAD(w)

v

ENTRY to v,thenbackedge vto w.

LOOPHEAD(w)

LOOPHEAD(y)

x

w to x, thenbackedge xto y.

LOOPHEAD(w)

EXIT

v to w, thenw to EXIT.

Page 29: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Instrumenting Backedges: Example

A

B

C D

E

F

G H

I

r=0

2

4

count[r]++; r=0

1

count[r]++

This assignmentdoes not ensureunique path values.Example: BCE,ABCE, ABCEFGIand BCEFGI allhave value 2.

Page 30: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Solution

For each vertex v that is a target of any backedge, add adummy edge ENTRY to v.

For each vertex w that is a source of any backedge, add adummy edge w to EXIT.

Eliminate all backedges except EXIT to ENTRY.

Apply first two steps of Path Profiling Algo (Edge valueassignment and chord increment).

Page 31: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Solution

For each vertex v that is a target of any backedge, add adummy edge ENTRY to v.

For each vertex w that is a source of any backedge, add adummy edge w to EXIT.

Eliminate all backedges except EXIT to ENTRY.

Apply first two steps of Path Profiling Algo (Edge valueassignment and chord increment).

Page 32: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Solution

For each vertex v that is a target of any backedge, add adummy edge ENTRY to v.

For each vertex w that is a source of any backedge, add adummy edge w to EXIT.

Eliminate all backedges except EXIT to ENTRY.

Apply first two steps of Path Profiling Algo (Edge valueassignment and chord increment).

Page 33: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Solution

For each vertex v that is a target of any backedge, add adummy edge ENTRY to v.

For each vertex w that is a source of any backedge, add adummy edge w to EXIT.

Eliminate all backedges except EXIT to ENTRY.

Apply first two steps of Path Profiling Algo (Edge valueassignment and chord increment).

Page 34: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

After applying transformation and Edge value assignment

A

B

C D

E

F

G H

I

2

0

8

0

3

0

2

0

1

Page 35: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

After computing chord increments

A(r = 0)

B

C D

E

F

G H

I

-6

2

10

13

r=0; count[r]++

-2

-1

count[r]++

’r’ uniquelydetermines apath now.

Page 36: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Dealing with Self Loops

Self loops are backedges with same source and target vertex.

We can’t just remove them as it leaves nothing forinstrumentation.

Approach: Add a counter along them to record the number oftimes they execute.

Page 37: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Dealing with Self Loops

Self loops are backedges with same source and target vertex.

We can’t just remove them as it leaves nothing forinstrumentation.

Approach: Add a counter along them to record the number oftimes they execute.

Page 38: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Dealing with Self Loops

Self loops are backedges with same source and target vertex.

We can’t just remove them as it leaves nothing forinstrumentation.

Approach: Add a counter along them to record the number oftimes they execute.

Page 39: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Optimizations

Instead of storing r as index into the count array, make it apointer. (saves 2 instructions per path)

Initialize r with base address of the array and do pointerarithmetic when r is updated.

This optimization, however reduces the range of increments.

In step 1, we can choose edges (v,w) such that NumPath[w] ismax of the set to reduce the range of increments.

Page 40: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Optimizations

Instead of storing r as index into the count array, make it apointer. (saves 2 instructions per path)

Initialize r with base address of the array and do pointerarithmetic when r is updated.

This optimization, however reduces the range of increments.

In step 1, we can choose edges (v,w) such that NumPath[w] ismax of the set to reduce the range of increments.

Page 41: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Optimizations

Instead of storing r as index into the count array, make it apointer. (saves 2 instructions per path)

Initialize r with base address of the array and do pointerarithmetic when r is updated.

This optimization, however reduces the range of increments.

In step 1, we can choose edges (v,w) such that NumPath[w] ismax of the set to reduce the range of increments.

Page 42: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Optimizations

Instead of storing r as index into the count array, make it apointer. (saves 2 instructions per path)

Initialize r with base address of the array and do pointerarithmetic when r is updated.

This optimization, however reduces the range of increments.

In step 1, we can choose edges (v,w) such that NumPath[w] ismax of the set to reduce the range of increments.

Page 43: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Example

A

B

C

D

54

0

A

B

C

D

01

2

numPaths[B] = 1; numPaths[C] = 1; numPaths[D] = 4.

Page 44: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Experimental Results

Path profiling overhead - 30.9% (5.5 to 96.9%).

Edge profiling overhead - 16.1% (-2.6 to 52.8%).

Programs with litte hashing have comparable or loweroverhead.

Programs with considerable hashing have lower overheads ifthey have large blocks or longer paths and infrequentexecution of path increments.

Page 45: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Experimental Results

Path profiling overhead - 30.9% (5.5 to 96.9%).

Edge profiling overhead - 16.1% (-2.6 to 52.8%).

Programs with litte hashing have comparable or loweroverhead.

Programs with considerable hashing have lower overheads ifthey have large blocks or longer paths and infrequentexecution of path increments.

Page 46: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Experimental Results

Path profiling overhead - 30.9% (5.5 to 96.9%).

Edge profiling overhead - 16.1% (-2.6 to 52.8%).

Programs with litte hashing have comparable or loweroverhead.

Programs with considerable hashing have lower overheads ifthey have large blocks or longer paths and infrequentexecution of path increments.

Page 47: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Experimental Results

Path profiling overhead - 30.9% (5.5 to 96.9%).

Edge profiling overhead - 16.1% (-2.6 to 52.8%).

Programs with litte hashing have comparable or loweroverhead.

Programs with considerable hashing have lower overheads ifthey have large blocks or longer paths and infrequentexecution of path increments.

Page 48: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Experimental Results

Results of comparing path predicted from edge profilingagainst measured paths.

Prediction approach: Use the most frequently executed edgeout of a block.

On average 37.9% (4.3-57.1%) paths correctly predicted.

Also computed the length of the predicted path upto firstmispredicted edge.

Weighted by the execution frequency, predicted paths werenearly as good as measured paths (5.1 vs 6.9) but containedfewer instructions (33.6 vs 88.4).

Result is attributed to simple nature of benchmarks.Consistent with: branches typically follow one direction withhigh probability which remains same for different input.

Page 49: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Experimental Results

Results of comparing path predicted from edge profilingagainst measured paths.

Prediction approach: Use the most frequently executed edgeout of a block.

On average 37.9% (4.3-57.1%) paths correctly predicted.

Also computed the length of the predicted path upto firstmispredicted edge.

Weighted by the execution frequency, predicted paths werenearly as good as measured paths (5.1 vs 6.9) but containedfewer instructions (33.6 vs 88.4).

Result is attributed to simple nature of benchmarks.Consistent with: branches typically follow one direction withhigh probability which remains same for different input.

Page 50: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Experimental Results

Results of comparing path predicted from edge profilingagainst measured paths.

Prediction approach: Use the most frequently executed edgeout of a block.

On average 37.9% (4.3-57.1%) paths correctly predicted.

Also computed the length of the predicted path upto firstmispredicted edge.

Weighted by the execution frequency, predicted paths werenearly as good as measured paths (5.1 vs 6.9) but containedfewer instructions (33.6 vs 88.4).

Result is attributed to simple nature of benchmarks.Consistent with: branches typically follow one direction withhigh probability which remains same for different input.

Page 51: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Experimental Results

Results of comparing path predicted from edge profilingagainst measured paths.

Prediction approach: Use the most frequently executed edgeout of a block.

On average 37.9% (4.3-57.1%) paths correctly predicted.

Also computed the length of the predicted path upto firstmispredicted edge.

Weighted by the execution frequency, predicted paths werenearly as good as measured paths (5.1 vs 6.9) but containedfewer instructions (33.6 vs 88.4).

Result is attributed to simple nature of benchmarks.Consistent with: branches typically follow one direction withhigh probability which remains same for different input.

Page 52: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Experimental Results

Results of comparing path predicted from edge profilingagainst measured paths.

Prediction approach: Use the most frequently executed edgeout of a block.

On average 37.9% (4.3-57.1%) paths correctly predicted.

Also computed the length of the predicted path upto firstmispredicted edge.

Weighted by the execution frequency, predicted paths werenearly as good as measured paths (5.1 vs 6.9) but containedfewer instructions (33.6 vs 88.4).

Result is attributed to simple nature of benchmarks.Consistent with: branches typically follow one direction withhigh probability which remains same for different input.

Page 53: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Experimental Results

Results of comparing path predicted from edge profilingagainst measured paths.

Prediction approach: Use the most frequently executed edgeout of a block.

On average 37.9% (4.3-57.1%) paths correctly predicted.

Also computed the length of the predicted path upto firstmispredicted edge.

Weighted by the execution frequency, predicted paths werenearly as good as measured paths (5.1 vs 6.9) but containedfewer instructions (33.6 vs 88.4).

Result is attributed to simple nature of benchmarks.Consistent with: branches typically follow one direction withhigh probability which remains same for different input.

Page 54: Efficient path profiling

Path Profiling Path Profiling Algorithm Arbitrary Control Flow Graph Optimizations Experimental Results

Thank you.