Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Whole Execution Trace and Its Applications in CS 260.2, Study notes of Computer Science

The concept of whole execution trace and its applications, including execution histories, control flow, dependencies, exercised addresses, referenced values, compiler optimizations, processor architectures, debugging, and testing. Topics covered include hot path specialization, value-based specialization, locality improving transformations, branch prediction, value prediction, code and data prefetching, load-store disambiguation, frequent values, delta debugging, dynamic slicing, and likely invariants.

Typology: Study notes

2009/2010

Uploaded on 03/28/2010

koofers-user-3ae-1
koofers-user-3ae-1 🇺🇸

10 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Whole Execution Trace and its
Applications
CS 260.2
2
Execution Histories
Control
Flow
Dependences
Exercised
Addresses
Referenced
Values
Computed
Compiler Optimizations
Hot Path Specialization
Value-based Specialization
Locality Improving Transformations
Data Speculation etc.
Profile-Guided Redundant and
Dead Code Elimination
Branches [PLDI’97a]
Assignments [PLDI’97b]
Expressions [MICRO’97,PLDI ’98]
Loads/Stores [PLDI’99,IJPP’ 96]
Bounds Checks [PLDI’00]
3
Execution Histories
Control
Flow
Dependences
Exercised
Addresses
Referenced
Values
Computed
Processor Architectures
Branch Prediction
Value Prediction
Code & Data Prefetching
Load-Store Disambiguation
Power
Frequent Values [ASPLOS’00,ACM TE CS’02]
Compression Caches [MICRO’02&’0 0]
Off-Chip Buses [ACM TODAES’04]
Performance
Value Prediction [HPCA’99,ISCA’99]
Load-Store Disambiguation [MICRO’9 9]
4
Execution Histories
Control
Flow
Dependences
Exercised
Addresses
Referenced
Values
Computed
Debugging & Testing
Delta Debugging
Dynamic Slicing
Likely Invariants
Test Suite Coverage
Dynamic Matching
Comparing executions
of two versions
[ESEC/FSE -05]
Efficient - space and time
[ICSE-03, TOPLAS 2005,
ICSE-04, PLDI-04]
Effective in locating faults
[AADEBUG-05, ASE-05,
ICSE-06, PLDI-06]
Dynamic Slicing
5
Whole Execution Trace Representation
Static Program Representation
Control flow graph
Program Dependences
Data and control dependences
Dynamic Profile Representation
Designed for Analysis
Annotates static program representation
Related information can be easily accessed
Comprehensive
Control flow
Addresses and values
Data and control dependences
Compact
Design compression techniques
6
Input: N=2
Representation of Dynamic Information
51: for I=1 to N do
61: if (i%2==0) then
71: p=&a
81: a=a+1
91: z=2*(*p)
101: print(z)
11: z=0
21: a=0
31: b=2
41: p=&b
52: for I=1 to N do
62: if (i%2==0) then
82: a=a+1
92: z=2*(*p)
1: z=0
2: a=0
3: b=2
4: p=&b
5: for i = 1 to N do
6: if ( i %2 == 0) then
7: p=&a
endif
endfor
8: a=a+1
9: z=2*(*p)
10: print(z)
&b
&a
0
0
2
1
F
1
4
2
T
2
4
4
pf3
pf4
pf5
pf8

Partial preview of the text

Download Whole Execution Trace and Its Applications in CS 260.2 and more Study notes Computer Science in PDF only on Docsity!

Whole Execution Trace and its

Applications

CS 260.

