diff options
Diffstat (limited to 'tensorflow/stream_executor/stream.cc')
-rw-r--r-- | tensorflow/stream_executor/stream.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tensorflow/stream_executor/stream.cc b/tensorflow/stream_executor/stream.cc index 2c495c99e1..6248aa2d01 100644 --- a/tensorflow/stream_executor/stream.cc +++ b/tensorflow/stream_executor/stream.cc @@ -1941,7 +1941,14 @@ void Stream::ReturnSubStream(Stream *sub_stream) { mutex_lock lock(mu_); for (auto &stream : sub_streams_) { if (stream.first.get() == sub_stream) { - stream.second = true; + // Streams have a monotonic state machine; if a stream + // encounters an error, it will remain in an error state + // forever. Only allow re-use of ok streams. + // + // TODO(toddw): Improve this mechanism, if necessary, to drop + // failed streams completely. + const bool ready_to_reuse = sub_stream->ok(); + stream.second = ready_to_reuse; return; } } |