[Openmp-commits] [PATCH] D137261: [openmp][AMDGPU] - Correct getNumberOfBlocks calculation.

Ethan Stewart via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 2 08:47:07 PDT 2022


estewart08 created this revision.
estewart08 added a reviewer: jdoerfert.
Herald added subscribers: kosarev, guansong, tpr, dstuttard, yaxunl, kzhuravl.
Herald added a project: All.
estewart08 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1, wdng.
Herald added a project: OpenMP.

This patch fixes the 6 openmp lit test failures.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137261

Files:
  openmp/libomptarget/DeviceRTL/src/Mapping.cpp


Index: openmp/libomptarget/DeviceRTL/src/Mapping.cpp
===================================================================
--- openmp/libomptarget/DeviceRTL/src/Mapping.cpp
+++ openmp/libomptarget/DeviceRTL/src/Mapping.cpp
@@ -79,7 +79,9 @@
 
 uint32_t getBlockId() { return __builtin_amdgcn_workgroup_id_x(); }
 
-uint32_t getNumberOfBlocks() { return __builtin_amdgcn_grid_size_x(); }
+uint32_t getNumberOfBlocks() {
+  return __builtin_amdgcn_grid_size_x() / __builtin_amdgcn_workgroup_size_x();
+}
 
 uint32_t getWarpId() {
   return impl::getThreadIdInBlock() / mapping::getWarpSize();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137261.472629.patch
Type: text/x-patch
Size: 589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221102/be97a988/attachment.bin>


More information about the Openmp-commits mailing list