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
c55865b4
Commit
c55865b4
authored
Jun 14, 2018
by
libing4752
Committed by
Tianqi Chen
Jun 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix copro_sync.cc errors of ctx (#1274)
parent
fed6298b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletions
+38
-1
src/pass/coproc_sync.cc
+1
-1
tests/python/unittest/test_pass_storage_sync.py
+37
-0
No files found.
src/pass/coproc_sync.cc
View file @
c55865b4
...
...
@@ -385,7 +385,7 @@ class CoProcInstDepDetector : public IRVisitor {
&
(
curr_state_
.
exit_push
),
&
(
curr_state_
.
enter_pop
));
curr_state_
.
enter_ctx
=
first_state_
.
enter_ctx
;
curr_state_
.
exit_ctx
=
last_state_
.
e
nter
_ctx
;
curr_state_
.
exit_ctx
=
last_state_
.
e
xit
_ctx
;
}
std
::
swap
(
first_state_
,
temp_first
);
std
::
swap
(
last_state_
,
temp_last
);
...
...
tests/python/unittest/test_pass_storage_sync.py
View file @
c55865b4
...
...
@@ -78,7 +78,44 @@ def test_coproc_sync2():
stmt
=
ib
.
get
()
stmt
=
tvm
.
ir_pass
.
CoProcSync
(
stmt
)
def
test_coproc_sync3
():
def
__check_list
(
tvm_array
,
py_list
):
for
ti
,
li
in
zip
(
tvm_array
,
py_list
):
if
ti
.
value
!=
li
:
return
False
return
True
ib
=
tvm
.
ir_builder
.
create
()
n
=
tvm
.
var
(
"n"
)
cp
=
tvm
.
thread_axis
((
0
,
1
),
"cop"
)
A
=
ib
.
allocate
(
"float32"
,
128
,
name
=
"A"
,
scope
=
"global.cache"
)
with
ib
.
for_range
(
0
,
n
,
name
=
"i"
)
as
i
:
with
ib
.
for_range
(
0
,
n
,
name
=
"i"
)
as
j
:
with
ib
.
new_scope
():
ib
.
scope_attr
(
cp
,
"coproc_scope"
,
1
)
A
[
i
]
=
1.0
with
ib
.
new_scope
():
ib
.
scope_attr
(
cp
,
"coproc_scope"
,
2
)
A
[
i
]
=
1.0
with
ib
.
new_scope
():
ib
.
scope_attr
(
cp
,
"coproc_scope"
,
3
)
A
[
0
]
=
0.0
stmt
=
ib
.
get
()
stmt
=
tvm
.
ir_pass
.
CoProcSync
(
stmt
)
slist
=
tvm
.
make
.
stmt_list
(
stmt
.
first
.
body
.
body
)
push_st
=
slist
[
2
]
slist
=
tvm
.
make
.
stmt_list
(
slist
[
-
1
])
pop_st
=
slist
[
0
]
.
body
.
first
assert
(
push_st
.
value
.
name
==
"cop.coproc_dep_push"
)
assert
(
__check_list
(
push_st
.
value
.
args
,
[
2
,
3
]))
assert
(
pop_st
.
value
.
name
==
"cop.coproc_dep_pop"
)
assert
(
__check_list
(
pop_st
.
value
.
args
,
[
2
,
3
]))
if
__name__
==
"__main__"
:
test_coproc_sync
()
test_storage_sync
()
test_coproc_sync2
()
test_coproc_sync3
()
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