[Vm-dev] FloatMathPlugin and -lm (libm)

Eliot Miranda eliot.miranda at gmail.com
Sat Jul 18 17:57:59 UTC 2020


Hi David,

> On Jul 17, 2020, at 11:46 AM, stes at PANDORA.BE <stes at telenet.be> wrote:
> 
> 
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> 
> I've noticed that in the FloatMathPlugin there is fdlibm
> (freely distributable libm) :
> 
> platforms/Cross/plugins/FloatMathPlugin
> 
> This refers to the platforms/Cross/third-party/fdlibm
> 
> I wonder whether the VM shouldn't be using the system provided libm (-lm).
> 
> Perhaps for Croquet or other software that depends on FLoatMathPlugin,
> see https://en.m.wikipedia.org/wiki/Croquet_Project
> a special test framework could be ran in Squeak,
> or perhaps as part of "./configure" configuration, to check the results,
> of the underlying (system) libm, so that it provides results similar to fdlibm ?
> 
> Maybe fdlibm and libm "run bit identically" on some platforms.
> 
> This is because for Croquet the goal is to have the VM run bit identically.
> 
> Using the system provided -lm would possibly result in a smaller executable,
> with less duplicated code (no overhead).
> 
> I'm no expert on libm, but perhaps the system provided libm is also faster.

For context see https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/383#issuecomment-629095487

What we want (I think) is either the entire vm, including the FloatMathPlugin, links against the platform’s libm, or the entire vm, including the FloatMathPlugin, links against fdlibm.  I don’t see much benefit in arbitrarily mixing and matching.

So then we arrive at the above message.  Is the default to link against the platform’s libm, requiring a Makefile to specify BIT_IDENTICAL_FLOATING_POINT to link against fdlibm, or is the default to link against fdlibm, requiring a Makefile to specify PLATFORM_SPECIFIC_FLOATING_POINT to link against the platform’s libm?

I agree with Marcel that the latter is preferable, by default a vm provides bit-identical floating-point, building and linking against fdlibm.  For the moment we have the former.

Im not too concerned about core floating-point performance.  I don’t think it dominates in our usage because we have other overheads, primarily primitive invocation and boxing/unboxing. Whereas I do think that the core execution engine should be perfectly cross-platform, and floating point is the one area I’m aware of where the platform percolates up.  So I think we should make it an objective that the 6.0 release vm links against fdlibm.

What do people think?

> Regards,
> David Stes

Eliot
_,,,^..^,,,_ (phone)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20200718/ebd75b4c/attachment-0001.html>


More information about the Vm-dev mailing list