RFR: 8342393: Promote commutative vector IR node sharing [v13]

Emanuel Peter epeter at openjdk.org
Wed Jan 22 13:05:41 UTC 2025


On Wed, 22 Jan 2025 12:29:02 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> Patch promotes the sharing of commutative vector IR with the same inputs but different input ordering.
>> Unlike scalar IR where we perform edge swapping by [sorting inputs](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/addnode.cpp#L122) based on node indices during IR idealization, for vector IR we chose a simpler approach to decorate commutative operations with a special node-level flag during IR construction thus
>> obviating any dependency on explicit idealization routines. This flag is later used during GVN hashing to enable node sharing.  
>> 
>> Following are the performance stats for JMH micro included with the patch.
>> 
>> 
>> Granite Rapids (P-core Xeon Server)
>> Baseline : 
>> Benchmark                                                                (size)   Mode  Cnt      Score   Error   Units
>> VectorCommutativeOperSharingBenchmark.commutativeByteOperationShairing     1024  thrpt    2   8982.549          ops/ms
>> VectorCommutativeOperSharingBenchmark.commutativeIntOperationShairing      1024  thrpt    2   6072.773          ops/ms
>> VectorCommutativeOperSharingBenchmark.commutativeLongOperationShairing     1024  thrpt    2   2368.856          ops/ms
>> VectorCommutativeOperSharingBenchmark.commutativeShortOperationShairing    1024  thrpt    2  15215.087          ops/ms
>> 
>> Withopt:
>> Benchmark                                                                (size)   Mode  Cnt      Score   Error   Units
>> VectorCommutativeOperSharingBenchmark.commutativeByteOperationShairing     1024  thrpt    2  11963.554          ops/ms
>> VectorCommutativeOperSharingBenchmark.commutativeIntOperationShairing      1024  thrpt    2   7036.088          ops/ms
>> VectorCommutativeOperSharingBenchmark.commutativeLongOperationShairing     1024  thrpt    2   2906.731          ops/ms
>> VectorCommutativeOperSharingBenchmark.commutativeShortOperationShairing    1024  thrpt    2  17148.131          ops/ms
>> 
>> Sierra Forest (E-core Xeon Server)
>> Baseline:
>> Benchmark                                                                (size)   Mode  Cnt     Score   Error   Units
>> VectorCommutativeOperSharingBenchmark.commutativeByteOperationShairing     1024  thrpt    2  2444.359          ops/ms
>> VectorCommutativeOperSharingBenchmark.commutativeIntOperationShairing      1024  thrpt    2  1710.256          ops/ms
>> VectorCommutativeOperSharingBenchmark.commutativeLongOperationShairing     1024  thrpt    2   308.766          ops/ms
>> VectorCommutativeOperSharingBenc...
>
> Jatin Bhateja has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:
> 
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8342393
>  - Review suggestions incorporated.
>  - Adding functional verification to test points using Verify.checkEQ
>  - Review suggestions incorporated
>  - Generalizing vector size constraints covering different AVX levels and KNLSetting
>  - GHA fix
>  - Review comments resolutions.
>  - removing spaces
>  - Adding functional and performance tests
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8342393
>  - ... and 1 more: https://git.openjdk.org/jdk/compare/25cd9d55...f21e30f1

Just got a gcc internal compiler error on `linux-x64-ri`:

.../open/src/hotspot/share/precompiled/precompiled.hpp:61:
.../open/src/hotspot/share/utilities/copy.hpp:362:2: internal compiler error: in gt_pch_save, at ggc-common.cc:674
[2025-01-22T12:48:11,911Z]   362 | };
[2025-01-22T12:48:11,911Z]       |  ^
[2025-01-22T12:48:12,841Z] 0x6e0432 gt_pch_save(_IO_FILE*)
[2025-01-22T12:48:12,841Z] 	/home/mikael/src/jdk/jdk/devkit/jdk/open/build/devkit/src/gcc-13.2.0/gcc/ggc-common.cc:674
[2025-01-22T12:48:12,867Z] 0x96b865 c_common_write_pch()
[2025-01-22T12:48:12,867Z] 	/home/mikael/src/jdk/jdk/devkit/jdk/open/build/devkit/src/gcc-13.2.0/gcc/c-family/c-pch.cc:175
[2025-01-22T12:48:12,885Z] 0x7b56e5 c_parse_final_cleanups()
[2025-01-22T12:48:12,885Z] 	/home/mikael/src/jdk/jdk/devkit/jdk/open/build/devkit/src/gcc-13.2.0/gcc/cp/decl2.cc:4940
[2025-01-22T12:48:12,885Z] 0x96b490 c_common_parse_file()
[2025-01-22T12:48:12,885Z] 	/home/mikael/src/jdk/jdk/devkit/jdk/open/build/devkit/src/gcc-13.2.0/gcc/c-family/c-opts.cc:1266
[2025-01-22T12:48:12,925Z] Please submit a full bug report, with preprocessed source (by using -freport-bug).

Ah, it was raised as https://bugs.openjdk.org/browse/JDK-8338470

-------------

PR Comment: https://git.openjdk.org/jdk/pull/22863#issuecomment-2607191650


More information about the hotspot-compiler-dev mailing list