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

[SOLVED] MSVC 2008 compilation crash with SSE2 optimization

Tags: None
(comma "," separated)
ben2610
Registered Member
Posts
7
Karma
0
This little program makes MSVC 2008 crash when SSE2 instruction set is enabled:

Code: Select all
#include
#include

using namespace Eigen;

int main(int argc, char** argv)
{
   MatrixXd A=MatrixXd::Random(100,100);
   SVD svd(A);
    return 0;
}


Here is the linker error:
Code: Select all
1>e:blenderdevelorocoslibeigensrccorecachefriendlyproduct.h(437) : fatal error C1001: An internal error has occurred in the compiler.
1>(compiler file 'f:ddvctoolscompilerutcsrcp2main.c[0x5121DFE4:0x00000004]', line 182)
1> To work around this problem, try simplifying or changing the program near the locations listed above.


Here is the compiler command line options:
Code: Select all
/O2 /Oi /GL /I "....lib" /I "....itasc" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /FD /EHsc /MD /arch:SSE2 /Fo"....buildmsvc9itasc-testRelease\" /Fd"....buildmsvc9itasc-testReleasevc90.pdb" /W3 /nologo /c /Zi /TP /errorReport:prompt

and the linker command line options:
Code: Select all
/OUT:"....binReleaseitasc-test.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"....buildmsvc9itasc-testReleaseitasc-test.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"e:BlenderdevelorocosbinReleaseitasc-test.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib


I'm also getting the same error at the same location when I try to compile a larger program that does not use the SVD module. This means that for now I cannot use SSE2 optimization :-(
I hope you can identify the problem.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
hi,

actually this error has already been fixed in trunk, and I just backported it to the 2.0 branch (it seems I forgot to do so). FYI, the stable 2.0 branch is there: svn://anonsvn.kde.org/home/kde/branches/eigen/2.0
ben2610
Registered Member
Posts
7
Karma
0
Thanks for the quick reply. I upgraded from SVN and I don't have the compilation problem.
However I encountered a different problem. This little program is causing an assert when SSE2 optimization is enabled:
Code: Select all
#include
using namespace Eigen;

int main(int argc, char** argv)
{
   MatrixXf A = Matrix4f::Zero();
   Matrix2f B = Matrix2f::Identity();
   A.block(0,0,2,2) = B;
   return 0;
}


Here is the call stack:
Code: Select all
>   itasc-test.exe!Eigen::MapBase,10000,10000,1,32> >::coeffRef(int index=0)  Line 99 + 0x18 bytes   C++
    itasc-test.exe!Eigen::ei_assign_impl,10000,10000,1,32>,Eigen::Matrix,2,0>::run(Eigen::Block,10000,10000,1,32> & dst={...}, const Eigen::Matrix & src={...})  Line 356 + 0x1e bytes   C++
    itasc-test.exe!Eigen::MatrixBase,10000,10000,1,32> >::lazyAssign >(const Eigen::MatrixBase > & other={...})  Line 407 + 0x17 bytes   C++
    itasc-test.exe!Eigen::ei_assign_selector,10000,10000,1,32>,Eigen::Matrix,0,0>::run(Eigen::Block,10000,10000,1,32> & dst={...}, const Eigen::Matrix & other={...})  Line 422 + 0x2f bytes   C++
    itasc-test.exe!Eigen::MatrixBase,10000,10000,1,32> >::operator= >(const Eigen::MatrixBase > & other={...})  Line 442 + 0x17 bytes   C++
    itasc-test.exe!Eigen::Block,10000,10000,1,32>::operator= >(const Eigen::MatrixBase > & other={...})  Line 225 + 0x34 bytes   C++
    itasc-test.exe!main(int argc=1, char * * argv=0x00486d50)  Line 41   C++
    itasc-test.exe!__tmainCRTStartup()  Line 582 + 0x19 bytes   C
    itasc-test.exe!mainCRTStartup()  Line 399   C
    kernel32.dll!7c817067()    


The crash occurs in coeffRef() because the block does not have the LinearAccessBit set.

As a side question I noticed that the .set() method is replaced by the = operator. I find this more elegant but is there an assignement method that explicitely checks the matrices sizes and assert if they don't have the same size, like the = operator used to do?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
arf, another fix that has not been backported... done now.
ben2610
Registered Member
Posts
7
Karma
0
It's working now.

I get a nice performance increase over uBLAS when working with large matrices.
Thanks for the great work.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell