x86: Add Cooper Lake detection with AVX512BF16

Message ID 20200624131226.232673-1-hjl.tools@gmail.com
State New
Headers show
Series
  • x86: Add Cooper Lake detection with AVX512BF16
Related show

Commit Message

Kirill Yukhin via Gcc-patches June 24, 2020, 1:12 p.m.
All Sky Lake family processors have the same CPUID model number, 0x55.
The differences are Cascade Lake has AVX512VNNI and Cooper Lake has
AVX512VNNI + AVX512BF16.  Check AVX512BF16 for Cooper Lake.

	PR target/95774
	* common/config/i386/cpuinfo.h (get_intel_cpu): Add Cooper Lake
	detection with AVX512BF16.
---
 gcc/common/config/i386/cpuinfo.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
2.26.2

Comments

Kirill Yukhin via Gcc-patches June 24, 2020, 2:49 p.m. | #1
On Wed, Jun 24, 2020 at 3:12 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>

> All Sky Lake family processors have the same CPUID model number, 0x55.

> The differences are Cascade Lake has AVX512VNNI and Cooper Lake has

> AVX512VNNI + AVX512BF16.  Check AVX512BF16 for Cooper Lake.

>

>         PR target/95774

>         * common/config/i386/cpuinfo.h (get_intel_cpu): Add Cooper Lake

>         detection with AVX512BF16.


OK.

Thanks,
Uros.

> ---

>  gcc/common/config/i386/cpuinfo.h | 10 +++++++++-

>  1 file changed, 9 insertions(+), 1 deletion(-)

>

> diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h

> index 0a0e88011bc..3eda53240f6 100644

> --- a/gcc/common/config/i386/cpuinfo.h

> +++ b/gcc/common/config/i386/cpuinfo.h

> @@ -397,7 +397,15 @@ get_intel_cpu (struct __processor_model *cpu_model,

>        CHECK___builtin_cpu_is ("corei7");

>        cpu_model->__cpu_type = INTEL_COREI7;

>        if (has_cpu_feature (cpu_model, cpu_features2,

> -                          FEATURE_AVX512VNNI))

> +                          FEATURE_AVX512BF16))

> +       {

> +         /* Cooper Lake.  */

> +         cpu = "cooperlake";

> +         CHECK___builtin_cpu_is ("cooperlake");

> +         cpu_model->__cpu_subtype = INTEL_COREI7_COOPERLAKE;

> +       }

> +      else if (has_cpu_feature (cpu_model, cpu_features2,

> +                               FEATURE_AVX512VNNI))

>         {

>           /* Cascade Lake.  */

>           cpu = "cascadelake";

> --

> 2.26.2

>

Patch

diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
index 0a0e88011bc..3eda53240f6 100644
--- a/gcc/common/config/i386/cpuinfo.h
+++ b/gcc/common/config/i386/cpuinfo.h
@@ -397,7 +397,15 @@  get_intel_cpu (struct __processor_model *cpu_model,
       CHECK___builtin_cpu_is ("corei7");
       cpu_model->__cpu_type = INTEL_COREI7;
       if (has_cpu_feature (cpu_model, cpu_features2,
-			   FEATURE_AVX512VNNI))
+			   FEATURE_AVX512BF16))
+	{
+	  /* Cooper Lake.  */
+	  cpu = "cooperlake";
+	  CHECK___builtin_cpu_is ("cooperlake");
+	  cpu_model->__cpu_subtype = INTEL_COREI7_COOPERLAKE;
+	}
+      else if (has_cpu_feature (cpu_model, cpu_features2,
+				FEATURE_AVX512VNNI))
 	{
 	  /* Cascade Lake.  */
 	  cpu = "cascadelake";