Tasks Messages

Period Optimization
for Hard Real-time
Distributed Automotive Systems
Abhijit Davare1, Qi Zhu1,
Marco Di Natale2, Claudio Pinello3,
Sri Kanajan2, Alberto Sangiovanni-Vincentelli1
1 EECS,
UC Berkeley
2 General Motors Research
3 Cadence Research Labs
Motivation: Active Safety Applications
[Source: G. Leen, D. Heffernan,
“Expanding Automotive Electronic
Systems”, IEEE Computer, 35(1),
1/02, pg. 88-93]
2
Design Flow
Application
150 ms
IR
Sensor
Wheel
Sensor
Architecture
Fusion
Task
Object
ID Task
Nav.
Task
ECU1
Brake
Actuator
CAN1
ECU3
Throttle
Actuator
ECU2
CAN2
ECU4
225 ms
Allocation
Mapping
Implementation
Priorities
Periods
3
Contributions
In industry today, all stages in mapping are
typically carried out manually
1. Capture the period assignment problem
with mathematical programming

Flexibility to add additional constraints for systemspecific situations
2. Construct an approximation to efficiently
solve the problem

Iterative approach to reduce approx. error
4
System Model
ECU
Bus
Task 1
Message
1
Task 2
Message
2
…
…
 Tasks allocated to ECUs
 Preemptive execution
 Scheduling: static priorities
 Messages allocated to buses
 Non-preemptive transmission
 Scheduling: static priorities
 Periodic task/message activation
 No synchronization between
ECUs/buses
 Communication
Task
Message
1-place
Buffer
 Read latest data value from buffer
 Overwrite old data values
5
Problem Inputs
 System: Directed Graph
 Nodes are objects
(EITHER tasks or messages)
 Edges are communication
links (1-place buffers)
T1
1
ECU1
T5
2
[0.7]
T6
3
M1
1.
2.
3.
4.
5.
Resource assignment
Worst case processing time (not shown)
Priority
Utilization bounds
End-to-End latency constraints
T2
1
CAN1
1
ECU2
M3
T4
3
[0.6]
M4
4
M2
2
2
[0.8]
T7
3
100 ms
T3
1
ECU3
[0.5]
M5
5
T8
280 ms
2
6
Problem Statement
Assign activation periods for
all tasks and messages
such that:
1. Set of objects must be schedulable
2. Stay within utilization bounds
3. Satisfy end-to-end latency constraints
7
1. Object Schedulability
 Ensure that all objects are processed before their
subsequent activations
Period (ti)
Response Time (ri)
oi
Interference from other objects on the same resource
8
2. Utilization Bounds
 Resource utilization
 Fraction of time the resource (either ECU or bus)
spends processing its objects (either tasks or
messages)
 Utilization bounds less than 100%
 To allow for future extensibility
 Intuition: Larger periods  lower utilization


c
  i   uj
 i:o  R ti 
 i j 
R j  R
9
3. End-to-End Latency
t1
o1
o2
t1
o1
R1
t2
…
o2
R2
t3
…
o3
R3
…
r1
t2
r2
t3
o3
r3
End-to-End Latency
 For each object in the path, add
 Period (ti)
 Worst case response time (ri)
10
Worst Case Response Times
Response time (ri) = Processing time (ci) + Interference time (wi)
Tasks
Messages
Pre-emption
(pi)
Blocking (bi) + Pre-emption
(pi)
z c
jhp ( i )
ij j
 ri 
 
t j 
z c
jhp ( i )
ij j
 ri  ci 


 tj 
11
Periods and Response Times
Tasks:
Messages:
 Intuition: decreasing the period of an object
 Decreases its own contribution to path latency
 Increases the response times of lower priority objects
on the same resource
12
Approach: Mathematical Programming
 What?
 Problem represented with:
• Set of decision variables
• Constraints
• Objective function
 Why?
 Modifying an object period affects:
• Schedulability of the object
• Utilization of the resource
• Latencies of other paths passing through same resource
 Additional constraints due to legacy tasks and messages
 Challenge:
 Capture the problem and obtain efficient runtimes
13
Geometric Programming
 Standard Form:
 x = (x1, x2, …, xn) are positive
 g is a set of monomial functions
 f is a set of posynomial functions
 Sum of monomials
 Variables:
 Integer & real-valued  Intractable
 Real-valued  Efficiently solvable (convex
programming)
14
Approximation
 Rationale
 Exact formulation needs integer variables (ceiling
function)
 MIGP gives no solution even after 6 hours for case study
 Approximate the ceiling function
 Constant parameter: 0 ≤ αi ≤ 1
 Approximated worst case response time: si
15
Approximation Example
Task
Priority
T1
c
t
T1
1
3
t1
T2
2
2
8
T3
3
1
20
T2
T3
 Impact on r3 as t1
r3
changes
 Lower bound:
 =0
 Upper bound:
 =1
t1
 If all αi = 1, si ≥ ri
16
Geometric Programming Formulation
 Sets
 Parameters
 Paths:
 Objects: =
 Resources:
 Computation time: c

 Variables
 Periods: t
 Approx. response times: s
Minimize the sum of
approx. response times
Meet end-to-end
latency deadlines
Transformed equations
for approx. response times
Ensure schedulability
Meet utilization bounds
Lower and upper bounds for periods
17
Iterative Procedure to Reduce Error
 Iteratively change αi
 Parameters
 maxIt – max. # iterations
 errLim – max. permissible
relative error between
r and s
(GP)
s
=1
r
 = 0.6
(Fixpoint)
t
Start
all αi = 1;
ItCount = 0;
ItCount++;
(s, t) = GP(α);
Calculate r;
ei = (si – ri)/ri;
max(|ei|) < errLim
OR
ItCount > maxIt
No
αi = αi - ei
Yes
End
18
Case Study: GM Experimental Vehicle
 Functionality
-
 92 tasks
 196 messages
.
 Architecture
.
.
.
 38 ECUs
 4 buses
.
.
.
.
 End-to-end latency constraints
 12 source-sink task pairs
 222 total paths
 Deadlines range from 100ms to
300ms
19
Experiments: Manual vs. Period Opt.
 GP feasible with all α = 1 in 1st iteration
 Solution time: 24s
20
Experiments: Iterative Procedure
 Max. error reduced from 58% to 0.56% in 15 iterations
 Avg. error (not shown) reduced from 6.98% to 0.009%
21
Conclusions
 Problem
 Period assignment for the design of distributed
automotive applications
 Approach
 Flexible: Approximate period assignment with GP
 Effective: Iterate to reduce approximation error
 Results for industrial case studies
 Experimental vehicle: 0.56% max. error
after 6 minutes
 Fault tolerant vehicle: 45% reduction in
average path latency
22
Questions?
23