]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nvptx: Support '-march=sm_52'
authorThomas Schwinge <tschwinge@baylibre.com>
Sun, 10 Nov 2024 16:47:16 +0000 (17:47 +0100)
committerThomas Schwinge <tschwinge@baylibre.com>
Fri, 6 Dec 2024 11:26:45 +0000 (12:26 +0100)
gcc/
* config/nvptx/nvptx-sm.def: Add '52'.
* config/nvptx/nvptx-gen.h: Regenerate.
* config/nvptx/nvptx-gen.opt: Likewise.
* config/nvptx/nvptx.cc (first_ptx_version_supporting_sm): Adjust.
* config/nvptx/nvptx.opt (-march-map=sm_52): Likewise.
* config.gcc: Likewise.
* doc/invoke.texi (Nvidia PTX Options): Document '-march=sm_52'.
* config/nvptx/gen-multilib-matches-tests: Extend.
gcc/testsuite/
* gcc.target/nvptx/march-map=sm_52.c: Adjust.
* gcc.target/nvptx/march=sm_52.c: New.
libgomp/
* testsuite/libgomp.c/declare-variant-3-sm52.c: New.
* testsuite/libgomp.c/declare-variant-3.h: Adjust.

12 files changed:
gcc/config.gcc
gcc/config/nvptx/gen-multilib-matches-tests
gcc/config/nvptx/nvptx-gen.h
gcc/config/nvptx/nvptx-gen.opt
gcc/config/nvptx/nvptx-sm.def
gcc/config/nvptx/nvptx.cc
gcc/config/nvptx/nvptx.opt
gcc/doc/invoke.texi
gcc/testsuite/gcc.target/nvptx/march-map=sm_52.c
gcc/testsuite/gcc.target/nvptx/march=sm_52.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/declare-variant-3-sm52.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/declare-variant-3.h

index b68ede921ec97d2324da78d906305d7d863023ef..21f3dcd9d009b2f15ab0e88f3d20e9c6120abd57 100644 (file)
@@ -5643,7 +5643,7 @@ case "${target}" in
                        case $nvptx_multilib in
                        #TODO 'sm_[...]' list per 'nvptx-sm.def'.
                        sm_30 | sm_35 | sm_37 \
-                       | sm_53 \
+                       | sm_52 | sm_53 \
                        | sm_70 | sm_75 \
                        | sm_80 )
                                TM_MULTILIB_CONFIG="$TM_MULTILIB_CONFIG $nvptx_multilib"
index 87045040b11ae36dc3dbeaea49adf2dc07f983d2..13b1c5b9d018e0ea084b424055100aac2b1ad612 100644 (file)
@@ -16,6 +16,7 @@ SMOIL sm_30
 AEMM .=misa?sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -28,14 +29,15 @@ SMOIL sm_30 sm_80
 AEMM .=misa?sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 CMMC
 
-BEGIN '--with-arch=sm_30', '--with-multilib-list=sm_30,sm_35,sm_37,sm_53,sm_70,sm_75,sm_80'
+BEGIN '--with-arch=sm_30', '--with-multilib-list=sm_30,sm_35,sm_37,sm_52,sm_53,sm_70,sm_75,sm_80'
 SMOID sm_30
-SMOIL sm_30 sm_35 sm_37 sm_53 sm_70 sm_75 sm_80
+SMOIL sm_30 sm_35 sm_37 sm_52 sm_53 sm_70 sm_75 sm_80
 AEMM .=misa?sm_30
 CMMC
 
@@ -46,6 +48,7 @@ SMOIL sm_35
 AEMM .=misa?sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -57,6 +60,7 @@ SMOID sm_35
 SMOIL sm_35 sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -69,6 +73,7 @@ SMOID sm_37
 SMOIL sm_37 sm_30
 AEMM misa?sm_30=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -76,11 +81,24 @@ AEMM .=misa?sm_80
 CMMC
 
 
