Skip to contentSkip to conversation

x86/cpuid: AVX-512 Feature Detection

PATCH Superseded Luwei Kang 3 participants 17 messages Jun 30, 2016 – Aug 22, 2016

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Luwei Kang

author
#0 lore raw

PATCH v4 1/1 x86/cpuid: AVX-512 Feature Detection

AVX-512 is an extention of AVX2. Its spec can be found at:
https://software.intel.com/sites/default/files/managed/b4/3a/319433-024.pdf
This patch detects AVX-512 features by CPUID.

---
[V4]:
Update the description about features dependency.
[V3]:
Adjust dependencies between features.
[V2]:
1.get max xstate_size from each bit.
2.change get cpuid function parameter from 0x07 to 7. 3.add dependencies between features in xen/tools/gen-cpuid.py. 4.split the cpuid call just like the way the hvm_cpuid() side works.

---
 xen/arch/x86/hvm/hvm.c                      | 14 ++++++++++++++
 xen/arch/x86/traps.c                        | 22 +++++++++++++++++++++-
 xen/include/public/arch-x86/cpufeatureset.h |  9 +++++++++
 xen/tools/gen-cpuid.py                      | 11 +++++++++++
 4 files changed, 55 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/hvm.c +14 -0
index c89ab6e..7696b1e 100644
@@ -3474,6 +3474,20 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx,
                                   xstate_sizes[_XSTATE_BNDCSR]);
             }
 
+            if ( _ebx & cpufeat_mask(X86_FEATURE_AVX512F) )
+            {
+                xfeature_mask |= XSTATE_OPMASK | XSTATE_ZMM | XSTATE_HI_ZMM;
+                xstate_size = max(xstate_size,
+                                  xstate_offsets[_XSTATE_OPMASK] +
+                                  xstate_sizes[_XSTATE_OPMASK]);
+                xstate_size = max(xstate_size,
+                                  xstate_offsets[_XSTATE_ZMM] +
+                                  xstate_sizes[_XSTATE_ZMM]);
+                xstate_size = max(xstate_size,
+                                  xstate_offsets[_XSTATE_HI_ZMM] +
+                                  xstate_sizes[_XSTATE_HI_ZMM]);
+            }
+
             if ( _ecx & cpufeat_mask(X86_FEATURE_PKU) )
             {
                 xfeature_mask |= XSTATE_PKRU;
xen/arch/x86/traps.c +21 -1
index 767d0b0..8fb697b 100644
@@ -975,7 +975,7 @@ void pv_cpuid(struct cpu_user_regs *regs)
 
     switch ( leaf )
     {
-        uint32_t tmp, _ecx;
+        uint32_t tmp, _ecx, _ebx;
 
     case 0x00000001:
         c &= pv_featureset[FEATURESET_1c];
@@ -1157,6 +1157,26 @@ void pv_cpuid(struct cpu_user_regs *regs)
                                xstate_sizes[_XSTATE_YMM]);
             }
 
+            if ( !is_control_domain(currd) && !is_hardware_domain(currd) )
+                domain_cpuid(currd, 7, 0, &tmp, &_ebx, &tmp, &tmp);
+            else
+                cpuid_count(7, 0, &tmp, &_ebx, &tmp, &tmp);
+            _ebx &= pv_featureset[FEATURESET_7b0];
+
+            if ( _ebx & cpufeat_mask(X86_FEATURE_AVX512F) )
+            {
+                xfeature_mask |= XSTATE_OPMASK | XSTATE_ZMM | XSTATE_HI_ZMM;
+                xstate_size = max(xstate_size,
+                                  xstate_offsets[_XSTATE_OPMASK] +
+                                  xstate_sizes[_XSTATE_OPMASK]);
+                xstate_size = max(xstate_size,
+                                  xstate_offsets[_XSTATE_ZMM] +
+                                  xstate_sizes[_XSTATE_ZMM]);
+                xstate_size = max(xstate_size,
+                                  xstate_offsets[_XSTATE_HI_ZMM] +
+                                  xstate_sizes[_XSTATE_HI_ZMM]);
+            }
+
             a = (uint32_t)xfeature_mask;
             d = (uint32_t)(xfeature_mask >> 32);
             c = xstate_size;
xen/include/public/arch-x86/cpufeatureset.h +9 -0
index 39acf8c..9320c9e 100644
@@ -206,15 +206,24 @@ XEN_CPUFEATURE(PQM,           5*32+12) /*   Platform QoS Monitoring */
 XEN_CPUFEATURE(NO_FPU_SEL,    5*32+13) /*!  FPU CS/DS stored as zero */
 XEN_CPUFEATURE(MPX,           5*32+14) /*S  Memory Protection Extensions */
 XEN_CPUFEATURE(PQE,           5*32+15) /*   Platform QoS Enforcement */
+XEN_CPUFEATURE(AVX512F,       5*32+16) /*A  AVX-512 Foundation Instructions */
+XEN_CPUFEATURE(AVX512DQ,      5*32+17) /*A  AVX-512 Doubleword & Quadword Instrs */
 XEN_CPUFEATURE(RDSEED,        5*32+18) /*A  RDSEED instruction */
 XEN_CPUFEATURE(ADX,           5*32+19) /*A  ADCX, ADOX instructions */
 XEN_CPUFEATURE(SMAP,          5*32+20) /*S  Supervisor Mode Access Prevention */
+XEN_CPUFEATURE(AVX512IFMA,    5*32+21) /*A  AVX-512 Integer Fused Multiply Add */
 XEN_CPUFEATURE(CLFLUSHOPT,    5*32+23) /*A  CLFLUSHOPT instruction */
 XEN_CPUFEATURE(CLWB,          5*32+24) /*A  CLWB instruction */
+XEN_CPUFEATURE(AVX512PF,      5*32+26) /*A  AVX-512 Prefetch Instructions */
+XEN_CPUFEATURE(AVX512ER,      5*32+27) /*A  AVX-512 Exponent & Reciprocal Instrs */
+XEN_CPUFEATURE(AVX512CD,      5*32+28) /*A  AVX-512 Conflict Detection Instrs */
 XEN_CPUFEATURE(SHA,           5*32+29) /*A  SHA1 & SHA256 instructions */
+XEN_CPUFEATURE(AVX512BW,      5*32+30) /*A  AVX-512 Byte and Word Instructions */
+XEN_CPUFEATURE(AVX512VL,      5*32+31) /*A  AVX-512 Vector Length Extensions */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0.ecx, word 6 */
 XEN_CPUFEATURE(PREFETCHWT1,   6*32+ 0) /*A  PREFETCHWT1 instruction */
