[eigen] XLC Port Part III: XLC failing to instantiate a partial template specialization unless it is defined before use in a forward declaration |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: [eigen] XLC Port Part III: XLC failing to instantiate a partial template specialization unless it is defined before use in a forward declaration*From*: Aron Ahmadia <aja2111@xxxxxxxxxxxx>*Date*: Tue, 2 Feb 2010 14:21:19 +0300*Cc*: Alexandre Eichenberger <alexe@xxxxxxxxxx>, aron.ahmadia@xxxxxxxxxxxx*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=4E9RkSAGZvusd4JbcgaNK2UvKABwCmMqSPEf8g/hFCo=; b=C+u5aYV0IZjSrK53+e8jaVaOjTK8T8W8tK1kkCzVJWWB4LvwhQ4v/YIH3IKeXTHS25 LtoDhCut0jNQgOxq3H0A7lSpzcbZHz27hL5YNhg0eyKSot/1ExlgxIJM1eyU57+kmSRz bJ451hBS0WqzyjVjArZqEJzI86jcbrCwzdEbk=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; b=wXBIZEXAAPC9MEJq1OKm4o7ZsGUoGDM29vNYBkOtxQEcPTGhaUrFuNFU4F4mVg/cZn 23nzKDIjwg6muCmomzvRxSDdF5JnTtH0YuHTpx2CEtPmXW7b/cyQevRv0gFJPiKa/CWc nb6Lit0/e8fnRkd4fQsh8XylA47etB9snWBAM=

A little more digging has turned up this nifty fact. If I 'forward-define' the partial specialization for ei_traits in ForwardDeclarations.h (moving it from Matrix.h): template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> struct ei_traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > { typedef _Scalar Scalar; typedef Dense StorageType; typedef DenseStorageMatrix DenseStorageType; enum { RowsAtCompileTime = _Rows, ColsAtCompileTime = _Cols, MaxRowsAtCompileTime = _MaxRows, MaxColsAtCompileTime = _MaxCols, Flags = ei_compute_matrix_flags<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::ret, CoeffReadCost = NumTraits<Scalar>::ReadCost }; }; Then template<typename MatrixType, int BlockRows=Dynamic, int BlockCols=Dynamic, int _DirectAccessStatus = (ei_traits<MatrixType>::Flags&DirectAccessBit) ? HasDirectAccess : NoDirectAccess> class Block; compiles (at least to instantiate a Matrix3f, make check is still failing miserably). This sort of problem is a real head-scratcher, since XLC seems to handle a simple version of this correctly: #include<iostream> #include<vector> template<typename T> struct A; template<typename Scalar, typename Allocator, int _bits = (A<std::vector<Scalar, Allocator> >::bits > 10) ? 1 : 0> struct B { static const int bits = _bits; }; template<typename Scalar, typename Allocator> struct A < std::vector <Scalar, Allocator > > { static const int bits = 3; std::vector <Scalar, Allocator> y; }; int main() { B < int, std::allocator<int> > b1; B < int, std::allocator<int>, 2 > b2; std::cout << "b1 " << b1.bits << std::endl; std::cout << "b2 " << b2.bits << std::endl; return 0; } This news is still positive, since we can at least identify what exactly is causing a problem (XLC is failing to instantiate a partial template specialization unless the specialization has already been defined) I tried forward-declaring the partial template specialization, a legal maneuver in XLC, but this didn't fix things. It's possible that "MatrixType" is not well-defined to XLC and I am missing other forward declarations of partial specializations that would fix things. Alexandre, can you follow up with the IBM Compiler Team and see if there are any outstanding issues in the XLC V9.0 that shipped with our BlueGene/P last year that would cause this sort of trouble? Thanks, Aron

**Follow-Ups**:

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] SSE questions** - Next by Date:
**Re: [eigen] XLC Port Part III: XLC failing to instantiate a partial template specialization unless it is defined before use in a forward declaration** - Previous by thread:
**Re: [eigen] SSE questions** - Next by thread:
**Re: [eigen] XLC Port Part III: XLC failing to instantiate a partial template specialization unless it is defined before use in a forward declaration**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |