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
3d8b75cb
Commit
3d8b75cb
authored
Aug 07, 2019
by
Umang Yadav
Committed by
Tianqi Chen
Aug 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take zero extent loops as NoOp and remove it and add unittest for the same (#3724)
parent
6b6e3888
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletions
+7
-1
src/pass/remove_no_op.cc
+3
-0
tests/python/unittest/test_pass_remove_no_op.py
+4
-1
No files found.
src/pass/remove_no_op.cc
View file @
3d8b75cb
...
...
@@ -70,6 +70,9 @@ class NoOpRemover : public IRMutator {
Stmt
Mutate_
(
const
For
*
op
,
const
Stmt
&
s
)
final
{
Stmt
stmt
=
IRMutator
::
Mutate_
(
op
,
s
);
op
=
stmt
.
as
<
For
>
();
if
(
is_zero
(
op
->
extent
))
{
return
Evaluate
::
make
(
0
);
}
return
is_no_op
(
op
->
body
)
?
MakeEvaluate
({
op
->
min
,
op
->
extent
})
:
stmt
;
}
Stmt
Mutate_
(
const
Allocate
*
op
,
const
Stmt
&
s
)
final
{
...
...
tests/python/unittest/test_pass_remove_no_op.py
View file @
3d8b75cb
...
...
@@ -39,7 +39,10 @@ def test_remove_no_op():
i
+
1
)
stmt2
=
tvm
.
make
.
Block
(
stmt
,
store
)
assert
(
tvm
.
ir_pass
.
RemoveNoOp
(
stmt2
)
==
store
)
# remove zero extent loop
stmt3
=
tvm
.
make
.
For
(
i
,
0
,
0
,
0
,
0
,
store
)
ret
=
tvm
.
ir_pass
.
RemoveNoOp
(
stmt3
)
assert
(
isinstance
(
ret
,
tvm
.
stmt
.
Evaluate
))
if
__name__
==
"__main__"
:
test_remove_no_op
()
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