[vtk-developers] vtkImageData 16-byte alignment for SSE

David Gobbi david.gobbi at gmail.com
Wed Jan 4 08:16:13 EST 2012


Hi Tim,

Even if all VTK arrays started at a 16-byte boundary, there would
still be alignment issues because

1) image data rows are not padded to 16-byte boundaries

2) vtkPoints stores 3 floats (or 3 doubles) rather than four

I can't see either of things changing, so in general, SSE in VTK would
have to be preceded by a non-SSE copy into an aligned array.  E.g. you
would use local aligned memory to store the image row that you were
currently processing, or to store a four-tuple that held the current
point.

 - David


On Wed, Jan 4, 2012 at 6:11 AM, David E DeMarle
<dave.demarle at kitware.com> wrote:
> There might be some better way, but if not you have to manage array
> allocation  yourself via vtkAbstractArray::SetVoidArray to ensure that the
> storage is aligned.
>
> Making the whole pipeline respect the alignment would require some more
> work.
>
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909
>
>
>
> On Wed, Jan 4, 2012 at 7:18 AM, Tim Hutton <tim.hutton at gmail.com> wrote:
>>
>> Hello,
>>
>> For SSE we need arrays aligned on 16-byte boundaries but VTK doesn't
>> currently seem to do this for (e.g.) vtkImageData. Is there any way to
>> achieve this? Or support for adding it as an option?
>>
>> Thanks,
>>
>> Tim
>>
>> --
>> Tim Hutton - http://www.sq3.org.uk -
>> http://profiles.google.com/tim.hutton/



More information about the vtk-developers mailing list