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
3279957f
Commit
3279957f
authored
Jan 17, 2020
by
hlu1
Committed by
Zhi
Jan 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Relay] Invoke tvm::build from relay compile_engine and interpreter (#4723)
parent
b171cf1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
src/relay/backend/compile_engine.cc
+4
-3
src/relay/backend/interpreter.cc
+4
-3
No files found.
src/relay/backend/compile_engine.cc
View file @
3279957f
...
...
@@ -599,12 +599,13 @@ class CompileEngineImpl : public CompileEngineNode {
CCacheValue
value
=
LowerInternal
(
key
);
if
(
value
->
packed_func
!=
nullptr
)
return
value
->
packed_func
;
// build the function.
tvm
::
runtime
::
Module
m
;
if
(
const
auto
*
f
=
runtime
::
Registry
::
Get
(
"relay.backend.build"
))
{
tvm
::
runtime
::
Module
m
=
(
*
f
)(
value
->
cached_func
->
funcs
,
key
->
target
);
value
->
packed_func
=
m
.
GetFunction
(
value
->
cached_func
->
func_name
);
m
=
(
*
f
)(
value
->
cached_func
->
funcs
,
key
->
target
);
}
else
{
LOG
(
FATAL
)
<<
"relay.backend.build is not registered"
;
m
=
build
(
value
->
cached_func
->
funcs
,
key
->
target
,
Target
(
nullptr
),
BuildConfig
::
Current
())
;
}
value
->
packed_func
=
m
.
GetFunction
(
value
->
cached_func
->
func_name
);
return
value
->
packed_func
;
}
...
...
src/relay/backend/interpreter.cc
View file @
3279957f
...
...
@@ -418,13 +418,14 @@ class Interpreter :
<<
"Shape function output sizes mismatch"
;
PackedFunc
shape_func
;
Module
m
;
TVMRetValue
rv
;
if
(
const
auto
*
f
=
runtime
::
Registry
::
Get
(
"relay.backend.build"
))
{
tvm
::
runtime
::
Module
m
=
(
*
f
)(
cfunc
->
funcs
,
cfunc
->
target
);
shape_func
=
m
.
GetFunction
(
cfunc
->
func_name
);
m
=
(
*
f
)(
cfunc
->
funcs
,
cfunc
->
target
);
}
else
{
LOG
(
FATAL
)
<<
"relay.backend.build is not registered"
;
m
=
build
(
cfunc
->
funcs
,
cfunc
->
target
,
Target
(
nullptr
),
BuildConfig
::
Current
())
;
}
shape_func
=
m
.
GetFunction
(
cfunc
->
func_name
);
shape_func
.
CallPacked
(
TVMArgs
(
values
.
data
(),
codes
.
data
(),
arity
),
&
rv
);
// Get output shapes
...
...
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