Skip to content

8266962: Add arch supporting check for "Op_VectorLoadConst" before creating the node #4023

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

Closed
wants to merge 1 commit into from

Conversation

XiaohongGong
Copy link

@XiaohongGong XiaohongGong commented May 14, 2021

When creating the vector shuffle, the "VectorLoadConstNode" will be created to get an initial index vector. Before creating it, the compiler should check whether the current platform supports this opcode in case the jvm crashes with "bad ad file". The compiler should finish the intrinsification and go back to the default java implementation if the backend doesn't support it.

Tested tier1 and jdk::tier3.


Progress

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

Issue

  • JDK-8266962: Add arch supporting check for "Op_VectorLoadConst" before creating the node

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4023

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented May 14, 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 14, 2021
@openjdk
Copy link

openjdk bot commented May 14, 2021

@XiaohongGong 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 openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label May 14, 2021
@mlbridge
Copy link

mlbridge bot commented May 14, 2021

Webrevs

Copy link
Contributor

@iwanowww iwanowww left a comment

Choose a reason for hiding this comment

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

The fix makes perfect sense, but I'm curious why do we have VectorLoadConst in the first place.

It exposes JVM support for the iota vector constant materialization, but it's not clear to me what benefits it brings compared to feeding the intrinsic with the vector materialized on JDK side.

@openjdk
Copy link

openjdk bot commented May 14, 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:

8266962: Add arch supporting check for "Op_VectorLoadConst" before creating the node

