Commit 9816c422 authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

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.
parent e480fd7a
......@@ -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) };
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment