← The journal

Numeric Foundation: What We Built and What Independent Testing Found

A development phase closed: reference arithmetic hardware, guarded repairs, two defects found by independent testing, and what remains open.

We've closed a development phase on the numeric foundation of Memdance's AI-first hardware engineering platform. The platform now covers fixed- and floating-point arithmetic from definition through synthesizable reference hardware, tooling that explains numerical behavior and offers guarded repairs, and conformance testing against references we didn't write.

This has been our longest development cycle so far. Independent testing found a rounding defect that every one of our own execution paths agreed on. It also found a performance defect that turned one test from under five minutes into almost two hours. Both are described below, along with what remains open.

"Closed" has a specific meaning here. The planned features are implemented and the reference hardware exists. Verification is not finished, the implementations are unoptimized, and nothing here has been qualified for a manufacturing process. The reference hardware is a checked baseline, not a set of production circuits.

The cycle also held up the next stage of our first AI-generated system-on-chip (SoC) effort, which was waiting on broader arithmetic. This milestone lets us return to it.

What the Foundation Covers

Numerical choices are part of a hardware design's requirements. A signal-processing coefficient needs a particular fixed-point resolution. A dot product may take compact inputs and a wider accumulator. A low-precision AI computation depends on exactly where rounding happens. The platform makes each of those choices explicit and carries it into the circuit.

Fixed point. Signed and unsigned values have independently specified integer and fractional widths, with wrapping, saturation and checked overflow as distinct, observable behaviors. Widths aren't limited to the host machine's integer sizes: targeted tests exercise 65-, 127-, 257- and 4,096-bit values. Maintained designs include a multiply-accumulate with 129-bit multiplicands and a 257-bit accumulator, and a 16-tap FIR filter.

Floating point. Standard formats from half through quadruple precision, bfloat16, and custom formats share one descriptor-based foundation. A descriptor defines precision, exponent range, zeros, subnormals, exceptional encodings and fallback results. Formats that can't represent infinity or NaN are first-class: their overflow and invalid-operation results are part of the definition.

Mixed precision and scaled AI formats. Operations accept independent operand and result formats. An exact dot product keeps the full sum until one final rounding; a sequential dot product applies the specified rounding at every accumulation step. Maintained hardware workloads include OFP8 inputs with binary32 accumulation, MXFP8 and MXFP4 quantize/dequantize paths, and FP4 conversion.

Rounding and status. Seven rounding policies are explicit: toward zero, toward positive, toward negative, nearest away, nearest even, round to odd, and stochastic. Stochastic randomness is an ordinary input, so replaying the same operands and random words reproduces the same decision. Every operation reports status (inexact, overflow, invalid and others) alongside its value.

Timed arithmetic. Division, remainder, square root, reciprocal and reciprocal square root are iterative hardware units with a defined request/response interface. They hold responses under backpressure and support reset, cancellation and reuse. This cycle also added reference hardware for the elementary functions: exponential, logarithmic, trigonometric and activation functions. Their contract is strict. A built-in function returns a result proved to be correctly rounded, or the request is refused; an error tolerance never substitutes for a defined result. A cheaper approximation is allowed only as a separately authored design whose coefficients, range reduction, intermediate precision and rounding at each stage are all explicit. Whether a given format is admitted depends on completing that proof within declared resource limits. Small formats are certified today. Admission across the full binary32 range is still open, and we have not yet published per-function costs.

Our earlier numeric case study shows why these distinctions matter: two dot products returned identical bits and the same inexact flag, yet only one satisfied its accumulation contract.

From Numerical Meaning to Synthesizable Hardware

The reference hardware is built from integer and bit datapaths, registers and control logic. An implementation must match the requested numerical behavior before it can be selected, and a request that exceeds a declared resource or response bound is rejected before a circuit is produced.

Reference hardware has one job: to be the checked baseline. It is written for coverage and correctness, with no arithmetic optimization, and a faster or smaller implementation has to match its bits and status before it can replace it. The numbers below should be read that way.

We measured complete reference implementations on a generic gate model. The unit is one generic gate, multiplexer or storage primitive, counted before technology mapping and without area weighting. These are not NAND2-equivalent counts or standard-cell areas.

