Skip to content
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

8267969: Add vectorized implementation for VectorMask.eq() #4272

Closed
wants to merge 2 commits into from

Conversation

XiaohongGong
Copy link

@XiaohongGong XiaohongGong commented May 31, 2021

Currently "VectorMask.eq()" is not vectorized:

    public VectorMask<E> eq(VectorMask<E> m) {
        // FIXME: Generate good code here.
        return bOp(m, (i, a, b) -> a == b);
    }

This can be implemented by calling "xor(m.not())" directly.

The performance improved about 1.4x ~ 1.9x for the following benchmark with different basic types:

@Benchmark
public Object eq() {
    boolean[] ma = fm.apply(size);
    boolean[] mb = fmb.apply(size);
    boolean[] mt = fmt.apply(size);
    VectorMask<Byte> m = VectorMask.fromArray(SPECIES, mt, 0);

    for (int ic = 0; ic < INVOC_COUNT; ic++) {
        for (int i = 0; i < ma.length; i += SPECIES.length()) {
            var av = SPECIES.loadMask(ma, i);
            var bv = SPECIES.loadMask(mb, i);

            // accumulate results, so JIT can't eliminate relevant computations
            m = m.and(av.eq(bv));
        }
    }

    return m;
}

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8267969: Add vectorized implementation for VectorMask.eq()

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4272/head:pull/4272
$ git checkout pull/4272

Update a local copy of the PR:
$ git checkout pull/4272
$ git pull https://git.openjdk.java.net/jdk pull/4272/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4272

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4272.diff

@bridgekeeper
Copy link

bridgekeeper bot commented May 31, 2021

👋 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.

@openjdk openjdk bot added the rfr Pull request is ready for review label May 31, 2021
@XiaohongGong
Copy link
Author

/label hotspot-compiler

@openjdk
Copy link

openjdk bot commented May 31, 2021

@XiaohongGong To determine the appropriate audience for reviewing this pull request, one or more labels corresponding to different subsystems will normally be applied automatically. However, no automatic labelling rule matches the changes in this pull request. In order to have an "RFR" email sent to the correct mailing list, you will need to add one or more applicable labels manually using the /label pull request command.

Applicable Labels
  • 2d
  • awt
  • beans
  • build
  • compiler
  • core-libs
  • hotspot
  • hotspot-compiler
  • hotspot-gc
  • hotspot-jfr
  • hotspot-runtime
  • i18n
  • javadoc
  • jdk
  • jmx
  • kulla
  • net
  • nio
  • security
  • serviceability
  • shenandoah
  • sound
  • swing

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label May 31, 2021
@XiaohongGong
Copy link
Author

/label core-libs

@openjdk
Copy link

openjdk bot commented May 31, 2021

@XiaohongGong
The hotspot-compiler label was successfully added.

@XiaohongGong
Copy link
Author

/label hotspot-compiler

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label May 31, 2021
@openjdk
Copy link

openjdk bot commented May 31, 2021

@XiaohongGong
The core-libs label was successfully added.

@openjdk
Copy link

openjdk bot commented May 31, 2021

@XiaohongGong The hotspot-compiler label was already applied.

@mlbridge
Copy link

mlbridge bot commented May 31, 2021

Webrevs

Copy link
Member

@PaulSandoz PaulSandoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks. Later we may want to consider pushing this down as an intrinsic, perhaps reusing VectorSupport.compare.

@openjdk
Copy link

openjdk bot commented Jun 1, 2021

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

8267969: Add vectorized implementation for VectorMask.eq()

Reviewed-by: psandoz, neliasso

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

  • 1cea6ca: 8260360: IGV: Short name of combined nodes is hidden by background color
  • 7530c00: 8266559: XPathEvaluationResult.XPathResultType.NODESET maps to incorrect type
  • b98e52a: 8267570: The comment of the class JavacParser is not appropriate

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@PaulSandoz, @neliasso) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 1, 2021
@XiaohongGong
Copy link
Author

Looks. Later we may want to consider pushing this down as an intrinsic, perhaps reusing VectorSupport.compare.

Thanks for your review @PaulSandoz ! Yes, reusing VectorSupport.compare is an alternative way to do the vectorization.

@XiaohongGong
Copy link
Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jun 2, 2021
@openjdk
Copy link

openjdk bot commented Jun 2, 2021

@XiaohongGong
Your change (at version f3a4802) is now ready to be sponsored by a Committer.

Copy link

@neliasso neliasso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@neliasso
Copy link

neliasso commented Jun 2, 2021

Please wait until you have two reviewers before integrating.

@neliasso
Copy link

neliasso commented Jun 2, 2021

/sponsor

@openjdk openjdk bot closed this Jun 2, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed sponsor Pull request is ready to be sponsored ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 2, 2021
@openjdk
Copy link

openjdk bot commented Jun 2, 2021

@neliasso @XiaohongGong Since your change was applied there have been 3 commits pushed to the master branch:

  • 1cea6ca: 8260360: IGV: Short name of combined nodes is hidden by background color
  • 7530c00: 8266559: XPathEvaluationResult.XPathResultType.NODESET maps to incorrect type
  • b98e52a: 8267570: The comment of the class JavacParser is not appropriate

Your commit was automatically rebased without conflicts.

Pushed as commit 496fb90.

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

@XiaohongGong XiaohongGong deleted the JDK-8267969 branch June 3, 2021 02:08
@XiaohongGong
Copy link
Author

Please wait until you have two reviewers before integrating.

Sure! Thanks so much for looking at this PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
3 participants