[Openmp-commits] [PATCH] D105163: [libomptarget] [amdgpu] Ensure OMP_TEAMS_THREAD_LIMIT is not overwritten by the default workgroup size
Dhruva Chakrabarti via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Tue Jun 29 17:25:57 PDT 2021
dhruvachak created this revision.
dhruvachak added reviewers: JonChesterfield, jhuber6.
Herald added subscribers: kerbowa, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
dhruvachak requested review of this revision.
Herald added subscribers: openmp-commits, wdng.
Herald added a project: OpenMP.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105163
Files:
openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
Index: openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
@@ -1104,18 +1104,16 @@
DeviceInfo.GroupsPerDevice[device_id]);
}
- // Adjust threads to the env variables
- if (DeviceInfo.EnvTeamThreadLimit > 0 &&
- (enforce_upper_bound(&DeviceInfo.NumThreads[device_id],
- DeviceInfo.EnvTeamThreadLimit))) {
- DP("Capping max number of threads to OMP_TEAMS_THREAD_LIMIT=%d\n",
+ if (DeviceInfo.EnvTeamThreadLimit > 0) {
+ DeviceInfo.NumThreads[device_id] = DeviceInfo.EnvTeamThreadLimit;
+ DP("Number of threads set according to OMP_TEAMS_THREAD_LIMIT=%d\n",
DeviceInfo.EnvTeamThreadLimit);
+ } else {
+ DeviceInfo.NumThreads[device_id] = RTLDeviceInfoTy::Default_WG_Size;
+ DP("Number of threads set according to library's default %d\n",
+ RTLDeviceInfoTy::Default_WG_Size);
}
- // Set default number of threads
- DeviceInfo.NumThreads[device_id] = RTLDeviceInfoTy::Default_WG_Size;
- DP("Default number of threads set according to library's default %d\n",
- RTLDeviceInfoTy::Default_WG_Size);
if (enforce_upper_bound(&DeviceInfo.NumThreads[device_id],
DeviceInfo.ThreadsPerGroup[device_id])) {
DP("Default number of threads exceeds device limit, capping at %d\n",
@@ -2100,7 +2098,7 @@
*/
int num_groups = 0;
- int threadsPerGroup = RTLDeviceInfoTy::Default_WG_Size;
+ int threadsPerGroup = DeviceInfo.NumThreads[KernelInfo->device_id];
getLaunchVals(threadsPerGroup, num_groups, KernelInfo->ConstWGSize,
KernelInfo->ExecutionMode, DeviceInfo.EnvTeamLimit,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105163.355409.patch
Type: text/x-patch
Size: 1777 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210630/b49df112/attachment.bin>
More information about the Openmp-commits
mailing list