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
01e1699d
Commit
01e1699d
authored
Apr 12, 2018
by
kun-zh
Committed by
Tianqi Chen
Apr 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate Lower Bound Conditions for issue 1014 (#1091)
parent
515d4b6f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
src/schedule/message_passing.cc
+7
-2
tests/python/unittest/test_pass_inject_copy_intrin.py
+1
-0
tests/python/unittest/test_schedule_schedule_ops.py
+13
-0
No files found.
src/schedule/message_passing.cc
View file @
01e1699d
...
...
@@ -477,9 +477,14 @@ std::vector<Expr> MakeBoundCheck(
CHECK
(
iv
->
dom
.
defined
());
if
(
!
skip_ivar_domain
&&
!
iv
->
dom
.
same_as
(
dom
))
{
Expr
value
=
ComputeExpr
<
Sub
>
(
value_map
.
at
(
iv
),
iv
->
dom
->
min
);
Expr
vmax
=
EvalSet
(
value
,
iset_dmap
).
max
();
IntSet
s
=
EvalSet
(
value
,
iset_dmap
);
Expr
vmin
=
s
.
min
();
Expr
vmax
=
s
.
max
();
if
(
vmin
.
type
()
!=
value
.
type
()
||
!
can_prove
(
vmin
>=
iv
->
dom
->
min
))
{
preds
.
emplace_back
(
value
>=
0
);
}
if
(
vmax
.
type
()
!=
value
.
type
()
||
!
can_prove
(
vmax
<
iv
->
dom
->
extent
))
{
preds
.
emplace_back
(
value
<
iv
->
dom
->
extent
);
preds
.
emplace_back
(
value
<
(
iv
->
dom
->
extent
-
iv
->
dom
->
min
)
);
}
}
}
...
...
tests/python/unittest/test_pass_inject_copy_intrin.py
View file @
01e1699d
...
...
@@ -82,6 +82,7 @@ def test_copy_pad_split():
Ab
=
tvm
.
decl_buffer
(
A
.
shape
,
A
.
dtype
,
name
=
'A'
)
Bb
=
tvm
.
decl_buffer
(
B
.
shape
,
B
.
dtype
,
name
=
'B'
)
stmt
=
tvm
.
ir_pass
.
StorageFlatten
(
stmt
,
{
A
:
Ab
,
B
:
Bb
},
64
)
stmt
=
tvm
.
ir_pass
.
Simplify
(
stmt
)
stmt
=
tvm
.
ir_pass
.
CanonicalSimplify
(
stmt
)
def
cb
(
src
,
dst
,
pad_before
,
pad_after
,
pad_value
):
assert
(
dst
.
elem_offset
.
value
==
0
)
...
...
tests/python/unittest/test_schedule_schedule_ops.py
View file @
01e1699d
...
...
@@ -249,6 +249,18 @@ def test_schedule_cache_relayout3():
stmt
=
tvm
.
schedule
.
ScheduleOps
(
s
,
bounds
)
def
test_schedule_bound_condition
():
A
=
tvm
.
placeholder
((
64
,),
name
=
'A'
,
dtype
=
"float32"
)
Apad
=
tvm
.
compute
((
66
,),
lambda
i
:
tvm
.
select
(
tvm
.
all
(
i
>
0
,
i
<
65
),
A
[
i
-
1
],
tvm
.
const
(
0.
)),
name
=
'Apad'
)
Apad2
=
tvm
.
compute
((
66
,),
lambda
i
:
Apad
[
i
]
*
2
,
name
=
'Apad2'
)
s
=
tvm
.
create_schedule
(
Apad2
.
op
)
AL1
=
s
.
cache_read
(
A
,
"local"
,[
Apad
])
s
=
s
.
normalize
()
bounds
=
tvm
.
schedule
.
InferBound
(
s
)
stmt
=
tvm
.
schedule
.
ScheduleOps
(
s
,
bounds
)
stmt
=
tvm
.
ir_pass
.
Simplify
(
stmt
)
assert
(
isinstance
(
stmt
.
body
.
body
.
first
.
body
.
body
.
then_case
,
tvm
.
stmt
.
IfThenElse
))
if
__name__
==
"__main__"
:
test_schedule_middle_cache
()
test_inline_multi_reduce
()
...
...
@@ -265,3 +277,4 @@ if __name__ == "__main__":
test_schedule1
()
test_schedule2
()
test_schedule_cache
()
test_schedule_bound_condition
()
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