aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/stream_executor
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-08-22 13:24:25 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-22 13:30:30 -0700
commita3960a0eeffac9467a5b3d4b525007d83ae137de (patch)
tree39abd1b4a7bd43a9e2a99238adcb61ede79e1e8a /tensorflow/stream_executor
parent6448db09a76e2803c1a46a7514c4bf82dd7d6261 (diff)
[SE] Avoid deadlock by calling HostCallbacks even when the stream is in an error state
HostCallbacks may trigger notifications that, if elided, would cause programs to hang. Ideally we would have errback semantics, but this is a band-aid while the semantics are redefined. PiperOrigin-RevId: 209818770
Diffstat (limited to 'tensorflow/stream_executor')
-rw-r--r--tensorflow/stream_executor/stream.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/tensorflow/stream_executor/stream.cc b/tensorflow/stream_executor/stream.cc
index 3695c839b5..19d3b2389a 100644
--- a/tensorflow/stream_executor/stream.cc
+++ b/tensorflow/stream_executor/stream.cc
@@ -5287,12 +5287,11 @@ Stream &Stream::ThenTransformTensor(const dnn::BatchDescriptor &input_desc,
Stream &Stream::ThenDoHostCallback(std::function<void()> callback) {
VLOG_CALL(PARAM(callback));
- if (ok()) {
- CheckError(parent_->HostCallback(this, callback));
- } else {
+ if (!ok()) {
LOG(INFO) << DebugStreamPointers()
<< " was in error state before adding host callback";
}
+ CheckError(parent_->HostCallback(this, std::move(callback)));
return *this;
}
@@ -5300,12 +5299,11 @@ Stream &Stream::ThenDoHostCallbackWithStatus(
std::function<port::Status()> callback) {
VLOG_CALL(PARAM(callback));
- if (ok()) {
- CheckError(parent_->HostCallback(this, std::move(callback)));
- } else {
- LOG(WARNING) << "stream " << DebugStreamPointers()
- << " was in error state before adding host callback";
+ if (!ok()) {
+ LOG(INFO) << DebugStreamPointers()
+ << " was in error state before adding host callback";
}
+ CheckError(parent_->HostCallback(this, std::move(callback)));
return *this;
}