[Openmp-commits] [PATCH] D159001: [OpenMP] Fix assert fail with user thread limit

Gheorghe-Teodor Bercea via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Aug 28 08:53:54 PDT 2023


doru1004 created this revision.
doru1004 added reviewers: jdoerfert, tianshilei1992, ronl.
doru1004 added a project: OpenMP.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
doru1004 requested review of this revision.
Herald added subscribers: openmp-commits, jplehr, sstefan1.

Fix assert fail with user thread limit to ensure the assert fail doesn't trigger when a user value is specified. Values given by the user are not guaranteed to satisfy the old assert condition.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159001

Files:
  openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp


Index: openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
===================================================================
--- openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
+++ openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
@@ -449,8 +449,9 @@
           IsNumThreadsFromUser) {
         // Enough parallelism for teams and threads.
         TripCountNumBlocks = ((LoopTripCount - 1) / NumThreads) + 1;
-        assert(TripCountNumBlocks >= DefaultNumBlocks &&
-               "Expected sufficient outer parallelism.");
+        assert(LoopTripCount < DefaultNumBlocks * NumThreads ||
+               TripCountNumBlocks >= DefaultNumBlocks &&
+                   "Expected sufficient outer parallelism.");
       } else if (LoopTripCount >= DefaultNumBlocks * MinThreads) {
         // Enough parallelism for teams, limit threads.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159001.553955.patch
Type: text/x-patch
Size: 929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230828/1d5b017a/attachment.bin>


More information about the Openmp-commits mailing list