+XEN_CPUFEATURE(AVX512VBMI,    6*32+ 1) /*A  AVX-512 Vector Byte Manipulation Instrs */
 XEN_CPUFEATURE(PKU,           6*32+ 3) /*H  Protection Keys for Userspace */
 XEN_CPUFEATURE(OSPKE,         6*32+ 4) /*!  OS Protection Keys Enable */
 
xen/tools/gen-cpuid.py +11 -0
index 7c45eca..e8b64ce 100755
@@ -243,6 +243,17 @@ def crunch_numbers(state):
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
         _3DNOW: [_3DNOWEXT],
+
+        # AVX2 is an extension to AVX, providing mainly new integer instructions.
+        # In principle, AVX512 only takes YMM register state as a prerequisite
+        # and many AVX2 instructions are extended by AVX512F to 512-bit forms.
+        AVX2: [AVX512F],
+
+        # AVX512F is taken to mean hardware support for EVEX encoded instructions,
+        # 512bit registers, and the instructions themselves. All further AVX512 features
+        # are built on top of AVX512F
+        AVX512F: [AVX512DQ, AVX512IFMA, AVX512PF, AVX512ER, AVX512CD,
+                    AVX512BW, AVX512VL, AVX512VBMI],
     }
 
     deep_features = tuple(sorted(deps.keys()))
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#1 lore raw

xen/tools/gen-cpuid.py def crunch_numbers(state): · line 250

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 30.06.16 at 07:50, <[email protected]> wrote:
xen/tools/gen-cpuid.py +5 -0
@@ -243,6 +243,17 @@ def crunch_numbers(state):
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
         _3DNOW: [_3DNOWEXT],
+
+        # AVX2 is an extension to AVX, providing mainly new integer instructions.
+        # In principle, AVX512 only takes YMM register state as a prerequisite
+        # and many AVX2 instructions are extended by AVX512F to 512-bit forms.
+        AVX2: [AVX512F],

I think this was meant to be "but" or "yet" instead of "and". And then I'm not particularly happy about the asymmetry with AVX (which is not dependent on SSE or any of its successors, despite extending many of them to 256-bit forms). Plus e.g. FMA gets extended too, but isn't being made a dependency. And quite opposite to that, at least some AVX2 instructions get extended only by e.g. AVX512BW. Nor are any of the extended forms listed to require other than the AVX512* bits checked in the doc.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw

What about remove the dependency between AVX2 and AVX512F ( AVX2: [AVX512F], ) ?

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Friday, July 1, 2016 3:56 PM
To: [email protected]; Kang, Luwei <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v4] x86/cpuid: AVX-512 Feature Detection

xen/tools/gen-cpuid.py def crunch_numbers(state): · line 250

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 30.06.16 at 07:50, <[email protected]> wrote:
xen/tools/gen-cpuid.py +5 -0
@@ -243,6 +243,17 @@ def crunch_numbers(state):
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
         _3DNOW: [_3DNOWEXT],
+
+        # AVX2 is an extension to AVX, providing mainly new integer instructions.
+        # In principle, AVX512 only takes YMM register state as a prerequisite
+        # and many AVX2 instructions are extended by AVX512F to 512-bit forms.
+        AVX2: [AVX512F],

