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

8296602: RISC-V: improve performance of copy_memory stub #11058

Closed
wants to merge 5 commits into from

Conversation

VladimirKempik
Copy link

@VladimirKempik VladimirKempik commented Nov 9, 2022

Please review this change to improve the performance of copy_memory stub on risc-v

This change has three parts

  1. use copy32 if possible to do 4 ld and 4 st per loop cycle
  2. don't produce precopy code if is_aligned is true, it's not executed.
  3. in the end of loop8 and loop32, remove data dependency between two addi opcodes, to allow them to be scheduled simultaneously

testing: org.openjdk.bench.vm.compiler.ArrayCopyObject, hotspot_compiler_arraycopy, hotspot:tier1, hotspot:tier2 - all ok
hotspot:tier2 is on the way.

and for the benchmark results, using
org.openjdk.bench.vm.compiler.ArrayCopyObject.conjoint_micro

thead rvb-ice c910
thead

Before ( copy8 only )
Benchmark (size) Mode Cnt Score Error Units
ArrayCopyObject.conjoint_micro 31 thrpt 25 6653.095 ± 251.565 ops/ms
ArrayCopyObject.conjoint_micro 63 thrpt 25 4933.970 ± 77.559 ops/ms
ArrayCopyObject.conjoint_micro 127 thrpt 25 3627.454 ± 34.589 ops/ms
ArrayCopyObject.conjoint_micro 2047 thrpt 25 368.249 ± 0.453 ops/ms
ArrayCopyObject.conjoint_micro 4095 thrpt 25 187.776 ± 0.306 ops/ms
ArrayCopyObject.conjoint_micro 8191 thrpt 25 94.477 ± 0.340 ops/ms

after ( with copy32 )
ArrayCopyObject.conjoint_micro 31 thrpt 25 7620.546 ± 69.756 ops/ms
ArrayCopyObject.conjoint_micro 63 thrpt 25 6677.978 ± 33.112 ops/ms
ArrayCopyObject.conjoint_micro 127 thrpt 25 5206.973 ± 22.612 ops/ms
ArrayCopyObject.conjoint_micro 2047 thrpt 25 653.655 ± 31.494 ops/ms
ArrayCopyObject.conjoint_micro 4095 thrpt 25 352.905 ± 7.390 ops/ms
ArrayCopyObject.conjoint_micro 8191 thrpt 25 165.127 ± 0.832 ops/ms

after ( copy32 with dead code elimination and independent addis )
ArrayCopyObject.conjoint_micro 31 thrpt 25 7576.346 ? 94.487 ops/ms
ArrayCopyObject.conjoint_micro 63 thrpt 25 6475.730 ? 252.590 ops/ms
ArrayCopyObject.conjoint_micro 127 thrpt 25 5221.764 ? 20.415 ops/ms
ArrayCopyObject.conjoint_micro 2047 thrpt 25 691.847 ? 1.102 ops/ms
ArrayCopyObject.conjoint_micro 4095 thrpt 25 360.269 ? 1.091 ops/ms
ArrayCopyObject.conjoint_micro 8191 thrpt 25 179.733 ? 3.012 ops/ms

on hifive unmatched:

before:
Benchmark (size) Mode Cnt Score Error Units
ArrayCopyObject.conjoint_micro 31 thrpt 25 5391.575 ± 152.984 ops/ms
ArrayCopyObject.conjoint_micro 63 thrpt 25 3700.946 ± 43.175 ops/ms
ArrayCopyObject.conjoint_micro 127 thrpt 25 2316.160 ± 24.734 ops/ms
ArrayCopyObject.conjoint_micro 2047 thrpt 25 188.616 ± 0.151 ops/ms
ArrayCopyObject.conjoint_micro 4095 thrpt 25 95.323 ± 0.053 ops/ms
ArrayCopyObject.conjoint_micro 8191 thrpt 25 46.935 ± 0.041 ops/ms

after:
Benchmark (size) Mode Cnt Score Error Units
ArrayCopyObject.conjoint_micro 31 thrpt 25 6136.169 ± 330.409 ops/ms
ArrayCopyObject.conjoint_micro 63 thrpt 25 4924.020 ± 78.529 ops/ms
ArrayCopyObject.conjoint_micro 127 thrpt 25 3732.561 ± 89.606 ops/ms
ArrayCopyObject.conjoint_micro 2047 thrpt 25 431.103 ± 0.505 ops/ms
ArrayCopyObject.conjoint_micro 4095 thrpt 25 221.543 ± 0.363 ops/ms
ArrayCopyObject.conjoint_micro 8191 thrpt 25 100.586 ± 0.197 ops/ms


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-8296602: RISC-V: improve performance of copy_memory stub

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11058

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 9, 2022

