i386: Add AMX-TILE dependency for AMX related ISAs

Message ID 20221111024330.87663-1-haochen.jiang@intel.com
State Accepted
Headers
Series i386: Add AMX-TILE dependency for AMX related ISAs |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Jiang, Haochen Nov. 11, 2022, 2:43 a.m. UTC
  Hi all,

For all AMX related ISAs, we have a potential dependency on AMX-TILE
or we even won't have the basic support on AMX.

This patch added those dependency. Ok for trunk?

BRs,
Haochen

gcc/ChangeLog:

	* common/config/i386/i386-common.cc
	(OPTION_MASK_ISA2_AMX_INT8_SET): Add AMX-TILE dependency.
	(OPTION_MASK_ISA2_AMX_BF16_SET): Ditto.
	(OPTION_MASK_ISA2_AMX_FP16_SET): Ditto.
	(OPTION_MASK_ISA2_AMX_TILE_UNSET): Disable AMX_{INT8,
	BF16, FP16} when disable AMX_TILE.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/amxbf16-dpbf16ps-2.c: Remove -amx-tile.
	* gcc.target/i386/amxfp16-dpfp16ps-2.c: Ditto.
	* gcc.target/i386/amxint8-dpbssd-2.c: Ditto.
	* gcc.target/i386/amxint8-dpbsud-2.c: Ditto.
	* gcc.target/i386/amxint8-dpbusd-2.c: Ditto.
	* gcc.target/i386/amxint8-dpbuud-2.c: Ditto.
---
 gcc/common/config/i386/i386-common.cc              | 13 +++++++++----
 gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c |  3 +--
 gcc/testsuite/gcc.target/i386/amxfp16-dpfp16ps-2.c |  3 +--
 gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c   |  3 +--
 gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c   |  3 +--
 gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c   |  3 +--
 gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c   |  3 +--
 7 files changed, 15 insertions(+), 16 deletions(-)
  

Comments

