projects
/
platform
/
upstream
/
tvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bbaee69
)
[TEXPR][PASS] Fix thread all reduce to avoid write after read hazzard (#2937)
author
Tianqi Chen
<tqchen@users.noreply.github.com>
Mon, 1 Apr 2019 06:04:03 +0000
(23:04 -0700)
committer
GitHub
<noreply@github.com>
Mon, 1 Apr 2019 06:04:03 +0000
(23:04 -0700)
src/pass/lower_thread_allreduce.cc
patch
|
blob
|
history
diff --git
a/src/pass/lower_thread_allreduce.cc
b/src/pass/lower_thread_allreduce.cc
index
05f942f
..
2c1bce8
100644
(file)
--- a/
src/pass/lower_thread_allreduce.cc
+++ b/
src/pass/lower_thread_allreduce.cc
@@
-175,6
+175,9
@@
class ThreadAllreduceBuilder final : public IRMutator {
}
std::vector<Stmt> seq;
std::vector<Var> shared_bufs(size);
+ // This sync is necessary because there might be incomplete read of
+ // previous iteration on the same buffer.
+ seq.emplace_back(SyncThread("shared"));
for (size_t idx = 0; idx < size; ++idx) {
shared_bufs[idx] = Var("red_buf"+std::to_string(idx), Handle());
Expr pred = const_true(types[idx].lanes());