RFR: 8173585: Intrinsify StringLatin1.indexOf(char)

mknjc github.com+35809+mknjc at openjdk.java.net
Tue Sep 22 04:56:09 UTC 2020


On Fri, 18 Sep 2020 23:11:46 GMT, Jason Tatton <github.com+70893615+jasontatton-aws at openjdk.org> wrote:

>> "the JVM has knowledge of the AVX capability of the chip it’s running on and disables the AVX2 code path for chips
>> which suffer from the performance degradation which has been outlined in this discussion"
>> Does it? The white paper Andrew cited doesn't mention this as being specific to only some chips that implement AVX2.
>> Can you explain where this restricted effect is documented?
>> Also, I assume you are referring to the code in vm_version_x86.cpp with this comment
>> 
>>     // Don't use AVX-512 on older Skylakes unless explicitly requested
>> 
>> is that correct?
>
>> Can you explain where this restricted effect is documented?
> 
> Certainly! I’ve found that determining the capability of the CPU and whether to enable AVX2 support if the chip
> supports it is mostly controlled in: [vm_version_x86.cpp](
> https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/vm_version_x86.cpp) specifically:
> [get_processor_features](https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/vm_version_x86.cpp#L684-L755)
> and in [generate_get_cpu_info](
> https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/vm_version_x86.cpp#L69-L611).  In order to test the
> patch comprehensively I had to track down an Intel Core i7 (I7-9750H) processor which the aforementioned code permitted
> AVX2 instructions for (maybe this is an error and it should not be enabled for this processor though) as most of the
> infrastructure I personally use here at AWS runs on Intel Xeon processors - I also tested on a E5-2680 which the JVM
> does not enable AVX2 for.  However, this is just the Intel side of things. When it comes to AMD I read that the AMD Zen
> 2 architecture, of which the current flagship: Threadripper 3990X, is based, is able to support AVX2 [without the
> frequency scaling](
> https://www.anandtech.com/Show/Index/14525?cPage=7&all=False&sort=0&page=9&slug=amd-zen-2-microarchitecture-analysis-ryzen-3000-and-epyc-rome)
> which some/all(?) of the Intel chips incur. I personally don’t have access to one of these chips so I cannot confirm
> how it is classified in the JVM.  Also, I found when investigating this that there is actually a JVM flag which can be
> used to control what level of AVX is enabled: `-XX:UseAVX=version.`

I really don't see the problem with using AVX for this?
As long as the used instructions all only activate license l0 the cpu don't scale the frequency at all. For AVX2 these
are most of all instructions which don't use the FMA or floating point ports. Additionally the cpu doesn't instant
scale down the frequency but runs the 256 bit instructions with reduced throughput but full cpu clock until enough
instructions use the avx command set. For more information see https://stackoverflow.com/a/56861355/130541

So as long the 512bit width instructions aren't used there should no frequency scaling happening.

-------------

PR: https://git.openjdk.java.net/jdk/pull/71


More information about the core-libs-dev mailing list