Speed issue with KahanSummation

AccurateArithmetic is implemented in Julia using llvmcall , not C. If your definition of “pure Julia” allows for wrapping LLVM’s SIMD intrinsics with llvmcall , then it is “pure Julia”.

Thank you for the clarification. By “pure Julia” I meant in the sense of ForwardDiff.jl’s “generic Julia” explained [in the doc] (Limitations of ForwardDiff · ForwardDiff). I tried using AccurateArithmetic’s sum_oro() and sum_kbn() in a maximum likelihood estimation using Optim.jl with the autodiff = :forward option, and it didn’t work. I am not sure whether it is because sum_oro() and sum_kbn() are not “generic Julia” to ForwardDiff. I started another thread to discuss the issue there, where I provided a MWE.

b) Seems like there is almost certainly a better way to get gradients with respect to a sum. E.g., overload (type piracy…) to provide a specialized implementation that takes ForwardDiff.Dual as inputs.

I am afraid I have no clue here. The MWE in the new thread mentioned above is very simple, but my real work involves high dimension Monte Carlo integrations which make the whole thing more complicated, I think. If there is a straightforward approach, I’ll certainly try.