👋 Welcome back vkempik! 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 9, 2022
@openjdk
Copy link

openjdk bot commented Nov 9, 2022

@VladimirKempik 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 Nov 9, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 9, 2022

Webrevs

@VladimirKempik
Copy link
Author

linux -x86 failure is infra issue and unrelated.

Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

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

Nice numbers! Overall looks good to me. Several minor nits.

src/hotspot/cpu/riscv/stubGenerator_riscv.cpp Show resolved Hide resolved
src/hotspot/cpu/riscv/stubGenerator_riscv.cpp Outdated Show resolved Hide resolved
src/hotspot/cpu/riscv/stubGenerator_riscv.cpp Outdated Show resolved Hide resolved
src/hotspot/cpu/riscv/stubGenerator_riscv.cpp Outdated Show resolved Hide resolved
src/hotspot/cpu/riscv/stubGenerator_riscv.cpp Outdated Show resolved Hide resolved
Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

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

Updated change looks good. Thanks.
PS: I think it might be better to rename 'copy8' and 'copy32' into 'copy8_loop' and 'copy32_loop' respectively. But it's up to you.

@openjdk
Copy link

openjdk bot commented Nov 17, 2022

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

8296602: RISC-V: improve performance of copy_memory stub

Reviewed-by: fyang

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

  • 4527dc6: 8297041: Remove the last remnants of sjavac
  • 636040f: 8296405: java/util/concurrent/forkjoin/AsyncShutdownNow.java is too slow
  • 2f728d0: 8295698: AArch64: test/jdk/sun/security/ec/ed/EdDSATest.java failed with -XX:+UseSHA3Intrinsics
  • b9db16a: 8288717: Add a means to close idle connections in HTTP/2 connection pool
  • 9f8b6d2: 8296437: NMT incurs costs if disabled
  • e81359f: 8296170: Refactor stack-locking path in C2_MacroAssembler::fast_unlock()
  • 502fa3e: 8296912: C2: CreateExNode::Identity fails with assert(i < _max) failed: oob: i=1, _max=1
  • 5795c76: 8296222: SwingEventMonitor - installListeners(Component , int ) - CELLEDITOR - bug
  • b9d6e83: 8296906: VMError::controlled_crash crashes with wrong code and address
  • cd9c688: 8276064: CheckCastPP with raw oop input floats below a safepoint
  • ... and 118 more: https://git.openjdk.org/jdk/compare/4a0093ccc4ec2880a789af3a50f30e44b686150e...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, 2022
@VladimirKempik
Copy link
Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 17, 2022

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

  • 4527dc6: 8297041: Remove the last remnants of sjavac
  • 636040f: 8296405: java/util/concurrent/forkjoin/AsyncShutdownNow.java is too slow
  • 2f728d0: 8295698: AArch64: test/jdk/sun/security/ec/ed/EdDSATest.java failed with -XX:+UseSHA3Intrinsics
  • b9db16a: 8288717: Add a means to close idle connections in HTTP/2 connection pool
  • 9f8b6d2: 8296437: NMT incurs costs if disabled
  • e81359f: 8296170: Refactor stack-locking path in C2_MacroAssembler::fast_unlock()
  • 502fa3e: 8296912: C2: CreateExNode::Identity fails with assert(i < _max) failed: oob: i=1, _max=1
  • 5795c76: 8296222: SwingEventMonitor - installListeners(Component , int ) - CELLEDITOR - bug
  • b9d6e83: 8296906: VMError::controlled_crash crashes with wrong code and address
  • cd9c688: 8276064: CheckCastPP with raw oop input floats below a safepoint
  • ... and 118 more: https://git.openjdk.org/jdk/compare/4a0093ccc4ec2880a789af3a50f30e44b686150e...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 17, 2022

@VladimirKempik Pushed as commit bd57e21.

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

@VladimirKempik VladimirKempik deleted the JDK-8296602 branch November 17, 2022 10:30
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
2 participants