2 Execution Histories Control Flow Dependences Exercised Addresses Referenced Values Computed Compiler Optimizations  Hot Path Specialization  Value-based Specialization  Locality Improving Transformations  Data Speculation etc. Profile-Guided Redundant and Dead Code Elimination  Branches [ PLDI’97a ]  Assignments [ PLDI’97b ]  Expressions [ MICRO’97,PLDI’ 98 ]  Loads/Stores [ PLDI’99,IJPP’ 96 ]  Bounds Checks [ PLDI’ 00 ] 3 Execution Histories Control Flow Dependences Exercised Addresses Referenced Values Computed Processor Architectures  Branch Prediction  Value Prediction  Code & Data Prefetching  Load-Store Disambiguation Power  Frequent Values [ ASPLOS’00,ACM TECS’ 02 ]  Compression Caches [ MICRO’02&’ 00 ]  Off-Chip Buses [ ACM TODAES’ 04 ] Performance  Value Prediction [ HPCA’99,ISCA’ 99 ]  Load-Store Disambiguation [ MICRO’ 99 ] 4 Execution Histories Control Flow Dependences Exercised Addresses Referenced Values Computed Debugging & Testing  Delta Debugging  Dynamic Slicing  Likely Invariants  Test Suite Coverage Dynamic Matching  Comparing executions of two versions [ ESEC/FSE -05 ]  Efficient - space and time [ ICSE-03, TOPLAS 2005, ICSE-04, PLDI-04 ]  Effective in locating faults [ AADEBUG-05, ASE-05, ICSE-06, PLDI-06 ] Dynamic Slicing 5 Whole Execution Trace Representation  Static Program Representation

  • Control flow graph
  • Program Dependences  Data and control dependences  Dynamic Profile Representation
  • Designed for Analysis  Annotates static program representation  Related information can be easily accessed
  • Comprehensive  Control flow  Addresses and values  Data and control dependences
  • Compact  Design compression techniques 6 Input: N= Representation of Dynamic Information 51 : for I=1 to N do 61 : if (i%2==0) then 71 : p=&a 81 : a=a+ 91 : z=2(p) 101 : print(z) 11 : z= 21 : a= 31 : b= 41 : p=&b 52 : for I=1 to N do 62 : if (i%2==0) then 82 : a=a+ 92 : z=2(p) 1: z= 2: a= 3: b= 4: p=&b 5: for i = 1 to N do 6: if ( i %2 == 0) then 7: p=&a endif endfor 8: a=a+ 9: z=2(p) 10: print(z) &b &a 0 0 2 1 F 1 4 2 T 2 4 4

7 5:for i=1 to N 6:if (i%2==0) then 7: p=&a 8: a=a+ 9: z=2(p) 10: print(z) T** (^) F 1: z= 2: a= 3: b= 4: p=&b T Input: N= 11 : z= 21 : a= 31 : b= 41 : p=&b 51 : for i = 1 to N do 61 : if ( i %2 == 0) then 81 : a=a+ 91 : z=2(p) 52 : for i = 1 to N do 62 : if ( i %2 == 0) then 71 : p=&a 82 : a=a+ 92 : z=2(p) 101 : print(z)

T 1 2 3 4 5 6 7 8 9

10 11 12 13 14 Annotating Static Rep. With Dynamic Info. (2,7) (3,8) (7,12) (11,13) (13,14) (4,8) (12,13) (5,6)(9,10) (10,11) (5,7)(9,12) (5,8)(9,13) 1 2 3 4 5, 6, 11 7, 8, 14 F &b &a 0 0 2 1, F,T 1, 4, 4 8 WET Representation < tn > Block n^ Basic S 1 S 2 ... < v 1 > < v 2 > … < (ts, tn) > <^ (ts,^ tn) > 9 WET Sizes 10, 11, 8, 8, 10, 9, 10, 5, 10, 9,

300.twolf 256.bzip 255.vortex 197.parser 181.mcf 164.gzip 130.li 126.gcc 099.go Average

WET

Representation Size (MB) Statements Executed (Millions) Program 10 Compaction of WET Representation

 Custom Compaction

 Node o Timestamps o Values/Addresses  Dependence Edges o Timestamp pairs

 Generic Compression

 All sequences  Context-based method 11 Node Timestamps 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 2

3 (^46) 7 9 3 (^56) 7 9 3 (^46) 8 9 3 (^56) 8 9 1 2 3

3 (^46) 7 9 1 2 3 3 4 5 6 7 8 9 12 Infer: Local Dependence Labels: Full Elimination X = Y= X

X =

Y= X

(10,10) (20,20) (30,30)

X =

Y= X

10,20, =Y 21 (20,21) ... (...,20) ...

19 Node Values Pattern = 010121 ababcb dedefe mnmnon pqpqrq ghghih jkjklk abc (^) def mno pqr ghi jkl 20 Generic Compression 1 X Y Z 1 X Y Z A X Y Z B AA X Y ZX Y Z B

 Traversable

  • Sequitur
  • Context-based

 Bidirectional

  • Forward traversal
  • Backward traversal 21 Compacted WET Sizes 690 751 609 615 715 650 740 365 685 647 Statements Executed (Millions) Before After

300.twolf 256.bzip 255.vortex 197.parser 181.mcf 164.gzip 130.li 126.gcc 099.go Average Before / After WET Size (MB) Program 22 Customized vs. Generic Customized x Generic = Total = 16. = 54. = 83. = 46. = 25. = 18. = 51. = 58. = 18. = 41. x 2. x 5. x 6. x 6. x 4. x 3. x 5. x 5. x 2. x 4.

