[15] RFR (S): 8238696: x86: Enumerate all detected CPU features in VM_Version feature string

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Feb 13 23:36:00 UTC 2020


Changes looks good to me.

I wish we have a definition of CPU features which specify name and enumeration so that it will be 
printed automatically, if supported, by VM_Version::get_processor_features(). Counting by hand how 
many %s I have to add is bug prone. We also need to check that we have enough bits for enumeration.

It could be a starter RFE.

Thanks,
Vladimir K

On 2/11/20 5:58 AM, Vladimir Ivanov wrote:
> 
>> Now I'm wondering about using the dot as a terminator. Doesn't the return value from jio_snprintf 
>> tell you whether you exceeded the buffer?
> 
> Yes, very good point. How about the following?
> 
>    http://cr.openjdk.java.net/~vlivanov/8238696/webrev.03
> 
> Considering some tests have hard-coded feature names, I decided to enhance the new test and check 
> that all reported features are known (at least, on x86).
> 
> Best regards,
> Vladimir Ivanov
> 
>>> On 10.02.2020 17:12, Vladimir Ivanov wrote:
>>>> Thanks for taking a look, David.
>>>>
>>>> Updated webrev:
>>>>    http://cr.openjdk.java.net/~vlivanov/8238696/webrev.01/
>>>>
>>>>>> http://cr.openjdk.java.net/~vlivanov/8238696/webrev.00/
>>>>>> https://bugs.openjdk.java.net/browse/JDK-8238696
>>>>>>
>>>>>> Abstract_VM_Version::features_string() doesn't contain all the CPU features detected by the 
>>>>>> JVM on x86 (for example, for AVX-512 only AVX-512F is included as "evex").
>>>>>>
>>>>>> The fix adds missing features to the list [1].
>>>>>
>>>>> The function naming that you have changed for supports_avx512_vpclmulqdq was explicitly 
>>>>> requested by Vladimir K.:
>>>>>
>>>>> http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2019-December/036326.html
>>>>>
>>>>> If anything I would suggest supports_vpopcntdq() should have the avx512 part added.
>>>>
>>>> Makes sense. Also, decided to rename VNNI, VAES, and VBMI2. They are listed in the manual as 
>>>> part of AVX512.
>>>>
>>>>> The actual expansion of the feature string seems okay. It does make me wonder why these items 
>>>>> have been left out previously.
>>>>
>>>> I believe it was just overlooked. Added a comment near cpu feature constant declarations.
>>>>
>>>> Also, introduced a check to ensure the temporary on-stack buffer is large enough.
>>>>
>>>> Best regards,
>>>> Vladimir Ivanov
>>>>>
>>>>> Thanks,
>>>>> David
>>>>>
>>>>>> Testing: manual (-Xlog:os+cpu=trace output on different hardware),
>>>>>>           hs-precheckin-comp, hs-tier1, hs-tier2
>>>>>>
>>>>>> Best regards,
>>>>>> Vladimir Ivanov
>>>>>>
>>>>>> [1] $ java -Xlog:os+cpu=trace -XX:UseAVX=3 -version
>>>>>>
>>>>>> ...
>>>>>> [0.010s][info][os,cpu] UseSSE=4  UseAVX=3  UseAES=1  MaxVectorSize=64
>>>>>> ...
>>>>>> [0.011s][info][os,cpu] CPU:total 8 (initial active 8) (4 cores per cpu, 2 threads per core) 
>>>>>> family 6 model 85 stepping 4, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, 
>>>>>> popcnt, vzeroupper, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, bmi1, bmi2, 
>>>>>> adx, avx512f, avx512dq, avx512cd, avx512bw, avx512vl, fma, clflush, clflushopt, clwb
>>>>>> ...
>>>>>> [0.011s][info][os,cpu] flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca 
>>>>>> cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc 
>>>>>> arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 
>>>>>> pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor 
>>>>>> lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi 
>>>>>> flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f 
>>>>>> avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 
>>>>>> xsaves arat umip pku ospke md_clear
>>>>>> ...


More information about the hotspot-dev mailing list