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
08b38be9
Unverified
Commit
08b38be9
authored
Mar 26, 2020
by
Ruizhe Zhao
Committed by
GitHub
Mar 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle empty LLVMModule in GetFunction (#5146)
parent
a1d6fc95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
src/target/llvm/llvm_module.cc
+10
-2
No files found.
src/target/llvm/llvm_module.cc
View file @
08b38be9
...
...
@@ -71,6 +71,10 @@ class LLVMModuleNode final : public runtime::ModuleNode {
});
}
if
(
ee_
==
nullptr
)
LazyInitJIT
();
// This LLVMModule is empty and no function can be retrieved.
if
(
entry_func_
.
empty
())
return
nullptr
;
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
const
std
::
string
&
fname
=
(
name
==
runtime
::
symbol
::
tvm_module_main
?
entry_func_
:
name
);
...
...
@@ -318,6 +322,10 @@ class LLVMModuleNode final : public runtime::ModuleNode {
<<
"Failed to initialize jit engine for "
<<
mptr_
->
getTargetTriple
();
ee_
->
runStaticConstructorsDestructors
(
false
);
// setup context address.
// we will skip context setup if this LLVMModule is empty.
if
(
GetGlobalAddr
(
runtime
::
symbol
::
tvm_module_main
)
==
0
)
return
;
entry_func_
=
reinterpret_cast
<
const
char
*>
(
GetGlobalAddr
(
runtime
::
symbol
::
tvm_module_main
));
if
(
void
**
ctx_addr
=
reinterpret_cast
<
void
**>
(
...
...
@@ -329,7 +337,7 @@ class LLVMModuleNode final : public runtime::ModuleNode {
});
}
// Get global address from execution engine.
uint64_t
GetGlobalAddr
(
const
std
::
string
&
name
)
{
uint64_t
GetGlobalAddr
(
const
std
::
string
&
name
)
const
{
// first verifies if GV exists.
if
(
mptr_
->
getGlobalVariable
(
name
)
!=
nullptr
)
{
return
ee_
->
getGlobalValueAddress
(
name
);
...
...
@@ -337,7 +345,7 @@ class LLVMModuleNode final : public runtime::ModuleNode {
return
0
;
}
}
uint64_t
GetFunctionAddr
(
const
std
::
string
&
name
)
{
uint64_t
GetFunctionAddr
(
const
std
::
string
&
name
)
const
{
// first verifies if GV exists.
if
(
mptr_
->
getFunction
(
name
)
!=
nullptr
)
{
return
ee_
->
getFunctionAddress
(
name
);
...
...
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