RFR: 8342393: Promote commutative vector IR node sharing
Jatin Bhateja
jbhateja at openjdk.org
Tue Jan 7 17:56:24 UTC 2025
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 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
VectorCommutativeOperSharingBenchmark.commutativeShortOperationShairing 1024 thrpt 2 3902.179 ops/ms
Withopt:
Benchmark (size) Mode Cnt Score Error Units
VectorCommutativeOperSharingBenchmark.commutativeByteOperationShairing 1024 thrpt 2 3352.839 ops/ms
VectorCommutativeOperSharingBenchmark.commutativeIntOperationShairing 1024 thrpt 2 2918.805 ops/ms
VectorCommutativeOperSharingBenchmark.commutativeLongOperationShairing 1024 thrpt 2 409.482 ops/ms
VectorCommutativeOperSharingBenchmark.commutativeShortOperationShairing 1024 thrpt 2 6955.057 ops/ms
Please review and share your comments.
Best Regards,
Jatin
-------------
Commit messages:
- Adding functional and performance tests
- Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8342393
- 8342393: Initial version
Changes: https://git.openjdk.org/jdk/pull/22863/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22863&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8342393
Stats: 389 lines in 5 files changed: 363 ins; 0 del; 26 mod
Patch: https://git.openjdk.org/jdk/pull/22863.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22863/head:pull/22863
PR: https://git.openjdk.org/jdk/pull/22863
More information about the hotspot-compiler-dev
mailing list