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 TAA15495; Tue, 8 Jun 2004 19:16:46 +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 TAA15103 for ; Tue, 8 Jun 2004 19:16:45 +0200 (MET DST) Received: from ptb-relay01.plus.net (ptb-relay01.plus.net [212.159.14.212]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i58HGiSH023520 for ; Tue, 8 Jun 2004 19:16:45 +0200 Received: from [80.229.56.224] (helo=chetara) by ptb-relay01.plus.net with esmtp (Exim) id 1BXkDM-0005SM-CU for caml-list@inria.fr; Tue, 08 Jun 2004 17:16:44 +0000 From: Jon Harrop Organization: University of Cambridge To: "caml" Subject: RE: [Caml-list] 32 bit floats, SSE instructions Date: Tue, 8 Jun 2004 18:15:20 +0100 User-Agent: KMail/1.6.2 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200406081815.20679.jdh30@cam.ac.uk> X-Miltered: at concorde with ID 40C5F47C.000 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 repetitive:01 xyzw:01 vectors:01 floats:01 ocamlopt:01 optimising:01 run-time:01 python:01 clue:01 python:01 generically:01 high-level:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk This post of mine seems to have gone walkies: On Mon, 7 Jun 2004, Brandon J. Van Every wrote: > A 3D graphics guy has to contend with a large number of numeric > problems. Some of them are cut, dried, and repetitive enough to justify > coding up a C routine for them. For example, transforming a large > number of XYZW vectors by a 4x4 matrix is a 'pat' problem that occurs at > some point in 3D graphics processing. If you want high performance, which you seem to want, the hardware should be doing those for you. > However, lotsa 3D problems are exploratory in nature. For those you > want to use an efficient high level language, i.e. OCaml. You'd like to > code it up once, have it be pretty fast, and not ever worry about > futzing with C <--> OCaml bureaucracy. There isn't necessarily an > 'array version' of the problem, and you may not wish to figure it out in > any event. If you don't want to "figure out" optimisations then you can't expect to get efficient programs. > C interfaces carry overhead, i.e. you'd rather have stuff go > straight down to machine code without any function calls, if all you're > doing is twiddling a few floats. I'm not sure you would rather do that. Can you give an example of where ocamlopt is so inefficient that a whole program could benefit significantly from optimising such a piece of code? > Basically it's not an answer to say "Ah, yes, look at this great > language OCaml!" when in practice all you're ever doing is writing C. I would expect to be dropping to C for only a tiny piece of (trivial to write) code. If you want to do anything complicated (which is where all the important optimisations are) then OCaml would be a much better choice. > I'm not exactly sure why language designers think 32 bit floats "don't > count." Quite a number of high level languages make the choice of > blowing them off. Typically because the language designers know that other aspects of the run-time will degrade performance significantly more. > I guess quite a lot of high level languages aren't > interested in widespread industrial application, just ease of compiler > implementation. In the case of OCaml, the language is there because it is a research project. Adding 32-bit floats doesn't count as research these days. Not even in France. ;-) > The reality is that 32 bit floats get used in the real > world all over the place by 3D graphics guys. Don't read that, Xavier. > The last time I tried to talk about 32 bit floats with 'language guys' > was the Python crowd. Generally speaking, that community doesn't have a > clue about performance, and hasn't coughed up any significant 3D > graphics work either. I don't believe Python was designed for doing 3D graphics. Most people want to write 3D graphics programs which run in real-time. In order to even attempt to satisfy this design criterion it is necessary to be close to the hardware - you need to know what it is capable of doing and how quickly. This goes directly against one of the fundamental design criteria of ML which is to "abstract from the machine". On the other hand, well designed graphics software can generically make very efficient use of modern, consumer graphics hardware from a high-level language such as OCaml. When used correctly, the OpenGL API is quite high-level. Also, it is much more effective (and interesting!) to spend your time performing algorithmic optimisations rather than tweaking your code at the 32-bit float level. Cheers, Jon. ------------------- 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