Skip to content

Commit

Permalink
[IE CLDNN] Fixed invalid stream reference in network_output if networ…
Browse files Browse the repository at this point in the history
…k is deleted (openvinotoolkit#6281)
  • Loading branch information
vladimir-paramuzov authored Jun 23, 2021
1 parent 4a4c3e8 commit 337abf1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 7 additions & 5 deletions inference-engine/thirdparty/clDNN/api/cldnn/graph/network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ struct network_output {
memory::ptr get_memory() const {
// TODO: in_order queue doesn't create proper output event in some cases which leads to syncronization issues with user app
// So call finish for associated stream to enusre that the output data is ready.
if (_stream.get_queue_type() == queue_types::in_order) {
_stream.finish();
if (_stream->get_queue_type() == queue_types::in_order) {
_stream->finish();
} else {
_event->wait();
}
Expand All @@ -47,8 +47,8 @@ struct network_output {
private:
event::ptr _event;
memory::ptr _result;
stream& _stream;
network_output(event::ptr evt, memory::ptr mem, stream& stream) : _event(evt), _result(mem), _stream(stream) {}
stream::ptr _stream;
network_output(event::ptr evt, memory::ptr mem, stream::ptr stream) : _event(evt), _result(mem), _stream(stream) {}
friend struct network;
};

Expand Down Expand Up @@ -110,6 +110,8 @@ struct network {

stream& get_stream() const;

stream::ptr get_stream_ptr() const;

/// @brief Return internal network id.
uint32_t get_id();

Expand Down Expand Up @@ -144,7 +146,7 @@ struct network {

/// @brief Returns @ref network_output object for particular @p output. Can't be called before network execution
network_output get_output(const primitive_id& output_id) const {
return network_output(get_primitive_event(output_id), get_output_memory(output_id), get_stream());
return network_output(get_primitive_event(output_id), get_output_memory(output_id), get_stream_ptr());
}

/// @brief Returns the list of @ref event for the primitives that were executed in network.
Expand Down
4 changes: 4 additions & 0 deletions inference-engine/thirdparty/clDNN/src/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ stream& network::get_stream() const {
return _impl->get_stream();
}

stream::ptr network::get_stream_ptr() const {
return _impl->get_stream_ptr();
}

uint32_t network::get_id() {
return _impl->get_id();
}
Expand Down

0 comments on commit 337abf1

Please sign in to comment.