Re: [PATCH RFC] kvm: x86: Expose AVX512_BF16 feature to guest

2019-06-24 Thread Jing Liu
Hi Paolo, On 6/24/2019 4:33 PM, Paolo Bonzini wrote: On 24/06/19 05:10, Jing Liu wrote: What do you think about @index in current function? Does it mean, we need put cpuid from index to max subleaf to @entry[i]? If so, the logic seems as follows, if (index == 0) { // Put subleaf 0 into @

Re: [PATCH RFC] kvm: x86: Expose AVX512_BF16 feature to guest

2019-06-24 Thread Paolo Bonzini
On 24/06/19 05:10, Jing Liu wrote: >> What do you think about @index in current function? Does it mean, we >> need put cpuid from index to max subleaf to @entry[i]? If so, the logic >> seems as follows, >> >> if (index == 0) { >> // Put subleaf 0 into @entry >> // Put subleaf 1 into @entr

Re: [PATCH RFC] kvm: x86: Expose AVX512_BF16 feature to guest

2019-06-23 Thread Jing Liu
Hi Paolo, After thinking more, I found way to satisfy all cases in a easy way. How about things like this? @@ -507,12 +510,26 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 fu * if the host doesn't support it. */

Re: [PATCH RFC] kvm: x86: Expose AVX512_BF16 feature to guest

2019-06-20 Thread Liu, Jing2
Hi Paolo, On 6/20/2019 8:16 PM, Paolo Bonzini wrote: On 20/06/19 13:21, Jing Liu wrote: + for (i = 1; i <= times; i++) { + if (*nent >= maxnent) + goto out; + do_cpuid_1_ent(&entry[i], function, i); +

Re: [PATCH RFC] kvm: x86: Expose AVX512_BF16 feature to guest

2019-06-20 Thread Paolo Bonzini
On 20/06/19 13:21, Jing Liu wrote: > + for (i = 1; i <= times; i++) { > + if (*nent >= maxnent) > + goto out; > + do_cpuid_1_ent(&entry[i], function, i); > + entry[i].eax &= F(AVX512_BF16); > +

[PATCH RFC] kvm: x86: Expose AVX512_BF16 feature to guest

2019-06-20 Thread Jing Liu
AVX512 BFLOAT16 instructions support 16-bit BFLOAT16 floating-point format (BF16) for deep learning optimization. Intel adds AVX512 BFLOAT16 feature in CooperLake, which is CPUID.7.1.EAX[5]. Detailed information of the CPUID bit can be found here, https://software.intel.com/sites/default/files/ma