8290034: Auto vectorize reverse bit operations.#9535
8290034: Auto vectorize reverse bit operations.#9535jatin-bhateja wants to merge 4 commits intoopenjdk:masterfrom
Conversation
|
/label add hotspot-compiler-dev |
|
👋 Welcome back jbhateja! A progress list of the required criteria for merging this PR into |
|
@jatin-bhateja |
Webrevs
|
XiaohongGong
left a comment
There was a problem hiding this comment.
Common codes looks good to me. Just some style issues.
src/hotspot/share/opto/subnode.cpp
Outdated
| } | ||
| const TypeInt* t1int = t1->isa_int(); | ||
| if (t1int && t1int->is_con()) { | ||
| jint res = reverse_bits(t1int->get_con()); |
There was a problem hiding this comment.
There is one more space between res = reverse_bits
| } | ||
|
|
||
| const Type* ReverseLNode::Value(PhaseGVN* phase) const { | ||
| const Type *t1 = phase->type( in(1) ); |
There was a problem hiding this comment.
The same with "ReverseINode::Value"
src/hotspot/share/opto/subnode.cpp
Outdated
| } | ||
| const TypeLong* t1long = t1->isa_long(); | ||
| if (t1long->is_con()) { | ||
| jint res = reverse_bits(t1long->get_con()); |
vnkozlov
left a comment
There was a problem hiding this comment.
Looks good. I submitted testing.
|
@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: 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 6 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
|
/integrate |
|
Going to push as commit 5d82d67.
Your commit was automatically rebased without conflicts. |
|
@jatin-bhateja Pushed as commit 5d82d67. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
| return TypeF::make( (float)sqrt( (double)f ) ); | ||
| } | ||
|
|
||
| static jlong reverse_bits(jlong val) { |
There was a problem hiding this comment.
This function is wrong and/or misnamed.
It should be called reverse_bits_in_bytes.
| } | ||
| const TypeInt* t1int = t1->isa_int(); | ||
| if (t1int && t1int->is_con()) { | ||
| jint res = reverse_bits(t1int->get_con()); |
There was a problem hiding this comment.
This is clearly wrong, if I understand correctly that ReverseI is an intrinsic for Integer::reverse, which reverses not only bits in bytes but also the bytes themselves.
Also, it seems noxious (IIUC) because it widens t1int's con to 64 bits with sign extension, does some sort of 64-bit reversal operation, and then chops off the high order bits assigning to res.
The root cause here is that reverse_bits should be properly factored out and maintained in its own modular header file, akin to utilities/powerOfTwo.hpp. I suggest utilities/moveBits.hpp, to hold bits-in-bytes reversal, byte reversal, full reversal, compress/expand (with which it should be grouped) and who knows what other future permutations.
I say it's a root cause in that something randomly coded in the bowels of subnode.cpp cannot be properly reviewed in isolation, especially if it is misnamed.
Also, the nearly identical use of the HD algorithm in code/compressedStream.cpp should use the new version in the header file.
The new hand-written assembly code for this changeset should refer the reader to utilities/moveBits.hpp as well.
Summary of changes:
Following are performance number for newly added JMH mocro benchmarks:-
Kindly review and share feedback.
Best Regards,
Jatin
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9535/head:pull/9535$ git checkout pull/9535Update a local copy of the PR:
$ git checkout pull/9535$ git pull https://git.openjdk.org/jdk pull/9535/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9535View PR using the GUI difftool:
$ git pr show -t 9535Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9535.diff