diff --git a/openmp/libomptarget/DeviceRTL/include/Debug.h b/openmp/libomptarget/DeviceRTL/include/Debug.h --- a/openmp/libomptarget/DeviceRTL/include/Debug.h +++ b/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 diff --git a/openmp/libomptarget/DeviceRTL/src/Debug.cpp b/openmp/libomptarget/DeviceRTL/src/Debug.cpp --- a/openmp/libomptarget/DeviceRTL/src/Debug.cpp +++ b/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 diff --git a/openmp/libomptarget/DeviceRTL/src/State.cpp b/openmp/libomptarget/DeviceRTL/src/State.cpp --- a/openmp/libomptarget/DeviceRTL/src/State.cpp +++ b/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);