Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Paramuzov <[email protected]>
  • Loading branch information
vladimir-paramuzov committed Oct 31, 2024
1 parent a0e9ce9 commit 78ab0ce
Show file tree
Hide file tree
Showing 25 changed files with 38 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/include/intel_gpu/graph/network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct network_output {
// 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 (do_sync) {
if (_stream->get_queue_type() == QueueTypes::in_order) {
if (_stream->get_queue_type() == QueueTypes::in_order || !_event) {
_stream->finish();
} else {
_event->wait();
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/activation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ struct activation_impl : public typed_primitive_impl<activation> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/broadcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ struct broadcast_impl : public typed_primitive_impl<broadcast> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/concat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct concatenation_impl : public typed_primitive_impl<concatenation> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ using vector3D = vector2D<vector1D<T>>;
template <typename T>
using vector4D = vector2D<vector2D<T>>;

inline event::ptr make_output_event(cldnn::stream& stream) {
if (stream.get_sync_method() == SyncMethods::events)
inline event::ptr make_output_event(cldnn::stream& stream, bool is_output) {
if (is_output)
return stream.create_user_event(true);
return nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/crop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct crop_impl : public typed_primitive_impl<crop> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ struct detection_output_impl : typed_primitive_impl<detection_output> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/eltwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ struct eltwise_impl : public typed_primitive_impl<eltwise> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/gather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ struct gather_impl : public typed_primitive_impl<gather> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ struct non_max_suppression_impl : typed_primitive_impl<non_max_suppression> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

static std::unique_ptr<primitive_impl> create(const non_max_suppression_node&, const kernel_impl_params&) {
Expand Down Expand Up @@ -460,7 +460,7 @@ struct non_max_suppression_gather_impl : typed_primitive_impl<non_max_suppressio
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

static std::unique_ptr<primitive_impl> create(const non_max_suppression_gather_node&, const kernel_impl_params&) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/proposal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ struct proposal_impl : typed_primitive_impl<proposal> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache&, const kernel_impl_params&) override {}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct range_impl : public typed_primitive_impl<range> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/read_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct read_value_impl : public typed_primitive_impl<read_value> {
return stream.aggregate_events(res_events, res_events.size() > 1);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ struct reduce_impl : public typed_primitive_impl<reduce> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/reorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct reorder_impl : public typed_primitive_impl<reorder> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct scatter_update_impl : public typed_primitive_impl<scatter_update> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct select_impl : public typed_primitive_impl<select> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/shape_of.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct shape_of_impl : public typed_primitive_impl<shape_of> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ struct strided_slice_impl : public typed_primitive_impl<strided_slice> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/impls/cpu/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct tile_impl : public typed_primitive_impl<tile> {
return stream.group_events(events);
}

return make_output_event(stream);
return make_output_event(stream, instance.is_output());
}

void init_kernels(const kernels_cache& , const kernel_impl_params&) override {}
Expand Down
6 changes: 4 additions & 2 deletions src/plugins/intel_gpu/src/plugin/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,11 @@ void Graph::update_profiling_info() {
auto event = execIter->second;
executedPrimitives.erase(execIter);

cldnn::instrumentation::profiling_info cldnnInfo{profiledID, event->get_profiling_info()};
if (event) {
cldnn::instrumentation::profiling_info cldnnInfo{profiledID, event->get_profiling_info()};
collectTimings(cldnnInfo, perfCount);
}

collectTimings(cldnnInfo, perfCount);
perfCount.num++;
}

Expand Down
11 changes: 8 additions & 3 deletions src/plugins/intel_gpu/src/runtime/ocl/ocl_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ void ocl_stream::wait_for_events(const std::vector<event::ptr>& events) {
bool needs_barrier = false;
std::vector<cl_event> clevents;
for (auto& ev : events) {
if (!ev)
continue;

if (auto ocl_base_ev = downcast<ocl_base_event>(ev.get())) {
if (ocl_base_ev->get().get() != nullptr) {
clevents.push_back(ocl_base_ev->get().get());
Expand All @@ -411,9 +414,11 @@ void ocl_stream::wait_for_events(const std::vector<event::ptr>& events) {
}
}

auto err = clWaitForEvents(clevents.size(), &clevents[0]);
if (err != CL_SUCCESS) {
OPENVINO_THROW("[GPU] clWaitForEvents failed with ", err, " code");
if (!clevents.empty()) {
auto err = clWaitForEvents(static_cast<cl_uint>(clevents.size()), &clevents[0]);
if (err != CL_SUCCESS) {
OPENVINO_THROW("[GPU] clWaitForEvents failed with ", err, " code");
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/runtime/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ event::ptr stream::aggregate_events(const std::vector<event::ptr>& events, bool
if (group && !is_output)
return group_events(events);

return events.empty() ? nullptr : enqueue_marker(events, is_output);
return events.empty() ? (is_output ? create_user_event(true) : nullptr) : enqueue_marker(events, is_output);
}

} // namespace cldnn
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ TEST(network_test, has_proper_event_for_in_order_queue) {
net.set_input_data("input1", input_mem);
net.execute();

ASSERT_FALSE(net.has_event("activation1"));
ASSERT_TRUE(net.has_event("activation1"));
ASSERT_TRUE(net.has_event("concat"));
ASSERT_TRUE(net.has_event("reorder"));
ASSERT_TRUE(net.has_event("activation2"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,11 @@ TEST_P(copy_between_gpu_buffer_and_gpu_usm, basic) {
case allocation_type::usm_shared:
case allocation_type::usm_device:
{
auto ev = mem_dst->copy_from(stream, *usm_host_src, true);
ev->wait();
mem_dst->copy_from(stream, *usm_host_src, true);
break;
}
case allocation_type::cl_mem: {
auto ev = mem_dst->copy_from(stream, *usm_host_src, true);
ev->wait();
mem_dst->copy_from(stream, *usm_host_src, true);
break;
}
default:
Expand Down

0 comments on commit 78ab0ce

Please sign in to comment.