]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp, nvptx: Add fallback for PTX versions lower than 4.1
authorKwok Cheung Yeung <kcy@codesourcery.com>
Wed, 22 Jun 2022 17:54:44 +0000 (18:54 +0100)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Tue, 28 Jun 2022 20:53:24 +0000 (13:53 -0700)
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.

libgomp/ChangeLog.omp
libgomp/config/nvptx/team.c

index 242cbbfa7a13c9ab096ef5397ac195088e0e1309..c79c592d97b32709351d190d848bfd58232e55f6 100644 (file)
@@ -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.
index c7b2c70dfa6ebcef67347d448d5d6e4fc8465e78..685610e00be331ed6512f2bd479074f9883fd607 100644 (file)
@@ -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 {