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
6ab05082
Commit
6ab05082
authored
Jan 15, 2019
by
Siva
Committed by
Tianqi Chen
Jan 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RELAY] Filter PlaceholderOp from schedule. (#2412)
parent
b692289e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletions
+20
-1
src/relay/backend/compile_engine.cc
+10
-1
tests/python/relay/test_backend_compile_engine.py
+10
-0
No files found.
src/relay/backend/compile_engine.cc
View file @
6ab05082
...
...
@@ -83,11 +83,20 @@ class ScheduleGetter :
cache_node
->
func_name
=
readable_name_stream_
.
str
();
CachedFunc
cfunc
(
cache_node
);
CHECK
(
master_op_
.
defined
());
// Fusion over tupled results may leave identity relationships
// between inputs and outputs, and those should not be scheduled.
// Hence schedule only non PlaceholderOp outputs.
tvm
::
Array
<
Tensor
>
tensor_outs
;
for
(
const
auto
&
tensor
:
cache_node
->
outputs
)
{
if
(
!
tensor
->
op
.
as
<
PlaceholderOpNode
>
())
{
tensor_outs
.
push_back
(
tensor
);
}
}
Schedule
schedule
;
// No need to register schedule for device copy op.
if
(
master_attrs_
.
as
<
DeviceCopyAttrs
>
()
==
nullptr
)
{
schedule
=
fschedule
[
master_op_
](
master_attrs_
,
cache_node
->
outp
uts
,
target_
);
fschedule
[
master_op_
](
master_attrs_
,
tensor_o
uts
,
target_
);
for
(
const
auto
&
scalar
:
scalars_
)
{
schedule
[
scalar
].
compute_inline
();
}
...
...
tests/python/relay/test_backend_compile_engine.py
View file @
6ab05082
...
...
@@ -33,6 +33,16 @@ def test_compile_engine():
y
.
asnumpy
(),
x
.
asnumpy
()
*
3
)
engine
.
dump
()
def
test_compile_placeholder_bypass
():
engine
=
relay
.
backend
.
compile_engine
.
get
()
x
=
relay
.
var
(
"x"
,
shape
=
(
2
,
3
))
y
=
relay
.
var
(
"y"
,
shape
=
(
2
,
3
))
z
=
relay
.
var
(
"z"
,
shape
=
(
2
,
3
))
result
=
relay
.
Tuple
([
x
,
relay
.
op
.
concatenate
([
y
,
z
],
axis
=
0
)])
func
=
relay
.
Function
(
relay
.
ir_pass
.
free_vars
(
result
),
result
)
with
relay
.
build_config
(
opt_level
=
0
):
graph
,
lib
,
params
=
relay
.
build
(
func
,
'llvm'
)
if
__name__
==
"__main__"
:
test_compile_engine
()
test_compile_placeholder_bypass
()
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