Hongtao Liu Nov. 14, 2022, 5:49 a.m. UTC | #1
On Fri, Nov 11, 2022 at 10:45 AM Haochen Jiang via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi all,
>
> For all AMX related ISAs, we have a potential dependency on AMX-TILE
> or we even won't have the basic support on AMX.
>
> This patch added those dependency. Ok for trunk?
Ok.
>
> BRs,
> Haochen
>
> gcc/ChangeLog:
>
>         * common/config/i386/i386-common.cc
>         (OPTION_MASK_ISA2_AMX_INT8_SET): Add AMX-TILE dependency.
>         (OPTION_MASK_ISA2_AMX_BF16_SET): Ditto.
>         (OPTION_MASK_ISA2_AMX_FP16_SET): Ditto.
>         (OPTION_MASK_ISA2_AMX_TILE_UNSET): Disable AMX_{INT8,
>         BF16, FP16} when disable AMX_TILE.
>
> gcc/testsuite/ChangeLog:
>
>         * gcc.target/i386/amxbf16-dpbf16ps-2.c: Remove -amx-tile.
>         * gcc.target/i386/amxfp16-dpfp16ps-2.c: Ditto.
>         * gcc.target/i386/amxint8-dpbssd-2.c: Ditto.
>         * gcc.target/i386/amxint8-dpbsud-2.c: Ditto.
>         * gcc.target/i386/amxint8-dpbusd-2.c: Ditto.
>         * gcc.target/i386/amxint8-dpbuud-2.c: Ditto.
> ---
>  gcc/common/config/i386/i386-common.cc              | 13 +++++++++----
>  gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c |  3 +--
>  gcc/testsuite/gcc.target/i386/amxfp16-dpfp16ps-2.c |  3 +--
>  gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c   |  3 +--
>  gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c   |  3 +--
>  gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c   |  3 +--
>  gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c   |  3 +--
>  7 files changed, 15 insertions(+), 16 deletions(-)
>
> diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc
> index 431fd0d3ad1..5e6d3da0306 100644
> --- a/gcc/common/config/i386/i386-common.cc
> +++ b/gcc/common/config/i386/i386-common.cc
> @@ -106,12 +106,15 @@ along with GCC; see the file COPYING3.  If not see
>  #define OPTION_MASK_ISA_CLWB_SET OPTION_MASK_ISA_CLWB
>  #define OPTION_MASK_ISA2_AVX512VP2INTERSECT_SET OPTION_MASK_ISA2_AVX512VP2INTERSECT
>  #define OPTION_MASK_ISA2_AMX_TILE_SET OPTION_MASK_ISA2_AMX_TILE
> -#define OPTION_MASK_ISA2_AMX_INT8_SET OPTION_MASK_ISA2_AMX_INT8
> -#define OPTION_MASK_ISA2_AMX_BF16_SET OPTION_MASK_ISA2_AMX_BF16
> +#define OPTION_MASK_ISA2_AMX_INT8_SET \
> +  (OPTION_MASK_ISA2_AMX_TILE | OPTION_MASK_ISA2_AMX_INT8)
> +#define OPTION_MASK_ISA2_AMX_BF16_SET \
> +  (OPTION_MASK_ISA2_AMX_TILE | OPTION_MASK_ISA2_AMX_BF16)
>  #define OPTION_MASK_ISA2_AVXVNNIINT8_SET OPTION_MASK_ISA2_AVXVNNIINT8
>  #define OPTION_MASK_ISA2_AVXNECONVERT_SET OPTION_MASK_ISA2_AVXNECONVERT
>  #define OPTION_MASK_ISA2_CMPCCXADD_SET OPTION_MASK_ISA2_CMPCCXADD
> -#define OPTION_MASK_ISA2_AMX_FP16_SET OPTION_MASK_ISA2_AMX_FP16
> +#define OPTION_MASK_ISA2_AMX_FP16_SET \
> +  (OPTION_MASK_ISA2_AMX_TILE | OPTION_MASK_ISA2_AMX_FP16)
>  #define OPTION_MASK_ISA2_PREFETCHI_SET OPTION_MASK_ISA2_PREFETCHI
>  #define OPTION_MASK_ISA2_RAOINT_SET OPTION_MASK_ISA2_RAOINT
>
> @@ -277,7 +280,9 @@ along with GCC; see the file COPYING3.  If not see
>  #define OPTION_MASK_ISA2_SERIALIZE_UNSET OPTION_MASK_ISA2_SERIALIZE
>  #define OPTION_MASK_ISA2_AVX512VP2INTERSECT_UNSET OPTION_MASK_ISA2_AVX512VP2INTERSECT
>  #define OPTION_MASK_ISA2_TSXLDTRK_UNSET OPTION_MASK_ISA2_TSXLDTRK
> -#define OPTION_MASK_ISA2_AMX_TILE_UNSET OPTION_MASK_ISA2_AMX_TILE
> +#define OPTION_MASK_ISA2_AMX_TILE_UNSET \
> +  (OPTION_MASK_ISA2_AMX_TILE | OPTION_MASK_ISA2_AMX_INT8_UNSET \
> +   | OPTION_MASK_ISA2_AMX_BF16_UNSET | OPTION_MASK_ISA2_AMX_FP16_UNSET)
>  #define OPTION_MASK_ISA2_AMX_INT8_UNSET OPTION_MASK_ISA2_AMX_INT8
>  #define OPTION_MASK_ISA2_AMX_BF16_UNSET OPTION_MASK_ISA2_AMX_BF16
>  #define OPTION_MASK_ISA2_UINTR_UNSET OPTION_MASK_ISA2_UINTR
> diff --git a/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c b/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c
> index b00bc13ec78..35881e7682a 100644
> --- a/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c
> +++ b/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c
> @@ -1,7 +1,6 @@
>  /* { dg-do run { target { ! ia32 } } } */
> -/* { dg-require-effective-target amx_tile } */
>  /* { dg-require-effective-target amx_bf16 } */
> -/* { dg-options "-O2 -mamx-tile -mamx-bf16" } */
> +/* { dg-options "-O2 -mamx-bf16" } */
>  #include <immintrin.h>
>
>  #define AMX_BF16
> diff --git a/gcc/testsuite/gcc.target/i386/amxfp16-dpfp16ps-2.c b/gcc/testsuite/gcc.target/i386/amxfp16-dpfp16ps-2.c
> index 2d359a689ea..a1fafbcbfeb 100644
> --- a/gcc/testsuite/gcc.target/i386/amxfp16-dpfp16ps-2.c
> +++ b/gcc/testsuite/gcc.target/i386/amxfp16-dpfp16ps-2.c
> @@ -1,8 +1,7 @@
>  /* { dg-do run { target { ! ia32 } } } */
> -/* { dg-require-effective-target amx_tile } */
>  /* { dg-require-effective-target amx_fp16 } */
>  /* { dg-require-effective-target avx512fp16 } */
> -/* { dg-options "-O2 -mamx-tile -mamx-fp16 -mavx512fp16" } */
> +/* { dg-options "-O2 -mamx-fp16 -mavx512fp16" } */
>  #define AMX_FP16
>  #define DO_TEST test_amx_fp16_dpfp16ps
>  void test_amx_fp16_dpfp16ps ();
> diff --git a/gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c b/gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c
> index 74ad71be5c5..d7efb3d20c2 100644
> --- a/gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c
> +++ b/gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c
> @@ -1,7 +1,6 @@
>  /* { dg-do run { target { ! ia32 } } } */
> -/* { dg-require-effective-target amx_tile } */
>  /* { dg-require-effective-target amx_int8 } */
> -/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
> +/* { dg-options "-O2 -mamx-int8" } */
>  #include <immintrin.h>
>
>  #define AMX_INT8
> diff --git a/gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c b/gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c
> index e7241bdd860..c8bf89d738b 100644
> --- a/gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c
> +++ b/gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c
> @@ -1,7 +1,6 @@
>  /* { dg-do run { target { ! ia32 } } } */
> -/* { dg-require-effective-target amx_tile } */
>  /* { dg-require-effective-target amx_int8 } */
> -/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
> +/* { dg-options "-O2 -mamx-int8" } */
>  #include <immintrin.h>
>
>  #define AMX_INT8
> diff --git a/gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c b/gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c
> index f0b9f97aec9..bb8777d920a 100644
> --- a/gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c
> +++ b/gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c
> @@ -1,7 +1,6 @@
>  /* { dg-do run { target { ! ia32 } } } */
> -/* { dg-require-effective-target amx_tile } */
>  /* { dg-require-effective-target amx_int8 } */
> -/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
> +/* { dg-options "-O2 -mamx-int8" } */
>  #include <immintrin.h>
>
>  #define AMX_INT8
> diff --git a/gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c b/gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c
> index eb70b2f9259..d30f46d8de3 100644
> --- a/gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c
> +++ b/gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c
> @@ -1,7 +1,6 @@
>  /* { dg-do run { target { ! ia32 } } } */
> -/* { dg-require-effective-target amx_tile } */
>  /* { dg-require-effective-target amx_int8 } */
> -/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
> +/* { dg-options "-O2 -mamx-int8" } */
>  #include <immintrin.h>
>
>  #define AMX_INT8
> --
> 2.18.1
>
  

