Re: [eigen] Matrix product crashes when compiled with MSVC 2010 in release |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Matrix product crashes when compiled with MSVC 2010 in release
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Fri, 13 Aug 2010 00:08:01 -0400
- Cc: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=8NfZ0rbVL8n0HHYQ9DuOB6+w1WXX186TxVG3Q95xZXM=; b=KJEDWtEa6O6iZThkJA3XkIH4F7LpkwCl9E/jKcKNUMU/Xm/FFJO2GyWsCth23bsRg3 hfmZcew4h7eu8DhmWlG2najQKnjI/Hn/LWg8uSOW0/2BSKWEmSFTvyMgV1IsZHGpZ0bG W+SeY1I3k4FGDVquIDMzrXzLFx8ppsa7a8+dc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=pQdp/ovVI1PB3HYrcZbc59NF2eDxtD7mx8M6jEWXoH4aT5+d606vHjsHkz2VCQjgeQ 0EqNmXo1v++yhSpLGEouZ3cha8FoVSDrbbA0wrfqsuCEGEmvsCI3D7h4RPM/Ij9bXNfs OV3T9b2RbkJfIWO8n+w98B2JmpU5Mi19G7Tb8=
2010/8/12 Ilya Baran <baran37@xxxxxxxxx>:
> Hi,
>
> I've run into a nasty crash with recent Eigen dev builds. The
> following code reproduces it:
>
> void test()
> {
> typedef Eigen::MatrixXd Mat;
> Mat r = Mat::Random(5, 2);
> Mat r2 = Mat::Random(2, 5);
> Mat r3 = r * r2;
> std::cout << r3;
> }
>
> It crashes only when the output matrix has an odd number of entries
> and only when built in release mode on MSVC 2010 and only when whole
> program optimization is turned off. I suspect that this is a compiler
> bug, but perhaps it can be worked around. I traced the crash to
> changeset 3260 (431547872cf7); 3259 works.
Thanks for your very detailed report, I am CC'ing Gael to ping him.
>
> Here's the backtrace (lines as in rev 3260, because it's a release
> build, debug info is unreliable):
>
> First-chance exception at 0x00ea34bd in EigenTest.exe: 0xC0000005:
> Access violation reading location 0xffffffff.
Hm, this is really, really strange. So MSVC claims that we are
dereferencing the 0xffffffff pointer. I've never seen such a bug in
Eigen.
>
> EigenTest.exe!Eigen::ei_gebp_kernel<double,double,int,4,4,0,0>::operator()(double
> * res=0x004d3e20, int resStride=5, const double * blockA=0x0037fc70,
> const double * blockB=0x0037fc20, int rows=5, int depth=2, int cols=5,
> double alpha=1.0000000000000000, int strideA=2, int strideB=2, int
> offsetA=0, int offsetB=0, double * unpackedB=0x0037fba0) Line 459 +
> 0x8 bytes C++
If I understand well what you write above, this line number 459 is
unreliable because it's a release build? Indeed, there's no way that
this line could result in this 0xffffffff dereferencing:
C1 = ei_pmadd(C1, alphav, R1);
this should be manipulating just registers; at worst, variables on the stack.
If we want to investigate this further, we really need a reliable line
number. If MSVC can't give that, could you find it by stepping through
this function in a debugger, or by bisecting it by adding cerr's, or
whatever you favorite artisanal debugging tool is?
Cheers,
Benoit
>
> EigenTest.exe!Eigen::ei_general_matrix_matrix_product<int,double,0,0,double,0,0,0>::run(int
> rows=5, int cols=5, int depth=2, const double * _lhs=0x004d3d20, int
> lhsStride=5, const double * _rhs=0x004d3da0, int rhsStride=2, double *
> res=0x004d3e20, int resStride=5, double alpha=1.0000000000000000,
> Eigen::ei_level3_blocking<double,double> & blocking={...},
> Eigen::GemmParallelInfo<int> * info=0x00000000) Line 203 + 0x37
> bytes C++
>
> EigenTest.exe!Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>::scaleAndAddTo<Eigen::Matrix<double,-1,-1,0,-1,-1>
>>(Eigen::Matrix<double,-1,-1,0,-1,-1> & dst={...}, double
> alpha=1.0000000000000000) Line 444 C++
>
> EigenTest.exe!Eigen::ProductBase<Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>,Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>
>>::evalTo<Eigen::Matrix<double,-1,-1,0,-1,-1>
>>(Eigen::Matrix<double,-1,-1,0,-1,-1> & dst={...}) Line 110 + 0x83
> bytes C++
>
> EigenTest.exe!test() Line 9 + 0x97 bytes C++
>
> EigenTest.exe!main() Line 16 C++
>
>
> Figuring out ei_gebp_kernel looks daunting--do you (well, Gael is the
> person who needs to look at this, I expect) need any additional info?
>
> Thanks,
>
> -Ilya
>
>
>