300.twolf 256.bzip 255.vortex 197.parser 181.mcf 164.gzip 130.li 126.gcc 099.go Average Program 23 Scalability 0 10 2030 40 5060 70 80 Execution length Compaction factor 099.go 126.gcc 130.li 164.gzip 181.mcf 197.parser 255.vortex 256.bzip2 300.twolf 1 Gigabyte ⇔ 2 Billion Statements **0 1020 3040 50 60 7080 90 Execution length Compaction factor 099.go 126.gcc 130.li 164.gzip 181.mcf 197.parser 255.vortex 256.bzip2 300.twolf (billion)

24** Dependences Eliminated

25 Architecture Specific Information

300.twolf 256.bzip 255.vortex 197.parser 181.mcf 164.gzip 130.li 126.gcc 099.go Cache Hit/Miss History (MB) Branch Outcomes (MB) Program 26 Response Time: Control Flow Query

300.twolf 256.bzip 255.vortex 197.parser 181.mcf 164.gzip 130.li 126.gcc 099.go Program Time (seconds) 27 Response Time: Load Value/Address Query

300.twolf 256.bzip 255.vortex 197.parser 181.mcf 164.gzip 130.li 126.gcc 099.go Program Load Values

Addresses 28 Dynamic Slicing

Dynamic slice is the set of statements that DID

affect the value of a variable at a program point

for ONE specific execution. [Korel and Laski, 1988]

  • Execution history  dynamic control dependences  dynamic data dependences
  • Construct a dynamic dependence graph
  • Traverse dynamic dependence graph to compute slices
  • Smaller, more precise, slices are more helpful 29 Dynamic Data Slice ……
  1. A = …...
  2. B = ……
  3. P =
  4. If (P<0) {
  5. A = A + 1
  6. B = B + 1
  7. } ……
  8. Error(A+B) 30 Dynamic Full Slice ……
  9. A = …...
  10. B = ……
  11. P =
  12. If (P<0) {
  13. A = A + 1
  14. B = B + 1
  15. } ……
  16. Error(A+B) ……
  17. A = …...
  18. B = ……
  19. P =
  20. If (P<0) {
  21. A = A + 1
  22. B = B + 1
  23. } ……
  24. Correct(A+B)

37 Matching Program Versions

Matching produces a MAPPING between executed

instructions belonging to two versions of a program

by comparing their WETs for the same input.

Debugging Optimized Code

Cause of erroneous behavior?

 Bug in the optimizer; or  Bug exposed by the optimizer. 38 Comparison Checking [ESEC/FSE 1999]

Drawbacks

  • Compiler writer must produce mappings
  • Compiler modification may not be possible Source Code mapping Execute Execute

Compiler

OPT

UNOPT

Compare

trace trace Report 39 Matching Overview

 Instruction Signatures

  • Exact Match versus Consistency

 Matching Dynamic Data Dependence Graph

  • Matching Roots  Order according to first execution
  • Matching Other Nodes  Use graph structure

 Matching Possibilities

  • No matches, One-to-one matches, & Many-to-one matches

 Matching Accuracy

  • Missed matches
  • False matches 40 Unoptimized vs. Optimized Versions

li.U li.O m88ksim.U m88ksim.O twolf.U twolf.O go.U go.O parser.U parser.O Dynamic Program Static (millions) 41 Matches Generated 302 289 362 387 265 Time (sec) 97.0 % 95.1 % 94.2 % 91.0 % 96.1 % li m88ksim twolf go parser Program Optimized 42 Matching Accuracy 0 4 0 0 0 Missed 35 72 123 27 29 False 112 823 1067 1362 243 li m88ksim twolf go parser Program Actual

43 Comparison Checking 44 Applications of Version Matching

 Debugging Optimized Code

  • Comparing unoptimized and optimized versions

 Software Piracy Detection

  • Measuring the degree of similarity in the computation

 Others…

45 Whole Execution Trace Representation

 Static and Dynamic Information

  • Definite & likely events can be queried

 Design for Analysis

  • Efficient analysis for answering queries

 Compact Representation

  • Sufficient dynamic information can be kept

 Comprehensive

  • Wide range of queries can be answered

 Extensible

  • New types of information/queries can be added 46 Work In Progress and Future Work

 Debugging, Slicing and Matching

  • Dynamic Slicing for Multiple runs/inputs
  • Dynamically altering branch outcomes
  • Code Obfuscation

 Making Execution Histories Available

  • API – Compaction is transparent
  • Support for range of queries

 Other forms of Dynamic Histories

  • Architecture specific information
  • Storage allocation/deallocation
  • System calls
  • Multiple Runs
  • Multithreading