|[eigen] Struct padding with the nvcc compiler.|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Struct padding with the nvcc compiler.
- From: "Jon E. A. Lund" <jonealund@xxxxxxxxx>
- Date: Tue, 31 May 2016 14:56:50 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=KpJArseh+kEnOLf6okIWJyaWdxSq3b8Yf/hPAuUzypQ=; b=OXSIyzGWbTHm+Y1zE3PdJwOhabcuiqHbl2tScpSn7CZUiesq1MGtQt0GMzuJoA8YN2 9QpplJNZ15Iz6BkCbW/PuSnfa4bd6r5oFA3f5CiafJA03SK9uSoon4/SOO0INb7mD3Or Wwe6MrW6QJmO+8ZkCWWjMecLslf6NgOeJjgwxfzlhZQIIAj/pQkavXs6Jzel/2F7+oGU EFmyocJlQ4tWc0OWoxcSkf4fyLZNAilRQm2kGdShg2m0iwxMr7s1ZxW26N0zBQkeNjX4 sIyTPYsbCYfVJ/+dzt6kbK6d2GIlSGacSTeD5DHwi5atmZ8KPRBAUx7RXJmDyNNhbs/H niLw==
I'm using Eigen in a Cuda program, and want to use a Struct containing multiple Eigen members. The problem I am having is that the nvcc compiler apparently doesn't understand how the struct is supposed to be padded. As far as I have understood, Eigen pads the struct such that every Eigen member starts on a 16 byte boundary. My c++ compiler (g++-4.9) does this correctly, but it seems nvcc doesn't pad correctly.
The symptoms i observe are that sizeof() and offsetof() return different values when run the .cpp file compared to when run in the .cu file. In the .cpp file i get padding to 16 byte boundaries, while in the .cu file I get no padding at all.
The problem is independent of whether I am using the EIGEN_MAKE_ALIGNED_OPERATOR_NEW macro or not.
I am using an Eigen 3.3 dev snapshot taken May 30th.
For now I am padding my structs manually to ensure correct behavior, but I am curious if this is a known issue or something that will be fixed.
Jon E. A. Lund