Re: [eigen] need help with assembly

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


OK, so it seems it's just g++ being a little unpredictable, perhaps nothing 
worth worrying about...

-Benoit

[12:01] <ggael> bjacob:here I have the opposite behavior adding .eval() slow 
down by 10%
[12:01] <ggael> and the assembly exhibits more differences
[12:04] <ggael> hm... with 4x4 matrices it's more like you said faster with 
the explicit .eval()
[12:04] <bjacob> oh strange
[12:04] <bjacob> ok, then i guess we're just fighting against the compiler...
[12:07] <ggael> ah and with 5x5 is other way round again
[12:07] <ggael> so don't worry
[12:07] <bjacob> ok i see
[12:08] <bjacob> the main reason to worry was, in case that were cause by a 
big bug in eigen, like the one you fixed yesterday
[12:08] <bjacob> if it's only compiler crazyness, all is fine




On Friday 02 May 2008 11:39:47 Benoît Jacob wrote:
> Hi,
>
> since today the Product by default evaluates immediately when nested into a
> bigger expression. We found that seems to improve performance. In other
> words, an expression like
>
> 	m + m*m
>
> is now equivalent to
>
> 	m + (m*m).eval()
>
> That was the theory; in practice, the second form still gives 10% better
> performance than the first one. I have tried the following two benchmarks
> (see benchmark.cpp):
>
> 1)
>
> Matrix3d m;
> ....
> for(int a = 0; a < REPEAT; a++)
> {
>   m = Matrix3d::ones() + 0.00005 * (m + m*m);
> }
>
> Assembly output: see attached file "b.s"
>
>
> 2)
>
> Matrix3d m;
> ....
> for(int a = 0; a < REPEAT; a++)
> {
>   m = Matrix3d::ones() + 0.00005 * (m + (m*m).eval());
> }
>
> Assembly output: see attached file "b-eval.s"
>
>
> I don't see much difference between the two files! In b-eval the 3 "movl"
> instructions are grouped together, while in b.s they are scattered over the
> whole loop. Can that alone explain the 10% speed difference?
>
> Cheers,
>
> Benoit


Attachment: signature.asc
Description: This is a digitally signed message part.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/