This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Eigen faster with SSE2 Disabled

Tags: None
(comma "," separated)
a1re
Registered Member
Posts
16
Karma
0

Eigen faster with SSE2 Disabled

Wed May 25, 2011 5:55 pm
Hi,

I've started using Eigen recently but my code runs faster with the SSE2 option disabled. Do you have any idea why this would occur? My most called method performs the computation

a = b*exp((c-1)*log(d/t)-d)

where a, b, c and d are of type Eigen::ArrayXd.

I'm currently using the Visual Studio 2010 IDE.

Thank You In Advance.

Edit: I maybe also should have mentioned that a, b, c, and d were actually mapped to Eigen::ArrayXd from std::vector<double>. Also, I looked at the assembly code and I don't see any vectorization occurring. How do I check if my vectors are aligned? Thanks again
graphicsMan
Registered Member
Posts
16
Karma
0
OS

Re: Eigen faster with SSE2 Disabled

Thu May 26, 2011 10:51 pm
My sense is that unless you write vectorizeable versions of the transcendental functions, you'll never get a win by using SSE here. Even if it did the division and addition in SIMD, it has to extract the elements from the SIMD vector to make the function calls, and then recombine them into vectors. This is not a cheap operation with any version of SSE. The best times to use SSE are when you can perform long runs of computations using the SSE units with no branches depending on individual elements of the SIMD vector. Note that there are some SSE libraries written to perform the standard transcendental functions in SIMD. Unsure how hard it would be to adapt them for use in Eigen.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Eigen faster with SSE2 Disabled

Fri May 27, 2011 7:10 am
we have SSE versions of log an exp only for floats, so when you use double you don't get any vectorization. If you want you can have a look at their implementations in Eigen/src/Core/arch/SSE/MathFunctions.h and make double versions of them :)


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar