Re: [eigen] stability of internal "packet math" interfaces |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] stability of internal "packet math" interfaces*From*: Chris Dyer <cdyer@xxxxxxxxxx>*Date*: Wed, 13 Jan 2016 23:21:18 -0500*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=VkndDUHgCRjdWsZ8j7iNKX52x7Pka0bqDmISCzRZyIA=; b=Q+HJLHSsOoSJch8+XvbR6Kr7K1S/EUWj/vbiIP+9AL/vDWJcjw5ndS4ktVDnuH0tn3 StbYTwQyh4o24TmWXFescO6SloLMswq0PcxhjhTaWs70J1RxDL+hqxTQDEUAy4nZcPEq s1VcqLhb5wKqMmX8TtAf9GYhGw8rVaClJTTNxZwAFCPHxKdh02uhh0576spIJmIBed0G TSbS0nQSsQTlUB8nNasNMdL0rQ7XszY+P4UurDZtuL2Mediwl7Q02JjNTqMKtKreeaY0 80qniCbu79u0D/AhNbFampyjtx1Vol/pEmLdA/HIgttFq206OvVlvrk6fYGKClnigfkb 6xsQ==

The tanh and erf implementations predated the Eigen support, but I will switch to using the public ones now--and the pointer to EIGEN_DECLARE_CONST_Packet4f is exactly what I was missing. Thanks for the info!

Would you consider adding "backward" calculations for things like tanh? I realize that Eigen is being used in TensorFlow, which takes a rather different view of how to do this, so I might be the only one interested in using this. But, I'd certainly happy to contribute my implementations.

On Wed, Jan 13, 2016 at 11:10 PM, Benoit Steiner <benoit.steiner.goog@xxxxxxxxx> wrote:

There's been a fair amount of work put in Eigen recently to add support for the functions most commonly used in neural networks. For example, tanh and erf are now part of the public API. I would encourage you to use these directly in your implementation, and contribute back performance improvements that you may have.We've been using the internal packet apis for about 2 years now, and they've been very stable. The only change that I can remember is that they've been extended with new functions.We often use the EIGEN_DECLARE_CONST_Packet4f macros to instantiate constant packets. That seems to work well. Maybe you could try to use them and see if that helps?--https://bitbucket.org/eigen/eigen/src/98fcfcb99dee04c9ffc8014cf8d56050692fe231/Eigen/src/Core/arch/SSE/MathFunctions.h?at=default&fileviewer=file-view-default#MathFunctions.h-26On Wed, Jan 13, 2016 at 6:28 PM, Chris Dyer <cdyer@xxxxxxxxxx> wrote:Hi all,I'm curious about the stability of Eigen's internal "packet math" interfaces. For some custom functors that we use in a neural network library, we've found it helpful to provide SIMD implementations to get a bit more performance on the CPU (see eg https://github.com/clab/cnn/blob/master/cnn/simd-functors.h#L172). However, putting lots of "using namespace Eigen::internal" in the implementations is a little disconcerting. Are these likely to remain stable? Might it be possible to make packet math a part of the public interface?A second related question concerns knowing the Packet type in the functor's constructor. For some of the more complex functor implementations, we need to create several constant "pset" values that could be created in the functor's constructor and reused in each packetOp. Looking through Eigen's implementations, this is done inside packetOp (eg https://bitbucket.org/eigen/eigen/src/98fcfcb99dee04c9ffc8014cf8d56050692fe231/Eigen/src/Core/functors/UnaryFunctors.h?at=default&fileviewer=file-view-default#UnaryFunctors.h-564). For simple calls like pset<Packet>(1), the compiler seems good at pulling out the relevant constant bits. Unfortunately, with our more complex operations, we're not always getting the best optimization from the compiler, and we end up with slower SIMD implementations than regular scalar implementations. I can't see an obvious easy work around with the current structure of the library, but I was wondering if this had come up before.Thanks!Chris

**References**:**[eigen] stability of internal "packet math" interfaces***From:*Chris Dyer

**Re: [eigen] stability of internal "packet math" interfaces***From:*Benoit Steiner

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] stability of internal "packet math" interfaces** - Next by Date:
**Re: [eigen] Sparse Arrays for Eigen?** - Previous by thread:
**Re: [eigen] stability of internal "packet math" interfaces** - Next by thread:
**Re: [eigen] stability of internal "packet math" interfaces**

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