mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Add padding to Grid struct in CellLocatorTwoLevel
There appears to be a bug in CUDA 9.2 where if you have a class that contains a struct that itself has to have padding in the middle for alignment purposes and you then put that class in a union with other classes, it seems like that padding can cause problems with other objects in the union.
This commit is contained in:
parent
e480fd7a24
commit
9816c422b1
@ -36,6 +36,10 @@ using FloatVec3 = vtkm::Vec3f;
|
||||
struct Grid
|
||||
{
|
||||
DimVec3 Dimensions;
|
||||
// Bug in CUDA 9.2 where having this gap for alignment was for some reason setting garbage
|
||||
// in a union with other cell locators (or perhaps not properly copying data). This appears
|
||||
// to be fixed by CUDA 10.2.
|
||||
DimensionType Padding;
|
||||
FloatVec3 Origin;
|
||||
FloatVec3 BinSize;
|
||||
};
|
||||
@ -54,6 +58,7 @@ VTKM_EXEC inline vtkm::Id ComputeFlatIndex(const DimVec3& idx, const DimVec3 dim
|
||||
VTKM_EXEC inline Grid ComputeLeafGrid(const DimVec3& idx, const DimVec3& dim, const Grid& l1Grid)
|
||||
{
|
||||
return { dim,
|
||||
0,
|
||||
l1Grid.Origin + (static_cast<FloatVec3>(idx) * l1Grid.BinSize),
|
||||
l1Grid.BinSize / static_cast<FloatVec3>(dim) };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user