Browse Source

fix(mgb/core): add MGB_HAVE_THREAD macro to thread_local

GitOrigin-RevId: cfcb50b041
tags/v1.3.0
Megvii Engine Team 4 years ago
parent
commit
47bdb4ef1d
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/core/impl/comp_node/cpu/comp_node.cpp

+ 3
- 3
src/core/impl/comp_node/cpu/comp_node.cpp View File

@@ -247,7 +247,7 @@ class CpuCompNode::CompNodeImpl final: public CpuDispatchableBase {
//! https://github.com/tensorflow/tensorflow/issues/18356
//! thread local is no support on IOS,
//! When update x-xode, this code should be deleted
#ifndef IOS
#if !defined(IOS) && MGB_HAVE_THREAD
static thread_local SeqRecorderImpl* sm_cur_recorder;
#else
SeqRecorderImpl* sm_cur_recorder = nullptr;
@@ -463,7 +463,7 @@ class CpuCompNode::CompNodeImpl final: public CpuDispatchableBase {
}

//! current sequence recorder of this thread
#ifndef IOS
#if !defined(IOS) && MGB_HAVE_THREAD
static SeqRecorderImpl* cur_recorder() { return sm_cur_recorder; }
#else
SeqRecorderImpl* cur_recorder() { return sm_cur_recorder; }
@@ -479,7 +479,7 @@ class CpuCompNode::CompNodeImpl final: public CpuDispatchableBase {
};
MGB_DYN_TYPE_OBJ_FINAL_IMPL(CpuCompNodeImpl);
CpuCompNodeImpl* CpuCompNodeImpl::sm_default_cpu_comp_node_ptr;
#ifndef IOS
#if !defined(IOS) && MGB_HAVE_THREAD
thread_local CpuCompNode::SeqRecorderImpl* CpuCompNodeImpl::sm_cur_recorder =
nullptr;
#endif


Loading…
Cancel
Save