[Openmp-commits] [openmp] 0813f41 - [libomptarget][nfc] Explicitly static function scope shared variables
Jon Chesterfield via Openmp-commits
openmp-commits at lists.llvm.org
Tue Mar 24 11:52:08 PDT 2020
Author: JonChesterfield
Date: 2020-03-24T18:51:50Z
New Revision: 0813f41005fddac8cc41b42fa5e918d9b049c60c
URL: https://github.com/llvm/llvm-project/commit/0813f41005fddac8cc41b42fa5e918d9b049c60c
DIFF: https://github.com/llvm/llvm-project/commit/0813f41005fddac8cc41b42fa5e918d9b049c60c.diff
LOG: [libomptarget][nfc] Explicitly static function scope shared variables
Summary:
[libomptarget][nfc] Explicitly static function scope shared variables
`__shared__` in CUDA implies static in function scope. See e.g. D.2.1.1
in CUDA_C_Programming_Guide.pdf,
http://developer.download.nvidia.com/compute/DevZone/docs/html/C/doc/
This is surprising for non-cuda developers, see e.g. D73239 where I thought
local variables would be thread local.
Tested by IR diff of libomptarget.bc (no change), running in tree tests,
and binary diff of the nvcc static archives (no significant change).
Reviewers: jdoerfert, ABataev, grokos
Reviewed By: jdoerfert
Subscribers: openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D76713
Added:
Modified:
openmp/libomptarget/deviceRTLs/common/src/reduction.cu
Removed:
################################################################################
diff --git a/openmp/libomptarget/deviceRTLs/common/src/reduction.cu b/openmp/libomptarget/deviceRTLs/common/src/reduction.cu
index 7f6ee2e39c7d..427c90a7e091 100644
--- a/openmp/libomptarget/deviceRTLs/common/src/reduction.cu
+++ b/openmp/libomptarget/deviceRTLs/common/src/reduction.cu
@@ -230,7 +230,7 @@ static int32_t nvptx_teams_reduce_nowait(int32_t global_tid, int32_t num_vars,
: /*Master thread only*/ 1;
uint32_t TeamId = GetBlockIdInKernel();
uint32_t NumTeams = GetNumberOfBlocksInKernel();
- SHARED volatile bool IsLastTeam;
+ static SHARED volatile bool IsLastTeam;
// Team masters of all teams write to the scratchpad.
if (ThreadId == 0) {
@@ -423,8 +423,8 @@ EXTERN int32_t __kmpc_nvptx_teams_reduce_nowait_v2(
: /*Master thread only*/ 1;
uint32_t TeamId = GetBlockIdInKernel();
uint32_t NumTeams = GetNumberOfBlocksInKernel();
- SHARED unsigned Bound;
- SHARED unsigned ChunkTeamCount;
+ static SHARED unsigned Bound;
+ static SHARED unsigned ChunkTeamCount;
// Block progress for teams greater than the current upper
// limit. We always only allow a number of teams less or equal
More information about the Openmp-commits
mailing list