[Openmp-commits] [PATCH] D119311: [OpenMP][CUDA] Refine the logic to determine grid size
Shilei Tian via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Tue Feb 8 21:53:55 PST 2022
tianshilei1992 created this revision.
tianshilei1992 added reviewers: jhuber6, JonChesterfield, jdoerfert.
Herald added subscribers: carlosgalvezp, guansong, yaxunl.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.
This patch refines the logic to determine grid size as previous method
can skip the check of whether `CudaBlocksPerGrid` could be greater than the actual
hardware limit.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D119311
Files:
openmp/libomptarget/plugins/cuda/src/rtl.cpp
Index: openmp/libomptarget/plugins/cuda/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -1170,15 +1170,17 @@
DP("Using default number of teams %d\n", DeviceData[DeviceId].NumTeams);
CudaBlocksPerGrid = DeviceData[DeviceId].NumTeams;
}
- } else if (TeamNum > DeviceData[DeviceId].BlocksPerGrid) {
- DP("Capping number of teams to team limit %d\n",
- DeviceData[DeviceId].BlocksPerGrid);
- CudaBlocksPerGrid = DeviceData[DeviceId].BlocksPerGrid;
} else {
DP("Using requested number of teams %d\n", TeamNum);
CudaBlocksPerGrid = TeamNum;
}
+ if (CudaBlocksPerGrid > DeviceData[DeviceId].BlocksPerGrid) {
+ DP("Capping number of teams to team limit %d\n",
+ DeviceData[DeviceId].BlocksPerGrid);
+ CudaBlocksPerGrid = DeviceData[DeviceId].BlocksPerGrid;
+ }
+
INFO(OMP_INFOTYPE_PLUGIN_KERNEL, DeviceId,
"Launching kernel %s with %d blocks and %d threads in %s mode\n",
(getOffloadEntry(DeviceId, TgtEntryPtr))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119311.407046.patch
Type: text/x-patch
Size: 1159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220209/f71e8dc7/attachment.bin>
More information about the Openmp-commits
mailing list