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
a2b45887
Commit
a2b45887
authored
Mar 12, 2019
by
Salem Derisavi
Committed by
Tianqi Chen
Mar 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure loop count is a constant before trying to unroll. (#2797)
parent
864da840
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletions
+14
-1
src/pass/unroll_loop.cc
+1
-1
tests/python/unittest/test_pass_unroll.py
+13
-0
No files found.
src/pass/unroll_loop.cc
View file @
a2b45887
...
...
@@ -78,7 +78,7 @@ class LoopUnroller : public IRMutator {
if
((
auto_unroll
&&
explicit_unroll_
)
||
// unroll loops with extent = 1, no matter how many steps in body
(
value
<=
auto_max_extent_
&&
auto_max_extent_
==
1
))
{
(
0
<=
value
&&
value
<=
auto_max_extent_
&&
auto_max_extent_
==
1
))
{
return
Unroll
(
op
);
}
else
{
if
(
auto_unroll
)
{
...
...
tests/python/unittest/test_pass_unroll.py
View file @
a2b45887
...
...
@@ -51,7 +51,20 @@ def test_unroll_fake_loop():
ret
=
tvm
.
ir_pass
.
UnrollLoop
(
stmt
,
8
,
0
,
1
,
True
)
assert
isinstance
(
ret
.
first
,
tvm
.
stmt
.
Store
)
def
test_unroll_single_count_loops
():
n
=
tvm
.
var
(
'n'
)
A
=
tvm
.
placeholder
((
n
,),
name
=
'A'
)
B
=
tvm
.
compute
((
n
,),
lambda
*
i
:
A
(
*
i
),
name
=
'B'
)
s
=
tvm
.
create_schedule
(
B
.
op
)
s
=
s
.
normalize
()
dom_map
=
tvm
.
schedule
.
InferBound
(
s
)
stmt
=
tvm
.
schedule
.
ScheduleOps
(
s
,
dom_map
)
# all parameters to UnrolLoops are default values except for
# auto_unroll_max_extent which has been set to 1 (default:0)
after_unroll_stmt
=
tvm
.
ir_pass
.
UnrollLoop
(
stmt
,
0
,
8
,
1
,
True
)
assert
after_unroll_stmt
==
stmt
if
__name__
==
"__main__"
:
test_unroll_loop
()
test_unroll_fake_loop
()
test_unroll_single_count_loops
()
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