+BEGIN '--with-arch=sm_52', '--with-multilib-list=sm_52,sm_75,sm_35'
+SMOID sm_52
+SMOIL sm_52 sm_75 sm_35
+AEMM misa?sm_35=misa?sm_30
+AEMM misa?sm_35=misa?sm_37
+AEMM .=misa?sm_52
+AEMM .=misa?sm_53
+AEMM .=misa?sm_70
+AEMM misa?sm_75=misa?sm_80
+CMMC
+
+
 BEGIN '--with-arch=sm_53', '--with-multilib-list=sm_53,sm_30'
 SMOID sm_53
 SMOIL sm_53 sm_30
 AEMM misa?sm_30=misa?sm_35
 AEMM misa?sm_30=misa?sm_37
+AEMM misa?sm_30=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -92,15 +110,16 @@ SMOID sm_53
 SMOIL sm_53 sm_37
 AEMM misa?sm_37=misa?sm_30
 AEMM misa?sm_37=misa?sm_35
+AEMM misa?sm_37=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
 CMMC
 
-BEGIN '--with-arch=sm_53', '--with-multilib-list=sm_53,sm_30,sm_35,sm_37,sm_70,sm_75,sm_80'
+BEGIN '--with-arch=sm_53', '--with-multilib-list=sm_53=sm_30,sm_35,sm_37,sm_52,sm_70,sm_75,sm_80'
 SMOID sm_53
-SMOIL sm_53 sm_30 sm_35 sm_37 sm_70 sm_75 sm_80
+SMOIL sm_53 sm_30 sm_35 sm_37 sm_52 sm_70 sm_75 sm_80
 AEMM .=misa?sm_53
 CMMC
 
@@ -111,6 +130,7 @@ SMOIL sm_70
 AEMM .=misa?sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -122,6 +142,7 @@ SMOID sm_70
 SMOIL sm_70 sm_30
 AEMM misa?sm_30=misa?sm_35
 AEMM misa?sm_30=misa?sm_37
+AEMM misa?sm_30=misa?sm_52
 AEMM misa?sm_30=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -134,6 +155,7 @@ SMOIL sm_70 sm_53
 AEMM misa?sm_53=misa?sm_30
 AEMM misa?sm_53=misa?sm_35
 AEMM misa?sm_53=misa?sm_37
+AEMM misa?sm_53=misa?sm_52
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
@@ -144,6 +166,7 @@ SMOID sm_70
 SMOIL sm_70 sm_53 sm_30
 AEMM misa?sm_30=misa?sm_35
 AEMM misa?sm_30=misa?sm_37
+AEMM misa?sm_30=misa?sm_52
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
@@ -155,6 +178,7 @@ SMOID sm_75
 SMOIL sm_75 sm_30
 AEMM misa?sm_30=misa?sm_35
 AEMM misa?sm_30=misa?sm_37
+AEMM misa?sm_30=misa?sm_52
 AEMM misa?sm_30=misa?sm_53
 AEMM misa?sm_30=misa?sm_70
 AEMM .=misa?sm_75
@@ -167,6 +191,7 @@ SMOIL sm_75 sm_53
 AEMM misa?sm_53=misa?sm_30
 AEMM misa?sm_53=misa?sm_35
 AEMM misa?sm_53=misa?sm_37
+AEMM misa?sm_53=misa?sm_52
 AEMM misa?sm_53=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
@@ -177,6 +202,7 @@ SMOID sm_75
 SMOIL sm_75 sm_30 sm_53
 AEMM misa?sm_30=misa?sm_35
 AEMM misa?sm_30=misa?sm_37
+AEMM misa?sm_30=misa?sm_52
 AEMM misa?sm_53=misa?sm_70
 AEMM .=misa?sm_75
 AEMM .=misa?sm_80
@@ -189,6 +215,7 @@ SMOIL sm_80
 AEMM .=misa?sm_30
 AEMM .=misa?sm_35
 AEMM .=misa?sm_37
+AEMM .=misa?sm_52
 AEMM .=misa?sm_53
 AEMM .=misa?sm_70
 AEMM .=misa?sm_75
@@ -200,6 +227,7 @@ SMOID sm_80
 SMOIL sm_80 sm_30
 AEMM misa?sm_30=misa?sm_35
 AEMM misa?sm_30=misa?sm_37
