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
98e761f8
Commit
98e761f8
authored
Jan 11, 2019
by
Jian Weng
Committed by
Tianqi Chen
Jan 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow const_range allocation; preprove if-then-else (#2419)
parent
7e5966a0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
+7
-1
python/tvm/hybrid/parser.py
+7
-1
No files found.
python/tvm/hybrid/parser.py
View file @
98e761f8
...
...
@@ -339,6 +339,9 @@ class HybridParser(ast.NodeVisitor):
else_body
=
visit_list_to_block
(
self
.
visit
,
node
.
orelse
)
else
:
else_body
=
util
.
make_nop
()
# Return no IfThenElse if proven
if
isinstance
(
cond
,
_expr
.
UIntImm
):
return
if_body
if
cond
.
value
else
else_body
return
_make
.
IfThenElse
(
cond
,
if_body
,
else_body
)
...
...
@@ -429,7 +432,7 @@ class HybridParser(ast.NodeVisitor):
for
i
in
range
(
low
,
low
+
ext
):
self
.
symbols
[
_name
]
=
Symbol
.
ConstLoopVar
,
i
bodies
.
append
(
visit_list_to_block
(
self
.
visit
,
node
.
body
))
return
pack_list_to_block
(
bodies
)
_body
=
pack_list_to_block
(
bodies
)
elif
iter_var
is
None
:
_internal_assert
(
for_type
is
not
None
,
"The loop bind function parse error!"
)
...
...
@@ -449,6 +452,9 @@ class HybridParser(ast.NodeVisitor):
res
=
_make
.
AttrStmt
(
iter_var
,
'thread_extent'
,
ext
,
_body
)
elif
not
isinstance
(
for_type
,
tuple
):
res
=
_make
.
For
(
iter_var
,
_api
.
const
(
0
,
'int32'
),
ext
,
for_type
,
0
,
_body
)
else
:
res
=
_body
self
.
symbols
.
pop
(
_name
)
return
res
...
...
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