Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

8288112: C2: Error: ShouldNotReachHere() in Type::typerr() #128

Closed
wants to merge 5 commits into from

Conversation

jatin-bhateja
Copy link
Member

@jatin-bhateja jatin-bhateja commented Jul 8, 2022

JDK-8284960 added new vector IR nodes and target specific backend support for ReverseByte vector operations.
For each scalar operation, auto-vectorizer analysis stage checks for existence of vector IR opcode and target specific backend implementation. While processing scalar IR nodes corresponding to Java SE APIs [Short/Character/Integer/Long].reverseBytes SLP analysis checks passes since relevant support already existed. This bug fix patch handles missing scalar reversebyte opcode checks in SLP backed to enable creation of corresponding vector IR nodes.

A new JBS issue JDK-8290034 is created to add the missing auto-vectorization support for bit reverse operation targeting JDK mainline.

Kindly review and share your feedback.

Best Regards,
Jatin


Progress

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

Issue

  • JDK-8288112: C2: Error: ShouldNotReachHere() in Type::typerr()

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 128

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk19/pull/128.diff

@jatin-bhateja
Copy link
Member Author

/label add hotspot-compiler-dev

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 8, 2022

👋 Welcome back jbhateja! 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 rfr Pull request is ready for review hotspot-compiler hotspot-compiler-dev@openjdk.org labels Jul 8, 2022
@openjdk
Copy link

openjdk bot commented Jul 8, 2022

@jatin-bhateja
The hotspot-compiler label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Jul 8, 2022

Webrevs

Copy link
Member

@dean-long dean-long 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, but I still have a problem with the error message. It seems like we could give a better error message if we detected the missing vectorization support earlier. What do you think?

Copy link

@vnkozlov vnkozlov 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. Thank you for fixing it. I will run testing.

@vnkozlov
Copy link

Failed:

test\micro\org\openjdk\bench\java\lang\Longs.java:148: error: incompatible types: possible lossy conversion from long to int
[2022-07-10T21:01:01,470Z]             int r = Long.reverseBytes(longArraySmall[i]);

@jatin-bhateja
Copy link
Member Author

jatin-bhateja commented Jul 11, 2022

test\micro\org\openjdk\bench\java\lang\Longs.java:148: error: incompatible types: possible lossy conversion from long to in

Looks good to me, but I still have a problem with the error message. It seems like we could give a better error message if we detected the missing vectorization support earlier. What do you think?

Hi @dean-long , Thanks for your comments, error occurs because SLP analysis passes all the checks to enable creation of vector ReverseByte IR, but SLP backend had this case missing due to which some of the IR nodes were vectorized and were feeding into a scalar ReverseByte node, thus while doing a value computation compiler encounters a meet operation b/w vector and scalar lattice. Since its an error related to internals of JIT compiler it will not be adding any value to user and just represent incorrect control path selected by compiler. With this patch we do not hit the trap any more.

@dean-long
Copy link
Member

@jatin-bhateja Right, a better error message wouldn't be a value-add to users, but if we could detect it sooner, like in SuperWord::output(), that might be useful to compiler engineers debugging issues.

@jatin-bhateja
Copy link
Member Author

@jatin-bhateja Right, a better error message wouldn't be a value-add to users, but if we could detect it sooner, like in SuperWord::output(), that might be useful to compiler engineers debugging issues.

Hi @dean-long , Agree, I have changed the error message generated with -XX:+TraceLoopOpts to be more explicit like.
SWPointer::output: Unhandled scalar opcode (ReverseBytesI), ShouldNotReachHere, exiting SuperWord

Since patch already handles the missing scalar case, hence this message will not be generated.

@dean-long
Copy link
Member

@jatin-bhateja OK, thanks.

Copy link

@vnkozlov vnkozlov 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. I submitted testing.

@vnkozlov
Copy link

Tests copyright header validation failed because you forgot , after 2022 year in TestLongVect.java and TestShortVect.java.
Otherwise testing results are good.

@jatin-bhateja
Copy link
Member Author

Thanks, fixed now

Copy link

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Good.

@openjdk
Copy link

openjdk bot commented Jul 13, 2022

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

8288112: C2: Error: ShouldNotReachHere() in Type::typerr()

Reviewed-by: dlong, kvn

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

  • 2bf6285: 8290209: jcup.md missing additional text
  • 73b83e0: 8290207: Missing notice in dom.md
  • ce36f6e: 8290203: ProblemList vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/TestDescription.java on linux-all
  • fff7f35: 8290201: ProblemList com/sun/jdi/InvokeHangTest.java on macosx-x64 in vthread mode
  • 128c6c6: 8290095: java/nio/channels/FileChannel/largeMemory/LargeGatheringWrite.java timed out
  • 59d0c73: 8289930: Improve Thread description of inherited AccessControlContext
  • 4545ed6: 8289365: SegmentAllocator:allocateArray(MemoryLayout, count) does not throw IAEx when count is -1
  • 0fd1b68: 8290071: Javadoc for MemorySegment/MemoryAddress getter/setters contains some typos
  • 2baf526: 8288850: SegmentAllocator:allocate() can return null some cases
  • 3164c98: 8289148: j.l.foreign.VaList::nextVarg call could throw IndexOutOfBoundsException or even crash the VM
  • ... and 9 more: https://git.openjdk.org/jdk19/compare/9981c85d462b1f5a82ebe8b88a1dabf033b4d551...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 Jul 13, 2022
@jatin-bhateja
Copy link
Member Author

jatin-bhateja commented Jul 13, 2022

Hi @dean-long , kindly approve if the patch version looks ok to you.

@jatin-bhateja
Copy link
Member Author

Thanks @vnkozlov @dean-long.

@jatin-bhateja
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jul 14, 2022

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

  • 2bf6285: 8290209: jcup.md missing additional text
  • 73b83e0: 8290207: Missing notice in dom.md
  • ce36f6e: 8290203: ProblemList vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/TestDescription.java on linux-all
  • fff7f35: 8290201: ProblemList com/sun/jdi/InvokeHangTest.java on macosx-x64 in vthread mode
  • 128c6c6: 8290095: java/nio/channels/FileChannel/largeMemory/LargeGatheringWrite.java timed out
  • 59d0c73: 8289930: Improve Thread description of inherited AccessControlContext
  • 4545ed6: 8289365: SegmentAllocator:allocateArray(MemoryLayout, count) does not throw IAEx when count is -1
  • 0fd1b68: 8290071: Javadoc for MemorySegment/MemoryAddress getter/setters contains some typos
  • 2baf526: 8288850: SegmentAllocator:allocate() can return null some cases
  • 3164c98: 8289148: j.l.foreign.VaList::nextVarg call could throw IndexOutOfBoundsException or even crash the VM
  • ... and 9 more: https://git.openjdk.org/jdk19/compare/9981c85d462b1f5a82ebe8b88a1dabf033b4d551...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 14, 2022
@openjdk openjdk bot closed this Jul 14, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 14, 2022
@openjdk
Copy link

openjdk bot commented Jul 14, 2022

@jatin-bhateja Pushed as commit fd89ab8.

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

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