[Libreoffice-bugs] [Bug 137679] Implement a Kahan summation algorithm to reduce the numerical error in the total

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat May 15 21:52:52 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #68 from dante19031999 at gmail.com ---
(In reply to b. from comment #67)

> from a short amateur! look in
> https://gerrit.libreoffice.org/c/core/+/115113/4/sc/source/core/tool/
> arraysumSSE2.cxx#30 I would think that: 
> - you tried to add 'Neumaier' into 'Kahan' and 'pairwise' instead of
> replacing the whole construct ... unnecessarily complicated? and that 
> - 'err2' and 'err4' have 'fallen by the wayside', i.e. are calculated in
> 'sum2' and 'sum4' but not evaluated in the rest of the construct ... ??? 

I don't completely understand it. But by the info I found.
If I'm wrong don't hesitate to correct me.

The SSE2 does seem to make use of intel's SSE2 by giving instructions at almost
machine level, allowing direct access to the register. I suppose the purpose is
to boost speed (by a lot) (wikipedia says some AMD also use it).

We are performing 4 sums at the same time to use an optimization called loop
unrolling. It is supposed to speed up results by making the 4 operations at
same time. It's usually what modern hardware support.
However I'm not sure if it stills useful. It's generally only worth it if the
loop is very simple.

So in order to speed up calculations we enter in the very complicated stuff.
It's quite hardcore to find good documentation to that kind of thing.
Had to guess it by the functions definitions on the header, which by the way is
compiler specific.
I'm not even sure it is part of the standard. I don't believe Intel's
particular stuff could be part of the standard.

Due to those reasons I had to go for raw Kahan (does not sum the error at the
end, so in the last operations the error is ignored: err2 and err4 ).

> i'm in good hope you didn't forget to add the accumulated error as a last
> step (difference between Kahan and Neumaier)

It's there.
And everything was re-checked by expert programmers (while patch review).
So it should be fine.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210515/e6e9f82e/attachment.htm>


More information about the Libreoffice-bugs mailing list