RFR: 8310949: RISC-V: Initialize UseUnalignedAccesses [v3]
Ludovic Henry
luhenry at openjdk.org
Wed Jun 28 08:06:07 UTC 2023
On Wed, 28 Jun 2023 04:23:59 GMT, Fei Yang <fyang at openjdk.org> wrote:
>> Ludovic Henry has updated the pull request incrementally with one additional commit since the last revision:
>>
>> fixup! 8310949: RISC-V: Initialize UseUnalignedAccesses
>
> We will need some performance numbers to validate this change. We witnessed some obvious regressions of Unsafe.Put*Unaligned methods when enabling UseUnalignedAccesses on some platforms like HiFive Unmatched with slow unaligned accesses. My guess is that we might want enable UseUnalignedAccesses for platforms like T-Head with fast unaligned accesses (RISCV_HWPROBE_MISALIGNED_FAST). But that will still depend on the measured JMH numbers.
>
> PS: JMH test for reference: https://cr.openjdk.org/~dzhang/TestUseUnalignedAccesses/
@RealFYang the issue I see with `UseUnalignedAccesses` is that there are two ways to interpret it:
1. unaligned accesses are supported
2. unaligned accesses are fast
The benchmark you're using tend towards "unaligned accesses are fast". However, I don't necessarily agree that it is what this `UseUnalignedAccesses` means as I would verge more towards "unaligned accesses are supported". Some applications out there will fail if `java.nio.Bits.unaligned()` returns false (some Apache projects for example), and that property is set from `Unsafe.unalignedAccess()` which itself is set with `UseUnalignedAccesses`.
The core of the issue is that x86 does support unaligned accesses out-of-the-box, so many applications and frameworks have taken the assumption that it holds true, and that not holding true is unexpected / an exception.
@theRealAph @shipilev is it something you've run into on AArch64 as well?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14676#issuecomment-1610953037
More information about the hotspot-dev
mailing list