[Openmp-commits] [openmp] [OpenMP] Fix incorrect use of align instead of round (PR #196191)

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Wed May 6 14:51:00 PDT 2026


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/196191

None

>From c027f60d69384d87e89cf2953c08f77d4353ad37 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 6 May 2026 16:50:39 -0500
Subject: [PATCH] [OpenMP] Fix incorrect use of align instead of round

---
 openmp/device/src/Mapping.cpp   | 2 +-
 openmp/device/src/Reduction.cpp | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/openmp/device/src/Mapping.cpp b/openmp/device/src/Mapping.cpp
index 5c51da65c8d28..1096e5f496590 100644
--- a/openmp/device/src/Mapping.cpp
+++ b/openmp/device/src/Mapping.cpp
@@ -131,7 +131,7 @@ uint32_t mapping::getBlockIdInKernel(int32_t Dim) {
 }
 
 uint32_t mapping::getNumberOfWarpsInBlock() {
-  return utils::alignUp(mapping::getNumberOfThreadsInBlock(),
+  return utils::roundUp(mapping::getNumberOfThreadsInBlock(),
                         mapping::getWarpSize());
 }
 
diff --git a/openmp/device/src/Reduction.cpp b/openmp/device/src/Reduction.cpp
index 271d31629d8ee..b1b1e0d2d2917 100644
--- a/openmp/device/src/Reduction.cpp
+++ b/openmp/device/src/Reduction.cpp
@@ -135,7 +135,7 @@ static int32_t nvptx_parallel_reduce_nowait(void *reduce_data,
   //
   // Only L1 parallel region can enter this if condition.
   if (NumThreads > mapping::getWarpSize()) {
-    uint32_t WarpsNeeded = utils::alignUp(NumThreads, mapping::getWarpSize());
+    uint32_t WarpsNeeded = utils::roundUp(NumThreads, mapping::getWarpSize());
     // Gather all the reduced values from each warp
     // to the first warp.
     cpyFct(reduce_data, WarpsNeeded);
@@ -280,7 +280,7 @@ int32_t __kmpc_nvptx_teams_reduce_nowait_v2(
       uint32_t ActiveThreads = kmpcMin(NumRecs, NumThreads);
       if (ActiveThreads > mapping::getWarpSize()) {
         uint32_t WarpsNeeded =
-            utils::alignUp(ActiveThreads, mapping::getWarpSize());
+            utils::roundUp(ActiveThreads, mapping::getWarpSize());
         // Gather all the reduced values from each warp
         // to the first warp.
         cpyFct(reduce_data, WarpsNeeded);



More information about the Openmp-commits mailing list