Patch

diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc
index 431fd0d3ad1..5e6d3da0306 100644
--- a/gcc/common/config/i386/i386-common.cc
+++ b/gcc/common/config/i386/i386-common.cc
@@ -106,12 +106,15 @@  along with GCC; see the file COPYING3.  If not see
 #define OPTION_MASK_ISA_CLWB_SET OPTION_MASK_ISA_CLWB
 #define OPTION_MASK_ISA2_AVX512VP2INTERSECT_SET OPTION_MASK_ISA2_AVX512VP2INTERSECT
 #define OPTION_MASK_ISA2_AMX_TILE_SET OPTION_MASK_ISA2_AMX_TILE
-#define OPTION_MASK_ISA2_AMX_INT8_SET OPTION_MASK_ISA2_AMX_INT8
-#define OPTION_MASK_ISA2_AMX_BF16_SET OPTION_MASK_ISA2_AMX_BF16
+#define OPTION_MASK_ISA2_AMX_INT8_SET \
+  (OPTION_MASK_ISA2_AMX_TILE | OPTION_MASK_ISA2_AMX_INT8)
+#define OPTION_MASK_ISA2_AMX_BF16_SET \
+  (OPTION_MASK_ISA2_AMX_TILE | OPTION_MASK_ISA2_AMX_BF16)
 #define OPTION_MASK_ISA2_AVXVNNIINT8_SET OPTION_MASK_ISA2_AVXVNNIINT8
 #define OPTION_MASK_ISA2_AVXNECONVERT_SET OPTION_MASK_ISA2_AVXNECONVERT
 #define OPTION_MASK_ISA2_CMPCCXADD_SET OPTION_MASK_ISA2_CMPCCXADD
-#define OPTION_MASK_ISA2_AMX_FP16_SET OPTION_MASK_ISA2_AMX_FP16
+#define OPTION_MASK_ISA2_AMX_FP16_SET \
+  (OPTION_MASK_ISA2_AMX_TILE | OPTION_MASK_ISA2_AMX_FP16)
 #define OPTION_MASK_ISA2_PREFETCHI_SET OPTION_MASK_ISA2_PREFETCHI
 #define OPTION_MASK_ISA2_RAOINT_SET OPTION_MASK_ISA2_RAOINT
 
@@ -277,7 +280,9 @@  along with GCC; see the file COPYING3.  If not see
 #define OPTION_MASK_ISA2_SERIALIZE_UNSET OPTION_MASK_ISA2_SERIALIZE
 #define OPTION_MASK_ISA2_AVX512VP2INTERSECT_UNSET OPTION_MASK_ISA2_AVX512VP2INTERSECT
 #define OPTION_MASK_ISA2_TSXLDTRK_UNSET OPTION_MASK_ISA2_TSXLDTRK
