On 2/17/22 18:24, Tobias Burnus wrote:
PTX version (-mptx=)
[patch adds -mptx=6.0 as option]
* Currently supported internally are 3.1 (CUDA 5.0, used by GCC <= 11),
6.0 (CUDA 9.0, current GCC 12 default), 6.3 (CUDA 10.0), 7.0 (CUDA 11.0)
* -mptx= supports 3.1, 6.3, 7.0 – but not the internal default 6.0
I tend not to think in terms of CUDA versions, but supported driver
versions.
In the end, drivers are used to translate ptx to SASS for execution,
CUDA is just used for build time verification (or not, if it's not in
the path).
And a driver may or may not be supported. F.i. 390.x still may receive
updates from nvidia, but there are JIT bugs that we've reported that
they've decided not to fix, so from that point of view 390.x is unsupported.
I think it makes sense to expose the 6.0 value to the user and not
only use it internally behind the scenes. As it is already used internally,
the change is tiny but user visible.
Sure, I've committed this (with a somewhat shorter commit log).
Thus, it has to stay when we will
bump the default in later GCC versions; on the other hand, if we bump
the default, it might be also a good reason to have it to permit the
user to have a backward compatible PTX output for linking libraries.
FWIW, I think that it's possible to link different versions of ptx isa
together (though perhaps there are specific scenarios where that's not
possible, I'm not sure). But mixing versions restricts the range of
drivers you can use, so it may make sense to just use one version.
Thanks,
- Tom
nvptx: Add -mptx=6.0
Currently supported internally are 3.1, 6.0, 6.3 and 7.0.
However, -mptx= supports 3.1, 6.3, 7.0 – but not the internal default 6.0.
Add -mptx=6.0 for consistency.
Tested on nvptx.
gcc/ChangeLog:
* config/nvptx/nvptx.opt (mptx): Add 6.0 alias PTX_VERSION_6_0.
* doc/invoke.texi (-mptx): Update for new values and defaults.
Co-Authored-By: Tom de Vries <tdevr...@suse.de>
---
gcc/config/nvptx/nvptx.opt | 3 +++
gcc/doc/invoke.texi | 7 ++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gcc/config/nvptx/nvptx.opt b/gcc/config/nvptx/nvptx.opt
index e56ec9288da..97e127cc4fb 100644
--- a/gcc/config/nvptx/nvptx.opt
+++ b/gcc/config/nvptx/nvptx.opt
@@ -82,6 +82,9 @@ Known PTX versions (for use with the -mptx= option):
EnumValue
Enum(ptx_version) String(3.1) Value(PTX_VERSION_3_1)
+EnumValue
+Enum(ptx_version) String(6.0) Value(PTX_VERSION_6_0)
+
EnumValue
Enum(ptx_version) String(6.3) Value(PTX_VERSION_6_3)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 635c5f79278..56f3a01de44 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -27286,9 +27286,10 @@ strings must be lower-case. Valid ISA strings include @samp{sm_30} and
@item -mptx=@var{version-string}
@opindex mptx
-Generate code for given the specified PTX version (e.g.@: @samp{6.3}).
-Valid version strings include @samp{3.1} and @samp{6.3}. The default PTX
-version is 3.1.
+Generate code for given the specified PTX version (e.g.@: @samp{7.0}).
+Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
+@samp{7.0}. The default PTX version is 6.0, unless a higher minimal
+version is required for specified PTX ISA via option @option{-misa=}.
@item -mmainkernel
@opindex mmainkernel