caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocaml, simd, & fftwgel RE: [Caml-list] Caml productivity.
@ 2002-07-30 17:58 Gurr, David (MED, self)
  2002-07-31  1:29 ` Travis Bemann
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Gurr, David (MED, self) @ 2002-07-30 17:58 UTC (permalink / raw)
  To: Travis Bemann, Nicolas Cannasse; +Cc: caml-list




> From: Travis Bemann:
> On Mon, Jul 29, 2002 at 10:13:24AM +0200, Nicolas Cannasse wrote:
> > > I agree that the C interface is pretty nice. However,
> > > how do would you use SIMD math instructions on the
> > > x86? Would you always call C-routines just to make use
> > > of SIMD or multimedia-instructions? What is the
> > > overhead for calling a function that is executing a
> > > few assembly instructions? Is it even possible to
> > > create a solid division line between "low-level" and
> > > "high-level" code?
> >
> > Yes it is.
> > Actually if you need to perform alot of SIMD instructions each frame
> > (involving zounds of C calls), you can try to group them in 
> one-C-call that
> > will do the job in one time. That's matter of architecture 
> and choices...
> > not always obvious :)
> 
> Note that most C or C++ compilers won't do this either, with the
> exception of some specialized vector parallelizing compilers (such as
> those used to compile code on vector supercomputers).  If you really
> need SIMD instructions, you'd probably need to hand-code it in
> assembly, no matter what language you're using.

IMHO:

High performance numerical code esp using SIMD or multiprocessor is
beyond the reach of hand written assembly or hand written C.  Very
heavy template based C++ almost works but odds are you will run into
C++ compiler bugs.  The best thing known at the present are special
purpose optimizing compilers.  The best known of these is fftgen, the
compiler that underlies FFTW and it is written in ocaml.  Others like
it are Atlas and Spiral.  Of special note is a versions of FFTW that
generates SIMD code for AMD Athlons:
http://www.complang.tuwien.ac.at/skral/fftwgel.html
Perhaps Dr Kral could explain more about fftwgel and the merits of
writting 
high performance code using ocaml.

About memory allocation, real time code should not be doing memory
allocation in the real time section.  For many things that you need
to do in realtime, the ocaml code does not allocate so allocation
is not issue.  If you need allocation control, write a C allocator.
You lose some of the safety of ocaml but it is better than writting
the whole thing in C.  And there is the possiblity of GC-free functional
programming as done in MLKit4.  This is SML not ocaml.  I would imagine
that the technique could be used in ocaml.

-D 
-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: ocaml, simd, & fftwgel RE: [Caml-list] Caml productivity.
@ 2002-08-01 15:36 Damien Doligez
  2002-08-01 16:38 ` John Max Skaller
  2002-08-01 16:45 ` Jonathan Coupe
  0 siblings, 2 replies; 11+ messages in thread
From: Damien Doligez @ 2002-08-01 15:36 UTC (permalink / raw)
  To: caml-list

>From: John Max Skaller <skaller@ozemail.com.au>

>Huh? Which parts of a real time interactive game aren't real time??
>The whole thing, from gameplay interaction to graphics and sound,
>must be done in 'real-time'.

I'd say no part of a real-time interactive game is real-time.  To me,
real-time means something like the Ariane 5 rocket, where you have a
deadline every 36ms for the 12 hours of the mission.  And if you miss
even one deadline your 100M$ rocket will crash.

On the other hand, in something like Unreal Tournament, a half-second
freeze every 10 minutes is no big deal, and the users will not even
complain about it.

With Objective Caml on a fast machine, if you're not doing heap
compaction, GC pauses should be somewhere between 1 and 10
milliseconds.  Quite workable for an interactive game, I'd say, but
then again it's not the future of my company that is at stake.

-- Damien
-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread
* RE: ocaml, simd, & fftwgel RE: [Caml-list] Caml productivity.
@ 2002-08-02  2:56 Gurr, David (MED, self)
  2002-08-02  9:57 ` Noel Welsh
  0 siblings, 1 reply; 11+ messages in thread
From: Gurr, David (MED, self) @ 2002-08-02  2:56 UTC (permalink / raw)
  To: Noel Welsh; +Cc: caml-list


Noel Welsh:

> There are a least two parallelising C compilers for
> the PC: Intel's and CodePlay's.  CodePlay say they do
> a better job than Intel.  I imagine Intel hold a
> differing opinion.

But do they do a better job than fftwgel or Spiral
or Atlas?

> I'm interested in knowing the deficiencies of these
> compilers.  I imagine they run into problems with
> dependency analysis on complicated array expressions. 
> Similarly, I'm interested in knowing in what areas HPF
> and SAC are performant.  It appears to me that a
> functional language (where dependency analysis is
> simple) with array shape inference should be capable
> of creating very array fast code is almost all
> situations (and the SAC benchmarks show them beating
> HPF).

Is SAC available for public inspection?

> 
> Cheers,
> Noel
 
I have not used either compiler.  From the FFTW, Atlas, etc experience
the only way to get consistently high performance from a C compiler is
to do most of the work for the compiler and carefully feed it code that
it correctly optimizes.  This is a compiler and application specific
trial and error process.  FFTW does the optimization and scheduling for
the C compiler.  Once you do this, it is much less clear what
the value added of the C compiler is.  In particular, the amount of 
refinement that would be needed to get ocamlopt to match C compilers
at this task might be relatively small.  I have not read to code to
fftwgel but if fftwgel could be married to ocamlopt, they might well
produce code superior to intel or codeplay since C is notoriously
difficult to optimize even without SIMD.

-D
-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2002-08-02  9:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-30 17:58 ocaml, simd, & fftwgel RE: [Caml-list] Caml productivity Gurr, David (MED, self)
2002-07-31  1:29 ` Travis Bemann
2002-07-31  8:09   ` Xavier Leroy
2002-07-31  8:39 ` Noel Welsh
2002-08-01 15:22 ` John Max Skaller
2002-08-01 15:36 Damien Doligez
2002-08-01 16:38 ` John Max Skaller
2002-08-01 16:55   ` Alexander V.Voinov
2002-08-01 16:45 ` Jonathan Coupe
2002-08-02  2:56 Gurr, David (MED, self)
2002-08-02  9:57 ` Noel Welsh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).