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

8329254: optimize integral reverse operations on x86 GFNI target. #18530

Closed
wants to merge 2 commits into from

Conversation

jatin-bhateja
Copy link
Member

@jatin-bhateja jatin-bhateja commented Mar 28, 2024

  • Efficient GFNI based instruction sequence to compute integral reverse operation was added along with JEP-426 (VectorAPI 4th Incubation). https://bugs.openjdk.org/browse/JDK-8284960

  • However, the CPUID based feature detection for GFNI was incorrectly performed under AVX512 check, fixing it shows roughly 2X performance improvement for Integer/Long.reverse APIs on E-core targets (MTL+).

BaseLine:
Benchmark              (size)  Mode  Cnt  Score   Error  Units
Integers.reverse          500  avgt    2  0.120          us/op
Longs.reverse             500  avgt    2  0.221          us/op

Withopt:
Benchmark              (size)  Mode  Cnt  Score   Error  Units
Integers.reverse          500  avgt    2  0.050          us/op
Longs.reverse             500  avgt    2  0.086          us/op

Kindly review.

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-8329254: optimize integral reverse operations on x86 GFNI target. (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 18530

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 28, 2024

👋 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
Copy link

openjdk bot commented Mar 28, 2024

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

8329254: optimize integral reverse operations on x86 GFNI target.

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

  • 70944ca: 8330033: com/sun/net/httpserver/bugs/B6431193.java fails in AssertionError after JDK-8326568
  • 279ed0d: 8329961: Buffer overflow in os::Linux::kernel_version
  • 9731b1c: 8327137: Add test for ConcurrentModificationException in BasicDirectoryModel
  • c5150c7: 8309751: Duplicate constant pool entries added during default method processing
  • 86cb767: 8326568: jdk/test/com/sun/net/httpserver/bugs/B6431193.java should use try-with-resource and try-finally
  • b49ba42: 8330002: Remove redundant public keyword in BarrierSet
  • dd6e453: 8329767: G1: Move G1BlockOffsetTable::set_for_starts_humongous to HeapRegion
  • e0fd6c4: 8329545: [s390x] Fix garbage value being passed in Argument Register
  • 51ed69a: 8327621: Check return value of uname in os::get_host_name
  • bea9acc: 8328482: Convert and Open source few manual applet test to main based
  • ... and 163 more: https://git.openjdk.org/jdk/compare/4fa77a2ad47a1a7c4064462c5c36e7710ec72549...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.

@jatin-bhateja
Copy link
Member Author

/label add hotspot-compiler-dev

@openjdk openjdk bot added rfr Pull request is ready for review hotspot-compiler hotspot-compiler-dev@openjdk.org labels Mar 28, 2024
@openjdk
Copy link

openjdk bot commented Mar 28, 2024

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

@mlbridge
Copy link

mlbridge bot commented Mar 28, 2024

Webrevs

@sviswa7
Copy link

sviswa7 commented Apr 9, 2024

@jatin-bhateja Thanks a lot for putting this PR together. The register class for the following two instructs in x86_64.ad also need change:
From:
instruct bytes_reversebit_int_gfni(rRegI dst, rRegI src, regF xtmp1, regF xtmp2, rRegL rtmp, rFlagsReg cr)
instruct bytes_reversebit_long_gfni(rRegL dst, rRegL src, regD xtmp1, regD xtmp2, rRegL rtmp, rFlagsReg cr)

To:
instruct bytes_reversebit_int_gfni(rRegI dst, rRegI src, vlRegF xtmp1, vlRegF xtmp2, rRegL rtmp, rFlagsReg cr)
instruct bytes_reversebit_long_gfni(rRegL dst, rRegL src, vlRegD xtmp1, vlRegD xtmp2, rRegL rtmp, rFlagsReg cr)

@jatin-bhateja
Copy link
Member Author

jatin-bhateja commented Apr 10, 2024

@jatin-bhateja Thanks a lot for putting this PR together. The register class for the following two instructs in x86_64.ad also need change: From: instruct bytes_reversebit_int_gfni(rRegI dst, rRegI src, regF xtmp1, regF xtmp2, rRegL rtmp, rFlagsReg cr) instruct bytes_reversebit_long_gfni(rRegL dst, rRegL src, regD xtmp1, regD xtmp2, rRegL rtmp, rFlagsReg cr)

To: instruct bytes_reversebit_int_gfni(rRegI dst, rRegI src, vlRegF xtmp1, vlRegF xtmp2, rRegL rtmp, rFlagsReg cr) instruct bytes_reversebit_long_gfni(rRegL dst, rRegL src, vlRegD xtmp1, vlRegD xtmp2, rRegL rtmp, rFlagsReg cr)

Hi @sviswa7 , GFNI is supported on Icelake+ CPUs, with regD/F register classes we select entire range of registers xmm1-31 on AVX512 targets which gives freedom to assembler to auto-promote instruction to EVEX encoding if allocator assigned a register from higher register bank, in this case since instruction operands are 128 bit registers, in principle an autopromotion on AVX512 target will only be feasible if target support VL, but given that all AVX512 GFNI targets support vector length orthogonality hence we should be good to go.
For non AVX512 targets with GFNI we anyways deal with lower register bank.

I still agree that it's good to be strict than keeping loose ends, given that cloud instances can be tuned to enable custom feature sets.

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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 10, 2024
@jatin-bhateja
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Apr 11, 2024

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

  • d9c84e7: 8329656: assertion failed in MAP_ARCHIVE_MMAP_FAILURE path: Invalid immediate -5 0
  • 5e544f1: 8329491: GetThreadListStackTraces function should use JvmtiHandshake
  • 643dd48: 8329432: PopFrame and ForceEarlyReturn functions should use JvmtiHandshake
  • 70944ca: 8330033: com/sun/net/httpserver/bugs/B6431193.java fails in AssertionError after JDK-8326568
  • 279ed0d: 8329961: Buffer overflow in os::Linux::kernel_version
  • 9731b1c: 8327137: Add test for ConcurrentModificationException in BasicDirectoryModel
  • c5150c7: 8309751: Duplicate constant pool entries added during default method processing
  • 86cb767: 8326568: jdk/test/com/sun/net/httpserver/bugs/B6431193.java should use try-with-resource and try-finally
  • b49ba42: 8330002: Remove redundant public keyword in BarrierSet
  • dd6e453: 8329767: G1: Move G1BlockOffsetTable::set_for_starts_humongous to HeapRegion
  • ... and 166 more: https://git.openjdk.org/jdk/compare/4fa77a2ad47a1a7c4064462c5c36e7710ec72549...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Apr 11, 2024

@jatin-bhateja Pushed as commit b04b304.

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

2 participants