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
0319f99d
Commit
0319f99d
authored
Oct 31, 2018
by
Andrew Tulloch
Committed by
Tianqi Chen
Oct 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Cleanliness] [Easy] Make TVM leak-sanitizer and Wnon-virtual-dtor clean. (#2046)
parent
add1f90e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
15 deletions
+20
-15
src/codegen/codegen_source_base.h
+1
-0
src/codegen/llvm/codegen_amdgpu.cc
+2
-2
src/codegen/llvm/codegen_nvptx.cc
+2
-2
src/codegen/llvm/llvm_common.cc
+2
-2
src/codegen/llvm/llvm_common.h
+1
-1
src/codegen/llvm/llvm_module.cc
+6
-6
src/runtime/dsl_api.h
+1
-0
src/runtime/registry.cc
+5
-2
No files found.
src/codegen/codegen_source_base.h
View file @
0319f99d
...
@@ -23,6 +23,7 @@ namespace codegen {
...
@@ -23,6 +23,7 @@ namespace codegen {
*/
*/
class
CodeGenSourceBase
{
class
CodeGenSourceBase
{
public
:
public
:
virtual
~
CodeGenSourceBase
()
=
default
;
/*!
/*!
* \brief Register constant value appeared in expresion tree
* \brief Register constant value appeared in expresion tree
* This avoid generated a ssa id for each appearance of the value
* This avoid generated a ssa id for each appearance of the value
...
...
src/codegen/llvm/codegen_amdgpu.cc
View file @
0319f99d
...
@@ -160,10 +160,10 @@ runtime::Module BuildAMDGPU(Array<LoweredFunc> funcs, std::string target) {
...
@@ -160,10 +160,10 @@ runtime::Module BuildAMDGPU(Array<LoweredFunc> funcs, std::string target) {
config
<<
"-mtriple=amdgcn-amd-amdhsa-hcc -mcpu=gfx"
config
<<
"-mtriple=amdgcn-amd-amdhsa-hcc -mcpu=gfx"
<<
DetectROCMComputeVersion
(
target
)
<<
DetectROCMComputeVersion
(
target
)
<<
target
.
substr
(
4
,
target
.
length
()
-
4
);
<<
target
.
substr
(
4
,
target
.
length
()
-
4
);
llvm
::
TargetMachine
*
tm
=
GetLLVMTargetMachine
(
config
.
str
());
std
::
unique_ptr
<
llvm
::
TargetMachine
>
tm
=
GetLLVMTargetMachine
(
config
.
str
());
std
::
unique_ptr
<
CodeGenAMDGPU
>
cg
(
new
CodeGenAMDGPU
());
std
::
unique_ptr
<
CodeGenAMDGPU
>
cg
(
new
CodeGenAMDGPU
());
std
::
unique_ptr
<
llvm
::
LLVMContext
>
ctx
(
new
llvm
::
LLVMContext
());
std
::
unique_ptr
<
llvm
::
LLVMContext
>
ctx
(
new
llvm
::
LLVMContext
());
cg
->
Init
(
funcs
[
0
]
->
name
,
tm
,
ctx
.
get
(),
false
,
false
);
cg
->
Init
(
funcs
[
0
]
->
name
,
tm
.
get
()
,
ctx
.
get
(),
false
,
false
);
for
(
LoweredFunc
f
:
funcs
)
{
for
(
LoweredFunc
f
:
funcs
)
{
cg
->
AddFunction
(
f
);
cg
->
AddFunction
(
f
);
}
}
...
...
src/codegen/llvm/codegen_nvptx.cc
View file @
0319f99d
...
@@ -171,10 +171,10 @@ runtime::Module BuildNVPTX(Array<LoweredFunc> funcs, std::string target) {
...
@@ -171,10 +171,10 @@ runtime::Module BuildNVPTX(Array<LoweredFunc> funcs, std::string target) {
config
<<
"-mtriple=nvptx64-nvidia-cuda -mcpu=sm_"
config
<<
"-mtriple=nvptx64-nvidia-cuda -mcpu=sm_"
<<
compute_ver
<<
compute_ver
<<
target
.
substr
(
5
,
target
.
length
()
-
5
);
<<
target
.
substr
(
5
,
target
.
length
()
-
5
);
llvm
::
TargetMachine
*
tm
=
GetLLVMTargetMachine
(
config
.
str
());
std
::
unique_ptr
<
llvm
::
TargetMachine
>
tm
=
GetLLVMTargetMachine
(
config
.
str
());
std
::
unique_ptr
<
CodeGenNVPTX
>
cg
(
new
CodeGenNVPTX
());
std
::
unique_ptr
<
CodeGenNVPTX
>
cg
(
new
CodeGenNVPTX
());
std
::
unique_ptr
<
llvm
::
LLVMContext
>
ctx
(
new
llvm
::
LLVMContext
());
std
::
unique_ptr
<
llvm
::
LLVMContext
>
ctx
(
new
llvm
::
LLVMContext
());
cg
->
Init
(
funcs
[
0
]
->
name
,
tm
,
ctx
.
get
(),
false
,
false
);
cg
->
Init
(
funcs
[
0
]
->
name
,
tm
.
get
()
,
ctx
.
get
(),
false
,
false
);
for
(
LoweredFunc
f
:
funcs
)
{
for
(
LoweredFunc
f
:
funcs
)
{
cg
->
AddFunction
(
f
);
cg
->
AddFunction
(
f
);
}
}
...
...
src/codegen/llvm/llvm_common.cc
View file @
0319f99d
...
@@ -114,7 +114,7 @@ void ParseLLVMTargetOptions(const std::string& target_str,
...
@@ -114,7 +114,7 @@ void ParseLLVMTargetOptions(const std::string& target_str,
}
}
llvm
::
TargetMachine
*
std
::
unique_ptr
<
llvm
::
TargetMachine
>
GetLLVMTargetMachine
(
const
std
::
string
&
target_str
,
GetLLVMTargetMachine
(
const
std
::
string
&
target_str
,
bool
allow_null
)
{
bool
allow_null
)
{
std
::
string
target_triple
,
mcpu
,
mattr
;
std
::
string
target_triple
,
mcpu
,
mattr
;
...
@@ -143,7 +143,7 @@ GetLLVMTargetMachine(const std::string& target_str,
...
@@ -143,7 +143,7 @@ GetLLVMTargetMachine(const std::string& target_str,
}
}
llvm
::
TargetMachine
*
tm
=
target
->
createTargetMachine
(
llvm
::
TargetMachine
*
tm
=
target
->
createTargetMachine
(
target_triple
,
mcpu
,
mattr
,
opt
,
llvm
::
Reloc
::
PIC_
);
target_triple
,
mcpu
,
mattr
,
opt
,
llvm
::
Reloc
::
PIC_
);
return
tm
;
return
std
::
unique_ptr
<
llvm
::
TargetMachine
>
(
tm
)
;
}
}
}
// namespace codegen
}
// namespace codegen
...
...
src/codegen/llvm/llvm_common.h
View file @
0319f99d
...
@@ -78,7 +78,7 @@ void ParseLLVMTargetOptions(const std::string& target_str,
...
@@ -78,7 +78,7 @@ void ParseLLVMTargetOptions(const std::string& target_str,
* \param allow_null Whether allow null to be returned.
* \param allow_null Whether allow null to be returned.
* \return target machine
* \return target machine
*/
*/
llvm
::
TargetMachine
*
std
::
unique_ptr
<
llvm
::
TargetMachine
>
GetLLVMTargetMachine
(
const
std
::
string
&
target_str
,
bool
allow_null
=
false
);
GetLLVMTargetMachine
(
const
std
::
string
&
target_str
,
bool
allow_null
=
false
);
}
// namespace codegen
}
// namespace codegen
...
...
src/codegen/llvm/llvm_module.cc
View file @
0319f99d
...
@@ -160,9 +160,9 @@ class LLVMModuleNode final : public runtime::ModuleNode {
...
@@ -160,9 +160,9 @@ class LLVMModuleNode final : public runtime::ModuleNode {
bool
system_lib
=
(
target
.
find
(
"-system-lib"
)
!=
std
::
string
::
npos
);
bool
system_lib
=
(
target
.
find
(
"-system-lib"
)
!=
std
::
string
::
npos
);
CHECK_NE
(
funcs
.
size
(),
0U
);
CHECK_NE
(
funcs
.
size
(),
0U
);
ctx_
=
std
::
make_shared
<
llvm
::
LLVMContext
>
();
ctx_
=
std
::
make_shared
<
llvm
::
LLVMContext
>
();
std
::
unique_ptr
<
CodeGenLLVM
>
cg
=
CodeGenLLVM
::
Create
(
tm_
);
std
::
unique_ptr
<
CodeGenLLVM
>
cg
=
CodeGenLLVM
::
Create
(
tm_
.
get
()
);
entry_func_
=
funcs
[
0
]
->
name
;
entry_func_
=
funcs
[
0
]
->
name
;
cg
->
Init
(
funcs
[
0
]
->
name
,
tm_
,
ctx_
.
get
(),
system_lib
,
system_lib
);
cg
->
Init
(
funcs
[
0
]
->
name
,
tm_
.
get
()
,
ctx_
.
get
(),
system_lib
,
system_lib
);
for
(
LoweredFunc
f
:
funcs
)
{
for
(
LoweredFunc
f
:
funcs
)
{
cg
->
AddFunction
(
f
);
cg
->
AddFunction
(
f
);
}
}
...
@@ -218,8 +218,8 @@ class LLVMModuleNode final : public runtime::ModuleNode {
...
@@ -218,8 +218,8 @@ class LLVMModuleNode final : public runtime::ModuleNode {
builder
.
setMAttrs
(
mattrs
);
builder
.
setMAttrs
(
mattrs
);
}
}
builder
.
setTargetOptions
(
opt
);
builder
.
setTargetOptions
(
opt
);
llvm
::
TargetMachine
*
tm
=
builder
.
selectTarget
(
);
auto
tm
=
std
::
unique_ptr
<
llvm
::
TargetMachine
>
(
builder
.
selectTarget
()
);
llvm
::
TargetMachine
*
tm_sys
=
GetLLVMTargetMachine
(
"llvm"
);
std
::
unique_ptr
<
llvm
::
TargetMachine
>
tm_sys
=
GetLLVMTargetMachine
(
"llvm"
);
if
(
tm_sys
->
getTargetTriple
().
getArch
()
!=
tm
->
getTargetTriple
().
getArch
())
{
if
(
tm_sys
->
getTargetTriple
().
getArch
()
!=
tm
->
getTargetTriple
().
getArch
())
{
LOG
(
FATAL
)
<<
"Cannot run module, architecture mismatch "
LOG
(
FATAL
)
<<
"Cannot run module, architecture mismatch "
<<
" module="
<<
tm
->
getTargetTriple
().
str
()
<<
" module="
<<
tm
->
getTargetTriple
().
str
()
...
@@ -231,7 +231,7 @@ class LLVMModuleNode final : public runtime::ModuleNode {
...
@@ -231,7 +231,7 @@ class LLVMModuleNode final : public runtime::ModuleNode {
<<
mptr_
->
getDataLayout
().
getStringRepresentation
()
<<
")"
<<
mptr_
->
getDataLayout
().
getStringRepresentation
()
<<
")"
<<
" and ExecutionEngine ("
<<
" and ExecutionEngine ("
<<
layout
.
getStringRepresentation
()
<<
")"
;
<<
layout
.
getStringRepresentation
()
<<
")"
;
ee_
=
builder
.
create
(
tm
);
ee_
=
builder
.
create
(
tm
.
release
()
);
CHECK
(
ee_
!=
nullptr
)
CHECK
(
ee_
!=
nullptr
)
<<
"Failed to initialize git engine for "
<<
mptr_
->
getTargetTriple
();
<<
"Failed to initialize git engine for "
<<
mptr_
->
getTargetTriple
();
ee_
->
runStaticConstructorsDestructors
(
false
);
ee_
->
runStaticConstructorsDestructors
(
false
);
...
@@ -275,7 +275,7 @@ class LLVMModuleNode final : public runtime::ModuleNode {
...
@@ -275,7 +275,7 @@ class LLVMModuleNode final : public runtime::ModuleNode {
// The raw pointer to the module.
// The raw pointer to the module.
llvm
::
Module
*
mptr_
{
nullptr
};
llvm
::
Module
*
mptr_
{
nullptr
};
// The target machine
// The target machine
llvm
::
TargetMachine
*
tm_
{
nullptr
};
std
::
unique_ptr
<
llvm
::
TargetMachine
>
tm_
{
nullptr
};
// The module, can be moved to ee if JIT is enabled.
// The module, can be moved to ee if JIT is enabled.
std
::
unique_ptr
<
llvm
::
Module
>
module_
;
std
::
unique_ptr
<
llvm
::
Module
>
module_
;
// the context.
// the context.
...
...
src/runtime/dsl_api.h
View file @
0319f99d
...
@@ -16,6 +16,7 @@ namespace runtime {
...
@@ -16,6 +16,7 @@ namespace runtime {
*/
*/
class
DSLAPI
{
class
DSLAPI
{
public
:
public
:
virtual
~
DSLAPI
()
=
default
;
virtual
void
NodeFree
(
NodeHandle
handle
)
const
=
0
;
virtual
void
NodeFree
(
NodeHandle
handle
)
const
=
0
;
virtual
void
NodeTypeKey2Index
(
const
char
*
type_key
,
virtual
void
NodeTypeKey2Index
(
const
char
*
type_key
,
...
...
src/runtime/registry.cc
View file @
0319f99d
...
@@ -34,8 +34,11 @@ struct Registry::Manager {
...
@@ -34,8 +34,11 @@ struct Registry::Manager {
}
}
static
Manager
*
Global
()
{
static
Manager
*
Global
()
{
static
Manager
inst
;
// We deliberately leak the Manager instance, to avoid leak sanitizers
return
&
inst
;
// complaining about the entries in Manager::fmap being leaked at program
// exit.
static
Manager
*
inst
=
new
Manager
();
return
inst
;
}
}
};
};
...
...
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