Ray's Knowledge Base
Unlock

Float sums in extensions use an exact accumulator only if it costs no meaningful speed

DecisionVerified 5 Oct 2026Holds project: dftracer-utils
Decision. The context, the choice, why, and the options that were turned down.

Context#

Float addition is order-dependent, so merged chunk sums can differ between runs and show up in content hashes.

Decision#

Float sums in extensions and JIT monoids use an exact order-independent accumulator (Radford Neal's superaccumulator: small fixed state, merge is an addition) only if a benchmark shows no meaningful speed loss. Otherwise the host merges chunk sums in file order, as the engine's group_by already does (fixed lanes merged in lane order). That gives equal bytes for every worker count, but bytes can differ in the last bit or two between checkpoint sizes: about 3e-15 relative, harmless for analysis but visible to a content hash and to a "rebuilt, content unchanged" verdict. Integer counts, sums, min, max and sketches with integer counters are already order-free; float sums, means, variances and co-moments are not.

The user's rule: make accumulators exact as long as performance does not deteriorate.

Why#

Order-free results keep content hashes stable.

Rejected options#

  • ReproBLAS: same bits for every order but not exact, and reported 2-4x slower.

Also found by searching

  • exact order-independent float sum superaccumulator for extensions
  • float sums differ in the last bit between worker counts or checkpoint sizes
  • ReproBLAS versus superaccumulator
  • float sum changes content hash rebuilt content unchanged