RFR: 8322535: Change default AArch64 SpinPause instruction
Andrew Haley
aph at openjdk.org
Mon Jan 29 10:16:37 UTC 2024
On Sat, 27 Jan 2024 11:45:43 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> When I was browsing the interweb I saw that it's not uncommon to use isb instead of yield while spinning on AArch64. Before jumping on the bandwagon I created a test program to measure how long time it takes to issue a large number of instructions from several threads running in parallel. I tested nop, yield and isb on Apple's M1, M2 and M3 CPUs. The yield instruction doesn't take longer to execute than a nop instruction (in fact it takes less time than nop). However isb always takes significantly longer time to run than nop or yield on all of the above mentioned Apple CPUs. This finding combined with the fact that the JVM
>> today uses isb as default for Neoverse CPUs, justified the use of isb on Apple's M1-M3 CPUs.
>>
>> But I do agree with both @theRealAph and @stooart-mon, isb is not intended for this purpose. It might create a delay that is too long for spinning purposes and applications overall won't necessarily show any benefit from isb vs yield.
>>
>> Maybe the most reasonable way forward is to only change the default value of OnSpinWaitInst from "none" to "yield" and NOT change it to "isb" for Apple CPUs.
>>
>> After all, that would make us use the "correct" spinning instruction on all AArch64 CPUs (except Neoverse).
>
> @fbredber In https://bugs.openjdk.org/browse/JDK-8320317 you said "The performance decrease seen on AArch64 based macOS can be fixed by implementing SpinPause() (see: JDK-8321371)."
>
> Please, where is the test case?
> @theRealAph The DaCapo-h2 test indicated that the regression could be mitigated by implementing SpinPause().
>
> Since there is no consensus about if ISB is a good idea or not, we have decided not to use it as default for Apple silicon and just use YIELD for all AArch64 CPUs.
But there's been no consensus because (as far as I know) no-one has published the test results. With evidence we can discuss, consensus should be achievable.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17430#issuecomment-1914373658
More information about the hotspot-dev
mailing list