C++ Logo

std-proposals

Advanced search

Re: [std-proposals] SIMD by just operating on 2 arrays

From: samuel ammonius <sfammonius_at_[hidden]>
Date: Wed, 12 Apr 2023 13:45:46 -0230
On Wed, Apr 12, 2023 at 1:02 PM Jason McKesson via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> The other elephant in the room is that SIMD often requires specific
> alignment for its objects. And C arrays don't come with that; you'd
> have to explicitly align them with `alignas`. Which means you now have
> to know what alignment to use for the platform, or to use some type
> that provides the alignment (which will often require you to restate
> the size of the array).
>
> Whereas with a proper, dedicated type, alignment comes for free.


I think a vectorized CPU would still be able to copy the elements of an
unaligned array with the same speed though, right?

If not I guess the requirement would have to be "a list of 2, 4, or 8
floats or ints with no byte padding".

Received on 2023-04-12 16:15:59