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

8275643: C2's unaryOp vector intrinsic does not properly handle LongVector.neg #6428

Closed
wants to merge 1 commit into from

Conversation

TobiHartmann
Copy link
Member

@TobiHartmann TobiHartmann commented Nov 17, 2021

Code in LongVector::lanewiseTemplate currently implements the NEG operation as a SUB and has a corresponding FIXME comment:

} else if (op == NEG) {
// FIXME: Support this in the JIT.
return broadcast(0).lanewise(SUB, this);
}
}
int opc = opCode(op);
return VectorSupport.unaryOp(
opc, getClass(), null, long.class, length(),

The implicit assumption is that since we will never pass NEG to VectorSupport.unaryOp in line 540, the corresponding C2 intrinsic does not need to handle that case. That's not guaranteed though because C2 might still compile that path when not being able to prove that it's unreachable at parse time. As a result, we then assert in the intrinsic because the negation operation on a long vector is currently not supported (i.e. there is no Op_NegVL). I propose to simply handle this case in VectorSupport::vop2ideal. We will then bail out from intrinsification with operation not supported: opc=NegL bt=long because VectorNode::opcode returns 0:

int opc = VectorSupport::vop2ideal(opr->get_con(), elem_bt);
int sopc = VectorNode::opcode(opc, elem_bt);
if ((opc != Op_CallLeafVector) && (sopc == 0)) {
if (C->print_intrinsics()) {
tty->print_cr(" ** operation not supported: opc=%s bt=%s", NodeClassNames[opc], type2name(elem_bt));

Question to the Vector API experts: There are other FIXME: Support this in the JIT comments in the code. Do these code paths suffer from similar issues? Is there a tracking RFE/bug?

Thanks,
Tobias


Progress

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

Issue

  • JDK-8275643: C2's unaryOp vector intrinsic does not properly handle LongVector.neg

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6428

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 17, 2021

👋 Welcome back thartmann! 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 Nov 17, 2021
@openjdk
Copy link

openjdk bot commented Nov 17, 2021

@TobiHartmann The following label will be automatically applied to this pull request:

  • hotspot

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 openjdk bot added the hotspot hotspot-dev@openjdk.org label Nov 17, 2021
@mlbridge
Copy link

mlbridge bot commented Nov 17, 2021

Webrevs

Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

That looks good to me!

@openjdk
Copy link

openjdk bot commented Nov 17, 2021

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

8275643: C2's unaryOp vector intrinsic does not properly handle LongVector.neg

Reviewed-by: chagedorn, sviswanathan

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

  • 29e552c: 8272358: Some tests may fail when executed with other locales than the US
  • ce4471f: 8277346: ProblemList 7 serviceability/sa tests on macosx-x64
  • 45a60db: 8277045: G1: Remove unnecessary set_concurrency call in G1ConcurrentMark::weak_refs_work
  • 6bb0462: 8277224: sun.security.pkcs.PKCS9Attributes.toString() throws NPE
  • d8c0280: 8277316: ciReplay: dump_replay_data is not thread-safe
  • 007ad7c: 8277303: Terminology mismatch between JLS17-3.9 and SE17's javax.lang.model.SourceVersion method specs
  • 8881f29: 8277310: ciReplay: @CPI MethodHandle references not resolved
  • 262d070: 8277246: Check for NonRepudiation as well when validating a TSA certificate
  • a907b2b: 8276177: nsk/jvmti/RedefineClasses/StressRedefineWithoutBytecodeCorruption failed with "assert(def_ik->is_being_redefined()) failed: should be being redefined to get here"
  • b687664: 8277159: Fix java/nio/file/FileStore/Basic.java test by ignoring /run/user/* mount points
  • ... and 3 more: https://git.openjdk.java.net/jdk/compare/e9934e1243929514e147ecdd3cefa74168ed0500...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 openjdk bot added the ready Pull request is ready to be integrated label Nov 17, 2021
@TobiHartmann
Copy link
Member Author

Thanks for the review, Christian!

Copy link

@sviswa7 sviswa7 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 to me.

@TobiHartmann
Copy link
Member Author

Thanks for the review, Sandhya!

@PaulSandoz
Copy link
Member

@sviswa7 @jatin-bhateja any thoughts on the other related FIXMEs brought up by Tobias? e.g.

            if (op == AND_NOT) {
                // FIXME: Support this in the JIT.
                that = that.lanewise(NOT);
                op = AND;

@sviswa7
Copy link

sviswa7 commented Nov 18, 2021

@PaulSandoz Those fixme notes are from John, pointing to us where further optimizations are possible and not related to correctness. I also looked at the vop2ideal, it now handles all the opcodes for the relevant data types (inegral/fp).

@PaulSandoz
Copy link
Member

@PaulSandoz Those fixme notes are from John, pointing to us where further optimizations are possible and not related to correctness. I also looked at the vop2ideal, it now handles all the opcodes for the relevant data types (inegral/fp).

Thanks, i also looked at vop2ideal and concluded the same.

@TobiHartmann
Copy link
Member Author

Thanks for checking!

@TobiHartmann
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 19, 2021

Going to push as commit 47564ca.
Since your change was applied there have been 38 commits pushed to the master branch:

  • 2f0bde1: 8277102: Dubious PrintCompilation output
  • 839033b: 8276976: Rename LIR_OprDesc to LIR_Opr
  • 89b125f: 8275527: Refactor forward pointer access
  • 36bd4a3: 8277404: Test VMDeprecatedOptions.java failing with Unable to create shared archive file
  • 57eb864: 8276927: [PPC64] Port shenandoahgc to linux on ppc64le
  • 8db0c36: 8277414: ProblemList runtime/CommandLine/VMDeprecatedOptions.java on windows-x64
  • 03473b4: 8270874: JFrame paint artifacts when dragged from standard monitor to HiDPI monitor
  • ce0f00f: 8276093: Improve naming in closures to iterate over card sets
  • 5d249c4: 8275071: [macos] A11y cursor gets stuck when combobox is closed
  • 354a34e: 8277336: Improve CollectedHeap::safepoint_workers comments
  • ... and 28 more: https://git.openjdk.java.net/jdk/compare/e9934e1243929514e147ecdd3cefa74168ed0500...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 19, 2021

@TobiHartmann Pushed as commit 47564ca.

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

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

Successfully merging this pull request may close these issues.

4 participants