RFR: 8269559: AArch64: Implement string_compare intrinsic in SVE [v3]

TatWai Chong duke at openjdk.java.net
Wed Oct 13 22:30:07 UTC 2021


> This patch implements string_compare intrinsic in SVE.
> It supports all LL, LU, UL and UU comparisons.
> 
> As we haven't found an existing benchmark to measure performance impact,
> we created a benchmark derived from the test [1] for this evaluation.
> This benchmark is attached to this patch.
> 
> Besides, remove the unused temporary register `vtmp3` from the existing
> match rules for StrCmp.
> 
> The result below shows all varients can be benefited largely.
> Command: make exploded-test TEST="micro:StringCompareToDifferentLength"
> 
> Benchmark    (size)  Mode  Cnt   Score Speedup Units
> compareToLL      24  avgt   10      1.0x       ms/op
> compareToLL      36  avgt   10      1.0x       ms/op
> compareToLL      72  avgt   10      1.0x       ms/op
> compareToLL     128  avgt   10      1.4x       ms/op
> compareToLL     256  avgt   10      1.8x       ms/op
> compareToLL     512  avgt   10      2.7x       ms/op
> compareToLU      24  avgt   10      1.6x       ms/op
> compareToLU      36  avgt   10      1.8x       ms/op
> compareToLU      72  avgt   10      2.3x       ms/op
> compareToLU     128  avgt   10      3.8x       ms/op
> compareToLU     256  avgt   10      4.7x       ms/op
> compareToLU     512  avgt   10      6.3x       ms/op
> compareToUL      24  avgt   10      1.6x       ms/op
> compareToUL      36  avgt   10      1.7x       ms/op
> compareToUL      72  avgt   10      2.2x       ms/op
> compareToUL     128  avgt   10      3.3x       ms/op
> compareToUL     256  avgt   10      4.4x       ms/op
> compareToUL     512  avgt   10      6.1x       ms/op
> compareToUU      24  avgt   10      1.0x       ms/op
> compareToUU      36  avgt   10      1.0x       ms/op
> compareToUU      72  avgt   10      1.4x       ms/op
> compareToUU     128  avgt   10      2.2x       ms/op
> compareToUU     256  avgt   10      2.6x       ms/op
> compareToUU     512  avgt   10      3.7x       ms/op
> 
> [1] https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/compiler/intrinsics/string/TestStringCompareToDifferentLength.java

TatWai Chong has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:

 - Merge master
 - Restore the removal of vtmp3 (=V2) as it is still used by the non-SVE compare-long-strings stub.
   
   And remove the assertion in `string_compare` since it won't help as the registers
   used in the stub are fixed.
 - 8269559: AArch64: Implement string_compare intrinsic in SVE
   
   This patch implements string_compare intrinsic in SVE.
   It supports all LL, LU, UL and UU comparisons.
   
   As we haven't found an existing benchmark to measure performance impact,
   we created a benchmark derived from the test [1] for this evaluation.
   This benchmark is attached to this patch.
   
   Besides, remove the unused temporary register `vtmp3` from the existing
   match rules for StrCmp.
   
   The result below shows all varients can be benefited largely.
   Command: make exploded-test TEST="micro:StringCompareToDifferentLength"
   
   Benchmark    (size)  Mode  Cnt   Score Speedup Units
   compareToLL      24  avgt   10      1.0x       ms/op
   compareToLL      36  avgt   10      1.0x       ms/op
   compareToLL      72  avgt   10      1.0x       ms/op
   compareToLL     128  avgt   10      1.4x       ms/op
   compareToLL     256  avgt   10      1.8x       ms/op
   compareToLL     512  avgt   10      2.7x       ms/op
   compareToLU      24  avgt   10      1.6x       ms/op
   compareToLU      36  avgt   10      1.8x       ms/op
   compareToLU      72  avgt   10      2.3x       ms/op
   compareToLU     128  avgt   10      3.8x       ms/op
   compareToLU     256  avgt   10      4.7x       ms/op
   compareToLU     512  avgt   10      6.3x       ms/op
   compareToUL      24  avgt   10      1.6x       ms/op
   compareToUL      36  avgt   10      1.7x       ms/op
   compareToUL      72  avgt   10      2.2x       ms/op
   compareToUL     128  avgt   10      3.3x       ms/op
   compareToUL     256  avgt   10      4.4x       ms/op
   compareToUL     512  avgt   10      6.1x       ms/op
   compareToUU      24  avgt   10      1.0x       ms/op
   compareToUU      36  avgt   10      1.0x       ms/op
   compareToUU      72  avgt   10      1.4x       ms/op
   compareToUU     128  avgt   10      2.2x       ms/op
   compareToUU     256  avgt   10      2.6x       ms/op
   compareToUU     512  avgt   10      3.7x       ms/op
   
   [1] https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/compiler/intrinsics/string/TestStringCompareToDifferentLength.java

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

Changes: https://git.openjdk.java.net/jdk/pull/5129/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5129&range=02
  Stats: 517 lines in 11 files changed: 421 ins; 1 del; 95 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5129.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5129/head:pull/5129

PR: https://git.openjdk.java.net/jdk/pull/5129


More information about the core-libs-dev mailing list