public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Enumerate and expose AVX_VNNI feature
@ 2020-12-16  2:01 Yang Zhong
  2020-12-16  2:01 ` [PATCH 1/2] Enumerate AVX Vector Neural Network instructions Yang Zhong
  2020-12-16  2:01 ` [PATCH 2/2] KVM: Expose AVX_VNNI instruction to guset Yang Zhong
  0 siblings, 2 replies; 6+ messages in thread
From: Yang Zhong @ 2020-12-16  2:01 UTC (permalink / raw)
  To: linux-kernel, x86, kvm
  Cc: tglx, mingo, bp, hpa, tony.luck, pbonzini, seanjc, vkuznets,
	wanpengli, jmattson, joro, kyung.min.park, yang.zhong

A processor supports AVX_VNNI instructions if CPUID.(EAX=7,ECX=1):EAX[bit 4]
is present.

This series includes kernel and kvm patches, kernel patch define this
new cpu feature bit and kvm expose this bit to guest. When this bit is
enabled on cpu or vcpu, the cpu feature flag is shown as "avx_vnni" in
/proc/cpuinfo of host and guest.

Detailed information on the instruction and CPUID feature flag can be
found in the latest "extensions" manual [1].

Reference:
[1]. https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html


Kyung Min Park (1):
  Enumerate AVX Vector Neural Network instructions

Yang Zhong (1):
  KVM: Expose AVX_VNNI instruction to guset

 arch/x86/include/asm/cpufeatures.h | 1 +
 arch/x86/kvm/cpuid.c               | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

-- 
2.29.2.334.gfaefdd61ec


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] Enumerate AVX Vector Neural Network instructions
  2020-12-16  2:01 [PATCH 0/2] Enumerate and expose AVX_VNNI feature Yang Zhong
@ 2020-12-16  2:01 ` Yang Zhong
  2020-12-16  2:01 ` [PATCH 2/2] KVM: Expose AVX_VNNI instruction to guset Yang Zhong
  1 sibling, 0 replies; 6+ messages in thread
From: Yang Zhong @ 2020-12-16  2:01 UTC (permalink / raw)
  To: linux-kernel, x86, kvm
  Cc: tglx, mingo, bp, hpa, tony.luck, pbonzini, seanjc, vkuznets,
	wanpengli, jmattson, joro, kyung.min.park, yang.zhong

From: Kyung Min Park <kyung.min.park@intel.com>

Add AVX version of the Vector Neural Network (VNNI) Instructions.

A processor supports AVX VNNI instructions if CPUID.0x07.0x1:EAX[4] is
present. The following instructions are available when this feature is
present.
  1. VPDPBUS: Multiply and Add Unsigned and Signed Bytes
  2. VPDPBUSDS: Multiply and Add Unsigned and Signed Bytes with Saturation
  3. VPDPWSSD: Multiply and Add Signed Word Integers
  4. VPDPWSSDS: Multiply and Add Signed Integers with Saturation

The only in-kernel usage of this is kvm passthrough. The CPU feature
flag is shown as "avx_vnni" in /proc/cpuinfo.

This instruction is currently documented in the latest "extensions"
manual (ISE). It will appear in the "main" manual (SDM) in the future.

Signed-off-by: Kyung Min Park <kyung.min.park@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
---
 arch/x86/include/asm/cpufeatures.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index f5ef2d5b9231..d10d9962bd9b 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -293,6 +293,7 @@
 #define X86_FEATURE_PER_THREAD_MBA	(11*32+ 7) /* "" Per-thread Memory Bandwidth Allocation */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
+#define X86_FEATURE_AVX_VNNI		(12*32+ 4) /* AVX VNNI instructions */
 #define X86_FEATURE_AVX512_BF16		(12*32+ 5) /* AVX512 BFLOAT16 instructions */
 
 /* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */
-- 
2.29.2.334.gfaefdd61ec


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] KVM: Expose AVX_VNNI instruction to guset
  2020-12-16  2:01 [PATCH 0/2] Enumerate and expose AVX_VNNI feature Yang Zhong
  2020-12-16  2:01 ` [PATCH 1/2] Enumerate AVX Vector Neural Network instructions Yang Zhong
@ 2020-12-16  2:01 ` Yang Zhong
  1 sibling, 0 replies; 6+ messages in thread
From: Yang Zhong @ 2020-12-16  2:01 UTC (permalink / raw)
  To: linux-kernel, x86, kvm
  Cc: tglx, mingo, bp, hpa, tony.luck, pbonzini, seanjc, vkuznets,
	wanpengli, jmattson, joro, kyung.min.park, yang.zhong

Expose AVX (VEX-encoded) versions of the Vector Neural Network
Instructions to guest.

The bit definition:
CPUID.(EAX=7,ECX=1):EAX[bit 4] AVX_VNNI

The following instructions are available when this feature is
present in the guest.
  1. VPDPBUS: Multiply and Add Unsigned and Signed Bytes
  2. VPDPBUSDS: Multiply and Add Unsigned and Signed Bytes with Saturation
  3. VPDPWSSD: Multiply and Add Signed Word Integers
  4. VPDPWSSDS: Multiply and Add Signed Integers with Saturation

