From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1729) id 859F73842AF2; Wed, 29 Jun 2022 14:43:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 859F73842AF2 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Kwok Yeung To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-12] libgomp, nvptx: Add fallback for PTX versions lower than 4.1 X-Act-Checkin: gcc X-Git-Author: Kwok Cheung Yeung X-Git-Refname: refs/heads/devel/omp/gcc-12 X-Git-Oldrev: c5d1d7651297a273321154a5fe1b01eba9dcf604 X-Git-Newrev: 1486a6a4a8d4a0714aaa3eab00a79e870cfbc9a6 Message-Id: <20220629144318.859F73842AF2@sourceware.org> Date: Wed, 29 Jun 2022 14:43:18 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2022 14:43:18 -0000 https://gcc.gnu.org/g:1486a6a4a8d4a0714aaa3eab00a79e870cfbc9a6 commit 1486a6a4a8d4a0714aaa3eab00a79e870cfbc9a6 Author: Kwok Cheung Yeung 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 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 + + * 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 * 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 {