|
|
|
|
@ -77,9 +77,9 @@ FeedFetchList FastThreadedSSAGraphExecutor::Run(
|
|
|
|
|
// run the recorded operators directly. This strategy could make the
|
|
|
|
|
// execution faster.
|
|
|
|
|
VLOG(3) << "Run the traced ops.";
|
|
|
|
|
RunTracedOps(traced_ops_);
|
|
|
|
|
RunTracedOps(fetch_ops);
|
|
|
|
|
if (exception_.IsCaught()) {
|
|
|
|
|
bool is_exception_free =
|
|
|
|
|
RunTracedOps(traced_ops_) && RunTracedOps(fetch_ops);
|
|
|
|
|
if (!is_exception_free) {
|
|
|
|
|
ExecutionFinal(&fetch_ops);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
@ -259,25 +259,25 @@ void FastThreadedSSAGraphExecutor::ExecutionFinal(
|
|
|
|
|
exception_.ReThrow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FastThreadedSSAGraphExecutor::RunTracedOps(
|
|
|
|
|
bool FastThreadedSSAGraphExecutor::RunTracedOps(
|
|
|
|
|
const std::vector<OpHandleBase *> &traced_ops) {
|
|
|
|
|
for (auto &op : traced_ops) {
|
|
|
|
|
if (exception_.IsCaught()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
RunOpSync(op);
|
|
|
|
|
if (!RunOpSync(op)) return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FastThreadedSSAGraphExecutor::RunOpSync(OpHandleBase *op) {
|
|
|
|
|
bool FastThreadedSSAGraphExecutor::RunOpSync(OpHandleBase *op) {
|
|
|
|
|
try {
|
|
|
|
|
VLOG(10) << op << " " << op->Name() << " : " << op->DebugString();
|
|
|
|
|
if (LIKELY(!strategy_.dry_run_)) {
|
|
|
|
|
op->Run(strategy_.use_cuda_);
|
|
|
|
|
}
|
|
|
|
|
VLOG(10) << op << " " << op->Name() << " Done ";
|
|
|
|
|
return true;
|
|
|
|
|
} catch (...) {
|
|
|
|
|
exception_.Catch(std::current_exception());
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|