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
532ee9b7
Commit
532ee9b7
authored
Jul 19, 2017
by
Tianqi Chen
Committed by
GitHub
Jul 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SCHEDULE] Detect useless bound early (#264)
* [SCHEDULE] Detect useless bound early * fix
parent
bdcd3256
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
4 deletions
+39
-4
python/tvm/make.py
+22
-0
src/op/op_util.cc
+17
-4
No files found.
python/tvm/make.py
View file @
532ee9b7
...
...
@@ -7,6 +7,7 @@ Each api is a PackedFunc that can be called in a positional argument manner.
You can use make function to build the IR node.
"""
from
._ffi.function
import
_init_api
from
.
import
stmt
as
_stmt
def
range_by_min_extent
(
min_value
,
extent
):
"""Construct a Range by min and extent.
...
...
@@ -28,4 +29,25 @@ def range_by_min_extent(min_value, extent):
"""
return
_range_by_min_extent
(
min_value
,
extent
)
def
stmt_seq
(
*
args
):
"""Make sequence of statements
Parameters
----------
args : list of Expr or Var
List of statements to be combined as sequence.
Returns
-------
stmt : Stmt
The combined statement.
"""
ret
=
None
for
value
in
args
:
if
not
isinstance
(
value
,
_stmt
.
Stmt
):
value
=
Evaluate
(
value
)
ret
=
value
if
ret
is
None
else
Block
(
ret
,
value
)
return
ret
if
ret
else
Evaluate
(
0
)
_init_api
(
"tvm.make"
)
src/op/op_util.cc
View file @
532ee9b7
...
...
@@ -198,17 +198,30 @@ std::vector<Expr> MakeBoundCheck(
}
PassUpBoundCheck
(
stage
,
dom_map
,
&
bound_state
);
std
::
vector
<
Expr
>
preds
;
std
::
unordered_map
<
const
Variable
*
,
IntSet
>
iset_dmap
;
// setup domain map for set analysis
for
(
const
auto
&
kv
:
dom_map
)
{
iset_dmap
[
kv
.
first
->
var
.
get
()]
=
IntSet
::
range
(
kv
.
second
);
}
for
(
IterVar
iv
:
stage
->
op
->
root_iter_vars
())
{
if
(
skip_iter
.
count
(
iv
)
||
iv
->
iter_type
==
kOpaque
)
continue
;
Range
dom
=
dom_map
.
at
(
iv
);
if
(
bound_state
.
at
(
iv
))
{
preds
.
emplace_back
(
ComputeExpr
<
Sub
>
(
value_map
.
at
(
iv
),
dom
->
min
)
<
dom
->
extent
);
Expr
value
=
ComputeExpr
<
Sub
>
(
value_map
.
at
(
iv
),
dom
->
min
);
Expr
vmax
=
EvalSet
(
value
,
iset_dmap
).
max
();
if
(
vmax
.
type
()
!=
value
.
type
()
||
!
can_prove
(
vmax
<
dom
->
extent
))
{
preds
.
emplace_back
(
value
<
dom
->
extent
);
}
}
CHECK
(
iv
->
dom
.
defined
());
if
(
!
skip_ivar_domain
&&
!
iv
->
dom
.
same_as
(
dom
))
{
preds
.
emplace_back
(
ComputeExpr
<
Sub
>
(
value_map
.
at
(
iv
),
iv
->
dom
->
min
)
<
iv
->
dom
->
extent
);
Expr
value
=
ComputeExpr
<
Sub
>
(
value_map
.
at
(
iv
),
iv
->
dom
->
min
);
Expr
vmax
=
EvalSet
(
value
,
iset_dmap
).
max
();
if
(
vmax
.
type
()
!=
value
.
type
()
||
!
can_prove
(
vmax
<
iv
->
dom
->
extent
))
{
preds
.
emplace_back
(
value
<
iv
->
dom
->
extent
);
}
}
}
return
preds
;
...
...
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