This instruction is currently documented in the latest "extensions"
manual (ISE). It will appear in the "main" manual (SDM) in the future.

Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
---
 arch/x86/kvm/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 83637a2ff605..4229b67f0a8d 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -433,7 +433,7 @@ void kvm_set_cpu_caps(void)
 		kvm_cpu_cap_set(X86_FEATURE_SPEC_CTRL_SSBD);
 
 	kvm_cpu_cap_mask(CPUID_7_1_EAX,
-		F(AVX512_BF16)
+		F(AVX_VNNI) | F(AVX512_BF16)
 	);
 
 	kvm_cpu_cap_mask(CPUID_D_1_EAX,
-- 
2.29.2.334.gfaefdd61ec


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 0/2] Enumerate and expose AVX_VNNI feature
@ 2021-01-05  0:49 Yang Zhong
  2021-01-21 15:02 ` Paolo Bonzini
  0 siblings, 1 reply; 6+ messages in thread
From: Yang Zhong @ 2021-01-05  0:49 UTC (permalink / raw)
  To: linux-kernel, x86, kvm
  Cc: tglx, mingo, bp, hpa, tony.luck, pbonzini, seanjc, vkuznets,
	wanpengli, jmattson, joro, kyung.min.park, yang.zhong

A processor supports AVX_VNNI instructions if CPUID.(EAX=7,ECX=1):EAX[bit 4]
is present.

This series includes kernel and kvm patches, kernel patch define this
new cpu feature bit and kvm expose this bit to guest. When this bit is
enabled on cpu or vcpu, the cpu feature flag is shown as "avx_vnni" in
/proc/cpuinfo of host and guest.

Detailed information on the instruction and CPUID feature flag can be
found in the latest "extensions" manual [1].

Reference:
[1]. https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html


Kyung Min Park (1):
  Enumerate AVX Vector Neural Network instructions

Yang Zhong (1):
  KVM: Expose AVX_VNNI instruction to guset

 arch/x86/include/asm/cpufeatures.h | 1 +
 arch/x86/kvm/cpuid.c               | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

-- 
2.29.2.334.gfaefdd61ec


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Enumerate and expose AVX_VNNI feature
  2021-01-05  0:49 [PATCH 0/2] Enumerate and expose AVX_VNNI feature Yang Zhong
@ 2021-01-21 15:02 ` Paolo Bonzini
  2021-01-22  6:43   ` Yang Zhong
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2021-01-21 15:02 UTC (permalink / raw)
  To: Yang Zhong, linux-kernel, x86, kvm
  Cc: tglx, mingo, bp, hpa, tony.luck, seanjc, vkuznets, wanpengli,
	jmattson, joro, kyung.min.park

On 05/01/21 01:49, Yang Zhong wrote:
> A processor supports AVX_VNNI instructions if CPUID.(EAX=7,ECX=1):EAX[bit 4]
> is present.
> 
> This series includes kernel and kvm patches, kernel patch define this
> new cpu feature bit and kvm expose this bit to guest. When this bit is
> enabled on cpu or vcpu, the cpu feature flag is shown as "avx_vnni" in
> /proc/cpuinfo of host and guest.
> 
> Detailed information on the instruction and CPUID feature flag can be
> found in the latest "extensions" manual [1].
> 
> Reference:
> [1]. https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html
> 
> 
> Kyung Min Park (1):
>    Enumerate AVX Vector Neural Network instructions
> 
> Yang Zhong (1):
>    KVM: Expose AVX_VNNI instruction to guset
> 
>   arch/x86/include/asm/cpufeatures.h | 1 +
>   arch/x86/kvm/cpuid.c               | 2 +-
>   2 files changed, 2 insertions(+), 1 deletion(-)
> 

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Enumerate and expose AVX_VNNI feature
  2021-01-21 15:02 ` Paolo Bonzini
@ 2021-01-22  6:43   ` Yang Zhong
  0 siblings, 0 replies; 6+ messages in thread
From: Yang Zhong @ 2021-01-22  6:43 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: linux-kernel, x86, kvm, tglx, mingo, bp, hpa, tony.luck, seanjc,
	vkuznets, wanpengli, jmattson, joro, kyung.min.park, yang.zhong

On Thu, Jan 21, 2021 at 04:02:17PM +0100, Paolo Bonzini wrote:
> On 05/01/21 01:49, Yang Zhong wrote:
> >A processor supports AVX_VNNI instructions if CPUID.(EAX=7,ECX=1):EAX[bit 4]
> >is present.
> >
> >This series includes kernel and kvm patches, kernel patch define this
> >new cpu feature bit and kvm expose this bit to guest. When this bit is
> >enabled on cpu or vcpu, the cpu feature flag is shown as "avx_vnni" in
> >/proc/cpuinfo of host and guest.
> >
> >Detailed information on the instruction and CPUID feature flag can be
> >found in the latest "extensions" manual [1].
> >
> >Reference:
> >[1]. https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html
> >
> >
> >Kyung Min Park (1):
> >   Enumerate AVX Vector Neural Network instructions
> >
> >Yang Zhong (1):
> >   KVM: Expose AVX_VNNI instruction to guset
> >
> >  arch/x86/include/asm/cpufeatures.h | 1 +
> >  arch/x86/kvm/cpuid.c               | 2 +-
> >  2 files changed, 2 insertions(+), 1 deletion(-)
> >
> 
> Queued, thanks.
> 
> Paolo

  Paolo, thanks, i will send the related Qemu patch soon.

  Yang

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-22  6:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-16  2:01 [PATCH 0/2] Enumerate and expose AVX_VNNI feature Yang Zhong
2020-12-16  2:01 ` [PATCH 1/2] Enumerate AVX Vector Neural Network instructions Yang Zhong
2020-12-16  2:01 ` [PATCH 2/2] KVM: Expose AVX_VNNI instruction to guset Yang Zhong
  -- strict thread matches above, loose matches on Subject: below --
2021-01-05  0:49 [PATCH 0/2] Enumerate and expose AVX_VNNI feature Yang Zhong
2021-01-21 15:02 ` Paolo Bonzini
2021-01-22  6:43   ` Yang Zhong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox