Version française
Home     About     Download     Resources     Contact us    
Browse thread
Optimizing Float Ref's
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Will M Farr <farr@M...>
Subject: Re: [Caml-list] Optimizing Float Ref's
Xavier,

Thanks for the comments.  I thought that float ref's were unboxed by  
default!  In fact, I find that breaking out the code into a stand- 
alone example which loops through matrix multiplies only indeed does  
not have any calls to "caml_modify"; everything is unboxed and stored  
on the stack (I'm on x86) as you say.  It must be the remainder of my  
application that is producing the calls to caml_modify (the profile I  
was using was embedded in a larger application with lots of inlining  
going on, so maybe something that calls caml_modify is getting inlined  
around the matrix multiply and confusing the profiler).

Thanks,
Will

On Sep 3, 2009, at 5:44 AM, Xavier Leroy wrote:

>> I'm running OCaml 3.11.1, and I noticed something strange in some  
>> native code for matrix multiply today.  The code was
>> [...]
>> [Local float ref being unboxed or not? ]
>
> You omitted the definition of "dims", but after adding the obvious
> definition, the float ref "sum" is indeed completely unboxed and is
> kept in a float register (on x86-64 bits) or stack location (on x86-32
> bits).  No "modify" takes place in the inner loop.  So, I don't
> understand the problem you observed.  Feel free to post a report on
> the BTS with a *complete* piece of code that reproduces the problem.
>
>> But, I thought that float ref's were automatically unboxed by the  
>> compiler when they didn't escape the local context.
>
> Yes, if all uses of the float ref are unboxed, which is the case in
> your code.
>
> - Xavier Leroy