performance of gather/scatter with different types of indexes
Matthias Kretz
[please enable javascript to see the address]
Tue May 16 08:48:11 CEST 2017
On Montag, 15. Mai 2017 17:26:44 CEST Kay F. Jahnke wrote:
> But I reckon the AVX gather/scatters are there?
Well, AVX2 is the first ISA extensions that ships instructions for gathers.
Scatter instructions are only part of AVX-512 even.
So currently all gather & scatter implementations use _mm[256]_set_
intrinsics, and the compiler does whatever its optimizer can do...
> I compiled with -mAVX,
> tried both versions and could not detect a significant difference. Now
> my gather/scatters are from quite widely spread out memory locations.
> Maybe the code is so memory-bound that the speed difference between
> using the intrinsics and the fallback scalar implementation is not
> really visible because it's only a small portion of the execution time.
Gather instructions can only provide a real speedup if at least two elements
are stored in the same cache line. Mental model: the CPU does a loop over all
involved cache lines to build up the vector...
And yeah, if those cache lines are cold you'll likely be limited by memory
latency. You might want to experiment with explicit prefetching.
> > If you are interested in optimizing gathers I'd be happy to help you with
> > resolving https://github.com/VcDevel/Vc/issues/32.
>
> I should, really, because my code uses gathers and scatters all the time.
>
> Do I have to have a git account to actually see the issue? I can't see
> anything but the issue page with the title and some sort of history
> which I can't access.
There isn't much info on the issue itself. The title explains it all (to me,
at least). :-)
> Can you point me to the relevant bit of code so that I can get a feel
> what would be required? If it's implemented in AVX, maybe I can just
> take that as a template and adapt it.
Let's move the discussion over to the github issue. You should be able to
comment and subscribe on the issue.
Cheers,
Matthias
--
──────────────────────────────────────────────────────────────────────────
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