Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
4e055c08
Commit
4e055c08
authored
Jan 08, 2019
by
Li-Wen Chang
Committed by
Tianqi Chen
Jan 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix LLVM initialization again (#2399)
parent
00f80d12
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
src/codegen/llvm/llvm_common.cc
+5
-4
No files found.
src/codegen/llvm/llvm_common.cc
View file @
4e055c08
...
...
@@ -5,6 +5,7 @@
#ifdef TVM_LLVM_VERSION
#include <tvm/base.h>
#include <atomic>
#include <mutex>
#include "llvm_common.h"
...
...
@@ -13,7 +14,7 @@ namespace codegen {
struct
LLVMEnv
{
std
::
mutex
mu
;
volatile
bool
all_initialized
{
false
};
std
::
atomic
<
bool
>
all_initialized
{
false
};
static
LLVMEnv
*
Global
()
{
static
LLVMEnv
inst
;
...
...
@@ -23,15 +24,15 @@ struct LLVMEnv {
void
InitializeLLVM
()
{
LLVMEnv
*
e
=
LLVMEnv
::
Global
();
if
(
!
e
->
all_initialized
)
{
if
(
!
e
->
all_initialized
.
load
(
std
::
memory_order
::
memory_order_acquire
)
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
e
->
mu
);
if
(
!
e
->
all_initialized
)
{
if
(
!
e
->
all_initialized
.
load
(
std
::
memory_order
::
memory_order_acquire
)
)
{
llvm
::
InitializeAllTargetInfos
();
llvm
::
InitializeAllTargets
();
llvm
::
InitializeAllTargetMCs
();
llvm
::
InitializeAllAsmParsers
();
llvm
::
InitializeAllAsmPrinters
();
e
->
all_initialized
=
true
;
e
->
all_initialized
.
store
(
true
,
std
::
memory_order
::
memory_order_release
)
;
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment