[llvm-branch-commits] [llvm] [offload] Fix teams/threads limits in record replay (PR #200639)

Robert Imschweiler via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 10 01:13:17 PDT 2026


================
@@ -250,18 +250,24 @@ Error NativeRecordReplayTy::recordDescImpl(
   JsonKernelInfo["VAllocAddr"] = (intptr_t)StartAddr;
   JsonKernelInfo["VAllocSize"] = TotalSize;
 
-  // Add minimum and maximum for allowed number of teams. If zero, it means
+  // Export minimum and maximum for allowed number of teams. If zero, it means
   // there was no restriction provided by the program.
+  uint32_t MinMaxBlocks = std::max(KernelArgs.UserNumBlocks[0], uint32_t(0));
   json::Array JsonTeamsLimits;
-  JsonTeamsLimits.push_back(KernelArgs.UserNumBlocks[0]);
-  JsonTeamsLimits.push_back(KernelArgs.UserNumBlocks[0]);
+  JsonTeamsLimits.push_back(MinMaxBlocks);
----------------
ro-i wrote:

```suggestion
  JsonTeamsLimits.push_back(MinMaxBlocks ? 1 : 0);
```
Not sure if that makes sense, but just for clarification: if we would do something like this (a bit similar to the ThreadsLimits), it would prevent the number of teams related error.

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


More information about the llvm-branch-commits mailing list