[Openmp-commits] [PATCH] D113963: [OpenMP] Fix initializer not working on AMDGPU

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Nov 15 20:14:15 PST 2021


jhuber6 updated this revision to Diff 387484.
jhuber6 added a comment.

Put the debug init call in the wrong init function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113963

Files:
  openmp/libomptarget/DeviceRTL/include/Debug.h
  openmp/libomptarget/DeviceRTL/src/Debug.cpp
  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
@@ -365,6 +365,7 @@
 }
 
 void state::init(bool IsSPMD) {
+  DebugEntryRAII::init();
   SharedMemorySmartStack.init(IsSPMD);
   if (mapping::isInitialThreadInLevel0(IsSPMD))
     TeamState.init(IsSPMD);
Index: openmp/libomptarget/DeviceRTL/src/Debug.cpp
===================================================================
--- openmp/libomptarget/DeviceRTL/src/Debug.cpp
+++ openmp/libomptarget/DeviceRTL/src/Debug.cpp
@@ -32,7 +32,7 @@
 }
 
 /// Current indentation level for the function trace. Only accessed by thread 0.
-static uint32_t Level = 0;
+static uint32_t Level;
 #pragma omp allocate(Level) allocator(omp_pteam_mem_alloc)
 
 DebugEntryRAII::DebugEntryRAII(const char *File, const unsigned Line,
@@ -55,4 +55,6 @@
     Level--;
 }
 
+void DebugEntryRAII::init() { Level = 0; }
+
 #pragma omp end declare target
Index: openmp/libomptarget/DeviceRTL/include/Debug.h
===================================================================
--- openmp/libomptarget/DeviceRTL/include/Debug.h
+++ openmp/libomptarget/DeviceRTL/include/Debug.h
@@ -65,6 +65,8 @@
 struct DebugEntryRAII {
   DebugEntryRAII(const char *File, const unsigned Line, const char *Function);
   ~DebugEntryRAII();
+
+  static void init();
 };
 
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113963.387484.patch
Type: text/x-patch
Size: 1443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211116/10019849/attachment.bin>


More information about the Openmp-commits mailing list