[Openmp-commits] [PATCH] D135391: [OpenMP][DeviceRTL] Fix an issue that thread array might be corrupted

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Oct 6 13:13:49 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG32dc48094b0c: [OpenMP][DeviceRTL] Fix an issue that thread array might be corrupted (authored by tianshilei1992).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135391/new/

https://reviews.llvm.org/D135391

Files:
  openmp/libomptarget/DeviceRTL/src/State.cpp


Index: openmp/libomptarget/DeviceRTL/src/State.cpp
===================================================================
--- openmp/libomptarget/DeviceRTL/src/State.cpp
+++ openmp/libomptarget/DeviceRTL/src/State.cpp
@@ -263,11 +263,11 @@
   if (!atomic::load(ThreadStatesBitsPtr, atomic::seq_cst)) {
     uint32_t Bytes = sizeof(ThreadStates[0]) * mapping::getBlockSize();
     void *ThreadStatesPtr =
-        memory::allocShared(Bytes, "Thread state array allocation");
+        memory::allocGlobal(Bytes, "Thread state array allocation");
     if (!atomic::cas(ThreadStatesBitsPtr, uintptr_t(0),
                      reinterpret_cast<uintptr_t>(ThreadStatesPtr),
                      atomic::seq_cst, atomic::seq_cst))
-      memory::freeShared(ThreadStatesPtr, Bytes,
+      memory::freeGlobal(ThreadStatesPtr, Bytes,
                          "Thread state array allocated multiple times");
     ASSERT(atomic::load(ThreadStatesBitsPtr, atomic::seq_cst) &&
            "Expected valid thread states bit!");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135391.465848.patch
Type: text/x-patch
Size: 1013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221006/0a7ddf82/attachment.bin>


More information about the Openmp-commits mailing list