Timed unitGeneric gatesResponse bound (clock edges)
Fixed-point divide8,28153
Fixed-point square root7,45828
Binary32 divide11,25126
Binary32 square root11,49925
Fused multiply-addGeneric gatesModeled worst arrival
Pipelined, bfloat16 multiplicands into binary3219,2953,090 ps
Unpipelined binary32 with stochastic rounding179,8594,785 ps
Unpipelined binary64 with stochastic rounding348,2395,329 ps
Unpipelined binary128 with stochastic rounding867,0545,902 ps

For the fixed-point multiply-accumulate and 16-tap FIR, we also built independently authored structural comparators. Our implementation used fewer gates on the multiply-accumulate (168,915 against 175,253) and more on the FIR (201,813 against 195,789). All of these met limits for structural size, construction resources and modeled timing that were chosen before measurement.

These are baselines for correct, complete behavior. They are large. The three unpipelined rows are the most general variant we build, a single-cycle multiply-add that supports every rounding policy including stochastic, and an optimized design would be considerably smaller. The first row is the multiply-add our planned inference accelerator would eventually use; the accelerator's first version uses none of these floating-point units, as described below. Competitive area, power and throughput against optimized arithmetic IP have not been established by this work.

One optimization is worth showing with matched numbers. The 32-element MXFP4 quantize/dequantize workload first failed its structural budget of 1,250,000 gates. After a shared improvement to arithmetic comparison, the same configuration was measured again under the same limits:

MXFP4 workload, same configurationGeneric gatesBudget of 1,250,000
Before1,273,522Exceeded by 1.88%
After1,038,962Met

That is 234,560 fewer gates, an 18.42% reduction, with numerical behavior rechecked. It is an improvement over our own earlier implementation and says nothing about other implementations. Later test builds of the MXFP4 pipeline in a different timing configuration measure 845,371 gates. That figure is not a matched rerun of the table above, so we don't present it as a further saving.

What Independent Conformance Found

Until this cycle, much of our confidence came from agreement: the source-level definition, the compiled execution engines and the reference circuit all produced the same results. Agreement is necessary, and it can conceal a shared mistake. So we tested against references we didn't write.

For IEEE formats, we ran Berkeley TestFloat vectors against a pinned SoftFloat build: 92 operation signatures across binary16, binary32, binary64 and binary128, under six rounding policies. Each signature and policy ran 400 vectors for half precision, 200 for binary32, 60 for binary64 and 12 for binary128, drawn from TestFloat's level-1 sequence. The counts fall with width because every vector also runs through the realized circuit, which takes several seconds per binary128 vector on our development machine. Every execution path was compared on result bits and complete status. For the low-precision AI formats, we built 1,019 conformance cases from independently encoded tables of the OFP8, MX and ONNX format definitions. All 1,019 passed, with no numeric mismatch. They compare exact bits and all ten status flags, and include conversion probes covering every finite interval of the narrow formats.

This evidence is finite. TestFloat establishes agreement on the vectors it runs; it is a soundness check and not a proof over every input. Alongside it we keep about 45 hand-derived boundary cases, including ties at quadruple precision, and we check that the comparison itself detects a flipped sign or a dropped status flag. "Independent" here means a reference we did not write. No outside group has reproduced these results.

Stochastic rounding is outside the SoftFloat comparison, which covers the six deterministic policies. We check it differently: in small formats, tests enumerate every random word against the published selection rule, which checks the rounding probabilities directly and not only replay. In wide formats, tests target 65-bit random inputs around exact thresholds. That wide-format coverage is targeted, not exhaustive.

The table below puts the coverage in one place, including what has no external reference at all.

AreaIndependent referenceRounding policiesHardware checkedExclusions
IEEE add, subtract, multiply, fused multiply-add, round-to-integral, comparisons, format and integer conversions; half to quadruple precisionSoftFloat, with TestFloat vectorsSix deterministic policiesReference circuit, every vectorNone
IEEE divide, square root, remainder; half to quadruple precisionSoftFloat, with TestFloat vectorsSix deterministic policiesTimed iterative unit, every vectorQuadruple precision: timed unit not built for remainder, or for divide and square root except under nearest-even (17 pairings). Values and status still checked through the other execution paths.
OFP8, MXFP8, MXFP4 and FP4 formats and scaled blocksTables we encoded independently from the OFP8, MX and ONNX definitionsAs each format defines, including stochasticCompiled reference circuit, every case; gate-level evaluation at boundary casesNone
Stochastic roundingThe published selection rule, enumeratedStochasticSmall formats: every random word. Wide formats: targeted thresholdsNot exhaustive in wide formats
Fixed point, custom formats, bfloat16, dot products, elementary functions, checked overflow and exception policiesNone external; our own independently specified expectationsAs applicableOur own suitesNo external reference exists in our testing

