[Haskell-cafe] 16 bit floating point data in Haskell?

wren ng thornton wren at freegeek.org
Sun Sep 27 16:50:40 EDT 2009


Olex P wrote:
> Hi,
> 
> Yes, I mean "sizeOf 2". It's useful not only on GPUs but also in "normal"
> software. Think of huge data sets in computer graphics (particle clouds,
> volumetric data, images etc.) Some data (normals, density, temperature and
> so on) can be easily represented as float 16 making files 200 GB instead of
> 300 GB. Good benefits.

I think, if you're going to want any kind of performance and 
portability, then you'll have to use the FFI to wrap some C code that 
performs the primops. From there you can define the instances for 
Floating, RealFloat, etc. to use them like normal types in Haskell.

There are a number of embedded systems that still use 24-bit floating 
registers, so it'd be nice to provide both Float16 and Float24. But 
since these aren't natively supported in C, it's not clear how best to 
write the primops so they're portable across GPUs and embedded systems.

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list