Re: [eigen] New(?) way to make using SIMD easier

[ Thread Index | Date Index | More Archives ]

On Tue, Nov 24, 2009 at 8:06 PM, Mark Borgerding <mark@xxxxxxxxxxxxxx> wrote:
> Just an idea:
> What if the user could write code like:
>   VectorOperator( std::plus<SomeDataType>() , dstPtr , srcPtr1, srcPtr2 ,
> num );
> which would use a SIMD-optimized call if one exists, and use a generic
> algorithm otherwise.

Right now, you map the source pointers as vectors and execute the
standard eigen operations. Everything then is vectorized for you.
> Examples:
> 1. a functor std::plus<float>  and float pointers:    there could be a
> specialization that uses _mm_add_ps (on x86) to add 4 floats at a time
> 2. a functor std::multiplies<double> and double pointers:    the
> specialization would be to use _mm_mul_pd to add 2 doubles at a time
> It might even be used to detect special conditions.  e.g. If CUDA processing
> is enabled and the source pointers are device memory  It performs all
> calculations on the device.  Then brings the result back to the host only if
> the destination resides in host memory.
> Does this offer any advantages in development speed/clarity  or in
> flexibility over Eigen's current method of using SIMD?  I admit I am fairly
> ignorant of the current state of Eigen SIMD.

Rohit Garg

Senior Undergraduate
Department of Physics
Indian Institute of Technology

Mail converted by MHonArc 2.6.19+