[Openmp-commits] [openmp] a158d36 - [OpenMP] Fix warnings for uninitialized block counts

via Openmp-commits openmp-commits at lists.llvm.org
Thu Jul 22 06:24:20 PDT 2021


Author: Joseph Huber
Date: 2021-07-22T09:24:07-04:00
New Revision: a158d3663fc5b3596eaac7da857e7422d12b243e

URL: https://github.com/llvm/llvm-project/commit/a158d3663fc5b3596eaac7da857e7422d12b243e
DIFF: https://github.com/llvm/llvm-project/commit/a158d3663fc5b3596eaac7da857e7422d12b243e.diff

LOG: [OpenMP] Fix warnings for uninitialized block counts

Summary:
Fixes some warning given for uninitialized block counts if the exection mode is
not recognized. This shouldn't happen in practice because the execution mode is
checked when it's read from the device.

Added: 
    

Modified: 
    openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
    openmp/libomptarget/plugins/cuda/src/rtl.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
index 843e2a11928e5..25add33595ab1 100644
--- a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
@@ -1969,7 +1969,7 @@ launchVals getLaunchVals(EnvironmentVariables Env, int ConstWGSize,
           num_groups = ((loop_tripcount - 1) / threadsPerGroup) + 1;
         } else if (ExecutionMode == GENERIC) {
           num_groups = loop_tripcount;
-        } else if (ExecutionMode == SPMD_GENERIC) {
+        } else /* ExecutionMode == SPMD_GENERIC */ {
           // This is a generic kernel that was transformed to use SPMD-mode
           // execution but uses Generic-mode semantics for scheduling.
           num_groups = loop_tripcount;

diff  --git a/openmp/libomptarget/plugins/cuda/src/rtl.cpp b/openmp/libomptarget/plugins/cuda/src/rtl.cpp
index fff33fe6b5fff..60b97dc1a462f 100644
--- a/openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -1069,6 +1069,9 @@ class DeviceRTLTy {
           // `teams distribute` region and will create var too few blocks using
           // the regular SPMD-mode method.
           CudaBlocksPerGrid = LoopTripCount;
+        } else {
+          REPORT("Unknown execution mode: %d\n", KernelInfo->ExecutionMode);
+          return OFFLOAD_FAIL;
         }
         DP("Using %d teams due to loop trip count %" PRIu32
            " and number of threads per block %d\n",


        


More information about the Openmp-commits mailing list