RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v13]
Claes Redestad
redestad at openjdk.org
Mon Jan 9 15:23:58 UTC 2023
On Thu, 22 Dec 2022 13:10:02 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> @cl4es Thanks for passing the constant node through, the code looks much cleaner now. The attached patch should handle the signed bytes/shorts as well. Please take a look.
>> [signed.patch](https://github.com/openjdk/jdk/files/10273480/signed.patch)
>
> I ran tests and some quick microbenchmarking to validate @sviswa7's patch to activate vectorization for `short` and `byte` arrays and it looks good:
>
> Before:
>
> Benchmark (size) Mode Cnt Score Error Units
> ArraysHashCode.bytes 10000 avgt 5 7845.586 ± 23.440 ns/op
> ArraysHashCode.chars 10000 avgt 5 1203.163 ± 11.995 ns/op
> ArraysHashCode.ints 10000 avgt 5 1131.915 ± 7.843 ns/op
> ArraysHashCode.multibytes 10000 avgt 5 4136.487 ± 5.790 ns/op
> ArraysHashCode.multichars 10000 avgt 5 671.328 ± 17.629 ns/op
> ArraysHashCode.multiints 10000 avgt 5 699.051 ± 8.135 ns/op
> ArraysHashCode.multishorts 10000 avgt 5 4139.300 ± 10.633 ns/op
> ArraysHashCode.shorts 10000 avgt 5 7844.019 ± 26.071 ns/op
>
>
> After:
>
> Benchmark (size) Mode Cnt Score Error Units
> ArraysHashCode.bytes 10000 avgt 5 1193.208 ± 1.965 ns/op
> ArraysHashCode.chars 10000 avgt 5 1193.311 ± 5.941 ns/op
> ArraysHashCode.ints 10000 avgt 5 1132.592 ± 10.410 ns/op
> ArraysHashCode.multibytes 10000 avgt 5 657.343 ± 25.343 ns/op
> ArraysHashCode.multichars 10000 avgt 5 672.668 ± 5.229 ns/op
> ArraysHashCode.multiints 10000 avgt 5 697.143 ± 3.929 ns/op
> ArraysHashCode.multishorts 10000 avgt 5 666.738 ± 12.236 ns/op
> ArraysHashCode.shorts 10000 avgt 5 1193.563 ± 5.449 ns/op
> @cl4es There seem to be failure on windows-x64 platform pre submit tests. Could you please take a look?
It looks like the `as_Address(ExternalAddress(StubRoutines::x86::arrays_hashcode_powers_of_31() + ...)` trick is running into some reachability issue on Windows, hitting the `assert(reachable(adr), "must be");` in `macroAssembler_x86.cpp`. Might be related to ASLR or some quirk of the VS compiler. I'll investigate.
-------------
PR: https://git.openjdk.org/jdk/pull/10847
More information about the hotspot-compiler-dev
mailing list