daisy
play

Daisy a framework for sound accuracy analysis of numerical programs - PowerPoint PPT Presentation

Daisy a framework for sound accuracy analysis of numerical programs Eva Darulova Anastasiia Izycheva eva@mpi-sws.org izycheva@in.tum.de Daisy a framework for sound accuracy analysis of numerical programs } and optimization Eva Darulova


  1. Daisy a framework for sound accuracy analysis of numerical programs Eva Darulova Anastasiia Izycheva eva@mpi-sws.org izycheva@in.tum.de

  2. Daisy a framework for sound accuracy analysis of numerical programs } and optimization Eva Darulova Anastasiia Izycheva eva@mpi-sws.org izycheva@in.tum.de

  3. Observation:

  4. Observation: many applications use more resources than they really need

  5. Observation: many applications use more resources than they really need ➡ particularly important for embedded systems

  6. Observation: many applications use more resources than they really need ➡ particularly important for embedded systems ➡ in numerical programs:

  7. Observation: many applications use more resources than they really need ➡ particularly important for embedded systems ➡ in numerical programs: ‣ too much precision (among other issues)

  8. Observation: many applications use more resources than they really need ➡ particularly important for embedded systems ➡ in numerical programs: ‣ too much precision (among other issues) Why?

  9. Observation: many applications use more resources than they really need ➡ particularly important for embedded systems ➡ in numerical programs: ‣ too much precision (among other issues) Why? challenging to optimise manually

  10. Observation: many applications use more resources than they really need ➡ particularly important for embedded systems ➡ in numerical programs: ‣ too much precision (among other issues) Why? challenging to optimise manually ‣ verification of finite-precision

  11. Observation: many applications use more resources than they really need ➡ particularly important for embedded systems ➡ in numerical programs: ‣ too much precision (among other issues) Why? challenging to optimise manually ‣ verification of finite-precision ‣ too many options for optimisation

  12. Daisy’s Goal real-valued program with accuracy spec Daisy optimised finite-precision program

  13. Daisy’s Goal general real-valued program with accuracy spec Daisy optimised finite-precision program

  14. Daisy’s Goal general real-valued program with accuracy spec Daisy automated optimised finite-precision program

  15. real-valued program with accuracy spec finite-precision program

  16. real-valued program with accuracy spec 1: def sine(x: Real ): Real = { 2: require (-1.5 <= x && x <= 1.5 && x +/- 1e-11) 3: 4: x - (x^3)/6.0 + (x^5)/120.0 - (x^7)/5040.0 5: 6: } ensuring (res => res +/- 1.001e-11) finite-precision program

  17. real-valued program with accuracy spec 1: def sine(x: Real ): Real = { 2: require (-1.5 <= x && x <= 1.5 && x +/- 1e-11) 3: 4: x - (x^3)/6.0 + (x^5)/120.0 - (x^7)/5040.0 5: 6: } ensuring (res => res +/- 1.001e-11) finite-precision program floating-point arithmetic def sine(x: Double ): Double = { require (-1.5 <= x && x <= 1.5) x - (x^3)/6.0 + (x^5)/120.0 - (x^7)/5040.0 }

  18. real-valued program with accuracy spec 1: def sine(x: Real ): Real = { 2: require (-1.5 <= x && x <= 1.5 && x +/- 1e-11) 3: 4: x - (x^3)/6.0 + (x^5)/120.0 - (x^7)/5040.0 5: 6: } ensuring (res => res +/- 1.001e-11) finite-precision program floating-point arithmetic fixed-point arithmetic def sine(x: Long): Long = { def sine(x: Double ): Double = { require (-1.5 <= x && x <= 1.5) require (-1.5 <= x && x <= 1.5) val _t1 = ((x * x) >> 31) val _t2 = ((_t1 * x) >> 30) x - (x^3)/6.0 + (x^5)/120.0 - (x^7)/5040.0 val _t3 = ((_t2 << 30) / 1610612736l) val _t4 = ((x << 1) - _t3) } . . .

  19. real-valued program with accuracy spec 1: def sine(x: Real ): Real = { 2: require (-1.5 <= x && x <= 1.5 && x +/- 1e-11) 3: 4: x - (x^3)/6.0 + (x^5)/120.0 - (x^7)/5040.0 5: 6: } ensuring (res => res +/- 1.001e-11) 1. verification 2. optimisation finite-precision program floating-point arithmetic fixed-point arithmetic def sine(x: Long): Long = { def sine(x: Double ): Double = { require (-1.5 <= x && x <= 1.5) require (-1.5 <= x && x <= 1.5) val _t1 = ((x * x) >> 31) val _t2 = ((_t1 * x) >> 30) x - (x^3)/6.0 + (x^5)/120.0 - (x^7)/5040.0 val _t3 = ((_t2 << 30) / 1610612736l) val _t4 = ((x << 1) - _t3) } . . .

  20. Accuracy Verification def sine(x: Real ): Real = { require (-1.5 <= x && x <= 1.5 && x +/- 1e-11) x - (x^3)/6.0 + (x^5)/120.0 - (x^7)/5040.0 } ensuring (res => res +/- 1.001e-11) How to measure accuracy? x ∈ I | f ( x ) − ˜ max f (˜ x ) | absolute errors

  21. Accuracy Verification def sine(x: Real ): Real = { require (-1.5 <= x && x <= 1.5 && x +/- 1e-11) x - (x^3)/6.0 + (x^5)/120.0 - (x^7)/5040.0 } ensuring (res => res +/- 1.001e-11) How to measure accuracy? � � f ( x ) − ˜ f (˜ x ) � � x ∈ I | f ( x ) − ˜ max f (˜ x ) | max � � f ( x ) � � x ∈ I � � absolute errors relative errors

  22. Accuracy Verification def sine(x: Real ): Real = { require (-1.5 <= x && x <= 1.5 && x +/- 1e-11) x - (x^3)/6.0 + (x^5)/120.0 - (x^7)/5040.0 } ensuring (res => res +/- 1.001e-11) How to measure accuracy? � � f ( x ) − ˜ f (˜ x ) � � x ∈ I | f ( x ) − ˜ max f (˜ x ) | max � � f ( x ) � � x ∈ I � � absolute errors relative errors Challenge: automatically and accurately bound worst-case errors

  23. Bounding Absolute Errors x ∈ I | f ( x ) − ˜ max f (˜ x ) | Static dataflow analysis ‣ fully automated ‣ sound upper bound

  24. Bounding Absolute Errors x ∈ I | f ( x ) − ˜ max f (˜ x ) | Static dataflow analysis ‣ fully automated ‣ sound upper bound for each arithmetic operation 1. compute real-valued range for intermediate value 2. propagate existing errors 3. compute new roundoff error

  25. Bounding Absolute Errors [1] x ∈ I | f ( x ) − ˜ max f (˜ x ) | Static dataflow analysis ‣ fully automated ‣ sound upper bound Challenge: tight bounds for nonlinear arithmetic

  26. Bounding Absolute Errors [1] x ∈ I | f ( x ) − ˜ max f (˜ x ) | Static dataflow analysis ‣ fully automated ‣ sound upper bound Challenge: tight bounds for nonlinear arithmetic Challenge: conditionals (control-flow may diverge)

  27. Bounding Absolute Errors [1] x ∈ I | f ( x ) − ˜ max f (˜ x ) | Static dataflow analysis ‣ fully automated ‣ sound upper bound Challenge: tight bounds for nonlinear arithmetic Challenge: conditionals (control-flow may diverge) Challenge: loops (errors may grow unboundedly)

  28. Bounding Absolute Errors x ∈ I | f ( x ) − ˜ max f (˜ x ) | Challenge: tight bounds for nonlinear arithmetic abstract domains:

  29. Bounding Absolute Errors x ∈ I | f ( x ) − ˜ max f (˜ x ) | Challenge: tight bounds for nonlinear arithmetic abstract domains: ‣ interval arithmetic

  30. Bounding Absolute Errors x ∈ I | f ( x ) − ˜ max f (˜ x ) | Challenge: tight bounds for nonlinear arithmetic abstract domains: ‣ interval arithmetic ‣ affine arithmetic

  31. Bounding Absolute Errors x ∈ I | f ( x ) − ˜ max f (˜ x ) | Challenge: tight bounds for nonlinear arithmetic abstract domains: ‣ interval arithmetic ‣ affine arithmetic additional techniques:

  32. Bounding Absolute Errors x ∈ I | f ( x ) − ˜ max f (˜ x ) | Challenge: tight bounds for nonlinear arithmetic abstract domains: ‣ interval arithmetic ‣ affine arithmetic additional techniques: ‣ SMT (nonlinear decision procedure)

  33. Bounding Absolute Errors x ∈ I | f ( x ) − ˜ max f (˜ x ) | Challenge: tight bounds for nonlinear arithmetic abstract domains: ‣ interval arithmetic ‣ affine arithmetic additional techniques: ‣ SMT (nonlinear decision procedure) ‣ interval subdivision

  34. Bounding Absolute Errors x ∈ I | f ( x ) − ˜ max f (˜ x ) | Challenge: tight bounds for nonlinear arithmetic abstract domains: ‣ interval arithmetic ‣ affine arithmetic additional techniques: ‣ SMT (nonlinear decision procedure) ‣ interval subdivision error bounds often within one order of magnitude of true errors

  35. Bounding Relative Errors state-of-the-art definition � � x ) − ˜ f ( ~ x ) − ˜ max x ∈ I | f ( ⃗ f ( ⃗ x ) | f ( ~ x ) ˜ ˜ � � max � � 6 = f ( ~ x ) min x ∈ I | f ( ⃗ x ) | � � x ∈ I � � Challenge: tight bounds

  36. Bounding Relative Errors state-of-the-art definition � � x ) − ˜ f ( ~ x ) − ˜ max x ∈ I | f ( ⃗ f ( ⃗ x ) | f ( ~ x ) ˜ ˜ � � max � � 6 = f ( ~ x ) min x ∈ I | f ( ⃗ x ) | � � x ∈ I � � Challenge: tight bounds Challenge: division by zero

  37. Tight Relative Error Bounds Assume NO division by zero � � x ) − ˜ f ( ~ f ( ~ x ) ˜ � � err rel = max � � f ( ~ x ) � � x ∈ I � � Our solution : ‣ evaluate the relative error expression directly ‣ interval subdivision

  38. Relative Errors Directly Replace ˜ f ( ~ e, ~ x ) with its abstraction ˜ f ( ~ d ) x, ~ according to IEEE754 f ( x ) = x + 0 . 3 Naive approach:

  39. Relative Errors Directly Replace ˜ f ( ~ e, ~ x ) with its abstraction ˜ f ( ~ d ) x, ~ according to IEEE754 f ( x ) = x + 0 . 3 Naive approach: e, ⃗ f ( ⃗ d ) = ( x (1 + e x ) + d x + 0 . 3(1 + e 0 . 3 ) + d 0 . 3 )(1 + e + ) + d + x, ⃗

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