Download presentation

Presentation is loading. Please wait.

Published byCandice Druce Modified over 2 years ago

1
Constraint Systems used in Worst-Case Execution Time Analysis Andreas Ermedahl andreas.ermedahl@it.uu.se Dept. of Information Technology Uppsala University

2
September 2000ASTEC/WCET2 Definition of WCET 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 0tighter safe BCET estimates safe WCET estimates actual BCET actual WCET possible execution times

3
September 2000ASTEC/WCET3 Uses of WCET Estimates Hard real-time systems Scheduling Schedulability analysis System dimensioning Formal verification Program performance tuning void foo(int j, int a[]) { int i; for(i=100, i>0; i--) { if(j>50) a[i] = 2 * i; else a[i] = i; } ?

4
September 2000ASTEC/WCET4 Static WCET Analysis Don’t run the program - analyze it! Guaranteed safe WCET Trying to be as tight as possible Provided all input is correct 0tighter safe BCET estimates safe WCET estimates actual BCET actual WCET possible execution times Static analysis will give results in the safe area Measurement will give results in the unsafe area

5
September 2000ASTEC/WCET5 Static WCET Analysis 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 Object Code Target Hardware Reality program Actual WCET Low level analysis Calculation Flow analysis Analysis WCET Estimate Actual WCET WCET Estimate

6
September 2000ASTEC/WCET6 WCET Analysis Architecture Compiler Program Flow Analysis Intermediate Code Cache Analysis Cache Info Simulator Pipeline Analysis WCET Calculation Constraint Problem Flow Info Object Code Modularization of WCET analysis Several separate analysis steps Make the analysis more retargetable Flow Fact Conversion All analysis results are converted to constraints

7
September 2000ASTEC/WCET7 Example program Flow Info Characteristics do { if(...) do { if(...)... else... if(...)... else... } while(...) else... } while(...)... Basic finiteness Statically allowed Actual feasible paths // A // B // C // D // E // F // G // H // I // J Structurally possible flows (infinite) Relation between possible executions and flow info max = 10 max = 20 samepath(D,G) WCET found here = desired result A B C D F G H E Basic block graph J I WCET found here = overestimation overestimation

8
September 2000ASTEC/WCET8 Program model: Basic block graph: nodes and edges Execution count variable (x entity ) holds number of times entity gets executed Foo() C A B D E F G end Count Variables XAXAXAXA XBXBXBXB XCXCXCXC XDXDXDXD XEXEXEXE XFXFXFXF XGXGXGXG x node for nodes X GA X AB X BC X BD X DE X EG X CE X EF X FG X fooA x edge for edges

9
September 2000ASTEC/WCET9 Constraints: Foo() C A B D E F G end Constraints Generated XAXAXAXA XBXBXBXB XCXCXCXC XDXDXDXD XEXEXEXE XFXFXFXF XGXGXGXG X GA X AB X BC X BD X DE X EG X CE X EF X FG X fooA X foo =1 X end =1 Start and end condition X AB =X A X E =X CE +X DE X A =X fooA +X GA X BC +X BD =X B Program structure X A <=100 Loop bounds X C +X F <=X A Other flow information

10
September 2000ASTEC/WCET10 A B Pipeline Analysis Time for a basic block: Time from first instruction enters pipeline to last instruction leaves pipeline t A = 7 B IF EX M F 12345 t B = 5 IF EX M F 1234567 A IF EX M F 1234567

11
September 2000ASTEC/WCET11 A B 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 t A = 7 B IF EX M F 12345 t B = 5 t AB = 10 AB = -2 AB = t AB - t A - t B = 10 - 7 - 5 = -2 123456789 IF EX M F 10 IF EX M F 1234567 A IF EX M F 1234567

12
September 2000ASTEC/WCET12 Pipeline Analysis Result Result: Foo() C A B D E F G end Each edge annotated with pipeline timing effect t GA =-1 t AB =-2 t BC =-3 t BD =-5 t DE =-2 t EG =-2 t CE =-1 t EF =-3 t FG =-3 t fooA =-4 Each basic block annotated with its execution time t A =7 t D =2 t B =5 t C =12 t E =4 t F =8 t G =20

13
September 2000ASTEC/WCET13 WCET= max (x entity * t entity ) Where each x entity satisfies all constraints Foo() C A B D E F G end t A =7 t D =2 t B =5 t C =12 t E =4 t F =8 t G =20 IPET Calculation XAXAXAXA XBXBXBXB XCXCXCXC XDXDXDXD XEXEXEXE XFXFXFXF XGXGXGXG X GA X AB X BC X BD X DE X EG X CE X EF X FG X fooA X foo =1 X AB =X A X E =X CE +X DE X A =X fooA +X GA X BC +X BD =X B X A <=100 X C +X F =100

14
September 2000ASTEC/WCET14 Solution methods: Integer linear programming Constraint satisfaction Solution: Counts for each individual node and edge The value of the WCET Foo() C A B D E F G end Calculation methods X A =100 X B =100 X C =100 X D =0 X E =100 X F =0 X G =100 WCET=4800 X foo =1 X end =1

15
September 2000ASTEC/WCET15 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” B C D E G H I F J A LK Complicating Flow Information

16
September 2000ASTEC/WCET16 scope foo scope loop Local semantics Create entry count variable: x entry(scope) holds number of times loop is entered Local flow info are raised to the global level For example: loop:[ ]:X H 10 gets converted to: gets converted to: X H 10 * X entry(loop) X H 10 * X entry(loop) B C D E G H I F J A Scope graph “For each entry of the loop block H will be executed at most 10 times” “Block H can not be executed more than 10 * the number of times the loop is entered” x entry(loop)

17
September 2000ASTEC/WCET17 scope loop Partial Flow Information B A C D F Facts can (partially) overlap scope:range Virtual scopes: scope:range let facts be valid for complete range of iterations G E Loop bound: 20 loop : 1..5 : X C =5 (f1) loop : 3..10 : X C + X F 8 (f2) loop:1..2 {f1} loop:3..5 {f1,f2} loop:6..10 {f2} loop:11..20 { } X C = X C + X C + X C + X C 1..2 3..5 6..10 11..20 X C + X C =5 (f1) 1..2 3..5

18
September 2000ASTEC/WCET18 scope loop Partial Flow Information B A C D F 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 G E loop:1..2 {f1} loop:3..5 {f1,f2} loop:6..10 {f2} Fact f1 and f2 only overlaps iterations 1..10

19
September 2000ASTEC/WCET19 Some flow info generates non-linear constraints ”Number of iterations of inner loop depends on current iteration of outer” outer: X B 55 or outer: X A * X A X B ”If D was taken then K will be taken once” if X D > 0 then X K > 0 and if X D = 0 then X K = 0 More powerful solver needed? B C D E G H I F J A LK Non-linear Constrains

20
September 2000ASTEC/WCET20 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
September 2000ASTEC/WCET21 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 (> 250)

22
September 2000ASTEC/WCET22 Questions What constraint solver should we use? Are the generated constraints of a certain type? More comments....

23
The End!

Similar presentations

OK

Masahiro Fujita Yoshihisa Kojima University of Tokyo May 2, 2008

Masahiro Fujita Yoshihisa Kojima University of Tokyo May 2, 2008

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on online marketing trends Free ppt on brain computer interface Ppt on school library management system Ppt on 60 years of indian parliament Ppt on nature of matter for class 6 Ppt on low level language list Ppt on fire management Ppt on media revolution help Ppt on bionics contact Ppt on operation research introduction