[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:43 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 &&
----------------
sarnex wrote:

nit: we usually start local vars with caps `UserDefinedGroups`, also having a verb in the name for bools helps me understand personally, so maybe something like `HasUserDefinedGroups`

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


More information about the llvm-commits mailing list