Enumerate and expose AVX_VNNI feature
cover Enumerate and expose AVX_VNNI feature
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(-)
Signature · 1 line
2.29.2.334.gfaefdd61ec
PATCH 1/2 Enumerate AVX Vector Neural Network instructions
From: Kyung Min Park <[email protected]>
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.
--- arch/x86/include/asm/cpufeatures.h | 1 + 1 file changed, 1 insertion(+)
arch/x86/include/asm/cpufeatures.h +1 -0
@@ -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 */
Signature · 1 line
2.29.2.334.gfaefdd61ec
Paolo Bonzini
maintainerRe: [PATCH 1/2] Enumerate AVX Vector Neural Network instructions
Quoted 31 lines · Yang Zhong
From: Kyung Min Park <[email protected]>
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 SaturationThe 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 <[email protected]>Signed-off-by Yang Zhong <[email protected]>Reviewed-by Tony Luck <[email protected]>--- arch/x86/include/asm/cpufeatures.h | 1 + 1 file changed, 1 insertion(+)arch/x86/include/asm/cpufeatures.h +0
-0
arch/x86/include/asm/cpufeatures.h line 299
Quoted 7 lines
arch/x86/include/asm/cpufeatures.h +1
-0@@ -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 */
Boris, is it possible to have a topic branch for this patch?
Re: [PATCH 1/2] Enumerate AVX Vector Neural Network instructions
Quoted 26 lines · Paolo Bonzini
Quoted 25 lines · Yang Zhong
From: Kyung Min Park <[email protected]>
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 SaturationThe 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 <[email protected]>Signed-off-by Yang Zhong <[email protected]>Reviewed-by Tony Luck <[email protected]>--- arch/x86/include/asm/cpufeatures.h | 1 + 1 file changed, 1 insertion(+)
Quoted 13 lines
arch/x86/include/asm/cpufeatures.h line 298
Quoted 11 lines
arch/x86/include/asm/cpufeatures.h +1
-0@@ -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 */ Boris, is it possible to have a topic branch for this patch?
Just take it through your tree pls.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH 1/2] Enumerate AVX Vector Neural Network instructions
Quoted 41 lines · Borislav Petkov
Quoted 26 lines · Paolo Bonzini
Quoted 25 lines · Yang Zhong
From: Kyung Min Park <[email protected]>
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 SaturationThe 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 <[email protected]>Signed-off-by Yang Zhong <[email protected]>Reviewed-by Tony Luck <[email protected]>--- arch/x86/include/asm/cpufeatures.h | 1 + 1 file changed, 1 insertion(+)Quoted 13 lines
arch/x86/include/asm/cpufeatures.h line 298
Quoted 11 lines
arch/x86/include/asm/cpufeatures.h +1
-0@@ -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 */ Boris, is it possible to have a topic branch for this patch?
Quoted 4 lines
Just take it through your tree pls.
Acked-by Borislav Petkov <[email protected]>
Paolo, Boris has acked this kernel patch, and if i need send new patchset to add this acked-by info ? or kvm tree will directly pull this patchset? thanks.
Yang
Quoted 7 lines
Thx.
Signature · 4 lines
Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette
Paolo Bonzini
maintainerRe: [PATCH 1/2] Enumerate AVX Vector Neural Network instructions
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
Boris, is it possible to have a topic branch for this patch?
Just take it through your tree pls.
Acked-by Borislav Petkov <[email protected]>Paolo, Boris has acked this kernel patch, and if i need send new patchset to add this acked-by info ? or kvm tree will directly pull this patchset? thanks.
I'll take care of it shortly.
Paolo
PATCH 2/2 KVM: Expose AVX_VNNI instruction to guset
In reply to Yang ZhongExpose 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.
--- arch/x86/kvm/cpuid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +1 -1
@@ -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,
Signature · 1 line
2.29.2.334.gfaefdd61ec
Quoted 18 lines · Yang Zhong
A processor supports
AVX_VNNIinstructions 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/cpuinfoof 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.htmlKyung Min Park (1):
Enumerate AVX Vector Neural Network instructions
Quoted 7 lines
Yang Zhong (1):
KVM: ExposeAVX_VNNIinstruction to gusetarch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kvm/cpuid.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
Queued, thanks.
Paolo
Quoted 22 lines · Paolo Bonzini
Quoted 21 lines · Yang Zhong
A processor supports
AVX_VNNIinstructions 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/cpuinfoof 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.htmlKyung Min Park (1):
Enumerate AVX Vector Neural Network instructionsYang Zhong (1):
KVM: ExposeAVX_VNNIinstruction to guset
Quoted 8 lines
Quoted 4 lines
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