-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8283699: Improve the peephole mechanism of hotspot #8025
Conversation
👋 Welcome back merykitty! A progress list of the required criteria for merging this PR into |
@merykitty The following label will be automatically applied to this pull request:
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. |
Webrevs
|
In case this has not reached the mailing list, may someone take a look at this, please. |
@merykitty This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
src/hotspot/cpu/x86/peephole_x86.cpp
Outdated
|
||
#ifdef COMPILER2 | ||
|
||
#include "opto/peephole.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why opto/peephole.hpp is useful. Why not just include peephole_x86.hpp? Then the empty peephole_.hpp for the other platforms are no longer needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opto/peephole.hpp
is needed from the generated ad_x86_peephole.cpp
so that addI_rRegNode::peephole
can call the helper functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about including peephole_<cpu>.hpp
only when "peepprocedure" is seen, and delete opto/peephole.hpp and empty peephole_<cpu>.hpp
files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think if I include peephole_x86.hpp
in x86_64.ad
in a source hpp block? This will result in the include appearing in ad_x86.hpp
, which will be transitively included in ad_x86_peephole.cpp
. Thanks a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering peephole_x86.cpp
contains only x64-specific code, I had a suggestion to rename it into peephole_x86_64.cpp
and move #ifdef _LP64
into peephole_x86.hpp
to guard x64-specific declarations. But if you intend to include the header directly from x86_64.ad
, you can rename the header to peephole_x86_64.hpp
and get rid of #ifdef _LP64
completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have refactored that and removed opto/peephole.hpp
as well as other peephole headers. peephole_x86.cpp
is also renamed to peephole_x86_64.cpp
. Thanks very much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started build testing. But I can only verify 64-bit.
@merykitty Can you verify 32 build too?
src/hotspot/cpu/x86/x86_64.ad
Outdated
@@ -319,6 +319,12 @@ reg_class int_rdi_reg(RDI); | |||
//----------SOURCE BLOCK------------------------------------------------------- | |||
// This is a block of C++ code which provides values, functions, and | |||
// definitions necessary in the rest of the architecture description | |||
|
|||
source_hpp %{ | |||
#include CPU_HEADER(peephole) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you simply include peephole_x86_64.hpp
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@vnkozlov I saw GHA being happy with x86_32, I also tried cross-compiling locally for 32-bit build. |
Good. My builds in tier1 also passed. I don't have any more comments. |
Thank you very much for your reviews! |
@merykitty This pull request has not yet been marked as ready for integration. |
@vnkozlov Could you reapprove this PR, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good.
Thanks a lot |
@merykitty |
/sponsor |
Going to push as commit 703a6ef.
Your commit was automatically rebased without conflicts. |
@vnkozlov @merykitty Pushed as commit 703a6ef. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi,
The current peephole mechanism has several drawbacks:
The patch proposes to enhance the peephole mechanism by allowing a peep rule to call into a dedicated function, which takes the responsibility to perform all required transformations on the basic block. This allows the peephole mechanism to perform several transformations effectively in a more fine-grain manner.
The patch uses the peephole optimisation to perform some classic peepholes, transforming on x86 the sequences:
and
On the added benchmarks, the transformations show positive results:
A following patch would add IR tests for these transformations since the IR framework has not been able to parse the ideal scheduling yet although printing the scheduling itself has been made possible recently.
Thank you very much.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/8025/head:pull/8025
$ git checkout pull/8025
Update a local copy of the PR:
$ git checkout pull/8025
$ git pull https://git.openjdk.org/jdk pull/8025/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 8025
View PR using the GUI difftool:
$ git pr show -t 8025
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/8025.diff