[15] RFR (S): 8238696: x86: Enumerate all detected CPU features in VM_Version feature string
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Thu Feb 13 21:44:36 UTC 2020
>> http://cr.openjdk.java.net/~vlivanov/8238696/webrev.03
>
> Functional part seems fine.
Thanks, David.
>> 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).
>
> Not sure about the test - I don't know enough about which features are
> "always" presents on x86/x64. I'd suggest using @requires x86 rather
> than the internal Platform checks.
The test does a different check: the full list of known CPU features is
hard-coded into the test and the test checks that all features reported
by CPUInfo.getFeatures() are present in the list.
So, if a new feature detection is added into the JVM, the test has to be
adjusted as well.
The test does look a bit artificial, but I found it convenient when
playing with the functionality.
Regarding @requires, I'd like to keep Platform.is* checks:
(1) the test has cross-platform case;
73 for (String feature : features) {
74 assertTrue(CPUInfo.hasFeature(feature), feature);
75 }
(2) it's easy to extend the test and enumerate known features for
other platforms
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