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

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

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.

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.

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