[llvm] [OFFLOAD][L0] Handle group sizes correctly for multidimensional bare kernels (PR #191770)

Nick Sarnie via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 07:06:39 PDT 2026


================
@@ -368,35 +368,40 @@ Error L0KernelTy::setKernelGroups(L0DeviceTy &l0Device, L0LaunchEnvTy &KEnv,
                                   uint32_t NumThreads[3],
                                   uint32_t NumBlocks[3]) const {
 
-  if (KernelEnvironment.Configuration.ExecMode != OMP_TGT_EXEC_MODE_BARE) {
-    // For non-bare mode, the groups are already set in the launch.
-    KEnv.GroupCounts = {NumBlocks[0], NumBlocks[1], NumBlocks[2]};
-    CALL_ZE_RET_ERROR(zeKernelSetGroupSize, getZeKernel(), NumThreads[0],
-                      NumThreads[1], NumThreads[2]);
-    return Plugin::success();
-  }
-
-  int32_t NumTeams = NumBlocks[0];
-  int32_t ThreadLimit = NumThreads[0];
-  if (NumTeams < 0)
-    NumTeams = 0;
-  if (ThreadLimit < 0)
-    ThreadLimit = 0;
+  bool userDefinedGroups = NumThreads[0] != 0 && NumThreads[1] != 0 &&
+                           NumThreads[2] != 0 && NumBlocks[0] != 0 &&
+                           NumBlocks[1] != 0 && NumBlocks[2] != 0;
 
   uint32_t GroupSizes[3];
-  auto DeviceId = l0Device.getDeviceId();
-  auto &KernelPR = KEnv.KernelPR;
-  // Check if we can reuse previous group parameters.
-  bool GroupParamsReused =
-      KernelPR.reuseGroupParams(NumTeams, ThreadLimit, GroupSizes, KEnv);
+  bool GroupParamsReused = false;
----------------
sarnex wrote:

maybe `CanReuseGroupParams` based on comment on line 392?

https://github.com/llvm/llvm-project/pull/191770


More information about the llvm-commits mailing list