I think this was meant to be "but" or "yet" instead of "and". And then I'm not particularly happy about the asymmetry with AVX (which is not dependent on SSE or any of its successors, despite extending many of them to 256-bit forms). Plus e.g. FMA gets extended too, but isn't being made a dependency. And quite opposite to that, at least some AVX2 instructions get extended only by e.g. AVX512BW. Nor are any of the extended forms listed to require other than the
AVX512* bits checked in the doc.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line · On 05.07.16 at 04:31, <[email protected]> wrote:

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F ( AVX2: [AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Quoted 24 lines

From: Jan Beulich [mailto:[email protected]]
Sent: Friday, July 1, 2016 3:56 PM

xen/tools/gen-cpuid.py def crunch_numbers(state): · line 250

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 30.06.16 at 07:50, <[email protected]> wrote:
xen/tools/gen-cpuid.py +5 -0
@@ -243,6 +243,17 @@ def crunch_numbers(state):
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
         _3DNOW: [_3DNOWEXT],
+
+        # AVX2 is an extension to AVX, providing mainly new integer instructions.
+        # In principle, AVX512 only takes YMM register state as a prerequisite
+        # and many AVX2 instructions are extended by AVX512F to 512-bit forms.
+        AVX2: [AVX512F],

I think this was meant to be "but" or "yet" instead of "and". And then I'm not particularly happy about the asymmetry with AVX (which is not dependent on SSE or any of its successors, despite extending many of them to 256-bit forms). Plus e.g. FMA gets extended too, but isn't being made a dependency. And quite opposite to that, at least some AVX2 instructions get extended only by e.g. AVX512BW.
Nor are any of the extended forms listed to require other than the AVX512* bits checked in the doc.

Quoted 1 line

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 10 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, July 5, 2016 3:03 PM
To: Kang, Luwei <[email protected]>
Cc: [email protected]; [email protected]; xen- [email protected]
Subject: RE: [PATCH v4] x86/cpuid: AVX-512 Feature Detection

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line · On 05.07.16 at 04:31, <[email protected]> wrote:

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F ( AVX2:

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

Quoted 16 lines
Quoted 7 lines

From: Jan Beulich [mailto:[email protected]]
Sent: Friday, July 1, 2016 3:56 PM

xen/tools/gen-cpuid.py def crunch_numbers(state): · line 243

Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 30.06.16 at 07:50, <[email protected]> wrote:
xen/tools/gen-cpuid.py +0 -0
@@ -243,6 +243,17 @@ def crunch_numbers(state):
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond

the

Quoted 4 lines

xen/tools/gen-cpuid.py def crunch_numbers(state):

Quoted 4 lines
xen/tools/gen-cpuid.py +2 -0
         # standard 3DNow in the earlier K6 processors.
         _3DNOW: [_3DNOWEXT],
+
+        # AVX2 is an extension to AVX, providing mainly new integer

instructions.

Quoted 1 line

xen/tools/gen-cpuid.py def crunch_numbers(state): · line 248

Quoted 1 line
xen/tools/gen-cpuid.py +1 -0
+        # In principle, AVX512 only takes YMM register state as a

prerequisite

Quoted 1 line

xen/tools/gen-cpuid.py def crunch_numbers(state): · line 249

Quoted 1 line
xen/tools/gen-cpuid.py +1 -0
+        # and many AVX2 instructions are extended by AVX512F to 512-bit
Quoted 16 lines

forms.

Quoted 6 lines

xen/tools/gen-cpuid.py def crunch_numbers(state): · line 250

Quoted 1 line
xen/tools/gen-cpuid.py +1 -0
+        AVX2: [AVX512F],

I think this was meant to be "but" or "yet" instead of "and". And then I'm not particularly happy about the asymmetry with AVX (which is not dependent on SSE or any of its successors, despite extending many of them to 256-bit forms). Plus e.g. FMA gets extended too, but isn't being

made a dependency.

Quoted 6 lines

And quite opposite to that, at least some AVX2 instructions get extended only by e.g. AVX512BW.
Nor are any of the extended forms listed to require other than the AVX512* bits checked in the doc.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
Quoted 10 lines · Luwei
Quoted 10 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, July 5, 2016 3:03 PM
To: Kang, Luwei <[email protected]>
Cc: [email protected]; [email protected]; xen- [email protected]
Subject: RE: [PATCH v4] x86/cpuid: AVX-512 Feature Detection

Quoted 1 line
Quoted 1 line
Quoted 1 line · On 05.07.16 at 04:31, <[email protected]> wrote:
Quoted 8 lines
Quoted 7 lines

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F ( AVX2:

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

You are in a better position to answer than me.

For a specific instruction which may be VEX and EVEX encoded, is the circuitry for a specific instruction shared, or discrete? Is there a plausible future where you might support only the EVEX variant of an instruction, and not the VEX variant?

These dependences are about what may be reasonably assumed about the way the environment is structured. It doesn't look reasonable to advertise an AVX512 environment to guests while at the same time stating that AVX2 is not present. If this is correct, then the dependency should stay. If Intel plausibly things it might release hardware with !AVX2 but AVX512, then the dependency should be dropped.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
Quoted 17 lines
Quoted 3 lines
Quoted 3 lines

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F

( AVX2:

Quoted 5 lines
Quoted 4 lines

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

You are in a better position to answer than me.

For a specific instruction which may be VEX and EVEX encoded, is the circuitry for a specific instruction shared, or discrete? Is there a plausible future where you might support only the EVEX variant of an instruction, and not the VEX variant?

Quoted 6 lines

These dependences are about what may be reasonably assumed about the way the environment is structured. It doesn't look reasonable to advertise an AVX512 environment to guests while at the same time stating that AVX2 is not present. If this is correct, then the dependency should stay. If Intel plausibly things it might release hardware with !AVX2 but AVX512, then the dependency should be dropped.

Regarding the dependency between AVX2 and AVX512F, I have ask some hardware architecture engineer.

AVX512 is a superset of AVX2, the most important item being the state. If the state for AVX2 isn't enabled (in XCR0), then AVX512 also can't function.

So if we want to use AVX512, AVX2 must be supported and enabled. The dependence between AVX512F and AVX2 may need be reserved.

Quoted 2 lines

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw
Quoted 22 lines · Luwei
Quoted 16 lines
Quoted 3 lines
Quoted 3 lines

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F

( AVX2:

Quoted 5 lines
Quoted 4 lines

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

You are in a better position to answer than me.

For a specific instruction which may be VEX and EVEX encoded, is the circuitry for a specific instruction shared, or discrete? Is there a plausible future where you might support only the EVEX variant of an instruction, and not the VEX variant?

Quoted 6 lines

These dependences are about what may be reasonably assumed about the way the environment is structured. It doesn't look reasonable to advertise an AVX512 environment to guests while at the same time stating that AVX2 is not present. If this is correct, then the dependency should stay. If Intel plausibly things it might release hardware with !AVX2 but AVX512, then the dependency should be dropped.

Quoted 5 lines

Regarding the dependency between AVX2 and AVX512F, I have ask some hardware architecture engineer.

AVX512 is a superset of AVX2, the most important item being the state. If the state for AVX2 isn't enabled (in XCR0), then AVX512 also can't function.

So if we want to use AVX512, AVX2 must be supported and enabled. The dependence between AVX512F and AVX2 may need be reserved.

Ok, so AVX512 strictly depends on AVX2.

In which case, the python code was correct. The meaning of the key/value relationship is "if the feature in the key is not present, all features in the value must also be disabled".

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw
Quoted 28 lines · Luwei
Quoted 22 lines
Quoted 16 lines
Quoted 3 lines
Quoted 3 lines

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F

( AVX2:

Quoted 5 lines
Quoted 4 lines

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

You are in a better position to answer than me.

For a specific instruction which may be VEX and EVEX encoded, is the circuitry for a specific instruction shared, or discrete? Is there a plausible future where you might support only the EVEX variant of an instruction, and not the VEX variant?

Quoted 6 lines

These dependences are about what may be reasonably assumed about the
way the environment is structured. It doesn't look reasonable to advertise an AVX512 environment to guests while at the same time
stating that AVX2 is not present. If this is correct, then the dependency should stay. If Intel plausibly things it might release hardware with !AVX2 but AVX512, then the dependency should be dropped.

Quoted 3 lines

Regarding the dependency between AVX2 and AVX512F, I have ask some hardware architecture engineer.

AVX512 is a superset of AVX2, the most important item being the state. If the state for AVX2 isn't enabled (in XCR0), then AVX512

also can't function.

Quoted 1 line
Quoted 7 lines
Quoted 1 line

So if we want to use AVX512, AVX2 must be supported and enabled. The dependence between AVX512F and AVX2 may need be

reserved.

Ok, so AVX512 strictly depends on AVX2.

In which case, the python code was correct. The meaning of the key/value relationship is "if the feature in the key is not present, all features in the value must also be disabled".

Hi jan, what is your opinion?

Quoted 2 lines

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#9 lore raw
Quoted 36 lines
Quoted 18 lines
Quoted 1 line · On 03.08.16 at 03:32, <[email protected]> wrote:
Quoted 16 lines · Luwei
Quoted 16 lines
Quoted 3 lines
Quoted 3 lines

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F

( AVX2:

Quoted 5 lines
Quoted 4 lines

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

You are in a better position to answer than me.

For a specific instruction which may be VEX and EVEX encoded, is the circuitry for a specific instruction shared, or discrete? Is there a plausible future where you might support only the EVEX variant of an instruction, and not the VEX variant?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

These dependences are about what may be reasonably assumed about the way the environment is structured. It doesn't look reasonable to advertise an AVX512 environment to guests while at the same time stating that AVX2 is not present. If this is correct, then the dependency

should stay.

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

If Intel plausibly things it might release hardware with !AVX2 but AVX512, then the dependency should be dropped.

Regarding the dependency between AVX2 and AVX512F, I have ask some hardware

architecture engineer.

Quoted 2 lines
Quoted 2 lines

AVX512 is a superset of AVX2, the most important item being the state. If

the state for AVX2 isn't enabled (in XCR0), then AVX512

Quoted 3 lines

also can't function.

Quoted 2 lines

So if we want to use AVX512, AVX2 must be supported and enabled. The

dependence between AVX512F and AVX2 may need be

Quoted 2 lines

reserved.

Quoted 7 lines
Quoted 3 lines

Ok, so AVX512 strictly depends on AVX2.

In which case, the python code was correct. The meaning of the key/value

relationship is "if the feature in the key is not present, all

Quoted 1 line

features in the value must also be disabled".

Hi jan, what is your opinion?

There's no opinion to be had here, according to your earlier reply. I do, however, continue to question that model: State and instruction set are independent items. Of course YMM state is a prereq to ZMM state, but I do not buy AVX2 insn support being a prereq to AVX-512 insns. Yet to me the AVX2 and AVX-512F feature flags solely represent the instructions, while the XSTATE leaf bits represent the states.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#10 lore raw
Quoted 45 lines
Quoted 45 lines
Quoted 18 lines
Quoted 1 line · On 03.08.16 at 03:32, <[email protected]> wrote:
Quoted 16 lines · Luwei
Quoted 16 lines
Quoted 3 lines
Quoted 3 lines

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F

( AVX2:

Quoted 5 lines
Quoted 4 lines

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

You are in a better position to answer than me.

For a specific instruction which may be VEX and EVEX encoded, is the circuitry for a specific instruction shared, or discrete? Is there a plausible future where you might support only the EVEX variant of an instruction, and not the VEX variant?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

These dependences are about what may be reasonably assumed about the way the environment is structured. It doesn't look reasonable to advertise an AVX512 environment to guests while at the same time stating that AVX2 is not present. If this is correct, then the dependency

should stay.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

If Intel plausibly things it might release hardware with !AVX2 but AVX512, then the dependency should be dropped.

Regarding the dependency between AVX2 and AVX512F, I have ask some hardware

architecture engineer.

Quoted 3 lines
Quoted 3 lines

AVX512 is a superset of AVX2, the most important item being the state. If

the state for AVX2 isn't enabled (in XCR0), then AVX512

Quoted 4 lines

also can't function.

Quoted 3 lines

So if we want to use AVX512, AVX2 must be supported and enabled. The

dependence between AVX512F and AVX2 may need be

Quoted 6 lines

reserved.

Ok, so AVX512 strictly depends on AVX2.

In which case, the python code was correct. The meaning of the key/value

relationship is "if the feature in the key is not present, all

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

features in the value must also be disabled".

Hi jan, what is your opinion?

There's no opinion to be had here, according to your earlier reply. I do, however, continue to question that model: State and instruction set are independent items. Of course YMM state is a prereq to ZMM state, but I do not buy AVX2 insn support being a prereq to AVX-512 insns. Yet to me the AVX2 and AVX-512F feature flags solely represent the instructions, while the XSTATE leaf bits represent the states.

Hi jan,
I get some information from hardware colleague. There is no dependence about AVX512 instructions and AVX2 instructions. It is also not states in the official document.
But I want to know the meaning of the dependence "AVX2: [AVX512F]" in "gen-cpuid.py" file.
If it is the feature dependence, I think the dependence between AVX512 and AVX2 may need to add. As we talk before, Zmm is part of AVX512 feature. If the state for AVX2 isn't enabled (in XCR0), then AVX512 also can't function. Apart from that, there is no processors with AVX512 without AVX2 currently and it is safe to treat AVX2 as part of the thermometer leading to AVX512. Regarding if will have a cpu support avx512 without avx2 in future, it is really hard to say.
If it is the instructions dependence, I have no idea to delete this dependence in "gen-cpuid.py" file.
So, I want to know your advice.

Thanks,
Luwei Kang

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw
Quoted 55 lines
Quoted 43 lines
Quoted 43 lines · On 10.08.16 at 11:58, <[email protected]> wrote:
Quoted 18 lines
Quoted 1 line · On 03.08.16 at 03:32, <[email protected]> wrote:
Quoted 16 lines · Luwei
Quoted 16 lines
Quoted 3 lines
Quoted 3 lines

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F

( AVX2:

Quoted 5 lines
Quoted 4 lines

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

You are in a better position to answer than me.

For a specific instruction which may be VEX and EVEX encoded, is the circuitry for a specific instruction shared, or discrete? Is there a plausible future where you might support only the EVEX variant of an instruction, and not the VEX variant?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

These dependences are about what may be reasonably assumed about the way the environment is structured. It doesn't look reasonable to advertise an AVX512 environment to guests while at the same time stating that AVX2 is not present. If this is correct, then the dependency

should stay.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

If Intel plausibly things it might release hardware with !AVX2 but AVX512, then the dependency should be dropped.

Regarding the dependency between AVX2 and AVX512F, I have ask some hardware

architecture engineer.

Quoted 3 lines
Quoted 3 lines

AVX512 is a superset of AVX2, the most important item being the state. If

the state for AVX2 isn't enabled (in XCR0), then AVX512

Quoted 4 lines

also can't function.

Quoted 3 lines

So if we want to use AVX512, AVX2 must be supported and enabled. The

dependence between AVX512F and AVX2 may need be

Quoted 4 lines

reserved.

Ok, so AVX512 strictly depends on AVX2.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

In which case, the python code was correct. The meaning of the key/value

relationship is "if the feature in the key is not present, all

Quoted 1 line

features in the value must also be disabled".

Hi jan, what is your opinion?

There's no opinion to be had here, according to your earlier reply. I do,

however, continue to question that model: State and

Quoted 1 line

instruction set are independent items. Of course YMM state is a prereq to

ZMM state, but I do not buy AVX2 insn support being a

Quoted 1 line

prereq to AVX-512 insns. Yet to me the AVX2 and AVX-512F feature flags solely

Quoted 8 lines

represent the instructions, while the XSTATE leaf bits

Quoted 2 lines

represent the states.

Hi jan,
I get some information from hardware colleague. There is no dependence
about AVX512 instructions and AVX2 instructions. It is also not states in the official document.

As I had assumed.

Quoted 4 lines

But I want to know the meaning of the dependence "AVX2: [AVX512F]" in
"gen-cpuid.py" file.
If it is the feature dependence, I think the dependence between AVX512
and AVX2 may need to add. As we talk before, Zmm is part of AVX512 feature.

Quoted 8 lines

If the state for AVX2 isn't enabled (in XCR0), then AVX512 also can't function. Apart from that, there is no processors with AVX512 without AVX2 currently and it is safe to treat AVX2 as part of the thermometer leading to AVX512. Regarding if will have a cpu support avx512 without avx2 in future, it is really hard to say.
If it is the instructions dependence, I have no idea to delete this
dependence in "gen-cpuid.py" file.
So, I want to know your advice.

Well, the main issue here is that we have no feature flag representation for the xstate bits. If we had, the relevant parts of the dependencies should look like

	XSTATE_YMM: [AVX, XSTATE_ZMM]
	AVX: [AVX2]
	XSTATE_ZMM: [AVX512F]
	AVX512F: [AVX512CD, ...]

But in their absence I guess keeping the AVX2 dependency as you have it is the only reasonable approach. Just that I'd like it to be accompanied by a comment explaining that this isn't the actual dependency (so that if XSTATE feature flags got introduced later, it would be clear how to adjust those parts).

Andrew - I keep forgetting why you think having such XSTATE_* feature flags is not appropriate.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#12 lore raw
Quoted 81 lines · Jan Beulich
Quoted 50 lines
Quoted 39 lines
Quoted 39 lines · On 10.08.16 at 11:58, <[email protected]> wrote:
Quoted 18 lines
Quoted 1 line · On 03.08.16 at 03:32, <[email protected]> wrote:
Quoted 16 lines · Luwei
Quoted 16 lines
Quoted 3 lines
Quoted 3 lines

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F

( AVX2:

Quoted 5 lines
Quoted 4 lines

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

You are in a better position to answer than me.

For a specific instruction which may be VEX and EVEX encoded, is the circuitry for a specific instruction shared, or discrete? Is there a plausible future where you might support only the EVEX variant of an instruction, and not the VEX variant?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

These dependences are about what may be reasonably assumed about the way the environment is structured. It doesn't look reasonable to advertise an AVX512 environment to guests while at the same time stating that AVX2 is not present. If this is correct, then the dependency

should stay.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

If Intel plausibly things it might release hardware with !AVX2 but AVX512, then the dependency should be dropped.

Regarding the dependency between AVX2 and AVX512F, I have ask some hardware

architecture engineer.

Quoted 2 lines
Quoted 2 lines

AVX512 is a superset of AVX2, the most important item being the state. If

the state for AVX2 isn't enabled (in XCR0), then AVX512

Quoted 3 lines

also can't function.

Quoted 2 lines

So if we want to use AVX512, AVX2 must be supported and enabled. The

dependence between AVX512F and AVX2 may need be

Quoted 2 lines

reserved.

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

Ok, so AVX512 strictly depends on AVX2.

In which case, the python code was correct. The meaning of the key/value

relationship is "if the feature in the key is not present, all

Quoted 1 line

features in the value must also be disabled".

Hi jan, what is your opinion?

There's no opinion to be had here, according to your earlier reply. I do,

however, continue to question that model: State and

Quoted 1 line

instruction set are independent items. Of course YMM state is a prereq to

ZMM state, but I do not buy AVX2 insn support being a

Quoted 8 lines
Quoted 1 line

prereq to AVX-512 insns. Yet to me the AVX2 and AVX-512F feature flags solely

represent the instructions, while the XSTATE leaf bits

Quoted 2 lines

represent the states.

Hi jan,
I get some information from hardware colleague. There is no dependence
about AVX512 instructions and AVX2 instructions. It is also not states in the official document.

As I had assumed.

Quoted 4 lines

But I want to know the meaning of the dependence "AVX2: [AVX512F]" in
"gen-cpuid.py" file.
If it is the feature dependence, I think the dependence between AVX512
and AVX2 may need to add. As we talk before, Zmm is part of AVX512 feature.

Quoted 8 lines

If the state for AVX2 isn't enabled (in XCR0), then AVX512 also can't function. Apart from that, there is no processors with AVX512 without AVX2 currently and it is safe to treat AVX2 as part of the thermometer leading to AVX512. Regarding if will have a cpu support avx512 without avx2 in future, it is really hard to say.
If it is the instructions dependence, I have no idea to delete this
dependence in "gen-cpuid.py" file.
So, I want to know your advice.

Well, the main issue here is that we have no feature flag representation for the xstate bits. If we had, the relevant parts of the dependencies should look like

	XSTATE_YMM: [AVX, XSTATE_ZMM]
	AVX: [AVX2]
	XSTATE_ZMM: [AVX512F]
	AVX512F: [AVX512CD, ...]
Quoted 8 lines

But in their absence I guess keeping the AVX2 dependency as you have it is the only reasonable approach. Just that I'd like it to be accompanied by a comment explaining that this isn't the actual dependency (so that if XSTATE feature flags got introduced later, it would be clear how to adjust those parts).

Andrew - I keep forgetting why you think having such XSTATE_* feature flags is not appropriate.

This is all about providing a plausible cpuid layout to a guest.

It is not plausible that we will ever see a processor with e.g. AVX512F but not XSTATE_ZMM.

Therefore, to avoid that misconfiguration (or the inverse misconfiguration) from ever occurring, the XSTATE is derived from the plain feature flags.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#13 lore raw
Quoted 92 lines
Quoted 1 line
Quoted 1 line · On 10.08.16 at 14:10, <[email protected]> wrote:
Quoted 49 lines · Jan Beulich
Quoted 49 lines
Quoted 39 lines
Quoted 39 lines · On 10.08.16 at 11:58, <[email protected]> wrote:
Quoted 18 lines
Quoted 1 line · On 03.08.16 at 03:32, <[email protected]> wrote:
Quoted 16 lines · Luwei
Quoted 16 lines
Quoted 3 lines
Quoted 3 lines

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F

( AVX2:

Quoted 5 lines
Quoted 4 lines

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

You are in a better position to answer than me.

For a specific instruction which may be VEX and EVEX encoded, is the circuitry for a specific instruction shared, or discrete? Is there a plausible future where you might support only the EVEX variant of an instruction, and not the VEX variant?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

These dependences are about what may be reasonably assumed about the way the environment is structured. It doesn't look reasonable to advertise an AVX512 environment to guests while at the same time stating that AVX2 is not present. If this is correct, then the dependency

should stay.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

If Intel plausibly things it might release hardware with !AVX2 but AVX512, then the dependency should be dropped.

Regarding the dependency between AVX2 and AVX512F, I have ask some hardware

architecture engineer.

Quoted 2 lines
Quoted 2 lines

AVX512 is a superset of AVX2, the most important item being the state. If

the state for AVX2 isn't enabled (in XCR0), then AVX512

Quoted 3 lines

also can't function.

Quoted 2 lines

So if we want to use AVX512, AVX2 must be supported and enabled. The

dependence between AVX512F and AVX2 may need be

Quoted 2 lines

reserved.

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

Ok, so AVX512 strictly depends on AVX2.

In which case, the python code was correct. The meaning of the key/value

relationship is "if the feature in the key is not present, all

Quoted 1 line

features in the value must also be disabled".

Hi jan, what is your opinion?

There's no opinion to be had here, according to your earlier reply. I do,

however, continue to question that model: State and

Quoted 1 line

instruction set are independent items. Of course YMM state is a prereq to

Quoted 8 lines
Quoted 8 lines

ZMM state, but I do not buy AVX2 insn support being a

Quoted 1 line

prereq to AVX-512 insns. Yet to me the AVX2 and AVX-512F feature flags solely

represent the instructions, while the XSTATE leaf bits

Quoted 2 lines

represent the states.

Hi jan,
I get some information from hardware colleague. There is no dependence
about AVX512 instructions and AVX2 instructions. It is also not states in

the

Quoted 32 lines
Quoted 1 line

official document.

As I had assumed.

Quoted 9 lines

But I want to know the meaning of the dependence "AVX2: [AVX512F]" in
"gen-cpuid.py" file.
If it is the feature dependence, I think the dependence between AVX512
and AVX2 may need to add. As we talk before, Zmm is part of AVX512 feature.

If the state for AVX2 isn't enabled (in XCR0), then AVX512 also can't function. Apart from that, there is no processors with AVX512 without AVX2 currently and it is safe to treat AVX2 as part of the thermometer leading to

Quoted 5 lines

AVX512. Regarding if will have a cpu support avx512 without avx2 in future, it is really hard to say.
If it is the instructions dependence, I have no idea to delete this
dependence in "gen-cpuid.py" file.
So, I want to know your advice.

Well, the main issue here is that we have no feature flag representation for the xstate bits. If we had, the relevant parts of the dependencies should look like

	XSTATE_YMM: [AVX, XSTATE_ZMM]
	AVX: [AVX2]
	XSTATE_ZMM: [AVX512F]
	AVX512F: [AVX512CD, ...]

But in their absence I guess keeping the AVX2 dependency as you have it is the only reasonable approach. Just that I'd like it to be accompanied by a comment explaining that this isn't the actual dependency (so that if XSTATE feature flags got introduced later, it would be clear how to adjust those parts).

Quoted 7 lines
Quoted 2 lines

Andrew - I keep forgetting why you think having such XSTATE_* feature flags is not appropriate.

This is all about providing a plausible cpuid layout to a guest.

It is not plausible that we will ever see a processor with e.g. AVX512F but not XSTATE_ZMM.

This is a somewhat bogus argument considering we have

        FXSR: [FFXSR, SSE],

which, as you certainly realize, is slightly wrong nowadays:
XSTATE_XMM would suffice as a prereq, without any FXSR. (But I certainly realize that lack of FXSR is unlikely, as that's considered part of the base x86-64 architecture, and I also realize that expressing alternative prereqs would make the deep dependency generation logic more complicated.)

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#14 lore raw
Quoted 105 lines
Quoted 97 lines
Quoted 1 line
Quoted 1 line · On 10.08.16 at 14:10, <[email protected]> wrote:
Quoted 54 lines · Jan Beulich
Quoted 54 lines
Quoted 41 lines
Quoted 41 lines · On 10.08.16 at 11:58, <[email protected]> wrote:
Quoted 18 lines
Quoted 1 line · On 03.08.16 at 03:32, <[email protected]> wrote:
Quoted 16 lines · Luwei
Quoted 16 lines
Quoted 3 lines
Quoted 3 lines

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F

( AVX2:

Quoted 5 lines
Quoted 4 lines

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

You are in a better position to answer than me.

For a specific instruction which may be VEX and EVEX encoded, is the circuitry for a specific instruction shared, or discrete? Is there a plausible future where you might support only the EVEX variant of an instruction, and not the VEX variant?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

These dependences are about what may be reasonably assumed about the way the environment is structured. It doesn't look reasonable to advertise an AVX512 environment to guests while at the same time stating that AVX2 is not present. If this is correct, then the dependency

should stay.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

If Intel plausibly things it might release hardware with !AVX2 but AVX512, then the dependency should be dropped.

Regarding the dependency between AVX2 and AVX512F, I have ask some hardware

architecture engineer.

Quoted 2 lines
Quoted 2 lines

AVX512 is a superset of AVX2, the most important item being the state. If

the state for AVX2 isn't enabled (in XCR0), then AVX512

Quoted 3 lines

also can't function.

Quoted 2 lines

So if we want to use AVX512, AVX2 must be supported and enabled. The

dependence between AVX512F and AVX2 may need be

Quoted 4 lines

reserved.

Ok, so AVX512 strictly depends on AVX2.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

In which case, the python code was correct. The meaning of the key/value

relationship is "if the feature in the key is not present, all

Quoted 1 line

features in the value must also be disabled".

Hi jan, what is your opinion?

There's no opinion to be had here, according to your earlier reply. I do,

however, continue to question that model: State and

Quoted 2 lines

instruction set are independent items. Of course YMM state is a prereq to

ZMM state, but I do not buy AVX2 insn support being a

Quoted 2 lines

prereq to AVX-512 insns. Yet to me the AVX2 and AVX-512F feature flags solely

Quoted 7 lines
Quoted 7 lines

represent the instructions, while the XSTATE leaf bits

Quoted 2 lines

represent the states.

Hi jan,
I get some information from hardware colleague. There is no
dependence about AVX512 instructions and AVX2 instructions. It is also not states in

the

Quoted 33 lines
Quoted 1 line

official document.

As I had assumed.

Quoted 10 lines

But I want to know the meaning of the dependence "AVX2:
[AVX512F]" in "gen-cpuid.py" file.
If it is the feature dependence, I think the dependence between
AVX512 and AVX2 may need to add. As we talk before, Zmm is part of AVX512 feature.

If the state for AVX2 isn't enabled (in XCR0), then AVX512 also can't function. Apart from that, there is no processors with AVX512 without AVX2 currently and it is safe to treat AVX2 as part of the thermometer leading to

Quoted 5 lines

AVX512. Regarding if will have a cpu support avx512 without avx2 in future, it is really hard to say.
If it is the instructions dependence, I have no idea to delete
this dependence in "gen-cpuid.py" file.
So, I want to know your advice.

Well, the main issue here is that we have no feature flag representation for the xstate bits. If we had, the relevant parts of the dependencies should look like

	XSTATE_YMM: [AVX, XSTATE_ZMM]
	AVX: [AVX2]
	XSTATE_ZMM: [AVX512F]
	AVX512F: [AVX512CD, ...]

But in their absence I guess keeping the AVX2 dependency as you have it is the only reasonable approach. Just that I'd like it to be accompanied by a comment explaining that this isn't the actual dependency (so that if XSTATE feature flags got introduced later, it would be clear how to adjust those parts).

Quoted 7 lines
Quoted 2 lines

Andrew - I keep forgetting why you think having such XSTATE_* feature flags is not appropriate.

This is all about providing a plausible cpuid layout to a guest.

It is not plausible that we will ever see a processor with e.g. AVX512F but not XSTATE_ZMM.

Quoted 9 lines

This is a somewhat bogus argument considering we have

        FXSR: [FFXSR, SSE],

which, as you certainly realize, is slightly wrong nowadays:
XSTATE_XMM would suffice as a prereq, without any FXSR. (But I certainly realize that lack of FXSR is unlikely, as that's considered part of the base x86-64 architecture, and I also realize that expressing alternative prereqs would make the deep dependency generation logic more complicated.)

According your advice, I change the comment of "AVX2: [AVX512F]," as below. If the description is not accurately enough, please help do some corrected, thank you.

xen/tools/gen-cpuid.py +10 -0
@@ -243,6 +243,17 @@ def crunch_numbers(state):
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
         _3DNOW: [_3DNOWEXT],
+
+        # This is just the dependency between AVX512 and AVX2 of XSTATE feature flag. 
+        # If want to use AVX512, AVX2 must be supported and enabled.
+        AVX2: [AVX512F],
+
+        # AVX512F is taken to mean hardware support for EVEX encoded instructions,
+        # 512bit registers, and the instructions themselves. All further AVX512 features
+        # are built on top of AVX512F
+        AVX512F: [AVX512DQ, AVX512IFMA, AVX512PF, AVX512ER, AVX512CD,
+                    AVX512BW, AVX512VL, AVX512VBMI],
     }
 
     deep_features = tuple(sorted(deps.keys()))

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#15 lore raw
Quoted 126 lines
Quoted 102 lines
Quoted 92 lines
Quoted 51 lines
Quoted 51 lines
Quoted 38 lines
Quoted 38 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 3 lines
Quoted 3 lines

First of all - please don't top post.

Quoted 1 line

What about remove the dependency between AVX2 and AVX512F

( AVX2:

Quoted 5 lines
Quoted 4 lines

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

You are in a better position to answer than me.

For a specific instruction which may be VEX and EVEX encoded, is the circuitry for a specific instruction shared, or discrete? Is there a plausible future where you might support only the EVEX variant of an instruction, and not the VEX variant?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

These dependences are about what may be reasonably assumed about the way the environment is structured. It doesn't look reasonable to advertise an AVX512 environment to guests while at the same time stating that AVX2 is not present. If this is correct, then the dependency

should stay.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

If Intel plausibly things it might release hardware with !AVX2 but AVX512, then the dependency should be dropped.

Regarding the dependency between AVX2 and AVX512F, I have ask some hardware

architecture engineer.

Quoted 2 lines
Quoted 2 lines

AVX512 is a superset of AVX2, the most important item being the state. If

the state for AVX2 isn't enabled (in XCR0), then AVX512

Quoted 3 lines

also can't function.

Quoted 2 lines

So if we want to use AVX512, AVX2 must be supported and enabled. The

dependence between AVX512F and AVX2 may need be

Quoted 4 lines

reserved.

Ok, so AVX512 strictly depends on AVX2.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

In which case, the python code was correct. The meaning of the key/value

relationship is "if the feature in the key is not present, all

Quoted 1 line

features in the value must also be disabled".

Hi jan, what is your opinion?

There's no opinion to be had here, according to your earlier reply. I do,

however, continue to question that model: State and

Quoted 2 lines

instruction set are independent items. Of course YMM state is a prereq to

ZMM state, but I do not buy AVX2 insn support being a

Quoted 2 lines

prereq to AVX-512 insns. Yet to me the AVX2 and AVX-512F feature flags solely

Quoted 7 lines
Quoted 7 lines

represent the instructions, while the XSTATE leaf bits

Quoted 2 lines

represent the states.

Hi jan,
I get some information from hardware colleague. There is no
dependence about AVX512 instructions and AVX2 instructions. It is also not states in

the

Quoted 33 lines
Quoted 1 line

official document.

As I had assumed.

Quoted 10 lines

But I want to know the meaning of the dependence "AVX2:
[AVX512F]" in "gen-cpuid.py" file.
If it is the feature dependence, I think the dependence between
AVX512 and AVX2 may need to add. As we talk before, Zmm is part of AVX512 feature.

If the state for AVX2 isn't enabled (in XCR0), then AVX512 also can't function. Apart from that, there is no processors with AVX512 without AVX2 currently and it is safe to treat AVX2 as part of the thermometer leading to

Quoted 5 lines

AVX512. Regarding if will have a cpu support avx512 without avx2 in future, it is really hard to say.
If it is the instructions dependence, I have no idea to delete
this dependence in "gen-cpuid.py" file.
So, I want to know your advice.

Well, the main issue here is that we have no feature flag representation for the xstate bits. If we had, the relevant parts of the dependencies should look like

	XSTATE_YMM: [AVX, XSTATE_ZMM]
	AVX: [AVX2]
	XSTATE_ZMM: [AVX512F]
	AVX512F: [AVX512CD, ...]

But in their absence I guess keeping the AVX2 dependency as you have it is the only reasonable approach. Just that I'd like it to be accompanied by a comment explaining that this isn't the actual dependency (so that if XSTATE feature flags got introduced later, it would be clear how to adjust those parts).

Quoted 7 lines
Quoted 2 lines

Andrew - I keep forgetting why you think having such XSTATE_* feature flags is not appropriate.

This is all about providing a plausible cpuid layout to a guest.

It is not plausible that we will ever see a processor with e.g. AVX512F but not XSTATE_ZMM.

This is a somewhat bogus argument considering we have

Quoted 9 lines
        FXSR: [FFXSR, SSE],

which, as you certainly realize, is slightly wrong nowadays:
XSTATE_XMM would suffice as a prereq, without any FXSR. (But I certainly realize that lack of FXSR is unlikely, as that's considered part of the base x86-64 architecture, and I also realize that expressing alternative prereqs would make the deep dependency generation logic more complicated.)

According your advice, I change the comment of "AVX2: [AVX512F]," as below. If the description is not accurately enough, please help do some corrected, thank you.

xen/tools/gen-cpuid.py +3 -0
@@ -243,6 +243,17 @@ def crunch_numbers(state):
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
         _3DNOW: [_3DNOWEXT],
+
+        # This is just the dependency between AVX512 and AVX2 of XSTATE feature flag.
+        # If want to use AVX512, AVX2 must be supported and enabled.

xen/tools/gen-cpuid.py def crunch_numbers(state): · line 258

Quoted 10 lines
xen/tools/gen-cpuid.py +7 -0
+        AVX2: [AVX512F],
+
+        # AVX512F is taken to mean hardware support for EVEX encoded instructions,
+        # 512bit registers, and the instructions themselves. All further AVX512 features
+        # are built on top of AVX512F
+        AVX512F: [AVX512DQ, AVX512IFMA, AVX512PF, AVX512ER, AVX512CD,
+                    AVX512BW, AVX512VL, AVX512VBMI],
     }
 
     deep_features = tuple(sorted(deps.keys()))

Hi jan,
What do you think about modify as above. If need any corrected?

Thanks,
Luwei Kang

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#16 lore raw
Quoted 141 lines
Quoted 59 lines
Quoted 59 lines · On 22.08.16 at 13:22, <[email protected]> wrote:
Quoted 58 lines
Quoted 58 lines
Quoted 58 lines
Quoted 38 lines
Quoted 38 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 3 lines
Quoted 3 lines

First of all - please don't top post.

What about remove the dependency between AVX2 and AVX512F

( AVX2:

Quoted 5 lines
Quoted 4 lines

[AVX512F], ) ?

Yes, that's what I think we want, but we need Andrew's agreement here.

Hi Andrew, what is your opinion ?

You are in a better position to answer than me.

For a specific instruction which may be VEX and EVEX encoded, is the circuitry for a specific instruction shared, or discrete? Is there a plausible future where you might support only the EVEX variant of an instruction, and not the VEX variant?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

These dependences are about what may be reasonably assumed about the way the environment is structured. It doesn't look reasonable to advertise an AVX512 environment to guests while at the same time stating that AVX2 is not present. If this is correct, then the dependency

should stay.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

If Intel plausibly things it might release hardware with !AVX2 but AVX512, then the dependency should be dropped.

Regarding the dependency between AVX2 and AVX512F, I have ask some hardware

architecture engineer.

Quoted 2 lines
Quoted 2 lines

AVX512 is a superset of AVX2, the most important item being the state. If

the state for AVX2 isn't enabled (in XCR0), then AVX512

Quoted 3 lines

also can't function.

Quoted 2 lines

So if we want to use AVX512, AVX2 must be supported and enabled. The

dependence between AVX512F and AVX2 may need be

Quoted 4 lines

reserved.

Ok, so AVX512 strictly depends on AVX2.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

In which case, the python code was correct. The meaning of the key/value

relationship is "if the feature in the key is not present, all

Quoted 1 line

features in the value must also be disabled".

Hi jan, what is your opinion?

There's no opinion to be had here, according to your earlier reply. I do,

however, continue to question that model: State and

Quoted 2 lines

instruction set are independent items. Of course YMM state is a prereq to

ZMM state, but I do not buy AVX2 insn support being a

Quoted 2 lines

prereq to AVX-512 insns. Yet to me the AVX2 and AVX-512F feature flags solely

represent the instructions, while the XSTATE leaf bits

Quoted 2 lines

represent the states.

Hi jan,
I get some information from hardware colleague. There is no
dependence about AVX512 instructions and AVX2 instructions. It is also not states in

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

the

Quoted 7 lines
Quoted 1 line

official document.

As I had assumed.

Quoted 4 lines

But I want to know the meaning of the dependence "AVX2:
[AVX512F]" in "gen-cpuid.py" file.
If it is the feature dependence, I think the dependence between
AVX512 and AVX2 may need to add. As we talk before, Zmm is part of AVX512

feature.

Quoted 46 lines
Quoted 36 lines
Quoted 26 lines
Quoted 26 lines
Quoted 11 lines

If the state for AVX2 isn't enabled (in XCR0), then AVX512 also can't function. Apart from that, there is no processors with AVX512 without AVX2 currently and it is safe to treat AVX2 as part of the thermometer leading to

AVX512. Regarding if will have a cpu support avx512 without avx2 in future, it is really hard to say.
If it is the instructions dependence, I have no idea to delete
this dependence in "gen-cpuid.py" file.
So, I want to know your advice.

Well, the main issue here is that we have no feature flag representation for the xstate bits. If we had, the relevant parts of the dependencies should look like

	XSTATE_YMM: [AVX, XSTATE_ZMM]
	AVX: [AVX2]
	XSTATE_ZMM: [AVX512F]
	AVX512F: [AVX512CD, ...]

But in their absence I guess keeping the AVX2 dependency as you have it is the only reasonable approach. Just that I'd like it to be accompanied by a comment explaining that this isn't the actual dependency (so that if XSTATE feature flags got introduced later, it would be clear how to adjust those parts).

Quoted 7 lines
Quoted 2 lines

Andrew - I keep forgetting why you think having such XSTATE_* feature flags is not appropriate.

This is all about providing a plausible cpuid layout to a guest.

It is not plausible that we will ever see a processor with e.g. AVX512F but not XSTATE_ZMM.

This is a somewhat bogus argument considering we have

Quoted 9 lines
        FXSR: [FFXSR, SSE],

which, as you certainly realize, is slightly wrong nowadays:
XSTATE_XMM would suffice as a prereq, without any FXSR. (But I certainly realize that lack of FXSR is unlikely, as that's considered part of the base x86-64 architecture, and I also realize that expressing alternative prereqs would make the deep dependency generation logic more complicated.)

Quoted 2 lines

According your advice, I change the comment of "AVX2: [AVX512F]," as below. If the description is not accurately enough, please help do some corrected,

thank you.

xen/tools/gen-cpuid.py index

Quoted 2 lines
xen/tools/gen-cpuid.py index renamed from xen/tools/gen-cpuid.py +0 -0

7c45eca..e8b64ce 100755

xen/tools/gen-cpuid.py def crunch_numbers(state): · line 247

Quoted 8 lines
xen/tools/gen-cpuid.py +2 -0
@@ -243,6 +243,17 @@ def crunch_numbers(state):
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
         _3DNOW: [_3DNOWEXT],
+
+        # This is just the dependency between AVX512 and AVX2 of XSTATE 

feature flag.

xen/tools/gen-cpuid.py def crunch_numbers(state):

Quoted 4 lines
xen/tools/gen-cpuid.py +4 -0
+        # If want to use AVX512, AVX2 must be supported and enabled.
+        AVX2: [AVX512F],
+
+        # AVX512F is taken to mean hardware support for EVEX encoded 

instructions,

xen/tools/gen-cpuid.py def crunch_numbers(state): · line 252

Quoted 1 line
xen/tools/gen-cpuid.py +1 -0
+        # 512bit registers, and the instructions themselves. All further 

AVX512 features

Quoted 5 lines
xen/tools/gen-cpuid.py +3 -0
+        # are built on top of AVX512F
+        AVX512F: [AVX512DQ, AVX512IFMA, AVX512PF, AVX512ER, AVX512CD,
+                    AVX512BW, AVX512VL, AVX512VBMI],
     }
 
Quoted 5 lines

xen/tools/gen-cpuid.py def crunch_numbers(state): · line 258

Quoted 2 lines
xen/tools/gen-cpuid.py +0 -0
     deep_features = tuple(sorted(deps.keys()))

Hi jan,
What do you think about modify as above. If need any corrected?

Looks okay - I was actually awaiting v5 ...

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel