1 | /******************************************************************************* |
2 | * Copyright 2017-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 "common/impl_list_item.hpp" |
18 | |
19 | #include "cpu/cpu_engine.hpp" |
20 | |
21 | #include "cpu/ref_sum.hpp" |
22 | #include "cpu/simple_sum.hpp" |
23 | |
24 | #if DNNL_X64 |
25 | #include "cpu/x64/jit_avx512_core_bf16_sum.hpp" |
26 | using namespace dnnl::impl::cpu::x64; |
27 | #endif |
28 | |
29 | namespace dnnl { |
30 | namespace impl { |
31 | namespace cpu { |
32 | |
33 | namespace { |
34 | using namespace dnnl::impl::data_type; |
35 | #define INSTANCE(...) \ |
36 | impl_list_item_t(impl_list_item_t::sum_type_deduction_helper_t< \ |
37 | __VA_ARGS__::pd_t>()), |
38 | #define INSTANCE_X64(...) DNNL_X64_ONLY(INSTANCE(__VA_ARGS__)) |
39 | // clang-format off |
40 | constexpr impl_list_item_t cpu_sum_impl_list[] = REG_SUM_P({ |
41 | INSTANCE_X64(jit_bf16_sum_t<bf16, bf16>) |
42 | INSTANCE_X64(jit_bf16_sum_t<bf16, f32>) |
43 | INSTANCE(simple_sum_t<f16>) |
44 | INSTANCE(simple_sum_t<f16, f32>) |
45 | INSTANCE(simple_sum_t<bf16>) |
46 | INSTANCE(simple_sum_t<bf16, f32>) |
47 | INSTANCE(simple_sum_t<f32>) |
48 | INSTANCE(ref_sum_t) |
49 | nullptr, |
50 | }); |
51 | // clang-format on |
52 | #undef INSTANCE_X64 |
53 | #undef INSTANCE |
54 | } // namespace |
55 | |
56 | const impl_list_item_t *cpu_engine_impl_list_t::get_sum_implementation_list() { |
57 | return cpu_sum_impl_list; |
58 | } |
59 | |
60 | } // namespace cpu |
61 | } // namespace impl |
62 | } // namespace dnnl |
63 | |