English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] 32 bit floats, SSE instructions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-06-08 (01:44)
From: Brian Hurt <bhurt@s...>
Subject: Re: [Caml-list] 32 bit floats, SSE instructions
On Mon, 7 Jun 2004, Brandon J. Van Every wrote:

> Game developers do tons of stuff with 32 bit floats.  How difficult to
> add these to OCaml?  I'm not saying, "do it for me," I'm asking how
> difficult it would be to add to the language.  If it were feasible, then
> this mod could be distributed as a patch, until such a time as it is
> accepted as A Good Thing.  (Anyone already tried this?)

The biggest problem you'd have is that you couldn't unbox them, so every 
individual fp number would be 8 bytes (at least- 12 bytes on 64-bit 

No, what game developers use a lot of is 3- and 4-element vectors, and 3x3 
and 4x4 matricies.  Dealing with them as vectors and matricies instead of 
individual floats would be a lot better- now, a 3-vector would take only 
16 or 20 bytes of memory.  Actually, I'd be inclined to go one step 
higher, and deal with arrays of vectors in what Intel calls SoA order 
(i.e. structure of arrays, instead of array of structures- so an array of 
3-vectors would be represented by three arrays- the first array is the x 
values of all vectors, the second is the y values, etc.).  This makes 
maximizing the utilization of the SSE units a lot easier.

> Does the lack of operator overloading pretty much prevent this support
> in practice?  If there's only one +. operator available, and it's for 64
> bit floats, whaddya gonna do?

Use some other operator.  While you can't overload operators, you can 
define new ones.

Just my $0.02.

"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
                                - Gene Spafford 

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners