performance of gather/scatter with different types of indexes
Kay F. Jahnke
[please enable javascript to see the address]
Tue May 16 09:35:33 CEST 2017
Am 16.05.2017 um 08:48 schrieb Matthias Kretz:
> On Montag, 15. Mai 2017 17:26:44 CEST Kay F. Jahnke wrote:
>> 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.
I don't think I can do that sensibly. My code operates on arbitrary nD
arrays, and there's only a slim chance any of the data I gather are near
each other - and, on the other hand, if they are sequential, I can
detect that and use load/store instead.
But where the gathers should help is with multichannel data. They always
come packed and interleaved, so gathering them should be potentially faster.
>>> 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.
To answer my own question: yes I had to create an account.
> There isn't much info on the issue itself. The title explains it all (to me,
> at least). :-)
I noticed you're not overly fond of comments ;)
I'm trying to do the opposite. You may think you have it all in your
head, but just stay away for a few years and come back and you'll see
how good your brain is at holding the stuff. And when delegating
something, you either make it hard for your collaborators or you'll have
to write it all down for them anyway. Also, comments help with forming
concepts: try explain what you're doing in a comment, chances are you'll
notice if your concepts aren't clear. Now I'll stop babbling and...
> Let's move the discussion over to the github issue. You should be able to
> comment and subscribe on the issue.
done.
Kay
More information about the Vc
mailing list