Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tvm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
ml
tvm
Commits
7ec58675
Commit
7ec58675
authored
7 years ago
by
Tianqi Chen
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[ARITH] More robust int set checking (#487)
parent
1b2e5ced
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/arithmetic/int_set.cc
+6
-15
6 additions, 15 deletions
src/arithmetic/int_set.cc
with
6 additions
and
15 deletions
src/arithmetic/int_set.cc
+
6
−
15
View file @
7ec58675
...
...
@@ -132,27 +132,18 @@ IntSet IntSet::interval(Expr min, Expr max) {
return
IntervalSet
::
make
(
min
,
max
);
}
inline
bool
prove_equal
(
Expr
lhs
,
Expr
rhs
)
{
return
is_zero
(
ir
::
Simplify
(
lhs
-
rhs
));
}
// Check if a is created from b.
bool
IntSet
::
match_range
(
const
Range
&
b
)
const
{
const
IntSet
&
a
=
*
this
;
const
IntervalSet
*
a_int
=
a
.
as
<
IntervalSet
>
();
if
(
!
a_int
)
return
false
;
const
Interval
&
i
=
a_int
->
i
;
if
(
!
i
.
min
.
same_as
(
b
))
return
false
;
if
(
is_one
(
b
->
extent
))
return
i
.
is_single_point
();
if
(
is_positive_const
(
b
->
extent
)
&&
is_const
(
b
->
min
))
{
// deep equality
return
Equal
(
ComputeExpr
<
Sub
>
(
ComputeExpr
<
Add
>
(
b
->
extent
,
b
->
min
),
1
),
a_int
->
i
.
max
);
}
const
Sub
*
sub
=
i
.
max
.
as
<
Sub
>
();
if
(
!
sub
)
return
false
;
if
(
is_one
(
sub
->
b
))
return
false
;
const
Add
*
add
=
sub
->
a
.
as
<
Add
>
();
return
add
&&
add
->
a
.
same_as
(
b
->
min
)
&&
add
->
b
.
same_as
(
b
->
extent
);
return
prove_equal
(
i
.
min
,
b
->
min
)
&&
prove_equal
(
i
.
max
,
ComputeExpr
<
Sub
>
(
ComputeExpr
<
Add
>
(
b
->
extent
,
b
->
min
),
1
));
}
inline
bool
MatchPoint
(
const
IntSet
&
a
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment