jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8335628: C2 SuperWord: cleanup: remove SuperWord::longer_type_for_conversion

Open eme64 opened this issue 1 year ago • 4 comments
trafficstars

After JDK-8325155, there is now only a single use of SuperWord::longer_type_for_conversion. The check there is rather useless, and we should just remove it for the sake of code complexity.

What did this check do? It checks if the input-type of a node is larger than the output type, relevant in these cases:

  • is_convert_opcode
  • is_scalar_op_that_returns_int_but_vector_op_returns_long

If there is a larger type, it checks if this larger type can even create vectors of at least size 2:

  • Matcher::max_vector_size_auto_vectorization(longer_bt) < 2)

Of course if there cannot be vectors for this larger type, then we could avoid creating these vectors.

Why is it rather useless? On most modern platforms, all types have vectors of at least length 2. So this would never fail on those platforms. And even if this check fails: we would pack the nodes and later reject those packs when we do the implemented checks. Hence, we do not wrongly vectorize anyway. The cost of removing this check is that on most platforms we do not have to do this check, and the few that it would fail for just have a bit more compilation time (but very very minimal increase). I think this is worth the reduction in complexity. But we could always revert this change if there are problems because of it.


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-8335628: C2 SuperWord: cleanup: remove SuperWord::longer_type_for_conversion (Enhancement - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20009

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

Using diff file

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

Webrev

Link to Webrev Comment

eme64 avatar Jul 03 '24 15:07 eme64

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

bridgekeeper[bot] avatar Jul 03 '24 15:07 bridgekeeper[bot]

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

8335628: C2 SuperWord: cleanup: remove SuperWord::longer_type_for_conversion

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

  • 8d0831478338e9b084b2c47f46eba9faae3a5eb6: 8337795: Type annotation attached to incorrect type during class reading
  • f84240bca80d2ff01e198bb67931ad4725a5b334: 8338011: CDS archived heap object support for 64-bit Windows
  • 04b146a31f55825e2c8e3c8e42310b3b3337ae95: 8337334: Test tools/javac/7142086/T7142086.java timeout with fastdebug binary
  • a36fb368e1a3630d32908884f4abdc3382eb9aaa: 8338108: Give better error message in configure if a full XCode is missing
  • 61d1dc59535a3dc186bc1986a04efdb4e5a8fa18: 8334466: Ambiguous method call with generics may cause FunctionDescriptorLookupError
  • 89a15f1414f89d2dd32eac791e9155fcb4207e56: 8337681: PNGImageWriter uses much more memory than necessary
  • a6c0630737bbf2f2e6c64863ff9b43c50c4742b6: 8337938: ZUtils::alloc_aligned allocates without reporting to NMT
  • 03204600c596214895ef86581eba9722f76d39b3: 8337958: Out-of-bounds array access in secondary_super_cache
  • 692f5cbdb9bd94f03e5f18ddf07d56fbb5c0d456: 8338101: remove old remap assertion in map_or_reserve_memory_aligned after JDK-8338058
  • 0e7c1c1afeaba1c125b70cabe7b1b7a3193ee5c3: 8338112: Test testlibrary_tests/ir_framework/tests/TestPrivilegedMode.java fails with release build

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[bot] avatar Jul 03 '24 15:07 openjdk[bot]

@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[bot] avatar Jul 03 '24 15:07 openjdk[bot]

Webrevs

mlbridge[bot] avatar Jul 04 '24 06:07 mlbridge[bot]

Ok, I'll run it on a few platforms and report back!

eme64 avatar Jul 30 '24 07:07 eme64

@vnkozlov I ran that benchmark both on x64 (AVX512) and aarch64 (neon). There is no significant difference. (i.e. the difference between the SuperWord and non-SuperWord runs of that benchmark is in factors 2x-10x, the difference between master and patch of the SuperWord run is in the normal noise range).

eme64 avatar Aug 12 '24 12:08 eme64

Thanks @vnkozlov @chhagedorn for the reviews. /integrate

eme64 avatar Aug 13 '24 05:08 eme64

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

  • d77e6fe45c7b834db457a772ce0bea514d2e44f3: 8338154: Fix -Wzero-as-null-pointer-constant warnings in gtest framework
  • e70c9bccaae375be1ee6812dabc9fbaff01a6ab0: 8338248: PartialArrayStateAllocator::Impl leaks Arena array
  • 5079c38ddf345b21d8cb1c959bc36c4341e11da6: 8338160: Fix -Wzero-as-null-pointer-constant warnings in management.cpp
  • 4417c276e484c1fe137ed7f4a7c28709d0c99af2: 8330535: Update nsk/jdb tests to use driver instead of othervm
  • b93b74e3ebd220e94fb5e33d2ebc62181db97bb0: 8338060: jdk/internal/util/ReferencedKeyTest should be more robust
  • 41e31d6b0ae00d70b6fb20c89318fde2bc605edb: 8337622: IllegalArgumentException in java.lang.reflect.Field.get
  • 2ca136a7adb6defaea3b7a69d30e6c36bda66e6a: 8337815: Relax G1EvacStats atomic operations
  • 99edb4a45d6a4a871dec9c07b41b3ab66b89a4b6: 8337702: Use new ForwardExceptionNode to call StubRoutines::forward_exception_entry()
  • 8d0831478338e9b084b2c47f46eba9faae3a5eb6: 8337795: Type annotation attached to incorrect type during class reading
  • f84240bca80d2ff01e198bb67931ad4725a5b334: 8338011: CDS archived heap object support for 64-bit Windows
  • ... and 8 more: https://git.openjdk.org/jdk/compare/6a3d045221c338fefec9bd59245324eae60b156b...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Aug 13 '24 05:08 openjdk[bot]

@eme64 Pushed as commit 73ddb7deab26c526337ec6e7cd5f528f698a552c.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Aug 13 '24 05:08 openjdk[bot]