1 /*******************************************************************************
2 * Copyright 2019 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.
15 *******************************************************************************/
17 #ifndef CPU_GEMM_INNER_PRODUCT_UTILS_HPP
18 #define CPU_GEMM_INNER_PRODUCT_UTILS_HPP
20 #include "c_types_map.hpp"
21 #include "cpu_inner_product_pd.hpp"
22 #include "cpu_engine.hpp"
23 #include "type_helpers.hpp"
25 #include "jit_generator.hpp"
26 #include "jit_uni_eltwise.hpp"
27 #include "ref_eltwise.hpp"
33 namespace inner_product_utils {
35 template <impl::data_type_t acc_type, impl::data_type_t dst_type>
36 class pp_kernel_t : jit_generator
39 DECLARE_CPU_JIT_AUX_FUNCTIONS(gemm_x8s8s32x_inner_product_fwd_t::pp_kernel);
40 pp_kernel_t(const cpu_inner_product_fwd_pd_t *pd);
43 delete eltwise_injector_;
48 typedef typename prec_traits<acc_type>::type acc_data_t;
49 typedef typename prec_traits<dst_type>::type dst_data_t;
51 void operator()(dst_data_t *dst, const acc_data_t *acc, const char *bias,
52 const float *scales, size_t start, size_t end);
59 const acc_data_t *acc;
66 void (*ker_)(const ker_args *args);
67 jit_uni_eltwise_injector_f32<avx512_common> *eltwise_injector_;
68 ref_eltwise_scalar_fwd_t *ref_eltwise_;
71 data_type_t bias_data_type_;
72 size_t bias_data_type_size_;
73 size_t scale_idx_mult_;
77 post_ops_t::entry_t::eltwise_t eltwise_;