Wait VarDummyHandle generated

testDrivenImageClassification
chengduoZH 7 years ago
parent 830532213a
commit a89cd46700

@ -35,7 +35,7 @@ void ComputationOpHandle::RunImpl() {
bool ComputationOpHandle::NeedWait(VarHandleBase *in_var) {
bool need_wait =
dynamic_cast<VarHandle *>(in_var) && in_var->generated_op_ &&
in_var && in_var->generated_op_ &&
in_var->generated_op_->DeviceContext(place_) != dev_ctxes_[place_];
return need_wait;
}

@ -105,7 +105,7 @@ void OpHandleBase::WaitInputVarGenerated(const platform::Place &place) {
}
bool OpHandleBase::NeedWait(VarHandleBase *in_var) {
return dynamic_cast<VarHandle *>(in_var) && in_var->generated_op_;
return in_var && in_var->generated_op_;
}
void OpHandleBase::RunAndRecordEvent(const std::function<void()> &callback) {

@ -26,8 +26,17 @@ SendOpHandle::SendOpHandle(const framework::OpDesc &op_desc,
place_(place) {}
void SendOpHandle::RunImpl() {
// TODO(wuyi): need further analysis whether wait VarDummyHandle.
// Wait input done
WaitInputVarGenerated(place_);
for (auto *in : inputs_) {
auto &p = static_cast<VarHandle *>(in)->place_;
if (in->DebugString() == "dummy") { // HACK
continue;
}
if (in->generated_op_) {
in->generated_op_->RecordWaitEventOnCtx(dev_ctxes_[p]);
}
}
auto &tmp_scope = local_scope_->FindVar(kLocalExecScopeName)->Get<Scope *>();
// FIXME(wuyi): can not use RunAndRecordEvent here, for it will cause dead
// lock.

Loading…
Cancel
Save