Combining Tools for Optimization and Analysis of Floating-Point Computations Heiko Becker, Pavel Panchekha, Eva Darulova, Zachary Tatlock FM 2018, 17.07.2018
Floating-Point Computations Are Ubiquitous 2
Floating-Point Computations are Tricky 3
None of these tools Renewed Interest Lead to Numerous Tools have been connected together! Precisa Precimonious Daisy VCFloat Herbie FPTuner Gappa ??? 4
+ • verify Herbies optimizations with Daisy • compare Herbie’s and Daisy’s optimizations ⟹ best run together connecting exposes tools to new inputs found bugs and inaccuracies ⟹ call to action to connect tools 5
+ Concretely • unify input formats + 𝐷𝐼𝐹𝐷𝐿 • verify Herbies optimizations with Daisy + 𝑃𝑄𝑈 • compare optimization techniques • fix bugs and inaccuracies 6
Floating-Point Arithmetic 0.2 + 0.1 0.2 + 0.1; ≠ 0.3 0.30000000000000004 roundoff error Units in the Last Place: in Herbie error of 𝟏 relative measure of lost bits 1 + 𝜀 abstraction: in Daisy error of 𝟓𝒇 −𝟐𝟔 𝑓 1 + 𝑓 2 = 𝑓 1 + 𝑓 2 ∗ 1 + 𝜀 7
Heuristic Optimization of Floating-Point Programs 1 𝑦 + 1 − 𝑦 Optimizer 𝑦 + 1 + 𝑦 ⟹ dynamic analysis ⟹ (possibly) unsound optimizations ⟹ heuristic hill-climbing algorithm 8
Sound Analysis of Floating-Point Programs 𝑔 𝑦 = 𝑦 + 1 − 𝑦 error is 2.34e −15 Static Analyzer 𝑦 ∈ [10, 100] ⟹ sound dataflow analysis ⟹ 2.34e −15 is a sound but possibly pessimistic upper bound 9
Sound Optimization of Floating-Point Programs −𝑦 1 ∗ 𝑦 2 − 2 ∗ 𝑦 2 ∗ 𝑦 3 − 𝑦 1 − 𝑦 3 𝑦 𝑗 ∈ [−15, 15] ⟹ rewriting optimizes accuracy Static Analyzer + Rewriter ⟹ improved error bound from 2.95e −13 to 1.98e −13 (−𝑦 1 ∗ 𝑦 2 − (𝑦 1 + 𝑦 3 )) − (2 ∗ 𝑦 2 ) ∗ 𝑦 3 10
+ 𝐷𝐼𝐹𝐷𝐿 11
The FPBench Project • collection of benchmarks • new standardized input format • converters to input formats • FPCore → Gappa • FPCore → C • FPCore → Scala 12
Herbie’s error improvement + 𝐷𝐼𝐹𝐷𝐿 better 103 FPBench benchmarks in total Herbie times out on 34 Daisy raises an alarm for 22 13 alarms on source programs 9 alarms on Herbies result End-to-end result for 47: • 8 have become worse • 18 have the same worst-case bound • 21 have a provable improvement 13
+ 𝑃𝑄𝑈 14
Error Improvement of Herbie Daisy Both better 15
Evaluation of the optimization algorithms Herbie Both Daisy 16
Additional Benefit: Improving Tool Robustness Herbie Daisy • Incorrect Typing rule for let-bindings • Improved analysis of elementary functions • Incorrect handling of duplicate fields • Improved error reporting • Infinite loop for some preconditions 17
Conclusion • floating-point tools solve orthogonal problems • connecting them is easy and exposes bugs • Daisy is a good verification backend for Herbie • Herbie’s and Daisy’s optimizations work best together • first step on bigger vision of connecting tools Questions? https://fpbench.org 18
Recommend
More recommend