Turning a math formula into fast, accurate floating-point code is getting harder as chips add low-precision accelerators, vector instructions, and special math libraries, and two kinds of compilers each solve only half the problem — traditional compilers like Clang specialize to a target but ignore accuracy (bit-exact or reckless fast-math), while numerical compilers like Herbie trade accuracy against speed but ignore the target; this paper (University of Washington and Utah — Brett Saiki, Jackson Brough, Jonas Regehr, Jesus Ponce, Varun Pradeep, Aditya Akhileshwaran, Zachary Tatlock, Pavel Panchekha) presents Chassis, a target-aware numerical compiler that, given a description of a target's instructions with their cost and accuracy, uses equality saturation over mixed real and floating-point expressions to select target-specific instructions that preserve the math, guided by an iterative cost-opportunity loop, finding accuracy-performance trade-offs 3.5 times better than Clang and up to 2.0 times better than Herbie across nine targets.
The argument in one glance
-
Problem
Turning a formula into fast, accurate float code needs two skills no compiler has both of
A programmer starts with a mathematical formula over real numbers and must implement it in floating-point arithmetic, which forces a trade-off: floating-point is finite-precision, so different implementations of the same formula have different accuracy and different speed. Modern hardware makes this harder and richer at once, offering low-precision accelerators, vector instruction sets, and specialized math libraries that can be much faster but change the accuracy. Getting the best result means two skills together: rewriting the formula using mathematical identities to be more accurate or cheaper, and choosing the right target-specific instructions and library functions to be fast. The trouble is that the existing tools each have only one of these skills, so a programmer cannot get an implementation that is both well-adapted to the target and numerically careful.
-
What people did
Use a traditional compiler, or a numerical compiler
Two lines of tools attack the problem from opposite ends. Traditional compilers like Clang specialize code to a wide range of targets and their instructions, but treat accuracy crudely: they either preserve bit-identical results (which usually prevents using accelerators) or turn on unrestricted "fast-math" optimizations that ignore numerical accuracy. Numerical compilers like Herbie and Rosa instead improve accuracy and performance through term rewriting and precision tuning — exploiting mathematical identities and choosing precisions.
-
Why it fell short
One knows the target but not accuracy, the other knows accuracy but not the target
Each tool is missing the other's skill. Traditional compilers are target-aware but accuracy-blind: preserving bit-exact results blocks the accelerators that would speed the code up, while fast-math is notorious for catastrophic accuracy losses because it applies identities that are not numerically safe. Numerical compilers are accuracy-aware but target-agnostic: they rewrite for accuracy and tune precision, but they do not know what instructions the intended target actually offers, so they cannot leverage its low-precision accelerators, its accuracy-optimized helper functions, or the subcomponents of its math libraries. The result is that a programmer must choose between a compiler that specializes to the hardware but may wreck accuracy, and one that reasons about accuracy but leaves the hardware's special capabilities on the table. What is missing is a compiler that does both: rewrite the math for accuracy and select the target's specific instructions for speed.
-
This paper's idea
Combine accuracy-aware rewriting with target-aware instruction selection
Chassis is a target-aware numerical compiler that optimizes for both accuracy and performance. It takes a target description that lists, for each instruction or library function the target provides, the real expression it approximates and estimates of its cost and accuracy — so Chassis knows the target's capabilities. It then compiles a real-number expression into a set of target-specific floating-point programs spanning the accuracy-performance Pareto frontier (the most accurate program achievable at each cost). Its core is a new instruction selection modulo equivalence algorithm: it runs equality saturation over mixed real and floating-point expressions in an e-graph (a data structure that compactly represents a huge or even infinite set of equivalent terms), so it can select target-specific instructions while preserving mathematical equality — combining the accuracy-aware rewriting of numerical compilers with the target-aware instruction selection of traditional compilers. To steer this heavyweight search, an iterative improvement loop with a cost-opportunity heuristic repeatedly identifies the subexpressions worth rewriting, generates variants, and keeps the Pareto-optimal ones. Across 9 targets — hardware ISAs, math libraries, and languages — Chassis finds better accuracy-performance trade-offs than Clang by 3.5 times and than Herbie by up to 2.0 times, exploiting low-precision accelerators, accuracy-optimized helper functions, and library subcomponents.
Why this problem is worth solving
Numerical code sits under science, graphics, machine learning, and finance, and how it is implemented in floating-point decides both whether its answers are trustworthy and how fast it runs. A mathematical formula is written over the real numbers, which are exact and infinite in precision. A computer implements it in floating-point, which represents numbers with finite precision, so every operation can introduce a small rounding error, and those errors can accumulate or amplify catastrophically depending on how the formula is arranged. Crucially, many different floating-point programs compute the same real formula — you can reorder operations, apply algebraic identities, use higher or lower precision, or call different library functions — and these choices trade off accuracy against speed. A rearrangement that is faster (fewer operations, or lower precision on an accelerator) may be less accurate, and one that is more accurate may be slower. So implementing numerical code is not a mechanical translation; it is a search over equivalent programs for a good point on the accuracy-performance curve. This matters enormously because the same formula can be implemented in ways that differ by orders of magnitude in speed and by many digits in accuracy, and the right choice depends on the application’s needs. Today’s hardware sharpens the stakes: low-precision accelerators offer big speedups but at reduced precision, so using them well requires knowing when the lost accuracy is acceptable. Getting this trade-off right is exactly the job a compiler should do, and doing it well is worth a great deal across all numerical computing.
The reason no existing compiler does the whole job is that the two required skills live in two separate research traditions. Compilation of numerical code has split into two camps that each solve half the problem. Traditional compilers, like Clang, are experts at targeting: they know the instruction sets, vector units, and libraries of many platforms and specialize code to run fast on each. But they treat floating-point conservatively, because reordering floating-point operations can change results: by default they preserve bit-identical output, which forbids most accuracy-changing optimizations and often rules out accelerators that compute slightly different bits; or, with fast-math enabled, they apply algebraic identities freely with no regard for whether those identities are numerically safe, which is infamous for silently destroying accuracy. Numerical compilers, like Herbie and Rosa, are experts at accuracy: they use term rewriting to apply mathematical identities that improve accuracy, and precision tuning to lower precision where it is safe, searching for programs that are both more accurate and faster. But they are target-agnostic — they optimize an abstract program without knowing which concrete instructions, accelerators, or library functions the deployment target provides, so they cannot exploit those. The two skills are complementary: target-awareness tells you what fast instructions exist, and accuracy-awareness tells you which rewrites are safe and how each choice affects error. Neither alone can find the best target-specific, numerically-careful implementation, which is precisely the gap Chassis sets out to bridge by joining them.
What people did before, and where it broke
- Traditional compiler, bit-exact mode (Clang default). Compile to the target while preserving bit-identical floating-point results. Where it broke. Preserving exact bits forbids accuracy-changing rewrites and usually prevents using low-precision accelerators, so it leaves large speedups unclaimed.
- Traditional compiler, fast-math mode. Enable aggressive floating-point optimizations that apply algebraic identities freely. Where it broke. Fast-math ignores numerical accuracy and is notorious for catastrophic, silent accuracy losses, so it is unsafe for code where accuracy matters.
- Numerical compilers (Herbie, Rosa, and others). Improve accuracy and performance via term rewriting and precision tuning. Where it broke. They are target-agnostic: they optimize an abstract program and cannot exploit the specific target’s low-precision accelerators, accuracy-optimized helper functions, or library subcomponents.
- Hand-tuning by an expert. Have a numerical-methods expert manually pick identities, precisions, and target instructions. Where it broke. It requires rare expertise, is slow and error-prone, and must be redone for every target and every accuracy requirement.
- The gap. No compiler combined accuracy-aware term rewriting with target-aware instruction selection, so none could search equivalent implementations for the best accuracy-performance trade-off on a specific target using that target’s actual instructions.
How Chassis works
Compiling a real formula to target-specific floating-point programs on the Pareto frontier
-
-
new
-
new
-
new
-
new
-
new
The idea
Tell the compiler what the target offers, so it can specialize like a real backend. The first move that makes Chassis target-aware is the target description: a listing of each instruction or library function the target provides, the real expression it approximates, and its estimated cost and accuracy. This turns the abstract target-agnostic optimization of numerical compilers into a concrete one that knows the hardware and libraries it is compiling for, so it can choose a low-precision accelerator instruction or a specialized helper function when that is the best point on the curve. Adapting a compiler’s output to the concrete cost characteristics of a specific target, rather than optimizing in the abstract, is the same target-specialization goal the work on a fast, portable Bayesian compiler-optimization framework covered elsewhere on this site pursues, tuning code to the actual target’s performance. Chassis makes the target’s accuracy characteristics part of that specialization too, which is what numerical code needs.
Search equivalent programs with an e-graph, keeping the math exact. The technical heart is instruction selection modulo equivalence: Chassis represents the huge space of mathematically equivalent implementations in an e-graph and runs equality saturation to grow it, so it can match the target’s instructions to the real expressions they compute while guaranteeing the selected program still means the same math. This is what lets it exploit identities without the recklessness of fast-math — every rewrite is an equivalence, and accuracy is evaluated explicitly rather than assumed. Searching a large space of program variants with a heavyweight engine to find one that satisfies a correctness relation while optimizing a cost is the same synthesis-by-search discipline the work on a solver-aided compiler for packet-processing pipelines covered elsewhere on this site is built on, using a powerful search to select a correct, efficient implementation. Chassis’s engine is equality saturation over real-and-float expressions, tuned to the accuracy-performance objective.
Spend the low precision the hardware offers, only where accuracy allows. A large part of Chassis’s gains come from using low-precision accelerators and reduced-precision helper functions — dropping precision where the application can tolerate it to gain speed, and keeping precision where it cannot. Because Chassis tracks accuracy per variant and produces a Pareto set, the developer can select exactly how much precision to trade for speed, rather than being forced to bit-exact or into blanket fast-math. Trading numerical precision for performance in a controlled, accuracy-aware way to exploit low-precision hardware is the same balance the work on a microscaling data format for efficient low-precision computation covered elsewhere on this site strikes, spending bits carefully to gain speed without unacceptable error. Chassis brings that balance to arbitrary real expressions and whatever low-precision capabilities the target exposes, choosing per subexpression where the trade is worth it.
Following an expression through Chassis
Implementing a math formula on a target with a low-precision accelerator
A trace, drawn from the paper, of how Chassis compiles a real expression into a Pareto set of target-specific floating-point programs.
Step 1 of 5
Provide the formula and the target description
The developer gives Chassis a real-number expression and a description of the target: its instructions and library functions, the real expressions they approximate, and their cost and accuracy. This tells Chassis both what to compute and what building blocks are available.
The target description is what makes the optimization target-aware.
Why it works
- A target description lets it use the hardware’s fast instructions. Target-agnostic numerical compilers cannot exploit accelerators or special libraries → but a description of each instruction’s real meaning, cost, and accuracy exposes them → so Chassis can select low-precision accelerators and helper functions that others leave unused.
- Equality saturation keeps every rewrite mathematically exact. Fast-math applies identities recklessly and destroys accuracy → but an e-graph grown by equality saturation only ever holds equivalent programs → so Chassis exploits identities without the catastrophic errors fast-math risks.
- Explicit accuracy evaluation makes the trade-off principled. Choosing lower precision blindly can ruin results → but Chassis measures each variant’s accuracy on training inputs and the target’s model → so it drops precision only where the accuracy loss is acceptable.
- The cost-opportunity loop makes a heavyweight search feasible. Rewriting the whole program with equality saturation would be too expensive → but the loop targets only the inaccurate or slow subexpressions → so the powerful search is spent where it pays off.
- A Pareto set gives developers real choice. A single output forces one accuracy-speed point on everyone → but Chassis returns the most accurate program at each cost → so a developer picks exactly the trade-off their application needs.
What it costs (trade-offs and scope)
- It needs a target description. Chassis is target-aware because someone must describe the target’s instructions and library functions, including the real expression each approximates and estimates of cost and accuracy; producing and maintaining accurate descriptions is real work, and the results are only as good as those estimates.
- The optimization is a heavyweight search. Equality saturation over real-and-float expressions is expensive, which is why Chassis needs the cost-opportunity heuristic and iterative loop to stay tractable; it is a compile-time cost paid to find good implementations, and very large expressions could still stress the search.
- Accuracy is measured empirically on training inputs. Chassis evaluates variants’ accuracy using training inputs and the target’s accuracy model rather than proving worst-case error bounds, so the accuracy it reports is with respect to that sampling and model, not a formal guarantee for all inputs.
- The gains are relative to specific baselines and targets. The 3.5-times improvement over Clang and up-to-2.0-times over Herbie are on the accuracy-performance trade-off across the 9 evaluated targets and benchmark expressions; other targets, expressions, and metrics would shift the numbers.
- It targets implementing real expressions, not whole programs. Chassis compiles numerical expressions to target-specific floating-point programs; it is a numerical compiler for that task, not a general-purpose compiler, and it composes with, rather than replaces, the traditional backend for the rest of a program.
The evaluation
Implementing a real-number formula in floating-point for a target
| Property | Traditional compiler (Clang) | Numerical compiler (Herbie) | Chassis |
|---|---|---|---|
| Target-aware | |||
| Accuracy-aware | |||
| Uses low-precision accelerators | |||
| Safe use of identities | |||
| Reported outcome |
Check yourself
Check your understanding
1. Why can neither a traditional compiler nor a numerical compiler alone implement a formula best?
2. What is Chassis's core mechanism?
3. How does Chassis exploit identities without fast-math's catastrophic accuracy loss?
4. What did Chassis achieve, and what are its main limitations?
Sources
The paper is “Target-Aware Implementation of Real Expressions” by Brett Saiki, Jackson Brough, Jonas Regehr, Jesus Ponce, Varun Pradeep, Aditya Akhileshwaran, Zachary Tatlock, and Pavel Panchekha (University of Washington and University of Utah), published at ASPLOS 2025, DOI 10.1145/3669940.3707277. The system is named Chassis. It is licensed CC BY.
This explainer is written from the paper’s full text (arXiv:2410.14025). The paper addresses implementing numerical code from mathematical formulas as a compilation problem, where two styles of compiler each solve half of it: traditional compilers like Clang specialize to targets but handle accuracy crudely (bit-identical results, which blocks accelerators, or fast-math, which ignores accuracy), while numerical compilers like Herbie and Rosa improve accuracy and performance through term rewriting and precision tuning but are target-agnostic. Chassis is a target-aware numerical compiler that joins both: it takes a target description listing the real expressions each operator or library function approximates and estimates of its cost and accuracy, and compiles a real-number expression into a set of target-specific floating-point programs spanning the accuracy-performance Pareto frontier. Its core is a new instruction selection modulo equivalence algorithm that runs equality saturation over mixed real-float expressions in an e-graph to select target-specific instructions while preserving mathematical equality, and it uses an iterative improvement loop with a cost-opportunity heuristic (and local-error analysis) to identify inaccurate or slow subexpressions, generate variants, and retain the Pareto-optimal ones, building on the Herbie engine. The reported results are the paper’s own: across 9 targets (hardware ISAs, math libraries, and programming languages), Chassis finds better accuracy-performance trade-offs than Clang by 3.5 times and than Herbie by up to 2.0 times, by leveraging low-precision accelerators, accuracy-optimized numerical helper functions, and library subcomponents. No numbers beyond the paper’s own have been introduced; exact algorithm details, the accuracy models, and the full evaluation should be confirmed in the paper.