The RAII class used for debugging RTL entry used a shared variable to
keep track of the current depth. This used a global initializer, which
isn't supported on AMDGPU. This patch removes the initializer and
instead sets it to zero when the state is initialized in the runtime.
Reviewed By: jdoerfert, JonChesterfield
Differential Revision: https://reviews.llvm.org/D113963
struct DebugEntryRAII {
DebugEntryRAII(const char *File, const unsigned Line, const char *Function);
~DebugEntryRAII();
+
+ static void init();
};
#endif
}
/// 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,
Level--;
}
+void DebugEntryRAII::init() { Level = 0; }
+
#pragma omp end declare target
void state::init(bool IsSPMD) {
SharedMemorySmartStack.init(IsSPMD);
- if (mapping::isInitialThreadInLevel0(IsSPMD))
+ if (mapping::isInitialThreadInLevel0(IsSPMD)) {
TeamState.init(IsSPMD);
+ DebugEntryRAII::init();
+ }
ThreadStates[mapping::getThreadIdInBlock()] = nullptr;
}