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
afa20869
Commit
afa20869
authored
Aug 11, 2017
by
Tianqi Chen
Committed by
GitHub
Aug 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PASS] More improvement of canonical (#314)
parent
3c2569a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
src/arithmetic/canonical.cc
+3
-0
tests/python/unittest/test_pass_simplify.py
+10
-0
No files found.
src/arithmetic/canonical.cc
View file @
afa20869
...
@@ -191,6 +191,9 @@ class Canonical::Internal : public IRMutator {
...
@@ -191,6 +191,9 @@ class Canonical::Internal : public IRMutator {
ret_entry_
.
max_level
=
stack_
.
back
().
max_level
;
ret_entry_
.
max_level
=
stack_
.
back
().
max_level
;
stack_
.
pop_back
();
stack_
.
pop_back
();
CHECK
(
expr
.
defined
());
CHECK
(
expr
.
defined
());
if
(
const
IntImm
*
op
=
expr
.
as
<
IntImm
>
())
{
return
Mutate_
(
op
,
expr
);
}
return
expr
;
return
expr
;
}
}
// call produce to get a cache entry.
// call produce to get a cache entry.
...
...
tests/python/unittest/test_pass_simplify.py
View file @
afa20869
...
@@ -27,6 +27,16 @@ def test_basic():
...
@@ -27,6 +27,16 @@ def test_basic():
assert
str
(
ret
.
value
)
==
"(m - 1)"
assert
str
(
ret
.
value
)
==
"(m - 1)"
def
test_canonical
():
x
=
tvm
.
var
(
"x"
)
z
=
tvm
.
const
(
3
)
ret
=
tvm
.
ir_pass
.
CanonicalSimplify
(
x
/
(
z
*
z
)
-
x
/
(
z
*
z
))
assert
(
tvm
.
ir_pass
.
Equal
(
ret
,
0
))
ret
=
tvm
.
ir_pass
.
CanonicalSimplify
(
x
/
(
z
+
z
)
-
x
/
(
z
+
z
))
assert
(
tvm
.
ir_pass
.
Equal
(
ret
,
0
))
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
test_basic
()
test_basic
()
test_simplify
()
test_simplify
()
test_canonical
()
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