RFR: 8338023: Support two vector selectFrom API [v5]
Jatin Bhateja
jbhateja at openjdk.org
Tue Aug 27 10:04:04 UTC 2024
On Fri, 23 Aug 2024 22:29:46 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
> API changes look good. (Note at the moment we are not proposing to change how shuffles works - as you point out the two vector `selectFrom` and `rearrange` differ in the index representation.)
>
> IIUC if the more direct two-table instruction is not available you fall back to calling two single arg rearranges with a blend, as a lowering transformation, similar to the fallback Java expression.
>
> The float/double conversion bothers me, not suggesting we do something about it here, noting down for any future conversation on shuffles. Ideally we would want the equivalent integral vector (int or long) to represent the index, tricky to express in the API, or alternative treat as a bitwise no-op conversion (there is also impact on `toShuffle` too).
Thanks @PaulSandoz,
> IIUC if the more direct two-table instruction is not available you fall back to calling two single arg rearranges with a blend, as > a lowering transformation, similar to the fallback Java expression.
Idea here is to be performant as much as possible and save additional boxing penalties incurred due to failed intrinsification if target does not directly support two vector permutation but does supports its constituents. I have now unwrapped and optimized the fallback implementation to directly operates over index vector lanes instead going through intermediate shuffle.
>
> The float/double conversion bothers me, not suggesting we do something about it here, noting down for any future conversation on shuffles.
I Agree.
> Ideally we would want the equivalent integral vector (int or long) to represent the index, tricky to express in the API, or alternative treat as a bitwise no-op conversion (there is also impact on `toShuffle` too).
Since floating-point index vector may carry special values like NaN, POSITIVE_INFINITY and NEGATIVE_INFINITY, thus with default wrapping semantics, its necessary to convert this into integral vector followed by wrapping normalization to valid two vector index range, through existing sequence we are bypassing partial wrapping (part to toShuffle) altogether which may save few instruction.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20508#issuecomment-2312089987
More information about the core-libs-dev
mailing list