-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8338023: Support two vector selectFrom API #20508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Welcome back jbhateja! A progress list of the required criteria for merging this PR into |
|
@jatin-bhateja This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 199 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
@jatin-bhateja The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
|
/label add hotspot-compiler-dev |
|
@jatin-bhateja |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The results look promising. I can provide guidance on the specification e.g., we can specify the behavior in terms of rearrange, with the addition of throwing on out of bounds indexes.
Regarding the throwing of exceptions, some wider context will help to know where we are heading before we finalize the specification. I believe we are considering changing the default throwing behavior for index out of bounds to wrapping, thereby we can avoid bounds checks. If that is the case we should wait until that is done then update rather than submitting a CSR just yet?
I see you created a specific intrinsic, which will avoid the cost of shuffle creation. Should we apply the same approach (in a subsequent PR) to the single argument shuffle? Or perhaps if we manage to optimize shuffles and change the default wrapping we don't require a specific intrinsic and can just use defer to rearrange?
Hi @PaulSandoz , Existing two vector rearrange API has a flexible specification which allows wrapping out of bounds shuffle indexes into exceptional index with a -ve value. Even if we optimize existing two vector rearrange implementation we will still need to emit additional instructions to generate an indexes which lie within two vector range [0, 2*VLEN). I see this as a specialized API like vector compress/expand which cater to targets like x86-AVX512+ and aarch64-SVE which offers direct instruction for two vector lookups. May be the API nomenclature can be refined to better reflect its semantics i.e. from selectFrom to twoVectorLookup ? |
|
Mailing list message from John Rose on hotspot-compiler-dev: (Better late than never, although I wish I?d been more explicit I think we should be moving away from throwing exceptions on all If I?m right, then new API points should start out with wrap There?s no loss of functionality in such a move. Instead the OK, so why is wrapping better than throwing? And first, why Or it did make sense. I think there is a technical debt Instead, consider the alternative of wrapping. First, This is why I think we should switch, ASAP, to masking I think some of our reports from customers have shown Did I miss a point? ? John On 14 Aug 2024, at 3:43, Jatin Bhateja wrote: |
Hi @rose00, I agree that wrapping should be the default behaviour if indices are passed through shuffles, idea was to pick exception throwing semantics for out of bounds indexes only for selectFrom flavour of APIs which accept indexes through vector interface, this will save redundant partial wrapping and un-wrapping for cross vector permutation API which has a direct mappings in x86 and AARCH64 ISA. As @PaulSandoz suggested we can also tune existing single 'selectFrom' API to adopt default exception throwing semantics if any of the indices lies beyond valid index range. While we will continue keeping default wrapping semantics for APIs accepting shuffles, this little deviation of semantics for selectFrom family of APIs will enable generating efficient code and will allow users to chooses between the rearrange and selectFrom API based on convenience vs efficient code trade-off. Since, API interfaces were crafted keeping in view long term flexibility, having multiple permutation interfaces (selectFrom / rearrange) accepting indexes though vector or shuffle enables compiler to emit efficient code. Best Regards, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
|
/reviewers 2 |
|
/reviewers 3 |
|
@PaulSandoz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it a quick scan, and I have no further comments. LGTM.
Thank you, i will kick off an internal test. |
Tier 1 to 3 tests pass. |
|
/integrate |
|
Thanks @PaulSandoz , @sviswa7 and @eme64 for review suggestions. |
|
@jatin-bhateja This pull request has not yet been marked as ready for integration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me.
|
/integrate |
|
Going to push as commit 709914f.
Your commit was automatically rebased without conflicts. |
|
@jatin-bhateja Pushed as commit 709914f. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
|
This patch failed on the lastest master. Another reason OpenJDK guide asks to merge master despite all these commit churns... |
Hi All,
As per the discussion on panama-dev mailing list[1], patch adds the support for following new two vector permutation APIs.
Semantics:-
Using index values stored in the lanes of "this" vector, assemble the values stored in first (v1) and second (v2) vector arguments. Thus, first and second vector serves as a table, whose elements are selected based on index value vector. API is applicable to all integral and floating-point types. The result of this operation is semantically equivalent to expression v1.rearrange(this.toShuffle(), v2). Values held in index vector lanes must lie within valid two vector index range [0, 2*VLEN) else an IndexOutOfBoundException is thrown.
Summary of changes:
JMH micro included with this patch shows around 10-15x gain over existing rearrange API :-
Test System: Intel(R) Xeon(R) Platinum 8480+ [ Sapphire Rapids Server]
Kindly review and share your feedback.
Best Regards,
Jatin
[1] https://mail.openjdk.org/pipermail/panama-dev/2024-May/020408.html
Progress
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20508/head:pull/20508$ git checkout pull/20508Update a local copy of the PR:
$ git checkout pull/20508$ git pull https://git.openjdk.org/jdk.git pull/20508/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20508View PR using the GUI difftool:
$ git pr show -t 20508Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20508.diff
Webrev
Link to Webrev Comment