[Paper Review] Finding Root Causes of Floating Point Error with Herbgrind
Herbgrind is a dynamic binary analysis tool that identifies root causes of floating-point errors in large C/C++ and Fortran applications by tracking error propagation across function boundaries and heap-allocated data. It uses shadow execution with symbolic expressions and input characterization to abstract error sources into debuggable, improvable code fragments, enabling precise diagnosis of non-local, non-compositional, and non-uniform floating-point errors in real-world scientific software.
Floating-point arithmetic plays a central role in science, engineering, and finance by enabling developers to approximate real arithmetic. To address numerical issues in large floating-point applications, developers must identify root causes, which is difficult because floating-point errors are generally non-local, non-compositional, and non-uniform. This paper presents Herbgrind, a tool to help developers identify and address root causes in numerical code written in low-level C/C++ and Fortran. Herbgrind dynamically tracks dependencies between operations and program outputs to avoid false positives and abstracts erroneous computations to a simplified program fragment whose improvement can reduce output error. We perform several case studies applying Herbgrind to large, expert-crafted numerical programs and show that it scales to applications spanning hundreds of thousands of lines, correctly handling the low-level details of modern floating point hardware and mathematical libraries, and tracking error across function boundaries and through the heap.
Motivation & Objective
- To address the lack of tools for diagnosing root causes of floating-point errors in large, expert-crafted numerical applications.
- To overcome the challenges of non-compositional, non-local, and non-uniform floating-point error propagation in production code.
- To enable developers to identify and improve specific program fragments that contribute most to output error.
- To scale dynamic floating-point error analysis to real-world scientific applications with hundreds of thousands of lines of code.
- To provide a practical, performant, and accurate debugging solution that works with modern floating-point hardware and mathematical libraries.
Proposed method
- Herbgrind uses the Valgrind binary instrumentation framework to perform dynamic binary analysis on compiled numerical programs.
- It maintains a shadow execution with MPFR-based high-precision values to track intermediate rounding errors.
- A taint-like analysis propagates error influence from operations to program outputs and control flow decisions.
- Symbolic expressions abstract sequences of operations that contribute to error, enabling numerical analysis and code improvement.
- Input characterization identifies the input ranges—full or subset—that trigger significant error, aiding reproducibility and debugging.
- The tool supports complex features like function calls, heap allocations, SIMD instructions, and library function wrapping, ensuring fidelity to real program behavior.
Experimental results
Research questions
- RQ1How can root causes of floating-point errors be identified in large, real-world numerical applications written in low-level languages?
- RQ2To what extent can dynamic analysis with symbolic execution and input characterization reduce false positives in floating-point error diagnosis?
- RQ3Can a tool scale to hundreds of thousands of lines of expert-crafted numerical code while accurately tracking error across function boundaries and heap-allocated data?
- RQ4How do the components of Herbgrind—shadow execution, symbolic expressions, and input characterization—contribute to its accuracy and performance?
- RQ5Can Herbgrind detect root causes of floating-point error that are missed even by expert developers in production numerical software?
Key findings
- Herbgrind successfully identified root causes of floating-point errors in three large, expert-crafted numerical applications, including cases missed by developers.
- The tool scales to applications with over 300,000 lines of code and correctly handles complex low-level details such as floating-point hardware behavior and mathematical library calls.
- Herbgrind’s components—shadow taint analysis, symbolic execution, and input characterization—were each shown to be crucial for accuracy and performance in controlled experiments with the FPBench benchmark suite.
- The tool correctly tracked error propagation across function boundaries and through heap-allocated data structures, demonstrating robustness in non-local error scenarios.
- Herbgrind’s approach enables developers to abstract problematic computations into simplified, improvable program fragments that can be targeted for numerical improvement.
- The implementation is publicly available and integrates with the Valgrind framework, enabling deployment on real scientific computing workloads.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.