The six deterministic policies are nearest even, nearest away, toward zero, toward positive, toward negative and round to odd. The last row matters: for a large part of the platform, including everything specific to custom formats, the only check is our own. Those tests state expected bits independently of the implementation, but the round-to-odd defect shows what that kind of independence can miss.

The IEEE run was less quiet. Three lessons stand out.

Agreement can hide a shared mistake. Round-to-integral under round-to-odd was wrong in every one of our engines, identically. The minimized case is a half-precision input of about 0.00025. The correct result is 1.0. Ours was 1025.0. Our specification contained two sentences that could each be read as governing this case; the implementation followed one, the reference circuit mirrored it, and an exhaustive small-format test encoded the same expectation. Nothing internal could disagree. The same defect also made some evaluations unnecessarily expensive. We corrected the specification, the semantic implementation and the circuit, and added independently specified regressions. After the repair, all 92 signatures agreed with SoftFloat on bits and status.

The case is small enough to check by hand:

Round to integral, round-to-odd, half precisionEncodingValueStatus
Input0x0c070.000245809555053711
Our result before the repair0x64011025.0inexact
SoftFloat, and our result after the repair0x3c001.0inexact

The corrected rule: truncate toward zero to the adjacent integer; if the input was inexact and that integer is even, select the adjacent integer away from zero. Here truncation gives 0, which is even, so the result is 1. The defective reading required the result's stored significand to be odd. Every integer below 1,024 has an even significand in half precision, so the first value that qualified was 1,025. The regressions cover every non-integer input of a tiny toy format with independently stated bits and status, and wide cases including 2.5, 3.5, 0.25 and -4.5, which the rule sends to 3, 3, 1 and -5.

The returned number is only part of the result. We repaired cases involving very small values and exceptional inputs where the value was right and the status was not. Whether a result was exact, overflowed or came from an invalid operation matters to the surrounding design. Two calculations can return the same bits while carrying different information about what happened, so our checks examine both.

Correct arithmetic still has to fit practical limits. The independent checks also exposed performance problems in build paths that our earlier workloads had not stressed. We traced the unnecessary work and improved the affected path while preserving numerical behavior. This added another useful dimension to the conformance effort: understanding which workloads challenge the engineering infrastructure itself. Broader scaling and implementation-cost evaluation remain part of the next phase.

We also ran a bounded fuzzing campaign over malformed numeric inputs with address and undefined-behavior sanitizers enabled: three seeds of 5,000 runs each, with no crashes, hangs or sanitizer findings. That result meets the finite experiment we declared in advance. It is not exhaustive coverage.

Repairs Without Searching the Implementation

An engineer or AI agent who hits a numerical error usually has to find out which choices are legal before fixing it. Typically that means searching compiler source or documentation. We wanted the platform's tooling to supply that information directly.

We completed seven controlled authoring and repair workflows in which a scripted client obtained everything it needed through the tooling. As a reference point, we took the same starting designs through an ordinary compile-and-read-the-error loop. Each of those needed at least one manual search of implementation source or plans to find a legal fix. The tooling path needed none, and used one repair application and one recheck to reach a valid design. Five of the seven completed in under a second; the two that execute a full hardware pipeline took about four and six seconds. Results were checked against independently specified bits and status.

Three examples:

A format that cannot represent infinity. A design requested infinity as its overflow result, but its custom format has only finite values. The ordinary error says the policy selects an absent class; it doesn't say which policies are legal. The tooling exposed the format's limits and offered saturation to the largest finite value. Checks then confirmed the saturated result and its overflow, inexact and saturated status.

A decimal coefficient that needs rounding. A fixed-point coefficient was written as the decimal 0.1 with no rounding choice. The workflow selected nearest-even rounding and then checked what was stored: 410/4096, which is 0.100098 to six digits, flagged inexact. The requested decimal and its finite representation are related, and they aren't interchangeable. The tooling reports both.

A conversion whose exceptional results need handling. A checked conversion compiled cleanly and failed only at execution, on a signaling NaN. The workflow changed the design to expose the result together with status information. Checks covered ordinary input, the invalid input, and a tie that overflows to infinity. The correction made the exceptional behavior visible for the design to handle; it didn't make the condition disappear.

