RFR: 8324734: Relax too-strict assert(VM_Version::supports_evex()) in Assembler::locate_operand() [v2]
Roman Kennke
rkennke at openjdk.org
Mon Jan 29 09:30:02 UTC 2024
On Fri, 26 Jan 2024 21:00:02 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
> > VM_Version could distinguish between CPU features that are supported by the CPU
> > We can start with just EVEX check. It is not big change:
>
> ```
> $ git diff
> diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp
> index df1ea6edd30..8b4ca442b5a 100644
> --- a/src/hotspot/cpu/x86/vm_version_x86.cpp
> +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp
> @@ -809,7 +809,8 @@ void VM_Version::get_processor_features() {
> _stepping = cpu_stepping();
>
> if (cpu_family() > 4) { // it supports CPUID
> - _features = feature_flags();
> + _features = feature_flags(); // It can be changed by VM flags
> + _cpu_features = _features; // Preserve features
> // Logical processors are only available on P4s and above,
> // and only if hyperthreading is available.
> _logical_processors_per_package = logical_processor_count();
> diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp b/src/hotspot/cpu/x86/vm_version_x86.hpp
> index e521a6ee3bc..de86ce51541 100644
> --- a/src/hotspot/cpu/x86/vm_version_x86.hpp
> +++ b/src/hotspot/cpu/x86/vm_version_x86.hpp
> @@ -640,7 +640,7 @@ class VM_Version : public Abstract_VM_Version {
> }
>
> //
> - // Feature identification
> + // Feature identification which can be affected by VM flags
> //
> static bool supports_cpuid() { return _features != 0; }
> static bool supports_cmov() { return (_features & CPU_CMOV) != 0; }
> @@ -703,6 +703,11 @@ class VM_Version : public Abstract_VM_Version {
> static bool supports_cet_ss() { return (_features & CPU_CET_SS) != 0; }
> static bool supports_cet_ibt() { return (_features & CPU_CET_IBT) != 0; }
>
> + //
> + // Feature identification not affected by VM flags
> + //
> + static bool cpu_supports_evex() { return (_cpu_features & CPU_AVX512F) != 0; }
> +
> // Intel features
> static bool is_intel_family_core() { return is_intel() &&
> extended_cpu_family() == CPU_FAMILY_INTEL_CORE; }
> diff --git a/src/hotspot/share/runtime/abstract_vm_version.hpp b/src/hotspot/share/runtime/abstract_vm_version.hpp
> index d8ffca8de81..05675cc683a 100644
> --- a/src/hotspot/share/runtime/abstract_vm_version.hpp
> +++ b/src/hotspot/share/runtime/abstract_vm_version.hpp
> @@ -54,10 +54,13 @@ class Abstract_VM_Version: AllStatic {
> static const char* _s_vm_release;
> static const char* _s_internal_vm_info_string;
>
> - // CPU feature flags.
> + // CPU feature flags which can be restricted by VM flags.
> static uint64_t _features;
> static const char* _features_string;
>
> + // CPU feature flags not affected by VM flags.
> + static uint64_t _cpu_features;
> +
> // These are set by machine-dependent initializations
> #ifndef SUPPORTS_NATIVE_CX8
> static bool _supports_cx8;
> ```
Nice, thank you! That works (with some minor modification). I've changed the PR from removing the assert to relaxing it to CPU feature check.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17590#issuecomment-1914284967
More information about the hotspot-compiler-dev
mailing list