Source: cura-engine
Version: 5.0.0-1
Severity: serious
Tags: ftbfs
Justification: fails to build from source (but built successfully in the past)
Usertags: i686
Forwarded: https://github.com/Ultimaker/CuraEngine/issues/1192
X-Debbugs-Cc: onit...@gmail.com

On i686, CuraEngine 5.x fails to build due to failing unit tests.

This is a longstanding issue, going back to 4.4, where it was fixed by adding a
larger tolerance to test values.
However, the issue was not investigated thoroughly and returns in 5.0 with more
failing unit tests.

The root cause of these failures are rounding errors on i686, where the x87 FPU
produces different results than floating point units in other processors. These
differences are tiny, and usually not more than a few ULPs.

CuraEngine uses integer math in most places, but resorts to double-precision
floating-point calculations in certain cases. Afterwards, the results are
truncated to 64-bit integers (C type long long), and subsequent calculation is
done on the integer values. Truncation (aka round-toward-zero) is often ok and
works fine on amd64 (SSE2 floating-point math) and other CPUs, but produces
different results on the x87 FPU. When truncating, these produce off-by-one
errors in many cases, and the these errors can accumulate and lead to huge
differences in the unit tests.

By strategically adding explicit rounding (round-to-nearest) in the right
places, these errors can be eliminated. While this will produce subtly
different results in some cases, it is arguably more correct than always
truncating.

And at least on amd64, there is no performance difference between truncation
and rounding: The SSE2 CVTTSD2SI and CVTSD2SI instructions have the same
performance.


-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 
'testing-debug'), (300, 'unstable'), (1, 'experimental-debug'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.3.0-2-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

-- no debconf information

Reply via email to