https://gcc.gnu.org/g:7b53b88381179c5c8152bcb890460f66d9c88fac
commit r16-565-g7b53b88381179c5c8152bcb890460f66d9c88fac Author: Thomas Schwinge <tschwi...@baylibre.com> Date: Wed May 7 16:02:16 2025 +0200 nvptx: Support '-march=sm_61' gcc/ * config/nvptx/nvptx-sm.def: Add '61'. * 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_61, -march-map=sm_62): Likewise. * config.gcc: Likewise. * doc/invoke.texi (Nvidia PTX Options): Document '-march=sm_61'. * config/nvptx/gen-multilib-matches-tests: Extend. gcc/testsuite/ * gcc.target/nvptx/march-map=sm_61.c: Adjust. * gcc.target/nvptx/march-map=sm_62.c: Likewise. * gcc.target/nvptx/march=sm_61.c: New. libgomp/ * testsuite/libgomp.c/declare-variant-3-sm61.c: New. * testsuite/libgomp.c/declare-variant-3.h: Adjust. Diff: --- gcc/config.gcc | 1 + gcc/config/nvptx/gen-multilib-matches-tests | 67 ++++++++++++++++++++-- gcc/config/nvptx/nvptx-gen.h | 1 + gcc/config/nvptx/nvptx-gen.opt | 3 + gcc/config/nvptx/nvptx-sm.def | 1 + gcc/config/nvptx/nvptx.cc | 2 + gcc/config/nvptx/nvptx.opt | 4 +- gcc/doc/invoke.texi | 1 + gcc/testsuite/gcc.target/nvptx/march-map=sm_61.c | 4 +- gcc/testsuite/gcc.target/nvptx/march-map=sm_62.c | 4 +- gcc/testsuite/gcc.target/nvptx/march=sm_61.c | 19 ++++++ .../testsuite/libgomp.c/declare-variant-3-sm61.c | 8 +++ libgomp/testsuite/libgomp.c/declare-variant-3.h | 8 +++ 13 files changed, 111 insertions(+), 12 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index c9fe996f2f7c..2454ec70a07e 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -5658,6 +5658,7 @@ case "${target}" in #TODO 'sm_[...]' list per 'nvptx-sm.def'. sm_30 | sm_35 | sm_37 \ | sm_52 | sm_53 \ + | sm_61 \ | sm_70 | sm_75 \ | sm_80 | sm_89 ) TM_MULTILIB_CONFIG="$TM_MULTILIB_CONFIG $nvptx_multilib" diff --git a/gcc/config/nvptx/gen-multilib-matches-tests b/gcc/config/nvptx/gen-multilib-matches-tests index a07f19adbdb1..fbfae880a2de 100644 --- a/gcc/config/nvptx/gen-multilib-matches-tests +++ b/gcc/config/nvptx/gen-multilib-matches-tests @@ -18,6 +18,7 @@ AEMM .=misa?sm_35 AEMM .=misa?sm_37 AEMM .=misa?sm_52 AEMM .=misa?sm_53 +AEMM .=misa?sm_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -32,14 +33,15 @@ AEMM .=misa?sm_35 AEMM .=misa?sm_37 AEMM .=misa?sm_52 AEMM .=misa?sm_53 +AEMM .=misa?sm_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 CMMC -BEGIN '--with-arch=sm_30', '--with-multilib-list=sm_30,sm_35,sm_37,sm_52,sm_53,sm_70,sm_75,sm_80,sm_89' +BEGIN '--with-arch=sm_30', '--with-multilib-list=sm_30,sm_35,sm_37,sm_52,sm_53,sm_61,sm_70,sm_75,sm_80,sm_89' SMOID sm_30 -SMOIL sm_30 sm_35 sm_37 sm_52 sm_53 sm_70 sm_75 sm_80 sm_89 +SMOIL sm_30 sm_35 sm_37 sm_52 sm_53 sm_61 sm_70 sm_75 sm_80 sm_89 AEMM .=misa?sm_30 CMMC @@ -52,6 +54,7 @@ AEMM .=misa?sm_35 AEMM .=misa?sm_37 AEMM .=misa?sm_52 AEMM .=misa?sm_53 +AEMM .=misa?sm_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -65,6 +68,7 @@ AEMM .=misa?sm_35 AEMM .=misa?sm_37 AEMM .=misa?sm_52 AEMM .=misa?sm_53 +AEMM .=misa?sm_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -79,6 +83,7 @@ AEMM misa?sm_30=misa?sm_35 AEMM .=misa?sm_37 AEMM .=misa?sm_52 AEMM .=misa?sm_53 +AEMM .=misa?sm_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -93,6 +98,7 @@ 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_61 AEMM .=misa?sm_70 AEMM misa?sm_75=misa?sm_80 AEMM misa?sm_75=misa?sm_89 @@ -106,6 +112,7 @@ 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_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -119,19 +126,55 @@ 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_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 AEMM .=misa?sm_89 CMMC -BEGIN '--with-arch=sm_53', '--with-multilib-list=sm_53=sm_30,sm_35,sm_37,sm_52,sm_70,sm_75,sm_80,sm_89' +BEGIN '--with-arch=sm_53', '--with-multilib-list=sm_30,sm_35,sm_37,sm_52,sm_61,sm_70,sm_75,sm_80,sm_89' SMOID sm_53 -SMOIL sm_53 sm_30 sm_35 sm_37 sm_52 sm_70 sm_75 sm_80 sm_89 +SMOIL sm_53 sm_30 sm_35 sm_37 sm_52 sm_61 sm_70 sm_75 sm_80 sm_89 AEMM .=misa?sm_53 CMMC +BEGIN '--with-arch=sm_61', '--with-multilib-list=sm_61,sm_30' +SMOID sm_61 +SMOIL sm_61 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_61 +AEMM .=misa?sm_70 +AEMM .=misa?sm_75 +AEMM .=misa?sm_80 +AEMM .=misa?sm_89 +CMMC + +BEGIN '--with-arch=sm_61', '--with-multilib-list=sm_61,sm_37' +SMOID sm_61 +SMOIL sm_61 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_37=misa?sm_53 +AEMM .=misa?sm_61 +AEMM .=misa?sm_70 +AEMM .=misa?sm_75 +AEMM .=misa?sm_80 +AEMM .=misa?sm_89 +CMMC + +BEGIN '--with-arch=sm_61', '--with-multilib-list=sm_30,sm_35,sm_37,sm_52,sm_61,sm_70,sm_75,sm_80,sm_89' +SMOID sm_61 +SMOIL sm_61 sm_30 sm_35 sm_37 sm_52 sm_53 sm_70 sm_75 sm_80 sm_89 +AEMM .=misa?sm_61 +CMMC + + BEGIN '--with-arch=sm_70', '--with-multilib-list=sm_70' SMOID sm_70 SMOIL sm_70 @@ -140,6 +183,7 @@ AEMM .=misa?sm_35 AEMM .=misa?sm_37 AEMM .=misa?sm_52 AEMM .=misa?sm_53 +AEMM .=misa?sm_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -153,6 +197,7 @@ 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_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -166,6 +211,7 @@ 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_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -178,6 +224,7 @@ 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_53=misa?sm_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -192,6 +239,7 @@ 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_61 AEMM misa?sm_30=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -205,6 +253,7 @@ 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_61 AEMM misa?sm_53=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -217,6 +266,7 @@ 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_61 AEMM misa?sm_53=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -232,6 +282,7 @@ AEMM .=misa?sm_35 AEMM .=misa?sm_37 AEMM .=misa?sm_52 AEMM .=misa?sm_53 +AEMM .=misa?sm_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -245,6 +296,7 @@ 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_61 AEMM misa?sm_30=misa?sm_70 AEMM misa?sm_30=misa?sm_75 AEMM .=misa?sm_80 @@ -259,6 +311,7 @@ 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_61 AEMM misa?sm_75=misa?sm_70 AEMM .=misa?sm_80 AEMM .=misa?sm_89 @@ -273,6 +326,7 @@ AEMM .=misa?sm_35 AEMM .=misa?sm_37 AEMM .=misa?sm_52 AEMM .=misa?sm_53 +AEMM .=misa?sm_61 AEMM .=misa?sm_70 AEMM .=misa?sm_75 AEMM .=misa?sm_80 @@ -286,6 +340,7 @@ AEMM misa?sm_52=misa?sm_30 AEMM misa?sm_52=misa?sm_35 AEMM misa?sm_52=misa?sm_37 AEMM misa?sm_52=misa?sm_53 +AEMM misa?sm_52=misa?sm_61 AEMM misa?sm_52=misa?sm_70 AEMM misa?sm_52=misa?sm_75 AEMM misa?sm_52=misa?sm_80 @@ -293,8 +348,8 @@ AEMM .=misa?sm_89 CMMC -BEGIN '--with-arch=sm_89', '--with-multilib-list=sm_89,sm_30,sm_35,sm_37,sm_52,sm_53,sm_70,sm_75,sm_80' +BEGIN '--with-arch=sm_89', '--with-multilib-list=sm_89,sm_30,sm_35,sm_37,sm_52,sm_53,sm_61,sm_70,sm_75,sm_80' SMOID sm_89 -SMOIL sm_89 sm_30 sm_35 sm_37 sm_52 sm_53 sm_70 sm_75 sm_80 +SMOIL sm_89 sm_30 sm_35 sm_37 sm_52 sm_53 sm_61 sm_70 sm_75 sm_80 AEMM .=misa?sm_89 CMMC diff --git a/gcc/config/nvptx/nvptx-gen.h b/gcc/config/nvptx/nvptx-gen.h index 893df41303e1..f5b989971ba9 100644 --- a/gcc/config/nvptx/nvptx-gen.h +++ b/gcc/config/nvptx/nvptx-gen.h @@ -26,6 +26,7 @@ #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_SM61 (ptx_isa_option >= PTX_ISA_SM61) #define TARGET_SM70 (ptx_isa_option >= PTX_ISA_SM70) #define TARGET_SM75 (ptx_isa_option >= PTX_ISA_SM75) #define TARGET_SM80 (ptx_isa_option >= PTX_ISA_SM80) diff --git a/gcc/config/nvptx/nvptx-gen.opt b/gcc/config/nvptx/nvptx-gen.opt index f45e8efacb68..bbae32d6dd45 100644 --- a/gcc/config/nvptx/nvptx-gen.opt +++ b/gcc/config/nvptx/nvptx-gen.opt @@ -38,6 +38,9 @@ Enum(ptx_isa) String(sm_52) Value(PTX_ISA_SM52) EnumValue Enum(ptx_isa) String(sm_53) Value(PTX_ISA_SM53) +EnumValue +Enum(ptx_isa) String(sm_61) Value(PTX_ISA_SM61) + EnumValue Enum(ptx_isa) String(sm_70) Value(PTX_ISA_SM70) diff --git a/gcc/config/nvptx/nvptx-sm.def b/gcc/config/nvptx/nvptx-sm.def index 1485f89d9cc1..9f9e86441311 100644 --- a/gcc/config/nvptx/nvptx-sm.def +++ b/gcc/config/nvptx/nvptx-sm.def @@ -25,6 +25,7 @@ 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 (61, NVPTX_SM_SEP) NVPTX_SM (70, NVPTX_SM_SEP) NVPTX_SM (75, NVPTX_SM_SEP) NVPTX_SM (80, NVPTX_SM_SEP) diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc index d5827074f65a..b1c476e95f4f 100644 --- a/gcc/config/nvptx/nvptx.cc +++ b/gcc/config/nvptx/nvptx.cc @@ -220,6 +220,8 @@ first_ptx_version_supporting_sm (enum ptx_isa sm) return PTX_VERSION_4_1; case PTX_ISA_SM53: return PTX_VERSION_4_2; + case PTX_ISA_SM61: + return PTX_VERSION_5_0; case PTX_ISA_SM70: return PTX_VERSION_6_0; case PTX_ISA_SM75: diff --git a/gcc/config/nvptx/nvptx.opt b/gcc/config/nvptx/nvptx.opt index d53a7271873c..d326ca4ad263 100644 --- a/gcc/config/nvptx/nvptx.opt +++ b/gcc/config/nvptx/nvptx.opt @@ -88,10 +88,10 @@ march-map=sm_60 Target RejectNegative Alias(misa=,sm_53) march-map=sm_61 -Target RejectNegative Alias(misa=,sm_53) +Target RejectNegative Alias(misa=,sm_61) march-map=sm_62 -Target RejectNegative Alias(misa=,sm_53) +Target RejectNegative Alias(misa=,sm_61) march-map=sm_70 Target RejectNegative Alias(misa=,sm_70) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 56d7c1a9f16e..ab89686256d0 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -30698,6 +30698,7 @@ Generate code for the specified PTX ISA target architecture. Valid architecture strings are @samp{sm_30}, @samp{sm_35}, @samp{sm_37}, @samp{sm_52}, @samp{sm_53}, +@samp{sm_61}, @samp{sm_70}, @samp{sm_75}, @samp{sm_80}, and @samp{sm_89}. The default depends on how the compiler has been configured, see diff --git a/gcc/testsuite/gcc.target/nvptx/march-map=sm_61.c b/gcc/testsuite/gcc.target/nvptx/march-map=sm_61.c index 742e25d5bd8e..d6e8ce967a34 100644 --- a/gcc/testsuite/gcc.target/nvptx/march-map=sm_61.c +++ b/gcc/testsuite/gcc.target/nvptx/march-map=sm_61.c @@ -2,7 +2,7 @@ /* { dg-options {-march-map=sm_61 -mptx=_} } */ /* { dg-additional-options -save-temps } */ /* { dg-final { scan-assembler-times {(?n)^ \.version 7\.3$} 1 } } */ -/* { dg-final { scan-assembler-times {(?n)^ \.target sm_53$} 1 } } */ +/* { dg-final { scan-assembler-times {(?n)^ \.target sm_61$} 1 } } */ #if __PTX_ISA_VERSION_MAJOR__ != 7 #error wrong value for __PTX_ISA_VERSION_MAJOR__ @@ -12,7 +12,7 @@ #error wrong value for __PTX_ISA_VERSION_MINOR__ #endif -#if __PTX_SM__ != 530 +#if __PTX_SM__ != 610 #error wrong value for __PTX_SM__ #endif diff --git a/gcc/testsuite/gcc.target/nvptx/march-map=sm_62.c b/gcc/testsuite/gcc.target/nvptx/march-map=sm_62.c index 02ced4c0db7a..ccce6f7f8594 100644 --- a/gcc/testsuite/gcc.target/nvptx/march-map=sm_62.c +++ b/gcc/testsuite/gcc.target/nvptx/march-map=sm_62.c @@ -2,7 +2,7 @@ /* { dg-options {-march-map=sm_62 -mptx=_} } */ /* { dg-additional-options -save-temps } */ /* { dg-final { scan-assembler-times {(?n)^ \.version 7\.3$} 1 } } */ -/* { dg-final { scan-assembler-times {(?n)^ \.target sm_53$} 1 } } */ +/* { dg-final { scan-assembler-times {(?n)^ \.target sm_61$} 1 } } */ #if __PTX_ISA_VERSION_MAJOR__ != 7 #error wrong value for __PTX_ISA_VERSION_MAJOR__ @@ -12,7 +12,7 @@ #error wrong value for __PTX_ISA_VERSION_MINOR__ #endif -#if __PTX_SM__ != 530 +#if __PTX_SM__ != 610 #error wrong value for __PTX_SM__ #endif diff --git a/gcc/testsuite/gcc.target/nvptx/march=sm_61.c b/gcc/testsuite/gcc.target/nvptx/march=sm_61.c new file mode 100644 index 000000000000..d8bccb8f86a5 --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/march=sm_61.c @@ -0,0 +1,19 @@ +/* { dg-do assemble } */ +/* { dg-options {-march=sm_61 -mptx=_} } */ +/* { dg-additional-options -save-temps } */ +/* { dg-final { scan-assembler-times {(?n)^ \.version 7\.3$} 1 } } */ +/* { dg-final { scan-assembler-times {(?n)^ \.target sm_61$} 1 } } */ + +#if __PTX_ISA_VERSION_MAJOR__ != 7 +#error wrong value for __PTX_ISA_VERSION_MAJOR__ +#endif + +#if __PTX_ISA_VERSION_MINOR__ != 3 +#error wrong value for __PTX_ISA_VERSION_MINOR__ +#endif + +#if __PTX_SM__ != 610 +#error wrong value for __PTX_SM__ +#endif + +int dummy; diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3-sm61.c b/libgomp/testsuite/libgomp.c/declare-variant-3-sm61.c new file mode 100644 index 000000000000..e6941d32ffe9 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/declare-variant-3-sm61.c @@ -0,0 +1,8 @@ +/* { dg-do link { target { offload_target_nvptx } } } */ +/* { dg-additional-options -foffload=nvptx-none } */ +/* { dg-additional-options "-foffload=-misa=sm_61 -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 "= f61 \\(\\);" "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3.h b/libgomp/testsuite/libgomp.c/declare-variant-3.h index c9c8f4a385fb..f5695a24b811 100644 --- a/libgomp/testsuite/libgomp.c/declare-variant-3.h +++ b/libgomp/testsuite/libgomp.c/declare-variant-3.h @@ -35,6 +35,13 @@ f53 (void) return 53; } +__attribute__ ((noipa)) +int +f61 (void) +{ + return 61; +} + __attribute__ ((noipa)) int f70 (void) @@ -68,6 +75,7 @@ f89 (void) #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 (f61) match (device={isa("sm_61")}) #pragma omp declare variant (f70) match (device={isa("sm_70")}) #pragma omp declare variant (f75) match (device={isa("sm_75")}) #pragma omp declare variant (f80) match (device={isa("sm_80")})