[Openmp-commits] [PATCH] D104880: [OpenMP][NFC] Fix wrong debug assertion.

Andrey Churbanov via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jun 24 15:44:11 PDT 2021


AndreyChurbanov created this revision.
AndreyChurbanov added reviewers: jlpeyton, hbae, Nawrin.
AndreyChurbanov added a project: OpenMP.
Herald added subscribers: guansong, yaxunl.
AndreyChurbanov requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.

Normalized bounds of chunk of iterations to steal from are inclusive, so upper bound should not be decremented in expression to check.
Problem was in attempt to steal iterations 0:0, that caused assertion after wrong decrement.
Reported in comment to https://reviews.llvm.org/D103648.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104880

Files:
  openmp/runtime/src/kmp_dispatch.cpp


Index: openmp/runtime/src/kmp_dispatch.cpp
===================================================================
--- openmp/runtime/src/kmp_dispatch.cpp
+++ openmp/runtime/src/kmp_dispatch.cpp
@@ -1450,7 +1450,7 @@
             } else {
               vnew.p.ub -= 1; // steal 1 chunk of 1..7 remaining
             }
-            KMP_DEBUG_ASSERT((vnew.p.ub - 1) * (UT)chunk <= trip);
+            KMP_DEBUG_ASSERT(vnew.p.ub * (UT)chunk <= trip);
             if (KMP_COMPARE_AND_STORE_REL64(
                     (volatile kmp_int64 *)&v->u.p.count,
                     *VOLATILE_CAST(kmp_int64 *) & vold.b,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104880.354379.patch
Type: text/x-patch
Size: 609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210624/66c4acd8/attachment.bin>


More information about the Openmp-commits mailing list