[vector] rearrange with implicit wrapping

Viswanathan, Sandhya sandhya.viswanathan at intel.com
Thu Apr 22 16:21:27 UTC 2021


The problem is that rearrange is implemented using different flavors of underlying shuffle instruction and not all of them do the zeroing when the index is greater than number of lanes.
So, there is an overhead to do the zeroing in some cases.

Doing the wrapping as part of rearrange intrinsic also has overheads. Clubbing the wrapping in the intrinsic results in wrap code being executed in the hot loop even if the shuffle was loop invariant.

So, it looks to me that the current solution is the best, where we have check index partially vectorized over the hot path.

Best Regards,
Sandhya

From: John Rose <john.r.rose at oracle.com>
Sent: Wednesday, April 21, 2021 5:13 PM
To: Paul Sandoz <paul.sandoz at oracle.com>
Cc: Viswanathan, Sandhya <sandhya.viswanathan at intel.com>; panama-dev at openjdk.java.net' <panama-dev at openjdk.java.net>
Subject: Re: [vector] rearrange with implicit wrapping

On Apr 19, 2021, at 6:33 PM, Paul Sandoz <paul.sandoz at oracle.com<mailto:paul.sandoz at oracle.com>> wrote:


When the MSB is set, the corresponding element is cleared and that is what you are observing.
Let me know if you need me to handle it in the intrinsic.

I think it may be worth exploring an intrinsic solution to help make the best decision. I am concerned rearrange is fragile with regards to the input shuffle.

That’s why I was toying with the idea of “fill with zero”
as a recovery mode for bad indexes.


More information about the panama-dev mailing list