performance of gather/scatter with different types of indexes
Matthias Kretz
[please enable javascript to see the address]
Mon May 15 09:56:22 CEST 2017
Hi Kay,
my guess:
ST::IndexType is an alias for SimdArray<int, ?>. So, it's typically passed as
one or two SIMD registers to the gather/scatter functions. However, I have not
implemented gathers with the existing AVX2 intrinsics yet, so you get the
scalar fallback implementation in all cases. Meaning, it has to read the
scalar elements of the SimdArray. Thus, it has to do the same as for the
TinyVector, except that the TinyVector is possibly easier to optimize for the
compiler since the scalars are already passed around in memory or even general
purpose registers
If you are interested in optimizing gathers I'd be happy to help you with
resolving https://github.com/VcDevel/Vc/issues/32.
Cheers,
Matthias
On Montag, 15. Mai 2017 09:30:11 CEST Kay F. Jahnke wrote:
> Hi all!
>
> Given a simdized type ST, I noticed recently that, apart from using
> ST::IndexType (which uses int) for gather/scatter operations, I can use
> any type offering operator[] and holding the required number of indexes.
> Initially I filed this under nice-to-have, but since the code I'm
> working on produces indexes initially as ptrdiff_t (which is long on my
> system), I experimentally coded passing vigra::TinyVector<ptrdiff_t,N>
> as index type, vigra::TinyVector being a fixed size container type. To
> my surprise, the resulting code was faster than the code using
> ST::IndexType, so it looks like a win-win situation: I don't need to
> safeguard against index overflow (as unlikely as that may be) and I get
> faster code. Since this is just a single observation on a single system
> (though it occurs both with g++ and clang++) I wonder if anyone else has
> looked into this - and what causes the effect.
>
> Kay
>
> _______________________________________________
> Vc mailing list
>[please enable javascript to see the address]
> https://compeng.uni-frankfurt.de/mailman/listinfo/vc
--
──────────────────────────────────────────────────────────────────────────
Dr. Matthias Kretz https://kretzfamily.de
GSI Helmholtzzentrum für Schwerionenforschung https://gsi.de
SIMD easy and portable https://github.com/VcDevel/Vc
──────────────────────────────────────────────────────────────────────────
More information about the Vc
mailing list