public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tobias Burnus <tobias@codesourcery.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch] nvptx: Add -mptx=6.0 + -misa=sm_70
Date: Tue, 22 Feb 2022 15:39:55 +0100	[thread overview]
Message-ID: <aee12220-8161-31c2-16ea-2d4816491b3e@suse.de> (raw)
In-Reply-To: <a17f985a-a003-8c5f-f406-121f54282aef@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

On 2/17/22 18:24, Tobias Burnus wrote:
> SM version (-misa=)
> [Patch adds -misa=sm_70]
> 
> * The compiler supports internally: SM_30, SM_35, SM_53, SM_70, SM_75, 
> SM_80.

I'd formulate it like: it uses SM_70 internally to accurately formulate 
when certain insns can be used.

> I think it makes sense to have sm_70 in addition:
> * The current code actually does generate different code for >= sm_70
>    already.

Agreed.

I've committed this (with a somewhat shorter commit log), and a 
test-case update.

Thanks,
- Tom

[-- Attachment #2: 0001-nvptx-Add-misa-sm_70.patch --]
[-- Type: text/x-patch, Size: 3172 bytes --]

nvptx: Add -misa=sm_70

Add -misa=sm_70, and use it to specify the misa value in test-case
gcc.target/nvptx/atomic-store-2.c.

Tested on nvptx.

gcc/ChangeLog:

	* config/nvptx/nvptx-c.cc (nvptx_cpu_cpp_builtins): Handle SM70.
	* config/nvptx/nvptx.cc (first_ptx_version_supporting_sm):
	Likewise.
	* config/nvptx/nvptx.opt (misa): Add sm_70 alias PTX_ISA_SM70.

gcc/testsuite/ChangeLog:

2022-02-22  Tom de Vries  <tdevries@suse.de>

	* gcc.target/nvptx/atomic-store-2.c: Use -misa=sm_70.
	* gcc.target/nvptx/uniform-simt-3.c: Same.

Co-Authored-By: Tom de Vries <tdevries@suse.de>

---
 gcc/config/nvptx/nvptx-c.cc                     | 2 ++
 gcc/config/nvptx/nvptx.cc                       | 2 ++
 gcc/config/nvptx/nvptx.opt                      | 3 +++
 gcc/testsuite/gcc.target/nvptx/atomic-store-2.c | 2 +-
 gcc/testsuite/gcc.target/nvptx/uniform-simt-3.c | 2 +-
 5 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/config/nvptx/nvptx-c.cc b/gcc/config/nvptx/nvptx-c.cc
index d68b9910d7e..b2375fb5b16 100644
--- a/gcc/config/nvptx/nvptx-c.cc
+++ b/gcc/config/nvptx/nvptx-c.cc
@@ -43,6 +43,8 @@ nvptx_cpu_cpp_builtins (void)
     cpp_define (parse_in, "__PTX_SM__=800");
   else if (TARGET_SM75)
     cpp_define (parse_in, "__PTX_SM__=750");
+  else if (TARGET_SM70)
+    cpp_define (parse_in, "__PTX_SM__=700");
   else if (TARGET_SM53)
     cpp_define (parse_in, "__PTX_SM__=530");
   else if (TARGET_SM35)
diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 981b91f7095..858789e6df7 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -217,6 +217,8 @@ first_ptx_version_supporting_sm (enum ptx_isa sm)
       return PTX_VERSION_3_1;
     case PTX_ISA_SM53:
       return PTX_VERSION_4_2;
+    case PTX_ISA_SM70:
+      return PTX_VERSION_6_0;
     case PTX_ISA_SM75:
       return PTX_VERSION_6_3;
     case PTX_ISA_SM80:
diff --git a/gcc/config/nvptx/nvptx.opt b/gcc/config/nvptx/nvptx.opt
index 97e127cc4fb..9776c3b9a1f 100644
--- a/gcc/config/nvptx/nvptx.opt
+++ b/gcc/config/nvptx/nvptx.opt
@@ -64,6 +64,9 @@ Enum(ptx_isa) String(sm_35) Value(PTX_ISA_SM35)
 EnumValue
 Enum(ptx_isa) String(sm_53) Value(PTX_ISA_SM53)
 
+EnumValue
+Enum(ptx_isa) String(sm_70) Value(PTX_ISA_SM70)
+
 EnumValue
 Enum(ptx_isa) String(sm_75) Value(PTX_ISA_SM75)
 
diff --git a/gcc/testsuite/gcc.target/nvptx/atomic-store-2.c b/gcc/testsuite/gcc.target/nvptx/atomic-store-2.c
index cd5e4c38267..b58f33f2abd 100644
--- a/gcc/testsuite/gcc.target/nvptx/atomic-store-2.c
+++ b/gcc/testsuite/gcc.target/nvptx/atomic-store-2.c
@@ -2,7 +2,7 @@
    shared state space.  */
 
 /* { dg-do compile } */
-/* { dg-options "-misa=sm_75" } */
+/* { dg-options "-misa=sm_70" } */
 
 enum memmodel
 {
diff --git a/gcc/testsuite/gcc.target/nvptx/uniform-simt-3.c b/gcc/testsuite/gcc.target/nvptx/uniform-simt-3.c
index 532fa825161..b61b8ba9d5b 100644
--- a/gcc/testsuite/gcc.target/nvptx/uniform-simt-3.c
+++ b/gcc/testsuite/gcc.target/nvptx/uniform-simt-3.c
@@ -1,4 +1,4 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -muniform-simt -misa=sm_75" } */
+/* { dg-options "-O2 -muniform-simt -misa=sm_70" } */
 
 #include "atomic-store-2.c"

  parent reply	other threads:[~2022-02-22 14:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 17:24 Tobias Burnus
2022-02-22 14:26 ` Tom de Vries
2022-02-22 14:39 ` Tom de Vries [this message]
2022-02-22 14:43 ` Tom de Vries
2022-02-22 16:03   ` Tobias Burnus
2022-02-24  8:29     ` Tom de Vries
2022-02-24 10:01       ` [PATCH][libgomp, testsuite, nvptx] Add libgomp.c/declare-variant-3-sm*.c Tom de Vries
2022-02-24 10:09         ` Jakub Jelinek
2022-02-24 10:32           ` Tom de Vries
2022-02-24 10:38             ` Jakub Jelinek
2023-11-30 14:48             ` Fix 'libgomp.c/declare-variant-3-*.c' compilation for configurations where GCN offloading is enabled in addition to nvptx (was: [PATCH][libgomp, testsuite, nvptx] Add libgomp.c/declare-variant-3-sm*.c) Thomas Schwinge
2023-11-30 14:49               ` Thomas Schwinge
2023-11-30 14:57             ` In 'libgomp.c/declare-variant-{3,4}-*.c', restrict 'scan-offload-tree-dump's to 'only_for_offload_target [...]' " Thomas Schwinge
2023-11-30 14:59             ` Spin 'dg-do run' part of 'libgomp.c/declare-variant-3-sm30.c' off into new 'libgomp.c/declare-variant-3.c' " Thomas Schwinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aee12220-8161-31c2-16ea-2d4816491b3e@suse.de \
    --to=tdevries@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tobias@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).