If you add the same numbers in a different order, floating-point gives you a different answer. A CPU and a GPU almost never add in the same order. So how can a CPU-only laptop and an H100 produce bit-identical logits for the same model and prompt?
Vahana does it with one rule for every dot product. I call it the "twin" rule, because each kernel has a twin on the other device that does exactly the same arithmetic. This post explains the rule, shows why it gives identical bits by construction, and lists what it cost, with numbers from the repo's experiment files and one check I ran on my laptop today.
The rule
Every dot product y = sum_k w[k] * x[k] is computed like this:
16 fp32 lanes. Lane l owns the elements k = 16j + l .
Ascending order, fused multiply-add. Each lane walks its elements in ascending j and does acc = fma(w[k], x[k], acc) , one rounding per step.
A fixed tree. The 16 lane sums are combined by halving: for s = 8, 4, 2, 1 : a[i] = a[i] + a[i+s] for i < s .β¦