From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA01600; Tue, 8 Jun 2004 03:44:44 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA01837 for ; Tue, 8 Jun 2004 03:44:43 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i581ifSH032087 for ; Tue, 8 Jun 2004 03:44:42 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id i581iUG08788; Mon, 7 Jun 2004 20:44:31 -0500 (CDT) Date: Mon, 7 Jun 2004 20:50:15 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: "Brandon J. Van Every" cc: caml Subject: Re: [Caml-list] 32 bit floats, SSE instructions In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 40C51A09.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 floats:01 brandon:99 floats:01 unbox:01 vectors:01 matricies:01 vectors:01 matricies:01 inclined:01 arrays:01 arrays:01 -bit:01 ocaml:01 overloading:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 systems). 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 Brian ------------------- 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