jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8293409: [vectorapi] Intrinsify VectorSupport.indexVector

Open XiaohongGong opened this issue 2 years ago • 8 comments

"VectorSupport.indexVector()" is used to compute a vector that contains the index values based on a given vector and a scale value (i.e. index = vec + iota * scale). This function is widely used in other APIs like "VectorMask.indexInRange" which is useful to the tail loop vectorization. And it can be easily implemented with the vector instructions.

This patch adds the vector intrinsic implementation of it. The steps are:

  1. Load the const "iota" vector.

We extend the "vector_iota_indices" stubs from byte to other integral types. For floating point vectors, it needs an additional vector cast to get the right iota values.

  1. Compute indexes with "vec + iota * scale"

Here is the performance result to the new added micro benchmark on ARM NEON:

Benchmark                              Gain
IndexVectorBenchmark.byteIndexVector   1.477
IndexVectorBenchmark.doubleIndexVector 5.031
IndexVectorBenchmark.floatIndexVector  5.342
IndexVectorBenchmark.intIndexVector    5.529
IndexVectorBenchmark.longIndexVector   3.177
IndexVectorBenchmark.shortIndexVector  5.841

Please help to review and share the feedback! Thanks in advance!


Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

  • JDK-8293409: [vectorapi] Intrinsify VectorSupport.indexVector

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10332/head:pull/10332
$ git checkout pull/10332

Update a local copy of the PR:
$ git checkout pull/10332
$ git pull https://git.openjdk.org/jdk pull/10332/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10332

View PR using the GUI difftool:
$ git pr show -t 10332

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10332.diff

XiaohongGong avatar Sep 19 '22 08:09 XiaohongGong

:wave: Welcome back xgong! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Sep 19 '22 08:09 bridgekeeper[bot]

@XiaohongGong The following labels will be automatically applied to this pull request:

  • core-libs
  • hotspot

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.

openjdk[bot] avatar Sep 19 '22 08:09 openjdk[bot]

/label add hotspot-compiler

XiaohongGong avatar Sep 19 '22 08:09 XiaohongGong

@XiaohongGong The hotspot-compiler label was successfully added.

openjdk[bot] avatar Sep 19 '22 08:09 openjdk[bot]

Webrevs

mlbridge[bot] avatar Sep 19 '22 08:09 mlbridge[bot]

Hi, could anyone please help to take a look at this PR? Thanks in advance for your time!

XiaohongGong avatar Sep 27 '22 06:09 XiaohongGong

@jatin-bhateja and @sviswa7 please look on this enhancement as Vector API experts.

vnkozlov avatar Sep 28 '22 17:09 vnkozlov

Ping again, could anyone please help to take a review at this PR? Thanks in advance!

XiaohongGong avatar Oct 08 '22 01:10 XiaohongGong

Hi @jatin-bhateja , all your comments have been addressed. Please help to look at the changes again! Thanks in advance!

XiaohongGong avatar Oct 18 '22 01:10 XiaohongGong

@XiaohongGong 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:

8293409: [vectorapi] Intrinsify VectorSupport.indexVector

Reviewed-by: eliu, jbhateja

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 55 new commits pushed to the master branch:

  • f502ab85c987be827d36b0a29f77ec5ce5bb3d01: 8295435: Build failure with GCC7 after JDK-8294314 due to strict-overflow warnings
  • 3f4964f83d6f03efbee2fb34aa8258d4fc923efb: 8293291: Simplify relocation of native pointers in archive heap
  • 1553551d821d92e529116e6ce56846831b13f492: 8286918: Better HttpServer service
  • 400aa2fb2c00c783f08b8e8dfc0ef9e63cbc4607: 8286511: Improve macro allocation
  • 2cee77444feb7911dc2234cbde0dccee4e6279c9: 8289366: Improve HTTP/2 client usage
  • 1ae683652134782745c4a7f261af3cbfc241e683: 8288508: Enhance ECDSA usage
  • 40539de8da78294a6d0ff0236687817cd767754b: 8286910: Improve JNDI lookups
  • 896a29dfaef6f0fb8e90b85205b599923d6e9e53: 8287446: Enhance icon presentations
  • 5a8e5ea3e234dc50935c09519791a59ee84f08c0: 8286526: Improve NTLM support
  • c622d56a0da5c27490bbe8ec572865b934499833: 8286519: Better memory handling
  • ... and 45 more: https://git.openjdk.org/jdk/compare/d3781ac8a38943d8a20304e770b01d5418ee33d0...master

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 master branch, type /integrate in a new comment.

openjdk[bot] avatar Oct 19 '22 07:10 openjdk[bot]

Thanks for the review @jatin-bhateja @theRealELiu !

XiaohongGong avatar Oct 19 '22 07:10 XiaohongGong

/integrate

XiaohongGong avatar Oct 19 '22 09:10 XiaohongGong

Going to push as commit 857b0f9b05bc711f3282a0da85fcff131fffab91. Since your change was applied there have been 56 commits pushed to the master branch:

  • 3f3d63d02ada66d5739e690d786684d25dc59004: 8294211: Zero: Decode arch-specific error context if possible
  • f502ab85c987be827d36b0a29f77ec5ce5bb3d01: 8295435: Build failure with GCC7 after JDK-8294314 due to strict-overflow warnings
  • 3f4964f83d6f03efbee2fb34aa8258d4fc923efb: 8293291: Simplify relocation of native pointers in archive heap
  • 1553551d821d92e529116e6ce56846831b13f492: 8286918: Better HttpServer service
  • 400aa2fb2c00c783f08b8e8dfc0ef9e63cbc4607: 8286511: Improve macro allocation
  • 2cee77444feb7911dc2234cbde0dccee4e6279c9: 8289366: Improve HTTP/2 client usage
  • 1ae683652134782745c4a7f261af3cbfc241e683: 8288508: Enhance ECDSA usage
  • 40539de8da78294a6d0ff0236687817cd767754b: 8286910: Improve JNDI lookups
  • 896a29dfaef6f0fb8e90b85205b599923d6e9e53: 8287446: Enhance icon presentations
  • 5a8e5ea3e234dc50935c09519791a59ee84f08c0: 8286526: Improve NTLM support
  • ... and 46 more: https://git.openjdk.org/jdk/compare/d3781ac8a38943d8a20304e770b01d5418ee33d0...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Oct 19 '22 09:10 openjdk[bot]

@XiaohongGong Pushed as commit 857b0f9b05bc711f3282a0da85fcff131fffab91.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Oct 19 '22 09:10 openjdk[bot]