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

8329273: C2 SuperWord: Some basic MemorySegment IR tests #18535

Closed
wants to merge 28 commits into from

Conversation

eme64
Copy link
Contributor

@eme64 eme64 commented Mar 28, 2024

I could not find any IR vectorization tests for MemorySegment yet.

I make sure to exercise different backing types:

  • arrays
  • buffers
  • native memory

I filed a follow-up RFE, to eventually make all cases where I have "FAILS" vectorize:

JDK-8331659: C2 SuperWord: investicate failed vectorization in compiler/loopopts/superword/TestMemorySegment.java


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-8329273: C2 SuperWord: Some basic MemorySegment IR tests (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 18535

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 28, 2024

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

@openjdk
Copy link

openjdk bot commented Mar 28, 2024

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

8329273: C2 SuperWord: Some basic MemorySegment IR tests

Reviewed-by: kvn, chagedorn

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 1 new commit pushed to the master branch:

  • 3e3f7cf: 8330387: Crash with a different types patterns (primitive vs generic) in instanceof

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.

@openjdk openjdk bot changed the title 8329273 8329273: C2 SuperWord: some basic MemorySegment IR tests Mar 28, 2024
@openjdk
Copy link

openjdk bot commented Mar 28, 2024

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

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Mar 28, 2024
@openjdk openjdk bot changed the title 8329273: C2 SuperWord: some basic MemorySegment IR tests 8329273: C2 SuperWord: Some basic MemorySegment IR tests Apr 10, 2024
@eme64 eme64 marked this pull request as ready for review May 3, 2024 14:18
@bridgekeeper
Copy link

bridgekeeper bot commented May 3, 2024

@eme64 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!

@openjdk openjdk bot added the rfr Pull request is ready for review label May 6, 2024
@mlbridge
Copy link

mlbridge bot commented May 6, 2024

Webrevs

Copy link
Contributor

@vnkozlov vnkozlov 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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 6, 2024
Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

Good basic tests! I have a few minor comments but otherwise, looks good.


/*
* @test id=byte-array
* @bug 8310190
Copy link
Member

@chhagedorn chhagedorn May 13, 2024

Choose a reason for hiding this comment

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

Should be updated to 8329273. Same for other runs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch!

Comment on lines 163 to 181
static {
String providerName = System.getProperty("memorySegmentProviderNameForTestVM");
provider = switch (providerName) {
case "ByteArray" -> ( () -> { return newMemorySegmentOfByteArray(); } );
case "CharArray" -> ( () -> { return newMemorySegmentOfCharArray(); } );
case "ShortArray" -> ( () -> { return newMemorySegmentOfShortArray(); } );
case "IntArray" -> ( () -> { return newMemorySegmentOfIntArray(); } );
case "LongArray" -> ( () -> { return newMemorySegmentOfLongArray(); } );
case "FloatArray" -> ( () -> { return newMemorySegmentOfFloatArray(); } );
case "DoubleArray" -> ( () -> { return newMemorySegmentOfDoubleArray(); } );
case "ByteBuffer" -> ( () -> { return newMemorySegmentOfByteBuffer(); } );
case "ByteBufferDirect" -> ( () -> { return newMemorySegmentOfByteBufferDirect(); } );
case "Native" -> ( () -> { return newMemorySegmentOfNative(); } );
case "MixedArray" -> ( () -> { return newMemorySegmentOfMixedArray(); } );
case "MixedBuffer" -> ( () -> { return newMemorySegmentOfMixedBuffer(); } );
case "Mixed" -> ( () -> { return newMemorySegmentOfMixed(); } );
default -> throw new RuntimeException("Test argument not recognized: " + providerName);
};
}
Copy link
Member

Choose a reason for hiding this comment

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

As discussed offline, this is an interesting workaround. Maybe the IR framework could be extended at some point to simplify this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would be nice!

Comment on lines +445 to +447
@IR(counts = {IRNode.LOAD_VECTOR_B, "= 0",
IRNode.ADD_VB, "= 0",
IRNode.STORE_VECTOR, "= 0"},
Copy link
Member

Choose a reason for hiding this comment

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

You should use failOn instead of = 0. Same for other tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I honestly prefer "= 0", because it is easier to flip to "> 0", and keeps the same style that way. But I guess that is really a matter of taste.

static {
String providerName = System.getProperty("memorySegmentProviderNameForTestVM");
provider = switch (providerName) {
case "ByteArray" -> ( () -> { return newMemorySegmentOfByteArray(); } );
Copy link
Member

Choose a reason for hiding this comment

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

You can directly use an expression lambda without return:

case "ByteArray"        -> (() -> newMemorySegmentOfByteArray());

But I think you can go even further and directly use a method reference:

Suggested change
case "ByteArray" -> ( () -> { return newMemorySegmentOfByteArray(); } );
case "ByteArray" -> (TestMemorySegmentImpl::newMemorySegmentOfByteArray);

Same for others.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, great idea!

Comment on lines 197 to 199
tests.put("testMemorySegmentBadExitCheck", () -> {
return testMemorySegmentBadExitCheck(copy(a));
});
Copy link
Member

Choose a reason for hiding this comment

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

Same as above, you can replace this with an expression lambda:

Suggested change
tests.put("testMemorySegmentBadExitCheck", () -> {
return testMemorySegmentBadExitCheck(copy(a));
});
tests.put("testIntLoop_longIndex_intInvar_sameAdr_byte",
() -> testIntLoop_longIndex_intInvar_sameAdr_byte(copy(a), 0));

Same for others.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice idea!

eme64 and others added 3 commits May 13, 2024 09:14
Co-authored-by: Christian Hagedorn <christian.hagedorn@oracle.com>
@openjdk
Copy link

openjdk bot commented May 13, 2024

⚠️ @eme64 This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

Updates look good, thanks!

@eme64
Copy link
Contributor Author

eme64 commented May 15, 2024

Thanks for the reviews @vnkozlov @chhagedorn !
/integrate

@openjdk
Copy link

openjdk bot commented May 15, 2024

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

  • 8032d64: 8332245: C2: missing record_for_ign() call in GraphKit::must_be_not_null()
  • fa043ae: 8294880: Review running time of jdk/internal/shellsupport/doc/JavadocHelperTest.java
  • a5005c8: 8330814: Cleanups for KeepAliveCache tests
  • 1a94447: 8332111: [BACKOUT] A way to align already compiled methods with compiler directives
  • 957eb61: 8331429: [JVMCI] Cleanup JVMCIRuntime allocation routines
  • 2f10a31: 8302850: Implement C1 clone intrinsic that reuses arraycopy code for primitive arrays
  • c642f44: 8329839: Cleanup ZPhysicalMemoryBacking trace logging
  • d04ac14: 8332236: javac crashes with module imports and implicitly declared class
  • 4e77cf8: 8330795: C2: assert((uint)type <= T_CONFLICT && _zero_type[type] != nullptr) failed: bad type with -XX:-UseCompressedClassPointers
  • 7b4ba7f: 8325932: Replace ATTRIBUTE_NORETURN with direct [[noreturn]]
  • ... and 19 more: https://git.openjdk.org/jdk/compare/d517d2df451e135583083ed3684d7d3241b36f76...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented May 15, 2024

@eme64 Pushed as commit c4867c6.

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

3 participants