public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-9096] OpenMP/nvptx: support 'arch(nvptx64)' as context selector
@ 2024-02-21 10:36 Tobias Burnus
  0 siblings, 0 replies; only message in thread
From: Tobias Burnus @ 2024-02-21 10:36 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:703d14132e202ed2ab787cfdb37a726fa654455a

commit r14-9096-g703d14132e202ed2ab787cfdb37a726fa654455a
Author: Tobias Burnus <tburnus@baylibre.com>
Date:   Wed Feb 21 11:31:43 2024 +0100

    OpenMP/nvptx: support 'arch(nvptx64)' as context selector
    
    The main 'arch' context selector for nvptx is, well, 'nvptx';
    however, as 'nvptx64' is used as by LLVM, it makes sense
    to support it as well.
    
    Note that LLVM has: "The triple architecture can be one of
    ``nvptx`` (32-bit PTX) or ``nvptx64`` (64-bit PTX)."
    GCC effectively only supports the 64bit variant (at least for
    offloading). Thus, GCC's 'nvptx' is not quite the same as LLVM's.
    
    The device-compiler part (nvptx_omp_device_kind_arch_isa) uses
    TARGET_ABI64 such that nvptx64 is only defined with -m64.
    
    gcc/ChangeLog:
    
            * config/nvptx/gen-omp-device-properties.sh: Add 'nvptx64' to arch.
            * config/nvptx/nvptx.cc (nvptx_omp_device_kind_arch_isa): Likewise.
    
    libgomp/ChangeLog:
    
            * libgomp.texi (OpenMP Context Selectors): Add 'nvptx64' as additional
            'arch' value for nvptx.

Diff:
---
 gcc/config/nvptx/gen-omp-device-properties.sh | 2 +-
 gcc/config/nvptx/nvptx.cc                     | 3 ++-
 libgomp/libgomp.texi                          | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/config/nvptx/gen-omp-device-properties.sh b/gcc/config/nvptx/gen-omp-device-properties.sh
index 95c754a164fd..3666f9746d1a 100644
--- a/gcc/config/nvptx/gen-omp-device-properties.sh
+++ b/gcc/config/nvptx/gen-omp-device-properties.sh
@@ -23,7 +23,7 @@ nvptx_sm_def="$1/nvptx-sm.def"
 sms=$(grep ^NVPTX_SM $nvptx_sm_def | sed 's/.*(//;s/,.*//')
 
 echo kind: gpu
-echo arch: nvptx
+echo arch: nvptx nvptx64
 
 isa=""
 for sm in $sms; do
diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 9363d3ecc6a2..2a8f713c6806 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -6403,7 +6403,8 @@ nvptx_omp_device_kind_arch_isa (enum omp_device_kind_arch_isa trait,
     case omp_device_kind:
       return strcmp (name, "gpu") == 0;
     case omp_device_arch:
-      return strcmp (name, "nvptx") == 0;
+      return (strcmp (name, "nvptx") == 0
+	      || (TARGET_ABI64 && strcmp (name, "nvptx64") == 0));
     case omp_device_isa:
 #define NVPTX_SM(XX, SEP)				\
       {							\
diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi
index f57190f203c2..0aea737350a7 100644
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -6098,7 +6098,7 @@ on more architectures, GCC currently does not match any @code{arch} or
 @item @code{amdgcn}, @code{gcn}
       @tab See @code{-march=} in ``AMD GCN Options''@footnote{Additionally,
       @code{gfx803} is supported as an alias for @code{fiji}.}
-@item @code{nvptx}
+@item @code{nvptx}, @code{nvptx64}
       @tab See @code{-march=} in ``Nvidia PTX Options''
 @end multitable

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-21 10:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21 10:36 [gcc r14-9096] OpenMP/nvptx: support 'arch(nvptx64)' as context selector Tobias Burnus

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).