RFR: 8350093: RISC-V: java/math/BigInteger/LargeValueExceptions.java timeout with COH
Feilong Jiang
fjiang at openjdk.org
Mon Feb 17 14:47:09 UTC 2025
On Fri, 14 Feb 2025 13:21:58 GMT, Fei Yang <fyang at openjdk.org> wrote:
> Hi, please review this change resolving a timeout issue in `LargeValueExceptions.squareDefiniteOverflow()`.
>
> This issue only happens on platforms with slow unaligned memory accesses like Unmatched or Premier-P550 SBCs.
> Async profiler shows major time was spent in multiplyToLen stub code. When AvoidUnalignedAccesses is enabled,
> there is a simple alignment check, which assumes 8-byte alignment for base_offset of int arrays. But this is
> not the case with COH: base_offset is 12 bytes instead of 16 bytes for int arrays.
>
> Patch simply makes it explicit about the requirement of base_offset. Sanity tested on Premier P550.
> No obvious change witnessed on JMH after this change:
>
> -----------------------------------------------------------------------------------------------
>
> Without COH:
>
> Benchmark (maxNumbits) Mode Cnt Score Error Units
> BigIntegers.SmallShifts.testLeftShift 32 avgt 15 138.939 ± 2.246 ns/op
> BigIntegers.SmallShifts.testLeftShift 128 avgt 15 88.391 ± 1.210 ns/op
> BigIntegers.SmallShifts.testLeftShift 256 avgt 15 117.590 ± 1.398 ns/op
> BigIntegers.SmallShifts.testRightShift 32 avgt 15 150.338 ± 1.961 ns/op
> BigIntegers.SmallShifts.testRightShift 128 avgt 15 104.540 ± 5.636 ns/op
> BigIntegers.SmallShifts.testRightShift 256 avgt 15 126.082 ± 1.756 ns/op
> BigIntegers.testAdd N/A avgt 15 97.513 ± 40.746 ns/op
> BigIntegers.testGcd N/A avgt 15 5409222.706 ± 5934.667 ns/op
> BigIntegers.testHugeLargeDivide N/A avgt 15 246.904 ± 1.552 ns/op
> BigIntegers.testHugeSmallDivide N/A avgt 15 248.997 ± 1.374 ns/op
> BigIntegers.testHugeToString N/A avgt 15 2421.432 ± 62.208 ns/op
> BigIntegers.testLargeSmallDivide N/A avgt 15 216.859 ± 1.760 ns/op
> BigIntegers.testLargeToString N/A avgt 15 425.653 ± 13.305 ns/op
> BigIntegers.testLeftShift N/A avgt 15 2265.137 ± 24.319 ns/op
> BigIntegers.testMultiply N/A avgt 15 15862.412 ± 417.880 ns/op <========
> BigIntegers.testRightShift N/A avgt 15 936.071 ± 15.247 ns/op
> BigIntegers.testSmallToString N/A avgt 15 322.350 ± 16.075...
Looks good, thanks!
-------------
Marked as reviewed by fjiang (Committer).
PR Review: https://git.openjdk.org/jdk/pull/23631#pullrequestreview-2621266093
More information about the hotspot-dev
mailing list