2 // Copyright (c) 2016 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #include "primitive_inst.h"
18 #include "data_inst.h"
19 #include "prior_box_inst.h"
20 #include "input_layout_inst.h"
21 #include "implementation_map.h"
23 #include "network_impl.h"
24 #include "events_waiter.h"
26 namespace cldnn { namespace gpu {
28 class wait_for_events_gpu : public primitive_impl
31 wait_for_events_gpu(const program_node& /*node*/) {}
33 event_impl::ptr execute(const std::vector<event_impl::ptr>& events, primitive_inst& instance) override
35 events_waiter events_waiter(instance.get_network().get_engine().get_context());
36 return events_waiter.run(events);
39 bool validate(const primitive_inst&) const override
44 static primitive_impl* create_data(const data_node& data)
46 return new wait_for_events_gpu(data);
49 static primitive_impl* create_input_layout(const input_layout_node& input)
51 return new wait_for_events_gpu(input);
54 static primitive_impl* create_prior_box(const prior_box_node& prior_box)
56 // This primitive is being executed on CPU during network compilation.
57 return new wait_for_events_gpu(prior_box);
64 implementation_map<data>::add({
65 { engine_types::ocl, wait_for_events_gpu::create_data }
68 implementation_map<input_layout>::add({
69 { engine_types::ocl, wait_for_events_gpu::create_input_layout }
72 implementation_map<prior_box>::add({
73 { engine_types::ocl, wait_for_events_gpu::create_prior_box }