jdk
jdk copied to clipboard
8332163: C2 SuperWord: refactor PacksetGraph and SuperWord::output into VTransformGraph
The original PR was here, it got too chaotic.
I added some extra tests for this in: https://github.com/openjdk/jdk/pull/19558 I extracted some refactorings to: https://github.com/openjdk/jdk/pull/19573
We used to have:
PacksetGraph: this detects cycles introduces by packs, and schedules/reorders the memops.SuperWord::apply_vectorization: createsVectorNodesdirectly from thePackSet.
In my blog, I have published lots of ideas for SuperWord / AutoVectorization improvements: https://eme64.github.io/blog/2023/11/03/C2-AutoVectorizer-Improvement-Ideas.html
Many ideas are based on the "VectorTransform IR": cost-model, if-conversion, direct widening of scalars to vectors, additional optimizations/features with shuffle/pack/extract, handling more reduction patterns, etc.
I now decided to name it VTransform, which is essencially a graph VtransformGraph of nodes VTransformNodes that resemble the C2 Node on purpose, because the VTransform models the C2 graph after vectorization. We can now model the transformation from scalar-loop to vectorized-loop without modifying the C2 graph yet.
The new code has these steps:
- Given the
PackSetfromSuperWord, we create aVTransformGraphwithSuperWordVTransformBuilder. - [Not yet: all sorts of optimizations / checks on the
VTransformGraph, in future RFE's] - We then schedule the
VTransformGraph, and check for cycles. - Once we are ready to commit to vectorization, we call
VTransformGraph::apply_vectorizationwhich lets each individualVTransformNode::applygenerate the new vectorized C2 nodes.
Testing
Regression testing passed.
Performance testing: no significant change in performance (as expected).
Progress
- [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
Issue
- JDK-8332163: C2 SuperWord: refactor PacksetGraph and SuperWord::output into VTransformGraph (Enhancement - P4)
Reviewers
- Vladimir Kozlov (@vnkozlov - Reviewer) 🔄 Re-review required (review applies to be2ea66c)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19719/head:pull/19719
$ git checkout pull/19719
Update a local copy of the PR:
$ git checkout pull/19719
$ git pull https://git.openjdk.org/jdk.git pull/19719/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19719
View PR using the GUI difftool:
$ git pr show -t 19719
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19719.diff
Webrev
:wave: 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.
@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:
8332163: C2 SuperWord: refactor PacksetGraph and SuperWord::output into VTransformGraph
Reviewed-by: chagedorn, kvn
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 2 new commits pushed to the master branch:
- ced99066354fc6a32c587b9e3c35b07e26d3452e: 8334371: [AIX] Beginning with AIX 7.3 TL1 mmap() supports 64K memory pages
- 916db07e533cdc0fca2010751f7ebe54e6ada7b9: 8335532: [JVMCI] Export VM_Version::L1_line_size in JVMCI
Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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.
@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.
Webrevs
- 15: Full - Incremental (148dd7b2)
- 14: Full - Incremental (18f95141)
- 13: Full - Incremental (c813a989)
- 12: Full - Incremental (f9638f80)
- 11: Full - Incremental (40c4db59)
- 10: Full - Incremental (303f2be1)
- 09: Full - Incremental (df175764)
- 08: Full - Incremental (52f296f4)
- 07: Full - Incremental (66fd19e8)
- 06: Full - Incremental (216932b1)
- 05: Full - Incremental (918b989b)
- 04: Full - Incremental (7e64e7e5)
- 03: Full - Incremental (b7c71935)
- 02: Full - Incremental (d0658cbc)
- 01: Full - Incremental (6dec7032)
- 00: Full (be2ea66c)
@chhagedorn thank you for the many suggestions, I will look into them now :)
@chhagedorn thanks again for all the review comments! I now addressed everything, except for the complaint that I repeatedly used _vtransform.arena(). But I don't know any better alternative. Your suggestion of using a _arena field in the SuperWordVTransformBuilder is not a great idea, because it suggests that this _arena has the life-time of the builder. But it should be the life-time of the vtransform, which outlives the builder. So it would have to be a _vtransform_arena field, at which point I might as well use _vtransform.arena() as it is now. Let me know if you have any better idea.
And please re-review ;)
@chhagedorn thanks for another round of reviews. I think I addressed all your comments :)
@chhagedorn thanks for the review, I added your suggestions!
Thanks @chhagedorn for the very in-depth and very helpful reviews and suggestions! Thanks @vnkozlov for reviewing too! /integrate
Going to push as commit 02956ab6e161ca8556a73f328f79bcbfba997cbc.
Since your change was applied there have been 20 commits pushed to the master branch:
- 3f37c5718d676b7001e6a084aed3ba645745a144: 8335806: RISC-V: Corrected typos Bizarrely
- 6f7f0f1de05fdc0f6a88ccd90b806e8a5c5074ef: 8333884: MemorySegment::reinterpret removes read-only property
- b83766e59063a41ea8801ac9e7c15dce67727c62: 8335632: jdk/jfr/api/consumer/streaming/TestJVMExit.java failed with "Process [...] is no longer alive"
- 7efe16038e5df9894a265ea1214068060f595c4e: 8335730: JFR: Clean up jdk.jfr
- ff49f677ee5017019c90823bc412ceb90068ffbd: 8335775: Remove extraneous 's' in comment of rawmonitor.cpp test file
- 194425d7875ef42fce52516ed59c81ee97720399: 8335645: j.u.Formatter#trailingZeros improved with String repeat
- c8acea87e2c5ba6672c011ec4e57a53c55fee74b: 8335706: G1: Remove unused G1ConcurrentRefine::RemSetSamplingClosure::_cset
- bdf470b3b8f8814cb29f2877490d5bc1e79bdecb: 8335742: Problemlist gc/g1/TestMixedGCLiveThreshold.java#25percent with virtual threads
- 6409ec336af647044d0746c219496ad070de5e9d: 8335711: G1: Remove unused bot_updates argument in G1AllocRegion constructor
- 4ec1ae109710aa150e27acf5706475d335c4655c: 8331385: G1: Prefix HeapRegion helper classes with G1
- ... and 10 more: https://git.openjdk.org/jdk/compare/c0604fb823d9f3b2e347a9857b11606b223ad8ec...master
Your commit was automatically rebased without conflicts.
@eme64 Pushed as commit 02956ab6e161ca8556a73f328f79bcbfba997cbc.
:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.