Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET...
Transcript of Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET...
![Page 1: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/1.jpg)
Timing Analysis of Real-Time Software
Raimund Kirner
Vienna University of TechnologyAustria
This is joint work with Peter Puschner and the CoSTA and ForTAS project teams.
![Page 2: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/2.jpg)
Grenoble, QA'09 2
From RTS Design to Implementation
T1
T4
T2 T3
t
Task set with precedenceconstraints and deadline
T1 T2 T3 T4t
Task sequence:execution times,response time
Can we guarantee that: response time < deadline?
![Page 3: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/3.jpg)
Grenoble, QA'09 3
WCET: Timing Analysis Abstraction
T1 T2 T3 T4
T1 T2 T3 T4t
In general it is infeasible to model all possible executionscenarios and combinations of task execution times
T1 T2 T3 T4
T1 T2T3 T4
WCET analysis abstracts the different execution times of eachtask to one single value WCET bound
Ti
Ti
xt < WCET
xt = WCET
![Page 4: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/4.jpg)
Grenoble, QA'09 4
WCET vs. calculated WCET bound
BCET WCET
t
freq
uenc
y
WCET Bound
![Page 5: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/5.jpg)
Grenoble, QA'09 5
Remarks on WCET Analysis• Computes upper bounds• Bounds are application-dependent• Assesses time that processor is actually executing
the code• WCET result is hardware-dependent
WCET bounds must be safeWCET bounds should be tight
![Page 6: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/6.jpg)
Grenoble, QA'09 6
Requirements on WCET Analysis ToolsFind feasible abstractions and analysis methods such that:1. development effort of WCET tool is affordable2. the calculated WCET estimates are sufficiently precise3. analysis problems are tractable with acceptable resource
requirements, and4. the WCET tool is easy to use
Acceptance depends on application domain…
Tradeoffs required: there is no single WCET analysis technique that is well-suited for all application domains!!
![Page 7: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/7.jpg)
Grenoble, QA'09 7
The Path Problem• The path problem: calculate a description or enumeration
of the (in)feasible paths of a program• Any brute-force approaches like executing or simulating
the program with all possible input data are intractable(the different values of input data are even more than different paths exist)
• Problem is shifted to the user: request for manual path descriptions (requires experts, high effort, is error-prone)
• Program analyzes with right abstractions help to reduce the needed manual code annotations.
![Page 8: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/8.jpg)
Grenoble, QA'09 8
Program Annotations for WCET Analysis
• Explicit flow information required to guide WCET analysis:– intractable program
complexity– description of execution
modes or input data
scope{
for (i=0; i<N; i++){
maximum N iterations;for (j=0; j<i; j++){
maximum N iterations;marker m1;
…}
}restriction m1 == N ∗ (N+1) / 2;
}1 • fm1 == [N•(N+1)/2] • fSCOPE
flow variable
linear flow constraint
loop bound
loop bound
![Page 9: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/9.jpg)
Grenoble, QA'09 9
Challenge: Correctness of Flow Information after Code Optimizationfor (i=0; i<N; i++) maximum 10 iterations{
f(i);}
for (i=0; i<(N-2); i=i+3) {
f(i); f(i+1); f(i+2);}for (;i<N; i++) {f(i);}
loop unrolling (unrolling factor 3)
Q: what flow information is known of the transformed code?
additional knowledge assumed: N≤10
(flow fact given as code annotation)
![Page 10: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/10.jpg)
Grenoble, QA'09 10
Challenge: Correctness of Flow Information after Code Optimization
for (i=0; i<N; i++) maximum 10 iterations{
f(i);}
scope {for (i=0; i<(N-2); i=i+3) maximum 3 iterations{
marker m1;f(i); f(i+1); f(i+2);
}for (;i<N; i++) maximum 2 iterations{
marker m2;f(i);
}restriction 3*m1 + m2 <= 10;
}
loop unrolling (unrolling factor 3)
Automatic update of flow information in parallel to code transformation
additional knowledge assumed: N≤10
(flow fact given as code annotation)
linear flow constraint
flow variable
flow variable
loop bound
loop bound
![Page 11: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/11.jpg)
Grenoble, QA'09 11
Universal Flow-Information Update• We developed a framework that allows to update flow
information for arbitrary code transformations using rules composed of the following operations:– Update of loop bound information ( ):
(create, modify, or delete loop bound information)– Update of flow constraints ( ):
(transform terms of the form “const • flowvariable” of a linear flow constraint into a new term respectively a sum of terms, creation of new flow constraints)
R
L
![Page 12: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/12.jpg)
Grenoble, QA'09 12
Example: Loop Unrolling (3 Times)
B1
C’
D
E
A’
S
B3
B4
C
S
B
AL1
L1
L2
B20:10
?:?
?:?
![Page 13: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/13.jpg)
Grenoble, QA'09 13
Example: Loop Unrolling (3 Times)
B1
C’
D
E
A’
S
B3
B4
C
S
B
AL1
L1
L2
B2
=
Σ 30:10
0:2
0:3
n·fAS n·fDSR
n·fAB 3n·fA’B1 + n·fDB4R
⟨L1,0:10⟩ ⟨L1,0:3⟩, ⟨L2,0:2⟩L
![Page 14: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/14.jpg)
Grenoble, QA'09 14
Universal Flow-Information UpdateAdvantages:
• Manual code annotations:Reduced cognitive complexity(no need anymore to annotate machine code)
• Automatic calculation of flow information:Platform-independent calculation with reduced effort (information more explicit available at source code)
![Page 15: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/15.jpg)
Grenoble, QA'09 15
The State Explosion Problem• Processor behavior modeling faces the problem of
state explosion– instruction timing depends on context
(execution history)– caches, pipelines, etc.– even, when using the timing relevant dynamic
processor state (TRDPS)• The desired solution:
decompose the timing analysis problem using “divide and conquer”
![Page 16: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/16.jpg)
Grenoble, QA'09 16
Series Decomposition• Analysis on control-flow graphs instead on the set of
execution traces
![Page 17: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/17.jpg)
Grenoble, QA'09 17
Parallel Composition• The execution time T(I,s) of an instruction sequence I
depends on the TRDPS s:
![Page 18: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/18.jpg)
Grenoble, QA'09 18
Parallel Composition (TRDPS Partitioning)Partitioning the TRDPS
between HW component A and HW component B:
TRDPS: A × B
Example:A … cache stateB … pipeline state
![Page 19: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/19.jpg)
Grenoble, QA'09 19
Example of Timing AnomaliesIs it that simple?
Using Newton’s world view together with an inadequate observation system may
cause underestimation of the timing effects at a local system!
![Page 20: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/20.jpg)
Grenoble, QA'09 20
Pitfall: Series Timing Anomalies
![Page 21: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/21.jpg)
Grenoble, QA'09 21
Pitfall: Parallel Timing Anomalies
![Page 22: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/22.jpg)
Grenoble, QA'09 22
Pitfall: Parallel Timing Anomalies
![Page 23: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/23.jpg)
Grenoble, QA'09 23
Pitfall: Parallel Timing Anomalies
![Page 24: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/24.jpg)
Grenoble, QA'09 24
Pitfall: Parallel Timing Anomalies
![Page 25: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/25.jpg)
Grenoble, QA'09 25
Example of TA-S-A and TA-P-Aout-of-order pipeline + cache + data dependencies:
![Page 26: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/26.jpg)
Grenoble, QA'09 26
Example of TA-S-I and TA-P-Iout-of-order pipeline + cache + data dependencies:
![Page 27: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/27.jpg)
Grenoble, QA'09 27
Our Contribution so far against the State Explosion Problem• Providing a precise definition of Timing Anomalies
(formal but without unnecessary details)• Formalizing the different types of decomposition
techniques for WCET analysis• Proofs of which types of TAs are incompatible with
which type of decomposition technique
[Kirner,TR-01-2009], [Kirner,ECRTS’09]
![Page 28: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/28.jpg)
Grenoble, QA'09 28
Measurement-Based Timing Analysis • Research project: ForTAS
(Formal Timing Analysis Suite)
• Cooperation with TU Darmstadt
• Learning the Hardware Timing Model by systematic execution time measurements
![Page 29: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/29.jpg)
Grenoble, QA'09 29
The ForTAS Refinement Loop• Testing for Timing Analysis
SUT
Environment
Model
Program
Measured Timed System (MTS)
Test Cases
Expected Time System (ETS)
0.30.2
0.40.7
Richer timing information than just WCET: probabilistic timing model
![Page 30: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/30.jpg)
Grenoble, QA'09 30
The Next Steps:Getting Out of the Complexity Mess • Take a pro-active approach to advance timing
analysis: construction of embedded systems that support: – Predictability (with reasonable margins)– Composability– Scalability
• Predictable access to shared resources• Timing-predictability requires a HW/SW co-design
(“patterns of predictability”).
![Page 31: Timing Analysis of Real-Time Softwaresseshia/qa09/kirner.pdf · task to one single value ÖWCET bound Ti Ti xt < WCET xt = WCET. Grenoble, QA'09 4 WCET vs. calculated WCET bound BCET](https://reader035.fdocuments.us/reader035/viewer/2022071103/5fdc939a7111b43b6b665f8f/html5/thumbnails/31.jpg)
Grenoble, QA'09 31
Thank You!
http://costa.tuwien.ac.at http://www.fortastic.net