+AEMM misa?sm_30=misa?sm_52
 AEMM misa?sm_30=misa?sm_53
 AEMM misa?sm_30=misa?sm_70
 AEMM misa?sm_30=misa?sm_75
@@ -212,13 +240,14 @@ SMOIL sm_80 sm_75
 AEMM misa?sm_75=misa?sm_30
 AEMM misa?sm_75=misa?sm_35
 AEMM misa?sm_75=misa?sm_37
+AEMM misa?sm_75=misa?sm_52
 AEMM misa?sm_75=misa?sm_53
 AEMM misa?sm_75=misa?sm_70
 AEMM .=misa?sm_80
 CMMC
 
-BEGIN '--with-arch=sm_80', '--with-multilib-list=sm_80,sm_30,sm_35,sm_37,sm_53,sm_70,sm_75'
+BEGIN '--with-arch=sm_80', '--with-multilib-list=sm_80,sm_30,sm_35,sm_37,sm_52,sm_53,sm_70,sm_75'
 SMOID sm_80
-SMOIL sm_80 sm_30 sm_35 sm_37 sm_53 sm_70 sm_75
+SMOIL sm_80 sm_30 sm_35 sm_37 sm_52 sm_53 sm_70 sm_75
 AEMM .=misa?sm_80
 CMMC
index 7f9b620ea778b315cfc6f0a25451cb39bd324759..5f271a33c357e365399571cf80152208303d25d6 100644 (file)
@@ -24,6 +24,7 @@
 #define TARGET_SM30 (ptx_isa_option >= PTX_ISA_SM30)
 #define TARGET_SM35 (ptx_isa_option >= PTX_ISA_SM35)
 #define TARGET_SM37 (ptx_isa_option >= PTX_ISA_SM37)
+#define TARGET_SM52 (ptx_isa_option >= PTX_ISA_SM52)
 #define TARGET_SM53 (ptx_isa_option >= PTX_ISA_SM53)
 #define TARGET_SM70 (ptx_isa_option >= PTX_ISA_SM70)
 #define TARGET_SM75 (ptx_isa_option >= PTX_ISA_SM75)
index 9124bd128967d91fe0bc7732b9aaf81e61911b47..0d76885c475ee839cdeeb692cb62d203951aadf8 100644 (file)
@@ -32,6 +32,9 @@ Enum(ptx_isa) String(sm_35) Value(PTX_ISA_SM35)
 EnumValue
 Enum(ptx_isa) String(sm_37) Value(PTX_ISA_SM37)
 
+EnumValue
+Enum(ptx_isa) String(sm_52) Value(PTX_ISA_SM52)
+
 EnumValue
 Enum(ptx_isa) String(sm_53) Value(PTX_ISA_SM53)
 
index 625007dd0b58d16834920b3c8455e980e38179b2..0fafc8aeddfa8cb9869c8299997ec368676521c5 100644 (file)
@@ -23,6 +23,7 @@
 NVPTX_SM (30, NVPTX_SM_SEP)
 NVPTX_SM (35, NVPTX_SM_SEP)
 NVPTX_SM (37, NVPTX_SM_SEP)
+NVPTX_SM (52, NVPTX_SM_SEP)
 NVPTX_SM (53, NVPTX_SM_SEP)
 NVPTX_SM (70, NVPTX_SM_SEP)
 NVPTX_SM (75, NVPTX_SM_SEP)
index c3aba05e753f4e3e8430e49d68ac5e6950c2f818..93402bf516b9a9d17c63321bbb948714d3725455 100644 (file)
@@ -216,6 +216,7 @@ first_ptx_version_supporting_sm (enum ptx_isa sm)
     case PTX_ISA_SM35:
       return PTX_VERSION_3_1;
     case PTX_ISA_SM37:
+    case PTX_ISA_SM52:
       return PTX_VERSION_4_1;
     case PTX_ISA_SM53:
       return PTX_VERSION_4_2;
index e02a845c00935523945622672979ba6ccf823189..4d14eda76991a77cbae877dfcb58113f668905c0 100644 (file)
@@ -79,7 +79,7 @@ march-map=sm_50
 Target RejectNegative Alias(misa=,sm_37)
 
 march-map=sm_52
