[Webkit-unassigned] [Bug 62204] New: Master bug for bugs which cause 1px difference on 32/64 bit architectures

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 7 05:15:49 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=62204

           Summary: Master bug for bugs which cause 1px difference on
                    32/64 bit architectures
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore Misc.
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: zherczeg at webkit.org
                CC: ossy at webkit.org


Such bugs are mostly caused by rounding. But what does exactly happen there? And how?

The answer is here, let's divide 400000 by 600

If the input arguments are float:  400000/600 = 666.666687
If the input arguments are double: 400000/600 = 666.666667

This is nice, but shouldn't the same rounding error should happen on ALL machines?

The understand this better, we need to see what exactly happen on lower (machine code) levels. The systems use registers to temporary keep the values of arithmetic. On x86, these registers have fixed size (10 byte for x87 fpu, and 8 byte for SSE2), and all arithmetic operations are executed using the highest precision. However, results are rounded to the storage size if we move the data to the memory.

Let's we have a super simple x86 machine with 2 double precision registers, d1 and d2, and we want to evaluate: (A*B)+(C*D). The following pesudo code show this:

LOAD A to d1
MULTIPLY B to d1
LOAD C to d2
MULTIPLY D to d2
ADD d1 and d2

However, what does happen, if let's say, d2 is reserved for some reasons:

LOAD A to d1
MULTIPLY B to d1
STORE d1 to [4 byte mem area]   // CONVERSION HERE!!!
LOAD C to d2
MULTIPLY D to d2
ADD d1 and [4 byte mem area]

There are several versions of such code, but the issue is the same: moving data to a storage with different precision cause rounding. However, if the data is not need to be moved (because it is in the right register at the moment), the rounding is ALSO optimized out by the compiler, and you may get a different result on different platforms.

Solution? I can't see a good solution. Storing everything on the highest precision would increase the memory consumption too much. Furthermore, these differences are hardly visible to the user. However, it is a nightmare for platform maintainers, you need to maintain too many expected files. I think we should live with it now, and try to reduce these bugs.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list