OpenMP Tasks dependencies hash re-sizing fixed.
authorAndreyChurbanov <andrey.churbanov@intel.com>
Fri, 25 Oct 2019 12:59:07 +0000 (15:59 +0300)
committerAndreyChurbanov <andrey.churbanov@intel.com>
Fri, 25 Oct 2019 13:04:46 +0000 (16:04 +0300)
Details:
- nconflicts field initialized;
- formatting fix (moved declaration out of the long line);
- count conflicts in new hash as opposed to old one.

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

openmp/runtime/src/kmp_taskdeps.cpp

index f8aa51d..8d60bbb 100644 (file)
@@ -85,19 +85,19 @@ static kmp_dephash_t *__kmp_dephash_extend(kmp_info_t *thread,
   h->nelements = current_dephash->nelements;
   h->buckets = (kmp_dephash_entry **)(h + 1);
   h->generation = gen;
-
+  h->nconflicts = 0;
   // insert existing elements in the new table
   for (size_t i = 0; i < current_dephash->size; i++) {
-    kmp_dephash_entry_t *next;
-    for (kmp_dephash_entry_t *entry = current_dephash->buckets[i]; entry; entry = next) {
+    kmp_dephash_entry_t *next, *entry;
+    for (entry = current_dephash->buckets[i]; entry; entry = next) {
       next = entry->next_in_bucket;
       // Compute the new hash using the new size, and insert the entry in
       // the new bucket.
       kmp_int32 new_bucket = __kmp_dephash_hash(entry->addr, h->size);
+      entry->next_in_bucket = h->buckets[new_bucket];
       if (entry->next_in_bucket) {
         h->nconflicts++;
       }
-      entry->next_in_bucket = h->buckets[new_bucket];
       h->buckets[new_bucket] = entry;
     }
   }