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

8299970: Speed up compiler/arraycopy/TestArrayCopyConjoint.java #12475

Closed
wants to merge 3 commits into from

Conversation

eme64
Copy link
Contributor

@eme64 eme64 commented Feb 8, 2023

I lowered the iteration count from 1000_000 (million) down to 30_000 (30k). I also removed a try-catch statement that seems to serve no purpose, but may actually prevent us from detecting failures of the test.

Per @run statement, I got the runtime down from about 4-4.5 sec to 1-1.3 sec (3-4x speedup).

Details
I ran the test with -XX:+PrintCompilation -XX:+PrintInlining -XX:-TieredCompilation -XX:CICompilerCount=1 -Xbatch, and then analyzed the output with this cat txt.txt | sed -n -e "s/.*java.lang.System::\(\w*\).*intrinsic.*/\1/p" | sort | uniq -c, which gives me the count for the arraycopy intrinsification. For 1000_000 and 30_000 iterations I got 336 intrinisifications, so I am not losing any. I also tried to lower the iterations further down to 10_000, but that did only marginally lower the runtime, to 1 sec, but with much less intrinsifications, only 144. So I decided to stay at 30k.

If this fix does not turn out to be sufficient, we can try an IR test, and trigger compilation of the test methods after a much smaller iteration count for warmup (after all we want to make sure intrinsification happens), and then verify that the intrinsic is in the IR.

Update
I applied the same changes to compiler/arraycopy/TestArrayCopyDisjoint.java, verified that no intrinsification was lost. Marginal speedup from 1 sec down to 0.7 sec per run statement.


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-8299970: Speed up compiler/arraycopy/TestArrayCopyConjoint.java

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12475

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 8, 2023

👋 Welcome back epeter! 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
Copy link

openjdk bot commented Feb 8, 2023

@eme64 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 Feb 8, 2023
@eme64 eme64 marked this pull request as ready for review February 8, 2023 14:47
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 8, 2023
@mlbridge
Copy link

mlbridge bot commented Feb 8, 2023

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

@openjdk
Copy link

openjdk bot commented Feb 8, 2023

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

8299970: Speed up compiler/arraycopy/TestArrayCopyConjoint.java

Reviewed-by: chagedorn, kvn, thartmann

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

  • d1c87a0: 8302203: IR framework should detect non-compilable test methods early
  • 1fec6b5: 8301852: RISC-V: Optimize class atomic when order is memory_order_relaxed
  • 7c233bc: 8302114: RISC-V: Several foreign jtreg tests fail with debug build after JDK-8301818
  • 8049e59: 8301833: Add wide-ranging tests for FDLIBM porting
  • 6a44120: 8301269: Update Commons BCEL to Version 6.7.0
  • 6f9f2b5: 8301737: java/rmi/server/UnicastRemoteObject/serialFilter/FilterUROTest.java fail with -Xcomp
  • 1ef9f65: 8302172: [JVMCI] HotSpotResolvedJavaMethodImpl.canBeInlined must respect ForceInline
  • 74b167b: 8301819: Enable continuations code by default
  • 919a6da: 8301202: Port fdlibm log to Java
  • 98e98e9: 8296322: javac: use methods to manage parser mode flags
  • ... and 50 more: https://git.openjdk.org/jdk/compare/3db352d003c5996a5f86f0f465adf86326f7e1fe...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 Feb 8, 2023
Comment on lines -267 to -268
} catch (Exception e) {
System.out.println(e.getMessage());
Copy link
Contributor

Choose a reason for hiding this comment

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

try/catch is there because arraycopy may throw exception due to some mess up in code generation and we want call stack and information about that to debug the issue.

Copy link
Member

Choose a reason for hiding this comment

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

But with that try/catch, no exception will be thrown and therefore the test would pass, right? And the exception would contain a stack trace, no need to catch it and print its contents.

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right. In this case, please also update TestArrayCopyDisjoint.java test.
It could be "copy/paste" issue when these tests were created based on other existing tests.
May be in separate RFE we should review tests which use catch and may hide a failure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the idea, I applied it to TestArrayCopyDisjoint.java, and updated the description above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eme64 eme64 requested review from TobiHartmann and vnkozlov and removed request for TobiHartmann and vnkozlov February 9, 2023 11:59
Copy link
Contributor

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

Copy link
Member

@TobiHartmann TobiHartmann 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 too.

@eme64
Copy link
Contributor Author

eme64 commented Feb 13, 2023

Thanks @TobiHartmann @vnkozlov @chhagedorn for the reviews!
/integrate

@openjdk
Copy link

openjdk bot commented Feb 13, 2023

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

  • d1c87a0: 8302203: IR framework should detect non-compilable test methods early
  • 1fec6b5: 8301852: RISC-V: Optimize class atomic when order is memory_order_relaxed
  • 7c233bc: 8302114: RISC-V: Several foreign jtreg tests fail with debug build after JDK-8301818
  • 8049e59: 8301833: Add wide-ranging tests for FDLIBM porting
  • 6a44120: 8301269: Update Commons BCEL to Version 6.7.0
  • 6f9f2b5: 8301737: java/rmi/server/UnicastRemoteObject/serialFilter/FilterUROTest.java fail with -Xcomp
  • 1ef9f65: 8302172: [JVMCI] HotSpotResolvedJavaMethodImpl.canBeInlined must respect ForceInline
  • 74b167b: 8301819: Enable continuations code by default
  • 919a6da: 8301202: Port fdlibm log to Java
  • 98e98e9: 8296322: javac: use methods to manage parser mode flags
  • ... and 50 more: https://git.openjdk.org/jdk/compare/3db352d003c5996a5f86f0f465adf86326f7e1fe...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 13, 2023

@eme64 Pushed as commit 5d39d14.

💡 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-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants