RFR: 8186670: Implement _onSpinWait() intrinsic for AArch64 [v4]
Patrick Zhang
qpzhang at openjdk.java.net
Thu Sep 23 10:50:03 UTC 2021
On Wed, 22 Sep 2021 13:48:40 GMT, Evgeny Astigeevich <github.com+42899633+eastig at openjdk.org> wrote:
>> This PR is a follow-up on the discussion [“RFC: AArch64: Implementing spin pauses with ISB”](https://mail.openjdk.java.net/pipermail/hotspot-dev/2021-August/054033.html).
>>
>> It adds the option `OnSpinWaitImpl=value`, where `value` can be:
>>
>> - `none`: no implementation for spin pauses. This is the default value.
>> - `Nnop`: use `nop` instruction for spin pauses. Optional `N` can be `2..9` to specify a number of `nop` instructions.
>> - `Nisb`: use `isb` instruction for spin pauses. Optional `N` can be `2..9` to specify a number of `isb` instructions.
>> - `Nyield`: use `yield` instruction for spin pauses. Optional `N` can be `2..9` to specify a number of `yield` instructions.
>>
>> The code for the `Thread.onSpinWait` intrinsic is generated based on the value of `OnSpinWaitImpl`.
>>
>> Testing:
>>
>> - `make test TEST="gtest"`: Passed
>> - `make run-test TEST="tier1"`: Passed
>> - `make run-test TEST="tier2"`: Passed
>> - `make run-test TEST=hotspot/jtreg/compiler/onSpinWait`: Passed
>
> Evgeny Astigeevich has updated the pull request incrementally with one additional commit since the last revision:
>
> Move spin_wait in cpp file with removal of loop macro
>
> In addition, comments are added to a checking method of a test.
src/hotspot/cpu/aarch64/globals_aarch64.hpp line 116:
> 114: product(ccstr, OnSpinWaitImpl, "none", \
> 115: "Use instructions to implement java.lang.Thread.onSpinWait()."\
> 116: "Options: none, Nnop, Nisb, Nyield, where optional N is 2..9.")
Could this N be changed to 2..99 instead of 2..9? I tested this with SpinWaitBench.pong:totalSpins (ops/us), 9nop or 9yield is unable to provide a similar pause time as 1isb, maybe ~20 can do. A larger range can be more convenient for future experiments/tunings. Thanks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5562
More information about the hotspot-dev
mailing list