-#define OPTION_MASK_ISA2_AMX_TILE_UNSET OPTION_MASK_ISA2_AMX_TILE
+#define OPTION_MASK_ISA2_AMX_TILE_UNSET \
+  (OPTION_MASK_ISA2_AMX_TILE | OPTION_MASK_ISA2_AMX_INT8_UNSET \
+   | OPTION_MASK_ISA2_AMX_BF16_UNSET | OPTION_MASK_ISA2_AMX_FP16_UNSET)
 #define OPTION_MASK_ISA2_AMX_INT8_UNSET OPTION_MASK_ISA2_AMX_INT8
 #define OPTION_MASK_ISA2_AMX_BF16_UNSET OPTION_MASK_ISA2_AMX_BF16
 #define OPTION_MASK_ISA2_UINTR_UNSET OPTION_MASK_ISA2_UINTR
diff --git a/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c b/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c
index b00bc13ec78..35881e7682a 100644
--- a/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c
+++ b/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c
@@ -1,7 +1,6 @@ 
 /* { dg-do run { target { ! ia32 } } } */
-/* { dg-require-effective-target amx_tile } */
 /* { dg-require-effective-target amx_bf16 } */
-/* { dg-options "-O2 -mamx-tile -mamx-bf16" } */
+/* { dg-options "-O2 -mamx-bf16" } */
 #include <immintrin.h>
 
 #define AMX_BF16
diff --git a/gcc/testsuite/gcc.target/i386/amxfp16-dpfp16ps-2.c b/gcc/testsuite/gcc.target/i386/amxfp16-dpfp16ps-2.c
index 2d359a689ea..a1fafbcbfeb 100644
--- a/gcc/testsuite/gcc.target/i386/amxfp16-dpfp16ps-2.c
+++ b/gcc/testsuite/gcc.target/i386/amxfp16-dpfp16ps-2.c
@@ -1,8 +1,7 @@ 
 /* { dg-do run { target { ! ia32 } } } */
-/* { dg-require-effective-target amx_tile } */
 /* { dg-require-effective-target amx_fp16 } */
 /* { dg-require-effective-target avx512fp16 } */
-/* { dg-options "-O2 -mamx-tile -mamx-fp16 -mavx512fp16" } */
+/* { dg-options "-O2 -mamx-fp16 -mavx512fp16" } */
 #define AMX_FP16
 #define DO_TEST test_amx_fp16_dpfp16ps
 void test_amx_fp16_dpfp16ps ();
diff --git a/gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c b/gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c
index 74ad71be5c5..d7efb3d20c2 100644
--- a/gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c
+++ b/gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c
@@ -1,7 +1,6 @@ 
 /* { dg-do run { target { ! ia32 } } } */
-/* { dg-require-effective-target amx_tile } */
 /* { dg-require-effective-target amx_int8 } */
-/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
+/* { dg-options "-O2 -mamx-int8" } */
 #include <immintrin.h>
 
 #define AMX_INT8
diff --git a/gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c b/gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c
index e7241bdd860..c8bf89d738b 100644
--- a/gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c
+++ b/gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c
@@ -1,7 +1,6 @@ 
 /* { dg-do run { target { ! ia32 } } } */
-/* { dg-require-effective-target amx_tile } */
 /* { dg-require-effective-target amx_int8 } */
-/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
+/* { dg-options "-O2 -mamx-int8" } */
 #include <immintrin.h>
 
 #define AMX_INT8
diff --git a/gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c b/gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c
index f0b9f97aec9..bb8777d920a 100644
--- a/gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c
+++ b/gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c
@@ -1,7 +1,6 @@ 
 /* { dg-do run { target { ! ia32 } } } */
-/* { dg-require-effective-target amx_tile } */
 /* { dg-require-effective-target amx_int8 } */
-/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
+/* { dg-options "-O2 -mamx-int8" } */
 #include <immintrin.h>
 
 #define AMX_INT8
diff --git a/gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c b/gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c
index eb70b2f9259..d30f46d8de3 100644
--- a/gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c
+++ b/gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c
@@ -1,7 +1,6 @@ 
 /* { dg-do run { target { ! ia32 } } } */
-/* { dg-require-effective-target amx_tile } */
 /* { dg-require-effective-target amx_int8 } */
-/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
+/* { dg-options "-O2 -mamx-int8" } */
 #include <immintrin.h>
 
 #define AMX_INT8