-Target RejectNegative Alias(misa=,sm_37)
+Target RejectNegative Alias(misa=,sm_52)
 
 march-map=sm_53
 Target RejectNegative Alias(misa=,sm_53)
index 8a91c578699ab6fc306fcf1c578791c87e9d774e..92728a7f6ce357f3ba62a6f1824f622db458b4f9 100644 (file)
@@ -30047,7 +30047,7 @@ supported.
 Generate code for the specified PTX ISA target architecture.
 Valid architecture strings are
 @samp{sm_30}, @samp{sm_35}, @samp{sm_37},
-@samp{sm_53},
+@samp{sm_52}, @samp{sm_53},
 @samp{sm_70}, @samp{sm_75},
 and @samp{sm_80}.
 The default depends on how the compiler has been configured, see
index 6dd8605721fa4dd23fe1af1ae85e3a565522999e..f37d13a8b088da53a11ba088c23f150485fa3ace 100644 (file)
@@ -2,7 +2,7 @@
 /* { dg-options {-march-map=sm_52 -mptx=_} } */
 /* { dg-additional-options -save-temps } */
 /* { dg-final { scan-assembler-times {(?n)^    \.version       6\.0$} 1 } } */
-/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_37$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_52$} 1 } } */
 
 #if __PTX_ISA_VERSION_MAJOR__ != 6
 #error wrong value for __PTX_ISA_VERSION_MAJOR__
@@ -12,7 +12,7 @@
 #error wrong value for __PTX_ISA_VERSION_MINOR__
 #endif
 
-#if __PTX_SM__ != 370
+#if __PTX_SM__ != 520
 #error wrong value for __PTX_SM__
 #endif
 
diff --git a/gcc/testsuite/gcc.target/nvptx/march=sm_52.c b/gcc/testsuite/gcc.target/nvptx/march=sm_52.c
new file mode 100644 (file)
index 0000000..515f950
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do assemble } */
+/* { dg-options {-march=sm_52 -mptx=_} } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { scan-assembler-times {(?n)^    \.version       6\.0$} 1 } } */
+/* { dg-final { scan-assembler-times {(?n)^    \.target        sm_52$} 1 } } */
+
+#if __PTX_ISA_VERSION_MAJOR__ != 6
+#error wrong value for __PTX_ISA_VERSION_MAJOR__
+#endif
+
+#if __PTX_ISA_VERSION_MINOR__ != 0
+#error wrong value for __PTX_ISA_VERSION_MINOR__
+#endif
+
+#if __PTX_SM__ != 520
+#error wrong value for __PTX_SM__
+#endif
+
+int dummy;
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3-sm52.c b/libgomp/testsuite/libgomp.c/declare-variant-3-sm52.c
new file mode 100644 (file)
index 0000000..591473c
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do link { target { offload_target_nvptx } } } */
+/* { dg-additional-options -foffload=nvptx-none } */
+/* { dg-additional-options "-foffload=-misa=sm_52 -foffload=-mptx=_" } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-3.h"
+
+/* { dg-final { only_for_offload_target nvptx-none scan-offload-tree-dump "= f52 \\(\\);" "optimized" } } */
index 58ec06bf9dfbfea7a3eb3538f33a5f28d866cefd..8db0fc536adb3b15d9aff565e74252fbca2d4268 100644 (file)
@@ -21,6 +21,13 @@ f37 (void)
   return 37;
 }
 
+__attribute__ ((noipa))
+int
+f52 (void)
+{
+  return 52;
+}
+
 __attribute__ ((noipa))
 int
 f53 (void)
@@ -52,6 +59,7 @@ f80 (void)
 #pragma omp declare variant (f30) match (device={isa("sm_30")})
 #pragma omp declare variant (f35) match (device={isa("sm_35")})
 #pragma omp declare variant (f37) match (device={isa("sm_37")})
+#pragma omp declare variant (f52) match (device={isa("sm_52")})
 #pragma omp declare variant (f53) match (device={isa("sm_53")})
 #pragma omp declare variant (f70) match (device={isa("sm_70")})
 #pragma omp declare variant (f75) match (device={isa("sm_75")})