Re: [eigen] Map alignedStart issue |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Map alignedStart issue
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Wed, 26 Jan 2011 22:33:31 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=1EwFLW+r99emnudrjbWW/7SjljU/DHpOugwVtQ6fM1s=; b=b5DyTGWQhghQtAyAi909CqflCN0QSa1q8OjsPGH88YQAU+F2vCJwOM2TMtTJUvUcvx rJ2zJ+0IGzfTk6x+c6zfCxYdIMKJn0/AjnZMM4iVxCV6cGJAJW47FhaTPIDYscdQyxfi 6srr2nTDJgTHfM/1eGc/NXsHV//WomxaZ+ZSs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=r4zJsdslw29LiNIf5vBLsXEx4wbGiqAvV87ksXul0wEE9HOmTZelugy5Ncugri7FWc CifNdO+MUFTr01q5mac8QE3ppgCwRzN799yqO4jUvkISh+kCf0zKTefvkErS7VjNM99V VHE2jX5EVLyJ86LMiI1dXXjw2Y0VFEq192BMY=
Hi I'd suggest you to run your code under valgrind. Under linux simply do:
$ valgrind ./your_exec
this will detect bad reads and writes and many other stuffs.
gael
On Wed, Jan 26, 2011 at 7:23 PM, Benoit Mathieu
<benoit.mathieu@xxxxxxxxxxxxxxxxxxxx> wrote:
> Hi all,
>
> I get a strange bug in my application that I cannot reproduce in a small
> test case.
>
> Somewhere in my code I have:
>
> void myfunction(double* pattern)
> {
> Map<ArrayXd> pVec(pattern,12);
> pVec.setZero();
>
> // ...
> }
>
> The problem is that when SSE2 is enabled, I get a segfault on the setZero()
> call. (If I don't activate sse2, no problems). The double* pattern pointer
> is NOT necessarily aligned. Please find the backtrace at the end of this
> message.
>
> The problem seems that Eigen start finding the first aligned index where to
> start vectorization, and it get -1075572760. Accessing this index causes the
> segfault.
>
> As I said, I cannot reproduce this bug in a small test case, so it may comes
> from a mistake in my code, but I have no idea where to look at.
>
> If I avoid the setZero call with a basic for loop, the same kind of problem
> appear later in a pVec.sum() call.
>
> I'm using the last version of eigen in the development branch, gcc 4.3.2 on
> debian with -msse2 -mstackrealign flags.
>
> Is anybody have an idea of what happen ? or where to look ?
> Any help is appreciated.
>
> ++
> Benoit
>
> ----------------------------
> (gdb) bt
> #0 0xb53869a0 in Eigen::internal::pstore<double, double __vector> (
> to=0x8c52df0, from=@0xbfe40df0)
> at /usr/lib/gcc/i486-linux-gnu/4.3.2/include/emmintrin.h:150
> #1 0xb5387706 in Eigen::internal::pstoret<double, double __vector, 1> (
> to=0x8c52df0, from=@0xbfe40df0)
> at
> /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/GenericPacketMath.h:280
> #2 0xb538d140 in Eigen::MapBase<Eigen::Map<Eigen::Array<double, -1, 1, 0,
> -1, 1>, 0, Eigen::Stride<0, 0> >, 1>::writePacket<1> (this=0xbfe40fe8,
> index=-1075572760, x=@0xbfe40df0)
> at
> /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/MapBase.h:235
> #3 0xb539f0a5 in Eigen::DenseCoeffsBase<Eigen::Map<Eigen::Array<double, -1,
> 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >,
> 1>::copyPacket<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
> Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >
>>, 1, 0> (this=0xbfe40fe8,
> index=-1075572760, other=@0xbfe40f38)
> at
> /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/DenseCoeffsBase.h:541
> #4 0xb539f169 in
> Eigen::internal::assign_impl<Eigen::Map<Eigen::Array<double, -1, 1, 0, -1,
> 1>, 0, Eigen::Stride<0, 0> >,
> Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
> Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >
>>, 3, 0>::run (dst=@0xbfe40fe8, src=@0xbfe40f38)
> at
> /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/Assign.h:422
> #5 0xb539f25a in Eigen::DenseBase<Eigen::Map<Eigen::Array<double, -1, 1, 0,
> -1, 1>, 0, Eigen::Stride<0, 0> >
>>::lazyAssign<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
> Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >
>> (this=0xbfe40fe8, other=@0xbfe40f38)
> at
> /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/Assign.h:511
> #6 0xb539f2cc in
> Eigen::internal::assign_selector<Eigen::Map<Eigen::Array<double, -1, 1, 0,
> -1, 1>, 0, Eigen::Stride<0, 0> >,
> Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
> Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >
>>, false, false>::run (dst=@0xbfe40fe8,
> other=@0xbfe40f38)
> at
> /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/Assign.h:534
> #7 0xb539f31c in Eigen::DenseBase<Eigen::Map<Eigen::Array<double, -1, 1, 0,
> -1, 1>, 0, Eigen::Stride<0, 0> >
>>::operator=<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>,
> Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >
>> (this=0xbfe40fe8, other=@0xbfe40f38)
> at
> /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/Assign.h:555
> #8 0xb539f397 in Eigen::DenseBase<Eigen::Map<Eigen::Array<double, -1, 1, 0,
> -1, 1>, 0, Eigen::Stride<0, 0> > >::setConstant (this=0xbfe40fe8,
> value=@0xbfe40f88)
> at
> /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/CwiseNullaryOp.h:341
> #9 0xb539f3d7 in Eigen::DenseBase<Eigen::Map<Eigen::Array<double, -1, 1, 0,
> -1, 1>, 0, Eigen::Stride<0, 0> > >::setZero (this=0x8c52df0)
> at
> /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/CwiseNullaryOp.h:490
> #10 0xb5399c8a in YAAFE_EXT::Chroma2ChordDict::Dict::fillPattern (
> this=0x9a44250, notes=@0x9a4c310, nbHarmo=1, pattern=0x9a4aeb0)
> at
> /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/tp-yaafe-extension/components/Chroma2ChordDict.cpp:96
>
>
>
>