Fine Grain Quality Management Jacques Combaz Jean-Claude Fernandez Mohamad Jaber Joseph Sifakis Loïc Strus Verimag Lab. Université Joseph Fourier Grenoble, France DCS seminar, 10 June 2008, Col de Porte Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 1 / 25
Outline 1 Motivations Video Encoder Problem & Approaches 2 Fine Grain QoS Control Model Approach Summary 3 Stochastic Approach Model & Problem Stochastic Mixed Quality Management Policy Performance Analysis Conclusion 4 Learning Problem Neural networks Experimental results Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 2 / 25
Motivations 1 Motivations Video Encoder Problem & Approaches 2 Fine Grain QoS Control Model Approach Summary 3 Stochastic Approach Model & Problem Stochastic Mixed Quality Management Policy Performance Analysis Conclusion 4 Learning Problem Neural networks Experimental results Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 3 / 25
Video Encoder Motivations Video Encoder collaboration with STMicroelectronics (GaloGiC project) embedded video encoder macroblock camera... input frames quality q level frame MotEst(q); DCT(q); Quant(q);... Coding(q); video encoder 1 0 0 1 0 1 1 1 0 1 0 0 bitstream (encoded frame)... Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 4 / 25
Motivations Video Encoder Video Encoder collaboration with STMicroelectronics (GaloGiC project) embedded video encoder macroblock camera... input frames quality q level frame MotEst(q); DCT(q); Quant(q);... Coding(q); video encoder 1 0 0 1 0 1 1 1 0 1 0 0 bitstream (encoded frame)... deadline D real-time constraints (e.g. D = 1/30 s = 33 ms) limited resources intensive computing uncertainty on execution times we propose an online adaptation of the quality level parameters q Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 4 / 25
Motivations Problem & Approaches Problem & Approaches Problem (embedded video encoder) meet the deadlines input buffer minimization avoid frame skipping optimal use of resources QoS maximization Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 5 / 25
Motivations Problem & Approaches Problem & Approaches Problem (embedded video encoder) meet the deadlines input buffer minimization avoid frame skipping optimal use of resources QoS maximization Existing Approaches hard real-time (critical system engineering) worst-case analysis meet the deadlines soft real-time (best-effort engineering) average-case analysis no guarantee efficient use of resources Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 5 / 25
Motivations Problem & Approaches Problem & Approaches Problem (embedded video encoder) meet the deadlines input buffer minimization avoid frame skipping optimal use of resources QoS maximization Our Approach bridging the gap by using adaptive techniques adapting software behaviour by setting quality level parameters optimal use of computing resources with real-time guarantees Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 5 / 25
Fine Grain QoS Control 1 Motivations Video Encoder Problem & Approaches 2 Fine Grain QoS Control Model Approach Summary 3 Stochastic Approach Model & Problem Stochastic Mixed Quality Management Policy Performance Analysis Conclusion 4 Learning Problem Neural networks Experimental results Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 6 / 25
Model Fine Grain QoS Control Model Application Software s 0 a 1 s 1 a 2... a n s n s i : control point a i : actions parameterized by integer quality levels q i Q = [q min, q max ] Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 7 / 25
Model Fine Grain QoS Control Model Application Software s 0 a 1 s 1 a 2... a n s n s i : control point a i : actions parameterized by integer quality levels q i Q = [q min, q max ] Estimates of Execution Times (increasing with quality) C av (a i, q): average execution time of a i at the quality level q C wc (a i, q): worst-case execution time of a i at the quality level q Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 7 / 25
Fine Grain QoS Control Model Model Application Software s a 1 a 2 a n 0... s 1 s n s i : control point a i : actions parameterized by integer quality levels q i Q = [q min, q max ] D Estimates of Execution Times (increasing with quality) C av (a i, q): average execution time of a i at the quality level q C wc (a i, q): worst-case execution time of a i at the quality level q Real-Time Constraints D: deadline for the completion of the actions Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 7 / 25
Fine Grain QoS Control Approach Quality Management Problem Application software: s a 1 a 2 a n 0 s 1... s n D The Problem find quality level parameters q i such that: safety deadlines are met optimality maximization of the quality levels smoothness of the quality levels online computation of the quality levels q i Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 8 / 25
Fine Grain QoS Control Quality Manager Design Approach next quality level q i Quality Manager Γ quality management policy X: q i = max { q Q t X (s i, q) t i 1 } Application Software control point s i 1, actual time t i 1 s i 1, t i 1 remaining execution time (estimate) for quality q: C X (a i..a n, q) feasibility criterion: D C X (a i..a n, q) + t i 1 we define t X (s i 1, q) = D C X (a i..a n, q) Quality Management Policy X at state (s i 1, t i 1 ) choosing the best quality level which is feasible, i.e.: q i := max { q t X (s i 1, q) t i 1 } Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 9 / 25
Fine Grain QoS Control Approach Mixed Quality Management Policy [EMSOFT 05,RTS] s n D s i 1 accessible states from (s i 1, t i 1 ) t i 1 (actual time) t D Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 10 / 25
Fine Grain QoS Control Approach Mixed Quality Management Policy [EMSOFT 05,RTS] s n D average behavior s i 1 t i 1 (actual time) t D average behavior: C av (a i..a n, q) = C av (a i, q) +... + C av (a n, q) Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 10 / 25
Fine Grain QoS Control Approach Mixed Quality Management Policy [EMSOFT 05,RTS] s n D worst-case behavior average behavior s i 1 t i 1 (actual time) t D average behavior: C av (a i..a n, q) = C av (a i, q) +... + C av (a n, q) worst-case behavior (under control): C sf (a i..a n, q) = C wc (a i, q) + C wc (a i+1, q min ) +... + C wc (a n, q min ) Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 10 / 25
Fine Grain QoS Control Approach Mixed Quality Management Policy [EMSOFT 05,RTS] s n D worst-case behavior average behavior s i 1 t i 1 (actual time) t D average behavior: C av (a i..a n, q) = C av (a i, q) +... + C av (a n, q) worst-case behavior (under control): C sf (a i..a n, q) = C wc (a i, q) + C wc (a i+1, q min ) +... + C wc (a n, q min ) C mx = C av + δ max, where δ max (a i..a n, q) = max { C sf (a j..a n, q) C av (a j..a n, q) j i } Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 10 / 25
Summary Fine Grain QoS Control Summary (+) fine grain quality management mixed policy: improves predictability reduces the impact of the worst-case (measured by δ max ) safety, optimality, smoothness Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 11 / 25
Summary Fine Grain QoS Control Summary (+) fine grain quality management mixed policy: improves predictability reduces the impact of the worst-case (measured by δ max ) safety, optimality, smoothness (-) limitations worst-case estimates: complex HW platforms computation of worst-case estimates non-flexibility only 100% guarantee low predictability and low time budget utilization for: controllable uncontrollable {}}{{}}{ δ max ( a 1 a 2...... a j a j+1 a j+2...... a n, q) can be sizable Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 11 / 25
Summary Fine Grain QoS Control Summary (+) fine grain quality management mixed policy: improves predictability reduces the impact of the worst-case (measured by δ max ) safety, optimality, smoothness (-) limitations worst-case estimates: complex HW platforms computation of worst-case estimates non-flexibility only 100% guarantee low predictability and low time budget utilization for: controllable uncontrollable {}}{{}}{ δ max ( a 1 a 2...... a j a j+1 a j+2...... a n, q) can be sizable we need soft real-time methodologies that provide guarantees & predictability Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 11 / 25
Stochastic Approach 1 Motivations Video Encoder Problem & Approaches 2 Fine Grain QoS Control Model Approach Summary 3 Stochastic Approach Model & Problem Stochastic Mixed Quality Management Policy Performance Analysis Conclusion 4 Learning Problem Neural networks Experimental results Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 12 / 25
Model & Problem Stochastic Approach Model & Problem Estimates of the Execution Times the integer probability distribution function d q i : d q i : N [0, 1] d q i (k) = P[" execution time of a i at quality q is k"] + k=0 d q i (k) = 1 independent execution times Problem find a Quality Manager Γ s.t.: safety the deadline miss ratio is a target ratio µ [0, 1] optimality maximization of the quality levels smoothness of the quality levels Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 13 / 25
Stochastic Approach Stochastic Mixed Quality Management Policy Stochastic Mixed Quality Management Policy d q (k) i k Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 14 / 25
Stochastic Approach Stochastic Mixed Quality Management Policy Stochastic Mixed Quality Management Policy d q (k) i probability = τ worst-case: probabilistic Cτ wc actual estimate C0 wc C wc probabilistic worst-case execution time Cτ wc (a i, q) s.t.: C wc τ (a i, q) = min { l + k=l k d q i (k) τ} Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 14 / 25
Stochastic Approach Stochastic Mixed Quality Management Policy Stochastic Mixed Quality Management Policy d q (k) i probability = τ worst-case: probabilistic Cτ wc actual estimate C0 wc C wc probabilistic worst-case execution time Cτ wc (a i, q) s.t.: C wc τ (a i, q) = min { l + k=l k d q i (k) τ} average execution time (mean value): C av (a i, q) = + k=0 kd q i (k) Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 14 / 25
Stochastic Approach Performance Analysis Performance Analysis d i : probability distribution for actual time t i (completion of a 1..a i ) recursive computation of d i : d i (k) = + l=0 d i 1 (l)d q i i (k l), where q i = Γ(s i 1, l) Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 15 / 25
Stochastic Approach Performance Analysis Performance Analysis d i : probability distribution for actual time t i (completion of a 1..a i ) recursive computation of d i : d i (k) = + l=0 d i 1 (l)d q i i (k l), where q i = Γ(s i 1, l) Performance of the Quality Manager Γ expected deadline miss ratio: P[t n > D] = k>d d n (k) expected time budget utilization: E(t n ) = + k=0 kd n (k) Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 15 / 25
Stochastic Approach Performance Analysis Performance Analysis expected deadline miss ratio 90 80 70 60 50 40 30 20 10 0 0 0.2 0.4 0.6 0.8 1 parameter τ Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 16 / 25
Stochastic Approach Performance Analysis Performance Analysis target µ expected deadline miss ratio 90 80 70 60 50 40 30 20 10 0 0 0.2 0.4 0.6 0.8 1 parameter τ τ Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 16 / 25
Stochastic Approach Performance Analysis Performance Analysis target µ expected deadline miss ratio 90 80 70 60 50 40 30 20 10 0 0 0.2 0.4 0.6 0.8 1 parameter τ τ expected time budget utilization (%) 140 120 100 80 60 40 20 0 0 0.2 0.4 0.6 0.8 1 parameter τ Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 16 / 25
Performance Analysis Stochastic Approach Performance Analysis expected deadline miss ratio 90 80 70 60 50 40 30 20 10 0 schedule #1 (S 1, A) schedule #2 (S 2, A) 0 0.2 0.4 0.6 0.8 1 parameter τ expected time budget utilization (%) 140 120 100 80 60 40 20 0 schedule #1 (S 1, A) schedule #2 (S 2, A) 0 0.2 0.4 0.6 0.8 1 parameter τ Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 16 / 25
Performance Analysis Stochastic Approach Performance Analysis expected deadline miss ratio 90 80 70 60 50 40 30 20 10 0 0 0.2 0.4 0.6 0.8 1 parameter τ expected time budget utilization (%) 140 120 100 80 60 40 20 0 0 0.2 0.4 0.6 0.8 1 parameter τ time budget utilization (%) 120 100 80 60 40 20 τ = 0.3 time budget utilization (%) 120 100 80 60 40 20 τ = 0.1 0 0 10 20 30 40 50 60 70 80 frame number 0 0 10 20 30 40 50 60 70 80 frame number Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 16 / 25
Conclusion Stochastic Approach Conclusion stochastic mixed quality management policy: soft real-time guarantees achieving a tradeoff time budget utilization / deadline miss ratio parameterized worst-case scenario influence: parameter τ: 0 1 deadlines: hard soft code reuse: one source for different target HWs / QoS requirements perspectives: depencies between execution times multiple tasks, multiple processors, operating systems Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 17 / 25
Learning 1 Motivations Video Encoder Problem & Approaches 2 Fine Grain QoS Control Model Approach Summary 3 Stochastic Approach Model & Problem Stochastic Mixed Quality Management Policy Performance Analysis Conclusion 4 Learning Problem Neural networks Experimental results Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 18 / 25
Problem Learning Problem Using worst-case execution time is problematic in some cases! controllable uncotrollable {}}{{}}{ a 1, a 2,..., a j a j+1,..., a n D Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 19 / 25
Problem Learning Problem Using worst-case execution time is problematic in some cases! controllable uncotrollable {}}{{}}{ a 1, a 2,..., a j a j+1,..., a n D mixed Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 19 / 25
Problem Learning Problem Using worst-case execution time is problematic in some cases! controllable uncotrollable {}}{{}}{ a 1, a 2,..., a j a j+1,..., a n D mixed average Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 19 / 25
Problem Learning Problem Using worst-case execution time is problematic in some cases! controllable uncotrollable {}}{{}}{ a 1, a 2,..., a j a j+1,..., a n D mixed average refined average Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 19 / 25
Problem Learning Problem Using worst-case execution time is problematic in some cases! controllable uncotrollable {}}{{}}{ a 1, a 2,..., a j a j+1,..., a n D mixed average refined average Refine average execution times Better predict the execution time of action using its input Using neural netwroks to predict the execution time Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 19 / 25
Neural Network Learning Neural networks A neural network is defined by: L = { L 1, L 2,..., L n } N l is the number of neurons w (l) ij is the weight f l is the activation function θ (l) i is a scalar bias y (l) ( i = f l ( PN l 1 y (l 1) w (l 1) + θ (l) j=1 j ij i ) if l 1 x i (input of neuron i) if l = 1. Input Layer 1-Hidden Layer Output Layer x 1 w (3) 11 y (3) 1 x 2 w (2) 32 w (2) 31 y (2) 3 = f 2 ( P 2 w (2) x i=1 3i i ) Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 20 / 25
Learning Neural networks Architecture and learning algorithm Architecture the number of layers ( n ) one hidden layer approximate every continuous function the number of neurons in each layer ( N l ) number of input * 2 the activation functions ( f l ) identity : x x and sigmoid : x 1 1+e βx Learning algorithm (X, Y ) where X = (x 1,..., x N1 ) input and Y = (y 1,..., y Nn ) desired output. N n Minimize E(W ) = 1/2 (y j y (n) j ) 2. 1 Initialize the network weights W. 2 Select a new sample (X, Y ). 3 Update weights of the output and hidden layers using specific rules, that is, W W + W. 4 Go to 3 if the error E(W ) is above a tolerance value. 5 Go to 2 if other samples must be learnt. j=1 Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 21 / 25
Experimental framework Learning Experimental results MPEG4 video encoder uncotrollable z } { GM(b 1 )MotEst(q, b 1 )... GM(b 350 )MotEst(q, b 350 ) DCT (b 1 )... Coding(b 1 )... DCT (b 350 )... Coding(b 350 ) b 1 camera input frames... buffer quality q level encoder frame b 350 video encoder 1 0 0 1 0 1 1 1 0 1 0 0 bitstream (encoded frame) deadline D Use neural networks for computing refined average of uncotrollable actions. We consider X = (x 1, x 2 ): x 1 is the SAD value (sum of absolute difference) x 2 is the position of the macroblock Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 22 / 25
Results Learning Experimental results Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 23 / 25
Learning Experimental results Results 120 100 time budget utilization (ms) 80 60 40 20 fixed average refined average (learning) mixed 0 0 20 40 60 80 100 120 140 frame number Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 24 / 25
Perspective Learning Experimental results BIP Combaz, Fernandez, Jaber, Sifakis, Strus () Fine Grain Quality Management DCS seminar, 10 June 2008 25 / 25