1 | /******************************************************************************* |
2 | * Copyright 2021-2022 Intel Corporation |
3 | * |
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 |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
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. |
15 | *******************************************************************************/ |
16 | |
17 | #include "gpu/gpu_impl_list.hpp" |
18 | |
19 | #include "gpu/ocl/ref_resampling.hpp" |
20 | #include "gpu/ocl/vectorized_resampling.hpp" |
21 | |
22 | namespace dnnl { |
23 | namespace impl { |
24 | namespace gpu { |
25 | |
26 | namespace { |
27 | using namespace dnnl::impl::prop_kind; |
28 | |
29 | // clang-format off |
30 | const std::map<pk_impl_key_t, std::vector<impl_list_item_t>> |
31 | impl_list_map REG_RESAMPLING_P({ |
32 | {{forward}, { |
33 | INSTANCE(ocl::ref_resampling_fwd_t) |
34 | nullptr, |
35 | }}, |
36 | {{backward}, REG_BWD_PK({ |
37 | INSTANCE(ocl::vectorized_resampling_bwd_t) |
38 | INSTANCE(ocl::ref_resampling_bwd_t) |
39 | nullptr, |
40 | })}, |
41 | }); |
42 | // clang-format on |
43 | } // namespace |
44 | |
45 | const impl_list_item_t *get_resampling_impl_list( |
46 | const resampling_desc_t *desc) { |
47 | static const impl_list_item_t empty_list[] = {nullptr}; |
48 | |
49 | const bool is_fwd = utils::one_of( |
50 | desc->prop_kind, forward_training, forward_inference); |
51 | prop_kind_t prop_kind = is_fwd ? forward : backward; |
52 | |
53 | const auto impl_list_it = impl_list_map.find({prop_kind}); |
54 | return impl_list_it != impl_list_map.cend() ? impl_list_it->second.data() |
55 | : empty_list; |
56 | } |
57 | |
58 | } // namespace gpu |
59 | } // namespace impl |
60 | } // namespace dnnl |
61 | |