caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: single-precision floats, etc.
@ 2000-10-27 21:39 ortmann
  2000-10-29  6:18 ` Chris Hecker
  0 siblings, 1 reply; 19+ messages in thread
From: ortmann @ 2000-10-27 21:39 UTC (permalink / raw)
  Cc: caml-list



Just curious ... would single-precision floats have been accurate enough
for the ICFP programming contest?

And how fast might they have been?

--
Daniel Ortmann, IBM Circuit Technology, Rochester, MN 55901-7829
ortmann@us.ibm.com / internal 8.553.6795 / external 507.253.6795
ortmann@isl.net home 507.288.7732

"The answers are so simple, and we all know where to look,
but it's easier just to avoid the question." -- Kansas




Chris Hecker <checker@d6.com>@inria.fr on 10/24/2000 10:22:20 PM

Sent by:  Pierre.Weis@inria.fr


To:   Charles Martin <martin@chasm.org>, caml-list@inria.fr
cc:
Subject:  Re: single-precision floats, etc.




>I would want single floats for space, not speed!

On today's architectures, size == speed.

Single precision is also still faster for things like divides, sqrts, and
whatnot.  And, as someone mentioned, the SIMD instruction sets are single
precision only (at least until Wilamette).  But yes, size is the biggest
issue.

I'm going to check out the Bigarray package and see how it performs,
though.

Chris






^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: single-precision floats, etc.
@ 2000-10-19 23:50 David Gurr
  2000-10-20 13:02 ` jean-marc alliot
  0 siblings, 1 reply; 19+ messages in thread
From: David Gurr @ 2000-10-19 23:50 UTC (permalink / raw)
  To: caml-list, Xavier.Leroy


Xavier Leroy:
> 
> Double-precision floats are hard-coded in a number of places in the
> OCaml implementation, such as the native-code generators, but also
> parts of the run-time system (e.g. the serializer and deserializer).
> Substituting single-precision floats everywhere is feasible, but a
> major undertaking.

Substituting single floats for double float would be a chore (I tried
and gave up).  But on machines where doubles are 64 bits and a packed
pair of singles is 64 bits, how hard would it be to generalize float
to allow any of the 64 bit arithmetric types (ie double floats,
pairs of single floats, pairs of 32 bit longs, quads of 16 bit shorts,
etc)?  

> I'm curious to why you need single floats.  It's certainly not for
> speed, because most processors nowadays do not compute over single
> floats any faster than over double floats.  

Machines with multimedia instruction sets do compute over single floats 
faster than double floats when the single floats are packed into a 64 bit 
pair of singles or a 128 bit quad of singles.

> Indeed, they convert
> single floats to double or extended precision at load time, and do
> all their arithmetic in double or extended precision.

They dont do conversion for packed floats and twice as many singles 
fit into a cache as do doubles.  
 
-David Gurr



^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: single-precision floats, etc.
@ 2000-10-18  1:17 David Gurr
  2000-10-18  9:56 ` Chris Hecker
  0 siblings, 1 reply; 19+ messages in thread
From: David Gurr @ 2000-10-18  1:17 UTC (permalink / raw)
  To: caml-list; +Cc: gurr

Chris Hecker:
> Most importantly, is there any way to make the "float" type compile to single precision floating point numbers?  

I do mostly DSP stuff for MRI machines and most of the code is single
precision floats.  Instead of adding single precision floats, I
wonder if I would rather replace boxed float with "boxed 
multi-media datatype".  So in Proc and Arch for AltiVec machines the
float registers would be replaced by 128 bit "vector" registers
and float arrays would instead be arrays of 128 bit elements and the
float ops would be replaced by packed int and packed float ops.

On the other hand, most x86 machines have weird multimedia
instruction sets (using the MMX registers precludes using the 
floating point stack, clever).

I suppose that Cmm would be modified to either replace the
float ops with packed ops or extend the float ops with 
packed ops and Selection would do what it could with 
incomplete multimedia instruction sets.

-David Gurr

 



^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re:  single-precision floats, etc.
@ 2000-10-17 16:10 Damien Doligez
  2000-10-18  8:39 ` Remi VANICAT
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Damien Doligez @ 2000-10-17 16:10 UTC (permalink / raw)
  To: caml-list

>From: Chris Hecker <checker@d6.com>

>Hi, I'm looking into the feasibility of using Caml for some
>high-performance numerically intensive video game stuff, and I had a
>couple questions:

I'd be worried about the GC pause times.  They're pretty short, but
are they short enough for high-performance video game stuff ?


>Another question, which is not as important, was the size limitation
>on arrays.  The biggest float array one can have is around 699000
>elements.

Where did you get that number from ?  The maximum size of float arrays
is 2097152 elements on a 32-bit machine, and 9007199254740992 elements
on a 64-bit machine (assuming you have enough memory...)


>Finally, why aren't simple arrays of ints unboxed, like the arrays of
>floats?  Would that be a hard change to make as well?

I can't give a precise answer to this question, but already the
special treatment of float arrays imposes some overhead on all
polymorphic array operations.  I'm not sure how much worse it would
get with a second kind of special arrays.

-- Damien



^ permalink raw reply	[flat|nested] 19+ messages in thread
[parent not found: <Chris Hecker's message of "Mon, 16 Oct 2000 11:20:59 -0700">]

end of thread, other threads:[~2000-10-30  7:21 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-27 21:39 single-precision floats, etc ortmann
2000-10-29  6:18 ` Chris Hecker
  -- strict thread matches above, loose matches on Subject: below --
2000-10-19 23:50 David Gurr
2000-10-20 13:02 ` jean-marc alliot
2000-10-18  1:17 David Gurr
2000-10-18  9:56 ` Chris Hecker
2000-10-17 16:10 Damien Doligez
2000-10-18  8:39 ` Remi VANICAT
2000-10-18  8:41 ` Fermin Reig
2000-10-18  9:51 ` Chris Hecker
     [not found] <Chris Hecker's message of "Mon, 16 Oct 2000 11:20:59 -0700">
2000-10-16 18:20 ` Chris Hecker
2000-10-18 13:53   ` Pierre.Boulet
2000-10-18 15:20     ` Chris Hecker
2000-10-19 11:28       ` Stephan Houben
2000-10-19 11:37       ` Xavier Leroy
2000-10-20  2:18         ` Chris Hecker
2000-10-19  9:11   ` Xavier Leroy
2000-10-23 13:28     ` Charles Martin
2000-10-25  3:22       ` Chris Hecker

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).