[Openmp-commits] [openmp] b278794 - [OpenMP][NFC] libomp: fix wrong debug assertion.

via Openmp-commits openmp-commits at lists.llvm.org
Thu Jun 24 16:02:31 PDT 2021


Author: AndreyChurbanov
Date: 2021-06-25T02:02:14+03:00
New Revision: b2787945f9cd2b4705dedea079b4d532c27817f9

URL: https://github.com/llvm/llvm-project/commit/b2787945f9cd2b4705dedea079b4d532c27817f9
DIFF: https://github.com/llvm/llvm-project/commit/b2787945f9cd2b4705dedea079b4d532c27817f9.diff

LOG: [OpenMP][NFC] libomp: fix wrong debug assertion.

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.

Differential Revision: https://reviews.llvm.org/D104880

Added: 
    

Modified: 
    openmp/runtime/src/kmp_dispatch.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/kmp_dispatch.cpp b/openmp/runtime/src/kmp_dispatch.cpp
index 6687c370b409c..cc2d0012bf38d 100644
--- a/openmp/runtime/src/kmp_dispatch.cpp
+++ b/openmp/runtime/src/kmp_dispatch.cpp
@@ -1450,7 +1450,7 @@ int __kmp_dispatch_next_algorithm(int gtid,
             } 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,


        


More information about the Openmp-commits mailing list