public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kwok Yeung <kcy@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] libgomp, nvptx: Add fallback for PTX versions lower than 4.1
Date: Wed, 29 Jun 2022 14:43:18 +0000 (GMT)	[thread overview]
Message-ID: <20220629144318.859F73842AF2@sourceware.org> (raw)

https://gcc.gnu.org/g:1486a6a4a8d4a0714aaa3eab00a79e870cfbc9a6

commit 1486a6a4a8d4a0714aaa3eab00a79e870cfbc9a6
Author: Kwok Cheung Yeung <kcy@codesourcery.com>
Date:   Wed Jun 22 18:54:44 2022 +0100

    libgomp, nvptx: Add fallback for PTX versions lower than 4.1
    
    Avoid using the dynamic_smem_size register if the PTX version does not
    support it.
    
    This patch should be included when the 'libgomp, nvptx: low-latency memory
    allocator' patch is upstreamed.
    
    2022-06-21  Kwok Cheung Yeung  <kcy@codesourcery.com>
    
            libgomp/
            * config/nvptx/team.c (gomp_nvptx_main): Initialize shared_pool_size
            to zero.  Do not use dynamic_smem_size register if PTX version lower
            than 4.1.

Diff:
---
 libgomp/ChangeLog.omp       | 6 ++++++
 libgomp/config/nvptx/team.c | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 242cbbfa7a1..c79c592d97b 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,9 @@
+2022-06-21  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+	* config/nvptx/team.c (gomp_nvptx_main): Initialize shared_pool_size
+	to zero.  Do not use dynamic_smem_size register if PTX version lower
+	than 4.1.
+
 2021-12-22  Andrew Stubbs  <ams@codesourcery.com>
 
 	* allocator.c (MEMSPACE_ALLOC): New macro.
diff --git a/libgomp/config/nvptx/team.c b/libgomp/config/nvptx/team.c
index c7b2c70dfa6..685610e00be 100644
--- a/libgomp/config/nvptx/team.c
+++ b/libgomp/config/nvptx/team.c
@@ -69,10 +69,13 @@ gomp_nvptx_main (void (*fn) (void *), void *fn_data)
 
       /* Find the low-latency heap details ....  */
       uint32_t *shared_pool;
-      uint32_t shared_pool_size;
+      uint32_t shared_pool_size = 0;
       asm ("cvta.shared.u64\t%0, __nvptx_lowlat_pool;" : "=r"(shared_pool));
+#if __PTX_ISA_VERSION_MAJOR__ > 4 \
+    || (__PTX_ISA_VERSION_MAJOR__ == 4 && __PTX_ISA_VERSION_MINOR__ >= 1)
       asm ("mov.u32\t%0, %%dynamic_smem_size;\n"
 	   : "=r"(shared_pool_size));
+#endif
 
       /* ... and initialize it with an empty free-chain.  */
       union {


                 reply	other threads:[~2022-06-29 14:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220629144318.859F73842AF2@sourceware.org \
    --to=kcy@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).