jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8357554: Enable vectorization of Bool -> CMove with different type size (on riscv)

Open Hamlin-Li opened this issue 6 months ago • 6 comments

Hi, Can you help to review this patch? This pr is splited from https://github.com/openjdk/jdk/pull/25341, and contains only share code change.

This patch enable the vectorization of statement like fd_1 bop fd_2 ? res_1 : res_2 in a loop.

The current behaviour on other platforms support vecatorization of fd_1 bop fd_2 ? res_1 : res_2 in a loop only when fd and res have the same size, but this constraint seems not necessary at least not necessary on riscv, so I relax this constraint on riscv, maybe on other platforms it can be relaxed too, but currently I only made it work on riscv. Besides of this, I also relax the constraint on transforming Op_CMoveI/L to Op_VectorBlend on riscv, this bring some extra benefit when the res is not float or double types. Both relaxation bring performance benefit via vectorization.

Compared with other runs (master, master with -XX:+UseVectorCmov -XX:+UseCMoveUnconditionally turned on, patch without flags turned on), average improvement introduced by the patch with -XX:+UseVectorCmov -XX:+UseCMoveUnconditionally turned on is more than 2.1 times, in some cases it can bring more than 4 times improvement. When -XX:-UseVectorCmov -XX:-UseCMoveUnconditionally turned off, there is no regression on average.

Check more details at: https://github.com/openjdk/jdk/pull/25341.

Thanks


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-8357554: Enable vectorization of Bool -> CMove with different type size (on riscv) (Enhancement - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25336

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

Using diff file

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

Using Webrev

Link to Webrev Comment

Hamlin-Li avatar May 20 '25 19:05 Hamlin-Li

:wave: Welcome back mli! 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 May 20 '25 19:05 bridgekeeper[bot]

❗ This change is not yet ready to be integrated. See the Progress checklist in the description for automated requirements.

openjdk[bot] avatar May 20 '25 19:05 openjdk[bot]

@Hamlin-Li The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

openjdk[bot] avatar May 20 '25 19:05 openjdk[bot]

Webrevs

mlbridge[bot] avatar May 26 '25 10:05 mlbridge[bot]

@Hamlin-Li Thanks for working on this!

Can you please provide the the JMH benchmark results for your measurements? It would also be good to have some IR tests, that cover the newly vectorized cases.

eme64 avatar May 28 '25 09:05 eme64

@Hamlin-Li Thanks for working on this!

@eme64 Sorry for the delayed reply, I've been on vacation. Thank you for having a look!

Can you please provide the the JMH benchmark results for your measurements?

Sure, I have the data in https://github.com/openjdk/jdk/pull/25341, I can copy the data here. But it won't impact jmh result until https://github.com/openjdk/jdk/pull/25341 is pushed in. I'll add more jmh test and data for integral types.

It would also be good to have some IR tests, that cover the newly vectorized cases.

You're right, will add more IR tests.

Hamlin-Li avatar Jun 02 '25 14:06 Hamlin-Li

@Hamlin-Li This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Jul 25 '25 08:07 bridgekeeper[bot]

@Hamlin-Li This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

bridgekeeper[bot] avatar Aug 22 '25 15:08 bridgekeeper[bot]