Constraint Systems used in Worst-Case Execution Time Analysis - PowerPoint PPT Presentation

About This Presentation
Title:

Constraint Systems used in Worst-Case Execution Time Analysis

Description:

WCET = Worst possible execution time for a program running on target hardware ... No interrupts or context switches. Other estimates: ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 24
Provided by: andrease
Category:

less

Transcript and Presenter's Notes

Title: Constraint Systems used in Worst-Case Execution Time Analysis


1
Constraint Systems used in Worst-Case Execution
Time Analysis
Andreas Ermedahl andreas.ermedahl_at_it.uu.se Dept.
of Information Technology Uppsala University
2
Definition of WCET
actual BCET
actual WCET
possible execution times
safe BCET estimates
safe WCET estimates
0
tighter
tighter
  • WCET Worst possible execution time for a
    program running on target hardware
  • One program in isolation
  • No interrupts or context switches
  • Other estimates
  • Best Case ET Best case, Inverse of WCET, hard
  • Average Case ET Soft real-time, not hard

3
Uses of WCET Estimates
  • Hard real-time systems
  • Scheduling
  • Schedulability analysis
  • System dimensioning
  • Formal verification
  • Program performancetuning

void foo(int j, int a) int i
for(i100, igt0 i--) if(jgt50)
ai 2 i else
ai i
4
Static WCET Analysis
  • Dont run the program - analyze it!
  • Guaranteed safe WCET
  • Trying to be as tight as possible
  • Provided all input is correct

actual BCET
actual WCET
possible execution times
safe BCET estimates
safe WCET estimates
0
tighter
tighter
Measurement will give results in the unsafe area
Static analysis will give results in the safe area
5
Static WCET Analysis
program
  • Flow analysis
  • Determine the dynamic behavior of program
  • Low level analysis
  • Determine execution time for program parts on the
    hardware
  • Calculation
  • Combine flow and low-level times to give a WCET
    estimate.

Compiler
ObjectCode
Target Hardware
ActualWCET
Reality
6
WCET Analysis Architecture
  • Modularization of WCET analysis
  • Several separate analysis steps
  • Make the analysis more retargetable
  • All analysis results are converted to
    constraints

Program
WCET
Compiler
Simulator
ObjectCode
Cache Analysis
Cache Info
IntermediateCode
Pipeline Analysis
Flow Analysis
Constraint Problem
FlowInfo
Calculation
Flow FactConversion
7
Flow Info Characteristics
do if(...) do
if(...) ...
else ...
if(...) ... else
... while(...)
else ... while(...) ...
WCET found here desired result
WCET found here overestimation
Example program
8
Count Variables
  • Program model
  • Basic block graph nodes and edges
  • Execution count variable (xentity) holds number
    of times entity gets executed

9
Constraints Generated
  • Constraints

10
Pipeline Analysis
  • Time for a basic block
  • Time from first instruction enters pipeline to
    last instruction leaves pipeline

1
2
3
4
5
6
7
tA 7
A
tB 5
B
11
Pipeline Analysis
  • Pipeline overlap between basic blocks
  • Timing effect of going from A to B is negative
    to indicate pipeline overlap
  • We use a general purpose simulator to extract
    times for nodes and edges

1
2
3
4
5
6
7
tA 7
A
?AB -2
tB 5
B
tAB 10
?AB tAB - tA - tB 10 - 7 - 5 -2
12
Pipeline Analysis Result
Result
13
IPET Calculation
  • WCETmax ?(xentity tentity)
  • Where each xentity satisfies all constraints

Xfoo1
XCXF100
XAlt100
14
Calculation methods
  • Solution methods
  • Integer linear programming
  • Constraint satisfaction
  • Solution
  • Counts for each individual node and edge
  • The value of the WCET

15
Complicating Flow Information
  • Some flow information complicates the picture
  • Examples
  • Local semantics For each entry of inner
    loop...
  • Partially valid flow info During iterations 5
    to 10 of inner loop it holds that...
  • Loop dependencies Number of iterations of
    inner loop depends on current iteration of
    outer
  • Non-linear constraints If D was taken then K
    will be taken once

16
Local semantics
  • Create entry count variable xentry(scope) holds
    number of times loop is entered
  • Local flow info are raised to the global level
  • For example loop XH ? 10
  • gets converted to
  • XH ? 10 Xentry(loop)

A
xentry(loop)
B
C
For each entry of the loop block H will be
executed at most 10 times
D
E
F
G
H
I
J
Block H can not be executed more than 10 the
number of times the loop is entered
Scope graph
17
Partial Flow Information
  • Facts can (partially) overlap
  • Virtual scopes scoperange let facts be valid
    for complete range of iterations

A
B
C
Loop bound 20 loop 1..5 XC5 (f1) loop
3..10 XC XF ? 8 (f2)
D
F
E
G
18
Partial Flow Information
  • Graph is unrolled according to overlapping flow
    info
  • Can generate large graphs
  • Flow information often local (but can stretch
    over loop borders)
  • Dependent flow info can be used to consider
    subpart of graph in isolation

A
B
C
D
F
E
Fact f1 and f2 only overlaps iterations 1..10
G

19
Non-linear Constrains
  • Some flow info generates non-linear constraints
  • Number of iterations of inner loop depends on
    current iteration of outer outer XB ? 55 or
    outer XA XA ? XB
  • If D was taken then K will be taken once if
    XD gt 0 then XK gt 0 and if XD 0 then XK 0
  • More powerful solver needed?

20
WCET Tool Prototype
  • Prototype tool implemented
  • Works over whole program or use flow info to work
    bottom up over smaller program parts
  • Fast solution times when testing with CPLEX or
    similar solver (a network flow problem?)
  • We use integer linear programming (ILP) and
    lp_solve()
  • Not all flow information can be handled
  • Rather fast calculation times
  • Flow information sometimes generates large graphs
    and solution times
  • Other WCET research Expressing hardware effects
    using constraints generates huge constraint
    systems and large solution times

21
Experimental Results
  • Small programs fast calculation (even with
    complex structure and flow)
  • Larger programs Flow information slows down but
    increase precision
  • Example program Nsichneu
  • Automatically generated program with massive
    amount of if-statements (gt 250)

22
Questions
  • What constraint solver should we use?
  • Are the generated constraints of a certain type?
  • More comments....

23
The End!
Write a Comment
User Comments (0)
About PowerShow.com