caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Travis Bemann <bemann@execpc.com>
To: "Gurr, David (MED, self)" <David.Gurr@med.ge.com>
Cc: caml-list@inria.fr
Subject: Re: ocaml, simd, & fftwgel RE: [Caml-list] Caml productivity.
Date: Tue, 30 Jul 2002 21:29:41 -0400	[thread overview]
Message-ID: <20020730212941.A765@execpc.com> (raw)
In-Reply-To: <D4DBD8568F05D511A1C20002A55C008C09C294EE@uswaumsx03medge.med.ge.com>; from David.Gurr@med.ge.com on Tue, Jul 30, 2002 at 12:58:02PM -0500

[-- Attachment #1: Type: text/plain, Size: 3618 bytes --]

On Tue, Jul 30, 2002 at 12:58:02PM -0500, Gurr, David (MED, self) wrote:
> 
> 
> 
> > 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.
> 
> 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.

Note that there is no such thing as a C allocator in OCaml, even
though you can have "custom blocks" that have custom C finalization
code (and which are also not looked inside by OCaml itself).  In OCaml
there's three classes of allocated data structures - small blocks,
large blocks, and custom blocks, all of which are handled differently
by the OCaml garbage collector; also note that custom blocks have data
on non-heap resources which is used to influence the garbage collector
in how often it garbage collects such blocks.

Note that overall, the OCaml garbage collector is a incremental
generational garbage collector, with only *two* generations - new
blocks and old blocks.  The garbage collector only tries to
aggressively garbage collect new blocks, and does not necessarily try
to do all garbage collection at once, which is useful for realtime
performance.

However, there is one thing that particularly disturbs me about OCaml
- the way that it handles floating point values.  In OCaml a floating
point value is always 64 bit, and because only values that are always
the size of a machine word internally are not allocated, floating
point values in OCaml are ALWAYS allocated on the heap!!  Even though
benchmarks of OCaml seem to say that it is pretty damn fast, this
particular aspect keeps me up at night.  I at least hope OCaml has
something like a specialized internal heap for ONLY floating point
values that would keep floating point computations from being horridly
slow...

-- 
Yes, I know my enemies.
They're the teachers who tell me to fight me.
Compromise, conformity, assimilation, submission, ignorance,
hypocrisy, brutality, the elite.
All of which are American dreams.

              - Rage Against The Machine

[-- Attachment #2: Type: application/pgp-signature, Size: 2767 bytes --]

  reply	other threads:[~2002-07-31  2:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-30 17:58 Gurr, David (MED, self)
2002-07-31  1:29 ` Travis Bemann [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020730212941.A765@execpc.com \
    --to=bemann@execpc.com \
    --cc=David.Gurr@med.ge.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).