[webkit-dev] Transformations precision: double -> float

Olmstead, Don Don.Olmstead at am.sony.com
Tue May 22 13:39:18 PDT 2012


What CPU executes single precision floating point values at the same speed as double precision?

Here's a benchmark from NASA giving a comparison of single vs. double precision performance for one of their simulations. https://modelingguru.nasa.gov/docs/DOC-1664.

Single precision maps better to GPU backends, and CPU's SIMD computations than double. Unless there's something in the spec requiring double precision it makes sense to move away from double precision throughout WebKit.

It's fairly trivial to make SIMD types that can have CPU architecture specific implementations. As an example of how to do this in the wild there's the Sony vectormath library that's present in the Bullet Physics Library. 
http://bullet.svn.sourceforge.net/viewvc/bullet/trunk/Extras/vectormathlibrary/include/vectormath/.

As Kui noted the TransformationMatrix is a hotspot that could be helped by SIMD. Making the solution generic enough to target multiple architectures using SIMD should help the performance on all the platforms.

Don

-----Original Message-----
From: webkit-dev-bounces at lists.webkit.org [mailto:webkit-dev-bounces at lists.webkit.org] On Behalf Of Simon Fraser
Sent: Monday, May 21, 2012 10:35 AM
To: Zoltan Herczeg
Cc: webkit-dev at lists.webkit.org
Subject: Re: [webkit-dev] Transformations precision: double -> float

TransformationMatrix started out as floats, then got changed to doubles in <http://trac.webkit.org/changeset/40761>

This was done because on most hardware there is no penalty for using doubles over floats, and provided a better match with our system APIs that used doubles.

I'd prefer to take a forward-looking stance here, and assume that in time hardware will catch up.

Simon

On May 21, 2012, at 4:04 AM, Zoltan Herczeg wrote:

> Hi,
> 
> is there any reason why the transformations in WebKit use doubles? We 
> could optimize some functions further with ARM SIMD if they would be 
> floats. Is there any objection to make them float if the change would 
> have no other side effects except some rounding because of the lower precision?
> 
> Regards,
> Zoltan
> 
> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

_______________________________________________
webkit-dev mailing list
webkit-dev at lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev




More information about the webkit-dev mailing list