Repairs are guarded. One computed against an outdated version of the design is rejected, and an authored numerical policy is never silently replaced to make an error go away. Review also caught a proposed repair that could change which failure a design encountered first; we tightened the conditions under which it is offered and added a regression.

The limits matter here. These demonstrations used scripted clients on specified tasks. They establish that the information and repairs are available through the tooling. The reference point was a plain compile error, not a capable agent working with documentation, so this is not a comparison against other workflows. They do not measure engineer or AI-agent productivity. The stronger evidence would be a blinded evaluation on unfamiliar designs with independently written tasks, as in our earlier blinded debugging pilot. The numeric tooling has not been through one yet.

Scaling the Engineering Loop

Numerical correctness is only part of making the platform useful. We exercise progressively larger arithmetic workloads to understand how build time, memory use and execution cost change as blocks compose into systems.

Those measurements exposed overhead that was difficult to see in small examples. Targeted improvements reduced work in the build while preserving the behavior being checked. Measurement connected an expensive workload to a concrete engineering decision.

For an AI-operated workflow, this matters directly. Every proposed change can trigger another build and verification run. We are developing the infrastructure so that larger investigations remain practical, and evaluating that progress across increasingly integrated workloads.

What Remains Open

The next phase combines broader verification with more demanding system workloads. We are extending coverage across numerical policies and execution paths, strengthening robustness checks, and measuring the cost of composing these capabilities into larger designs.

Numerical agreement is one requirement for useful hardware. Physical implementation still needs its own evidence: area, timing, power, and fit for a target technology and workload. Production readiness depends on both correct behavior and practical implementation quality.

Why We Need This: An AI Inference Accelerator

We are also designing our own AI inference accelerator. It is an architecture proposal today, before RTL, and its targets are proposals and not silicon results. Its arithmetic contract is where this numeric work becomes a requirement.

The first version is deliberately integer-only. Its compute core multiplies signed 8-bit values and accumulates in 32 bits with wrapping addition. Saturation, rounding, requantization and scaling apply once, after the complete reduction, with the rounding mode declared in each model's numerical contract. Four-bit weights are unpacked to 8 bits before the multiplier, and their per-group scales are applied after the reduction.

Each clause of that contract is a numerical choice of the kind described above:

  • Wrapping and saturation are different behaviors. Wrapping addition is associative, so the accumulated result is bit-identical for any reduction order or tree shape. That frees the hardware to use whichever adder tree is cheapest. Saturating at each step would not have that property. The design also carries a bound: up to 131,071 products cannot overflow the 32-bit accumulator, and longer reductions must be split or explicitly declared.
  • Where rounding happens is part of the result. Requantizing after the full reduction and requantizing along the way give different answers. The contract fixes one boundary, and the platform makes that boundary explicit in the design.
  • The check is independent. We wrote a bit-exact reference model of this contract, with exhaustive small cases, that shares test vectors with the hardware description and no code.

During this cycle we added integer sum and dot-product reductions with explicit accumulator width and wrap policy to support that core, built on the same foundation as the rest of the arithmetic.

It would be wrong to say the first version needs everything in this post. It does not use floating point in its main datapath, and we chose that scope to keep new numeric work off its critical path. The floating-point work matters for what follows: a planned later mode multiplies bfloat16 values and accumulates in binary32. Floating-point addition is not associative, so that mode must fix its reduction order, which is the distinction between exact and sequential dot products described earlier. A bfloat16-by-bfloat16 multiply-add into binary32 is already one of our maintained hardware workloads. Each such mode will need its own area and timing qualification.

The platform can't yet express the whole chip. A single compute cluster can be written today; memory interfaces, hard IP integration and simulation at the scale of a full compute region are open work, and we expect that work to drive the platform's next requirements.

Returning to the SoC

We're now working on the next stage of that SoC effort: extending the system design we maintain and test, and bringing these numerical capabilities into a larger engineering workload.

The SoC gives the platform a demanding purpose. Engineers and AI agents have to work through a system whose parts interact, investigate failures, and check that a correction preserves the behavior around it. Human direction continues to set the goals and acceptance criteria.

The arithmetic library is larger than it was, but that is not the result we care most about. The result is that an arithmetic decision can be stated explicitly, carried into a circuit, inspected and checked at each step of automated hardware engineering: which precision, where the rounding happens, what an overflow does, and what the status says afterwards. This cycle showed that works, and showed how much checking it takes to be sure. We'll share progress as the SoC develops, including what works and what still needs improvement.