Array addition and array sum Panama benchmarks

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Mar 20 18:51:13 UTC 2024


Thanks for the analysis Roland. If I understand correctly, even if this 
analysis is not supported today, in principle it could be done, right?

After all, we know ia/oa (e.g. their addresses) and the ranges we're 
going to access these at (otherwise we could not hoist bound checks 
outside the loop).

So, we might be able, in principle, to check that - perhaps the issue is 
that (as in this case) all the addresses are completely dynamic, so you 
really need a disjointness runtime check (outside the loop), which might 
be more expensive than the incremental benefit added by vectorization?

Maurizio


On 20/03/2024 16:26, Roland Westrelin wrote:
> is that the compiler can't prove it's legal to vectorize. Doubles are
> read from ia and oa and then added and written back to oa. There's no
> way for the compiler to tell that the off heap areas pointed to by ia
> and oa don't overlap. So possibly, the value written to:
>
> oa + 8*i
>
> is going to be read back at the next iteration with:
>
> ia + 8*i
>
> (ia could be oa+8)
>
> The autovectorizer would need to insert a runtime check that the 2 areas
> don't overlap but there's no support for that at this point. I suppose
> the same issue exists with the MemorySegment API when memory is off
> heap.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20240320/1d0ff196/attachment.htm>


More information about the panama-dev mailing list