[vector] Sparse load (simple gather) of vector from array?

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Thu Mar 21 17:51:36 UTC 2019


Hi Lev,

>>>    What is simplest way to perform such "gather" load?
>>
>> Strictly speaking, it's not a "gather" operation - the input data being
>> accessed is still laid out contiguously in memory.
>>
>> You can achieve your goal by adapting vector contents after it is loaded
>> from memory. On API level you can achieve that by reshape + rearrange +
>> blend and I see it as the idiomatic way to implement such transformation:

>    Now I'm using 5-arguments form `fromArray()` (with shuffle integer array).
>     I need to benchmark these two methods, but, as far as I understand,
> backend is not ready for serious benchmarking.

FTR gather load is more generic than needed here and it may be slower 
than just load + reshuffle (depending on how fast gather/scatter H/W 
instructions are).

Not sure what you mean by "serious benchmarking" here.

As I noted in previous email, x86 backend is not powerful enough yet to 
fold nested vector operations into single vector instructions, but it 
should already produce decently optimized vectorized code.

There's still a small number of vector operations left which aren't 
intrinsified yet, but it should be fixed soon.

So, if you see a case when Vector API slower than scalar version, 
please, do report a bug.

>     Now I have full library of real and complex vector operations (in DSP
> sense — not in 3D-graphics sense, so, "vector" is infinite sequence of
> real or complex numbers, not something like vector-row or
> vector-columns), implemented both in pure Java and with Vector API, but
> benchmarks results are very strange on my custom build of
> "foreign+vector" branch. I need 2-3 day to clean it up and I'll publish
> code with some my (strange) result.

I assume that's what you are talking about in the other thread. A 
reproducer would be very helpful. It looks like a compiler bug.

Best regards,
Vladimir Ivanov

[1] http://mail.openjdk.java.net/pipermail/panama-dev/2019-March/005011.html


More information about the panama-dev mailing list