diff mbox series

nvptx: Clarify that our baseline is PTX ISA Version 3.1 (was: [committed][nvptx] Choose -mptx default based on -misa)

Message ID 875xnxm5kw.fsf@euler.schwinge.ddns.net
State New
Headers show
Series nvptx: Clarify that our baseline is PTX ISA Version 3.1 (was: [committed][nvptx] Choose -mptx default based on -misa) | expand

Commit Message

Thomas Schwinge Dec. 6, 2024, 11:08 a.m. UTC
Hi!

On 2022-02-08T13:57:53+0100, Tom de Vries via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> --- a/gcc/config/nvptx/nvptx-opts.h
> +++ b/gcc/config/nvptx/nvptx-opts.h
> @@ -31,7 +31,9 @@ enum ptx_isa
>  
>  enum ptx_version
>  {
> +  PTX_VERSION_3_0,
>    PTX_VERSION_3_1,
> +  PTX_VERSION_4_2,
>    PTX_VERSION_6_0,
>    PTX_VERSION_6_3,
>    PTX_VERSION_7_0

Pushed to trunk branch commit 380ceb23b130a2b9ec541607a3eb1ffd0387c576
"nvptx: Clarify that our baseline is PTX ISA Version 3.1", see attached.


Grüße
 Thomas
diff mbox series

Patch

From 380ceb23b130a2b9ec541607a3eb1ffd0387c576 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tschwinge@baylibre.com>
Date: Sun, 10 Nov 2024 17:32:55 +0100
Subject: [PATCH] nvptx: Clarify that our baseline is PTX ISA Version 3.1

Added in commit decde11183bdccc46587d6614b75f3d56a2f2e4a
"[nvptx] Choose -mptx default based on -misa", 'PTX_VERSION_3_0' was added for
'first_ptx_version_supporting_sm' to return it for 'PTX_ISA_SM30' (as
documented by Nvidia).  It's however then immediately overridden to 3.1, which
in GCC/nvptx "has been the smallest version historically", and also '-mptx=3.0'
isn't exposed to the user.  As we also elsewhere (machine description etc.)
assume that our baseline is PTX ISA Version 3.1, there's no real value added in
maintaining 'PTX_VERSION_3_0' for purposes of 'first_ptx_version_supporting_sm'
only.

No change in behavior intended.

	gcc/
	* config/nvptx/nvptx-opts.h (enum ptx_version): Remove
	'PTX_VERSION_3_0'.
	* config/nvptx/nvptx.cc (first_ptx_version_supporting_sm)
	(default_ptx_version_option, ptx_version_to_string)
	(ptx_version_to_number): Adjust.
	* config/nvptx/nvptx.h: Comment.
---
 gcc/config/nvptx/nvptx-opts.h | 4 +++-
 gcc/config/nvptx/nvptx.cc     | 9 +--------
 gcc/config/nvptx/nvptx.h      | 2 ++
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/gcc/config/nvptx/nvptx-opts.h b/gcc/config/nvptx/nvptx-opts.h
index fb5147c143e9..d0b47f0aeeff 100644
--- a/gcc/config/nvptx/nvptx-opts.h
+++ b/gcc/config/nvptx/nvptx-opts.h
@@ -30,11 +30,13 @@  enum ptx_isa
 #undef NVPTX_SM
 };
 
+/* 'PTX_VERSION_[...]'s smaller than 'PTX_VERSION_3_1' are not listed here:
+   our baseline is PTX ISA Version 3.1.  */
+
 enum ptx_version
 {
   PTX_VERSION_unset,
   PTX_VERSION_default = PTX_VERSION_unset,
-  PTX_VERSION_3_0,
   PTX_VERSION_3_1,
   PTX_VERSION_4_2,
   PTX_VERSION_6_0,
diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 924399f7a35e..fb5a45a18e3c 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -212,7 +212,7 @@  first_ptx_version_supporting_sm (enum ptx_isa sm)
   switch (sm)
     {
     case PTX_ISA_SM30:
-      return PTX_VERSION_3_0;
+      return /* PTX_VERSION_3_0 not defined */ PTX_VERSION_3_1;
     case PTX_ISA_SM35:
       return PTX_VERSION_3_1;
     case PTX_ISA_SM53:
@@ -236,9 +236,6 @@  default_ptx_version_option (void)
   /* Pick a version that supports the sm.  */
   enum ptx_version res = first;
 
-  /* Pick at least 3.1.  This has been the smallest version historically.  */
-  res = MAX (res, PTX_VERSION_3_1);
-
   /* Pick at least 6.0, to enable using bar.warp.sync to have a way to force
      warp convergence.  */
   res = MAX (res, PTX_VERSION_6_0);
@@ -253,8 +250,6 @@  ptx_version_to_string (enum ptx_version v)
 {
   switch (v)
     {
-    case PTX_VERSION_3_0:
-      return "3.0";
     case PTX_VERSION_3_1:
       return "3.1";
     case PTX_VERSION_4_2:
@@ -275,8 +270,6 @@  ptx_version_to_number (enum ptx_version v, bool major_p)
 {
   switch (v)
     {
-    case PTX_VERSION_3_0:
-      return major_p ? 3 : 0;
     case PTX_VERSION_3_1:
       return major_p ? 3 : 1;
     case PTX_VERSION_4_2:
diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h
index 68ab011c5a16..792da4901d22 100644
--- a/gcc/config/nvptx/nvptx.h
+++ b/gcc/config/nvptx/nvptx.h
@@ -88,6 +88,8 @@ 
 
 #include "nvptx-gen.h"
 
+/* There are no 'TARGET_PTX_3_1' and smaller conditionals: our baseline is
+   PTX ISA Version 3.1.  */
 #define TARGET_PTX_6_0 (ptx_version_option >= PTX_VERSION_6_0)
 #define TARGET_PTX_6_3 (ptx_version_option >= PTX_VERSION_6_3)
 #define TARGET_PTX_7_0 (ptx_version_option >= PTX_VERSION_7_0)
-- 
2.34.1