|Re: [eigen] Eigen 2 to Eigen 3 performance regressions with mapped matrices|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Eigen 2 to Eigen 3 performance regressions with mapped matrices
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 12 Jan 2012 07:40:19 -0500
- Cc: Sameer Agarwal <sameeragarwal@xxxxxxxxxx>, tucker@xxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=OcXDZ7wyjEC6TGPe9dsqcZGlxSCHwMOpOEXMxtQ9EY0=; b=RI4TB8gC2ZpHSf5xPfi+YOVH1vItZgoLqFjOpi43Z9NT/ujo9avMa0NPr2FG0Wp4LH M/Jv/fP2xRQc2jkJOIYO10IjYPQHuFUVwwiCZdhYBkY6XToCNPZtjl0C7IPva/Zv1sWo IlSUBztd/sg8ycXdVgd7ze6e6568S/p0wPHxc=
I would be in favor of always assuming that fixed-size products are
small so always use "lazyProduct" in the fixed-size case, without even
a runtime size check.
This would also allow to really guarantee that we never malloc on
We could still provide a separate way to do cache-friendly products on
fixed-size matrices, if there really is demand for that. For starters,
people can always Map as dynamic-size.
2012/1/12 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
> well first you should really use 1 instead of Dynamic for the vectors
> such that gemv like operations are called (instead of gemm like).
> Then, the main difference with Eigen2, is that we don't check anymore
> the sizes at runtime to fallback to a naive product implementation if
> the objects are too small. Again, you can still enforce the naive
> product with .lazyProduct if you know that's best for you.
> That said, I still plan to add such runtime tests to pick the right
> algorithm. I think there is still room for designing even better
> product algorithms for such small matrices and vectors. However I
> observed the performance of a "naive" product algorithm depends a lot
> on the architecture and compiler for small objects, so the choice of
> the thresholds is rather difficult.
> I'll add an entry in our bug tracker.
> On Wed, Jan 11, 2012 at 4:58 AM, Keir Mierle <mierle@xxxxxxxxx> wrote:
>> I've attached a microbenchmark that is similar in spirit to what we are
>> doing with Eigen, that illustrates slowdown from Eigen 2 to Eigen 3. In
>> particular, the benchmark does y += A*x, for A, x, y mapped unaligned
>> dynamic but small dimension matrices. It could be that I have not chosen
>> appropriate compiler flags. I am seeing performance 2x to 3x worse. Take a
>> look at the header comments in the attached benchmark for more numbers.