for programs that execute on
play

for Programs that Execute on Unreliable Hardware Michael Carbin , - PowerPoint PPT Presentation

Rely: Verifying Quantitative Reliability for Programs that Execute on Unreliable Hardware Michael Carbin , Sasa Misailovic, and Martin Rinard MIT CSAIL Image Scaling Image Scaling Kernel: Bilinear Interpolation f ( ) = Bilinear


  1. Rely: Verifying Quantitative Reliability for Programs that Execute on Unreliable Hardware Michael Carbin , Sasa Misailovic, and Martin Rinard MIT CSAIL

  2. Image Scaling

  3. Image Scaling Kernel: Bilinear Interpolation f ( ) =

  4. Bilinear Interpolation int bilinear_interpolation(int i, int j, int src[][], int dest[][]) { int i_src = map_y(i, src, dest), j_src = map_x(j, src, dest); int up = i_src - 1, down = i_src + 1, left = j_src – 1, right = j_src + 1; int val = src[up][left] + src[up][right] + src[down][right] + src[down][left]; return 0.25 * val; }

  5. Bilinear Interpolation int bilinear_interpolation(int i, int j, int src[][], int dest[][]) { int i_src = map_y(i, src, dest), j_src = map_x(j, src, dest); int up = i_src - 1, down = i_src + 1, left = j_src – 1, right = j_src + 1; int val = src[up][left] + src[up][right] + src[down][right] + src[down][left]; return 0.25 * val; }

  6. Unreliable Hardware Memory CPU Registers CU ALU Unreliable Units (ALUs and Memories) May produce incorrect results • • Faster, smaller, and lower power

  7. Image Scaling with Approximate Bilinear Interpolation 20% 40% 99.9% 99% 60% 80% 90% Reliability

  8. Unreliable Hardware Memory CPU Registers CU ALU Necessitates • Hardware Specification: probability operations execute correctly Software Specification: required reliability of computations • Analysis: verify software satisfies its specification on hardware •

  9. Rely: a Language for Quantitative Reliability Hardware Specification (Architect) Static Analysis (Language) Software Specification (Developer) 20% 40% 99.9% 99% 60% 80% 90% Reliability

  10. Hardware Specification hardware { operator (+) = 1 - 10^-7; operator (-) = 1 - 10^-7; operator (*) = 1 - 10^-7; operator (<) = 1 - 10^-7; memory urel {rd = 1 - 10^-7, wr = 1}; }

  11. Approximate Bilinear Interpolation in Rely int bilinear_interpolation(int i, int j, int src[][], int dest[][]) { int i_src = map_y(i, src, dest), j_src = map_x(j, src, dest); int up = i_src - 1, down = i_src + 1, left = j_src – 1, right = j_src + 1; int val = src[up][left] +. src[up][right] +. src[down][right] +. src[down][left]; return 0.25 *. val; } Unreliable Operations: executed on unreliable ALUs

  12. Approximate Bilinear Interpolation in Rely int bilinear_interpolation(int i, int j, int in urel src[][], int in urel dest[][]) { int i_src = map_y(i, src, dest), j_src = map_x(j, src, dest); int up = i_src - 1, down = i_src + 1, left = j_src – 1, right = j_src + 1; int in urel val = src[up][left] +. src[up][right] +. src[down][right] +. src[down][left]; return 0.25 *. val; } Unreliable Memories: stored in unreliable SRAM/DRAM

  13. What is reliability?

  14. Semantics of Reliability • Reliable Hardware One Execution • • Unreliable Hardware • Multiple Executions • Reliability Probability unreliable • execution reaches same state • Or, 𝑆({𝑦, 𝑧}) = probability over distribution of states that x and y (only) have correct values.

  15. Semantics of Reliability • Reliable Hardware One Execution • • Unreliable Hardware • Multiple Executions • Reliability Probability unreliable • execution reaches same state • Or, 𝑆({𝑦, 𝑧}) = probability over distribution of states that x and y (only) have correct values.

  16. Approximate Bilinear Interpolation Reliability Specification int bilinear_interpolation(int i, int j, int in urel src[][], int in urel dest[][]);

  17. Approximate Bilinear Interpolation Reliability Specification int <.99> bilinear_interpolation(int i, int j, int in urel src[][], int in urel dest[][]); Reliability of output is a function of reliability of inputs •

  18. Approximate Bilinear Interpolation Reliability Specification int <.99 * R(i, j, src, dest)> bilinear_interpolation(int i, int j, int in urel src[][], int in urel dest[][]); Reliability of output is a function of reliability of inputs • The term R(i, j, src, dest) abstracts the joint • reliability of the function’s inputs on entry

  19. Approximate Bilinear Interpolation Reliability Specification int <.99 * R(i, j, src, dest)> bilinear_interpolation(int i, int j, int in urel src[][], int in urel dest[][]); Reliability of output is a function of reliability of inputs • The term R(i, j, src, dest) abstracts the joint • reliability of the function’s inputs on entry Coefficient .99 bounds reliability degradation •

  20. How does Rely verify reliability?

  21. Rely’s Analysis Framework • Precondition generator for statements { Precondition } s { Postcondition } 𝑠 𝑗 ∗ 𝑆 {𝑦 𝑗1 , … , 𝑦 𝑗𝑜 } ≤ 𝑠′ 𝑗 ∗ 𝑆 {𝑦′ 𝑗1 , … , 𝑦′ 𝑗𝑛 } 𝑗 0.9 ∗ 𝑆 { x} ≤ 0.99 ∗ 𝑆({ y} ) Specification Computation

  22. Assignment Rule {𝑠 1 ∗ 𝑆 𝑦 1 … , 𝑦 𝑜 ≤ 𝑠 2 ∗ 𝑠𝑓𝑚 𝑓 ∗ 𝑥𝑠 𝑦′ ∗ 𝑆( 𝑦′ 1 , … , 𝑦′ 𝑛 ∪ 𝑔𝑤 𝑓 )} x ’ = e 2 ∗ 𝑆({𝑦 ′ 1 , … , 𝑦′, … , 𝑦′ 𝑛 )} {𝑠 1 ∗ 𝑆 𝑦 1 … , 𝑦 𝑜 ≤ 𝑠

  23. Assignment Rule {𝑠 1 ∗ 𝑆 𝑦 1 … , 𝑦 𝑜 ≤ 𝑠 2 ∗ 𝑠𝑓𝑚 𝑓 ∗ 𝑥𝑠 𝑦′ ∗ 𝑆( 𝑦′ 1 , … , 𝑦′ 𝑛 ∪ 𝑔𝑤 𝑓 )} x’ = e Unmodified 2 ∗ 𝑆({𝑦 ′ 1 , … , 𝑦′, … , 𝑦′ 𝑛 )} {𝑠 1 ∗ 𝑆 𝑦 1 … , 𝑦 𝑜 ≤ 𝑠

  24. Assignment Rule {𝑠 1 ∗ 𝑆 𝑦 1 … , 𝑦 𝑜 ≤ 𝑠 2 ∗ 𝑠𝑓𝑚 𝑓 ∗ 𝑥𝑠 𝑦′ ∗ 𝑺( 𝒚′ 𝟐 , … , 𝒚′ 𝒏 ∪ 𝒈𝒘 𝒇 )} Standard x’ = e Substitution 2 ∗ 𝑺({𝒚 ′ 𝟐 , … , 𝒚′, … , 𝒚′ 𝒏 )} {𝑠 1 ∗ 𝑆 𝑦 1 … , 𝑦 𝑜 ≤ 𝑠

  25. Assignment Rule {𝑠 1 ∗ 𝑆 𝑦 1 … , 𝑦 𝑜 ≤ 𝑠 2 ∗ 𝒔𝒇𝒎 𝒇 ∗ 𝒙𝒔 𝒚′ ∗ 𝑆( 𝑦′ 1 , … , 𝑦′ 𝑛 ∪ 𝑔𝑤 𝑓 )} x’ = e 2 ∗ 𝑆({𝑦 ′ 1 , … , 𝑦′, … , 𝑦′ 𝑛 )} {𝑠 1 ∗ 𝑆 𝑦 1 … , 𝑦 𝑜 ≤ 𝑠 • 𝑠𝑓𝑚 𝑓 ∗ 𝑥𝑠 𝑦′ is the probability the expression and write execute correctly

  26. Verifying the Reliability of Bilinear Interpolation int<.99 * R(i,j,src,dest)> bilinear_interpolation(int i, int j, int in urel src[][], int in urel dest[][]) { int i_src = map_y(i, src, dest), j_src = map_x(j, src, dest); int up = i_src - 1, down = i_src + 1, left = j_src – 1, right = j_src + 1; int in urel val = src[up][left] +. src[up][right] +. src[down][right] +. src[down][left]; return 0.25 *. val; }

  27. Verifying the Reliability of Bilinear Interpolation 1. Generate postcondition from return statement .99 ∗ 𝑆 𝑡𝑠𝑑, 𝑗, 𝑘, 𝑒𝑓𝑡𝑢 ≤ return 0.25 *. val; 𝑠𝑒(𝑤𝑏𝑚) ∗ 𝑝𝑞(∗. ) ∗ 𝑆(𝑤𝑏𝑚) 2. Work backwards to produce verification condition .99 ∗ 𝑆 𝑡𝑠𝑑, 𝑗, 𝑘, 𝑒𝑓𝑡𝑢 ≤ 𝑠𝑒(𝑤𝑏𝑚) ∗ 𝑝𝑞(∗. ) ∗ 𝑠𝑒 𝑡𝑠𝑑 4 ∗ 𝑝𝑞 +. 3 ∗ 𝑥𝑠(𝑤𝑏𝑚) ∗ 𝑆(𝑡𝑠𝑑, 𝑗, 𝑘, 𝑒𝑓𝑡𝑢) 3. Use hardware specification to replace reliabilities Reliability of return Reliability of sum of neighbors .99 ∗ 𝑆 𝑡𝑠𝑑, 𝑗, 𝑘, 𝑒𝑓𝑡𝑢 ≤ (1 − 10 −7 ) ∗ (1 − 10 −7 ) ∗ 1 − 10 −7 4 ∗ 1 − 10 −7 3 ∗ 1.0 ∗ 𝑆(𝑡𝑠𝑑, 𝑗, 𝑘, 𝑒𝑓𝑡𝑢)

  28. Verifying the Reliability of Bilinear Interpolation 1. Generate postcondition from return statement .99 ∗ 𝑆 𝑡𝑠𝑑, 𝑗, 𝑘, 𝑒𝑓𝑡𝑢 ≤ return 0.25 *. val; 𝑠𝑒(𝑤𝑏𝑚) ∗ 𝑝𝑞(∗. ) ∗ 𝑆(𝑤𝑏𝑚) 2. Work backwards to produce verification condition .99 ∗ 𝑆 𝑡𝑠𝑑, 𝑗, 𝑘, 𝑒𝑓𝑡𝑢 ≤ 𝑠𝑒(𝑤𝑏𝑚) ∗ 𝑝𝑞(∗. ) ∗ 𝑠𝑒 𝑡𝑠𝑑 4 ∗ 𝑝𝑞 +. 3 ∗ 𝑥𝑠(𝑤𝑏𝑚) ∗ 𝑆(𝑡𝑠𝑑, 𝑗, 𝑘, 𝑒𝑓𝑡𝑢) 3. Use hardware specification to replace reliabilities .99 ∗ 𝑆 𝑡𝑠𝑑, 𝑗, 𝑘, 𝑒𝑓𝑡𝑢 ≤ . 999999 ∗ 𝑆(𝑡𝑠𝑑, 𝑗, 𝑘, 𝑒𝑓𝑡𝑢) 4. Discharge Verification Condition

  29. Verification Condition Checking Insight 𝑠 𝑗 ∗ 𝑆 {𝑦 𝑗1 , … , 𝑦 𝑗𝑜 } ≤ 𝑠′ 𝑗 ∗ 𝑆 {𝑦′ 𝑗1 , … , 𝑦′ 𝑗𝑛 } 𝑗 Computing full joint distributions is intractable and input distribution dependent 𝑦′ 1 , … , 𝑦′ 𝑛 ⊆ 𝑦 1 , … , 𝑦 𝑜 → 𝑆 𝑦 1 , … , 𝑦 𝑜 ≤ 𝑆( 𝑦′ 1 , … , 𝑦′ 𝑛 )

  30. Conjunct Checking • A conjunct is implied by a pair of constraints 𝑠 1 ≤ 𝑠 2 𝑦′ 1 , … , 𝑦′ 𝑛 ⊆ {𝑦 1 , … , 𝑦 𝑜 } 1 ∗ 𝑆 𝑦 1 , … , 𝑦 𝑜 𝑠 ≤ 𝑠 2 ∗ 𝑆 {𝑦′ 1 , … , 𝑦′ 𝑛 } • Decidable, efficiently checkable, and input distribution agnostic

  31. Verification Condition Checking for Approximate Bilinear Interpolation Data Hardware Dependences Specification src , i , j , dest ⊆ src , i , j , dest .99 ≤ .999999 . 99 ∗ 𝑆 src, i, j, dest ≤ .999999 ∗ 𝑆 src, i, j, dest

  32. What about…programs? (conditionals, loops, and functions)

  33. Conditionals if (y >. 0) x = x +. 1 x = 2 *. x +. 1

  34. Conditionals ℓ = y >. 0 if ( ℓ ) x 1 = x 0 +. 1 x 2 = 2 *. x 0 +. 1

  35. Conditionals ℓ = y >. 0 if ( ℓ ) x 1 = x 0 +. 1 x 2 = 2 *. x 0 +. 1 x = φ ( ℓ , x 1 , x 2 )

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend