Olly,
On Wed, Oct 26, 2022 at 03:28:01AM +0100, Olly Betts
wrote:> On Sun, Oct 23, 2022 at 03:11:07PM +0300, Vitaly Chikunov wrote:
> > (Unable to register on bug tracker, so writing here.)
> > While building package for ALT Linux I found that when tests are run
on
> > i686 (32-bit x86 flavour) with 'make check' for 1.4.21
release, they
> > fail with:
>
> I can only reproduce your problem if I configure with --disable-sse,
> which is not a recommended configuration because on x86 without SSE, we
> get 387 FP's excess precision inflicted on us.
>
> There are hacks in the code to work around the worst problems that
> causes (such as segfaults due to undefined behaviour caused by not being
> able to reliably even use an FP comparison in a sort comparison function)
> but more subtle problems remain and we don't recommend using
> --disable-sse.
>
> Fundamentally it's hard to order results correctly by an FP value when
> the same equation evaluated with the same inputs in two places in the
> code is able to give different answers depending which intermediate
> results are spilled to memory.
>
> If you're using GCC, -ffloat-store mostly avoids the problem, but at
> a significant performance cost because FP values get written to memory
> everywhere rather than carried in registers when possible, and that cost
> is paid by everyone using the package on i686 when most of them have a
> perfectly capable FP unit.
>
> GCC's -fexcess-precision=standard option would provide a solution with
> less overhead, but sadly it's only been implemented for C.
Thanks for suggestions. First I want to (out of order) answer this
important remark:
> If you insist on using --disable-sse, the simplest solution is to not
> run the testsuite. (The purpose of the testsuite is to find bugs; an
> effect of --disable-sse is essentially to introduce bugs...)
I had no intention of producing buggy packages, and did not expect
(looking sane) configure option to intentionally introduce bugs (and not
just slowness).
JFYI, some other distros package while compiling with `--disable-sse`:
OpenSUSE:
https://build.opensuse.org/package/view_file/openSUSE:Factory/xapian-core/xapian-core.spec?expand=1
OpenMandriva:
https://github.com/OpenMandrivaAssociation/xapian-core/blob/rolling/xapian-core.spec
> I'm not sure what the ALT Linux baseline for i686 is, but if you really
> need to build binary packages which will run on processors without SSE,
> I'd strongly recommend the approach describing in the last entry here:
>
> https://trac.xapian.org/wiki/PackagingXapian
I understand this approach (this is perhaps how Debian packages), but
think users of old hardware still want correctness (at least internal to
the library).
> That way most x86 users get a build using SSE (i.e. one which works
> properly), and the problems excess precision causes will only affect the
> dwindling number of users who really have an x86 old enough not to have
> SSE.
Unfortunately our i686 micro-architecture baseline is without SSE:
builder at i586:/.in$ gcc -Q --help=target | grep -e -msse | head -2
-msse [disabled]
-msse2 [disabled]
> > (Empty lines removed.) On other architectures we build tests succeed
> > (aarch64, > arm7hf, ppc64le, x86_64). Would appreciate help
resolving
> > this.
>
> If you insist on using --disable-sse, the simplest solution is to not
> run the testsuite. (The purpose of the testsuite is to find bugs; an
> effect of --disable-sse is essentially to introduce bugs...)
To not run testsuite to not see the bugs while looks like a solution,
does not looks like a correct one.
Thanks,
>
> Cheers,
> Olly