Reviewed-by: vlivanov, 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 72 new commits pushed to the master branch:

  • 894547d: 8266897: com/sun/net/httpserver/FilterTest.java fails intermittently with AssertionError
  • da7c846: 8264408: test_oopStorage no longer needs to disable some tests on WIN32
  • f6c2891: 8267229: Split runtime/Metaspace/elastic test configurations for better scalability
  • b60975d: 8267237: ARM32: bad AD file in matcher.cpp after 8266810
  • 905b41a: 8265711: C1: Intrinsify Class.getModifier method
  • 554caf3: 8251392: Consolidate Metaspace Statistics
  • 3e97b07: 8267116: Lanai: Incorrect AlphaComposite for VolatileImage graphics
  • cd1c17c: 8266404: Fatal error report generated with -XX:+CrashOnOutOfMemoryError should not contain suggestion to submit a bug report
  • 2effdd1: 8267112: JVMCI compiler modules should be kept upgradable
  • da4dfde: 8264777: Overload optimized FileInputStream::readAllBytes
  • ... and 62 more: https://git.openjdk.java.net/jdk/compare/06d760283344a1d0fd510aed306e0efb76b51617...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.

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 (@iwanowww, @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 May 14, 2021
@XiaohongGong
Copy link
Author

The fix makes perfect sense, but I'm curious why do we have VectorLoadConst in the first place.

It exposes JVM support for the iota vector constant materialization, but it's not clear to me what benefits it brings compared to feeding the intrinsic with the vector materialized on JDK side.

Thanks for looking at this PR @iwanowww ! As far as I know the VectorLoadConst is used here to get the initial shuffle iota of the vector. I'm not so clear about what the iota vector constant materialization you mean. Could you please elaborate more about it? Thanks so much!

@XiaohongGong
Copy link
Author

/integrate

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

openjdk bot commented May 18, 2021

@XiaohongGong
Your change (at version 8e8a6e8) 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.

@iwanowww
Copy link
Contributor

As far as I know the VectorLoadConst is used here to get the initial shuffle iota of the vector. I'm not so clear about what the iota vector constant materialization you mean.

VectorLoadConst is backed by a constant in StubRoutines. Instead, the constant can be materialized as a on-heap ByteVector instance, cached in a static final field, and passed into the intrinsic.

An alternative approach would be to replace VectorLoadConst with a LoadVector which performs raw vector access at StubRoutines::_vector_iota_indices address.

All in all, I don't see VectorLoadConst well-justified.

src/hotspot/cpu/aarch64/aarch64_neon.ad:

  3369 instruct loadcon8B(vecD dst, immI0 src)
  3374   match(Set dst (VectorLoadConst src));
  3378     __ lea(rscratch1, ExternalAddress(StubRoutines::aarch64::vector_iota_indices()));


src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp:

  7055     StubRoutines::aarch64::_vector_iota_indices    = generate_iota_indices("iota_indices");

   618   // Generate indices for iota vector.
   619   address generate_iota_indices(const char *stub_name) {
   620     __ align(CodeEntryAlignment);
   621     StubCodeMark mark(this, "StubRoutines", stub_name);
   622     address start = __ pc();
   623     __ emit_data64(0x0706050403020100, relocInfo::none);
   624     __ emit_data64(0x0F0E0D0C0B0A0908, relocInfo::none);
   625     return start;
   626   }

@XiaohongGong
Copy link
Author

As far as I know the VectorLoadConst is used here to get the initial shuffle iota of the vector. I'm not so clear about what the iota vector constant materialization you mean.

VectorLoadConst is backed by a constant in StubRoutines. Instead, the constant can be materialized as a on-heap ByteVector instance, cached in a static final field, and passed into the intrinsic.

An alternative approach would be to replace VectorLoadConst with a LoadVector which performs raw vector access at StubRoutines::_vector_iota_indices address.

All in all, I don't see VectorLoadConst well-justified.

src/hotspot/cpu/aarch64/aarch64_neon.ad:

  3369 instruct loadcon8B(vecD dst, immI0 src)
  3374   match(Set dst (VectorLoadConst src));
  3378     __ lea(rscratch1, ExternalAddress(StubRoutines::aarch64::vector_iota_indices()));


src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp:

  7055     StubRoutines::aarch64::_vector_iota_indices    = generate_iota_indices("iota_indices");

   618   // Generate indices for iota vector.
   619   address generate_iota_indices(const char *stub_name) {
   620     __ align(CodeEntryAlignment);
   621     StubCodeMark mark(this, "StubRoutines", stub_name);
   622     address start = __ pc();
   623     __ emit_data64(0x0706050403020100, relocInfo::none);
   624     __ emit_data64(0x0F0E0D0C0B0A0908, relocInfo::none);
   625     return start;
   626   }

Thanks for your explanation! Yes, currently VectorLoadConst is implemented by loading the constant in StubRoutines. And the alternative way that passing a static final instance (like ByteMaxShuffle.IOTA) to the intrinisc makes sense to me. Maybe we can revisit it as a kind of optimization in future? Thanks!

@iwanowww
Copy link
Contributor

Maybe we can revisit it as a kind of optimization in future?

Sure. Please, file an RFE.

@XiaohongGong
Copy link
Author

Maybe we can revisit it as a kind of optimization in future?

Sure. Please, file an RFE.

Sure, please see: https://bugs.openjdk.java.net/browse/JDK-8267366. Thanks!

@nsjian
Copy link

nsjian commented May 19, 2021

/sponsor

@openjdk openjdk bot closed this May 19, 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 May 19, 2021
@openjdk
Copy link

openjdk bot commented May 19, 2021

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

  • 4954383: 8267364: Remove mask.incr which is introduced by JDK-8256973
  • c2b50f9: 8266480: Implicit null check optimization does not update control of hoisted memory operation
  • 3f883e8: 8267351: runtime/cds/SharedBaseAddress.java fails on x86_32 due to Unrecognized VM option 'UseCompressedOops'
  • 7aa6568: 8256973: Intrinsic creation for VectorMask query (lastTrue,firstTrue,trueCount) APIs
  • 65a8bf5: 8265126: [REDO] unified handling for VectorMask object re-materialization during de-optimization
  • ff84577: 8267098: AArch64: C1 StubFrames end confusingly
  • 0daec49: 8267246: -XX:MaxRAMPercentage=0 is unreasonable for jtreg tests on many-core machines
  • 324defe: 8267212: test/jdk/java/util/Collections/FindSubList.java intermittent crash with "no reachable node should have no use"
  • bdbe23b: 8265462: Handle multiple slots in the NSS Internal Module from SunPKCS11's Secmod
  • 10236e7: 8263242: serviceability/sa/ClhsdbFindPC.java cannot find MaxJNILocalCapacity with ASLR
  • ... and 79 more: https://git.openjdk.java.net/jdk/compare/06d760283344a1d0fd510aed306e0efb76b51617...master

Your commit was automatically rebased without conflicts.

Pushed as commit 2563a6a.

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

@XiaohongGong XiaohongGong deleted the JDK-8266962 branch May 19, 2021 07:54
@XiaohongGong XiaohongGong restored the JDK-8266962 branch May 19, 2021 07:54
@XiaohongGong XiaohongGong deleted the JDK-8266962 branch May 19, 2021 07:54
@XiaohongGong XiaohongGong restored the JDK-8266962 branch May 19, 2021 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants