Re: [eigen] Re: 3.0.4 coming soon, testing appreciated |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Re: 3.0.4 coming soon, testing appreciated
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sat, 26 Nov 2011 17:50:25 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=A4utgIclOL611iwEjm6V+cIQoh+iA8//C9oGSmMIjd8=; b=CUPM3k8wIFC6El5fcI5cIxboxEWVvQ33q/Ex7q8i78GgUQEmkXeclPywLcORtoEBIx b1rEUyIqwj7bwjQd6HPYwlTsGZRUusRrdtnxPVEJt7pdL1EP/CXgn5i6VzN7gWkScvyq 8y5iH2OA3LaC5FchwlKUdMc26pNC8t6gxDVoc=
2011/11/26 Jitse Niesen <jitse@xxxxxxxxxxxxxxxxx>:
> Benoit Jacob <jacob.benoit.1@...> writes:
>
>> This is now fixed in both branches: f7e4c54e8c44 in default branch,
>> dfea1f0cbf7a in 3.0 branch.
>>
>> Can you please retry?
>>
>> The fix is very nontrivial so I would like to discuss it here.
>>
>> We used to have 2 different ways of computing whether we statically
>> align types: one for the actual static alignment stuff in
>> DenseStorage.h, checking if the byte size is a multiple of 16 bytes,
>> and one for the AlignedBit flag computation in compute_matrix_flags in
>> XprHelper.h, checking if the Scalar type is vectorizable and if
>> Rows*Cols is a multiple of the vectorization packet size.
>>
>> For example, when vectorization is disabled, Matrix4d is still
>> statically aligned (we need that to preserve the ABI) but its Flags do
>> not have the AlignedBit.
>
> It looks like this introduced another problem which manifests itself in the
> matrix_exponential_8 test failing occasionally. The issue is illustrated by the
> following program:
>
> int main()
> {
> Matrix<std::complex<long double>, 2, 2> mat1;
> std::cout << mat1.data() << std::endl;
> std::cout << mat1.col(0) << std::endl;
> }
>
> The last line fails 50% of the time on the assertion on MapBase.h:174 which is
>
> eigen_assert(EIGEN_IMPLIES(internal::traits<Derived>::Flags&AlignedBit,
> (size_t(m_data) % (sizeof(Scalar)*internal::packet_traits<Scalar>::size)) == 0)
> && "data is not aligned");
>
> AlignedBit is set and sizeof(Scalar) is 32, but m_data is only aligned on a
> 16-byte boundary, so it bombs out.
Clearly this assertion is wrong. It predates my changes (actually my
changes were fixing the same mistake elsewhere). We never align to
more than 16 bytes, so requiring higher alignment than that is wrong.
The fix is to replace this by the same check that is performed in
compute_matrix_flags. Actually, it would be very useful to isolate
this alignedness computation in a little template helper, maybe call
it is_fixed_size_vectorizable<Type>::value (returning 0 or 1).
Indeed, this will be the 3rd place in the code where we need to check
that, the others being compute_matrix_flags and in DenseStorage.h.
Are you doing this fix?
Cheers,
Benoit
>
> I don't know whether it's the assertion or the computation in
> compute_matrix_flags in XprHelper.h that is wrong.
>
>
> Jitse
>
>
>
>