1/*******************************************************************************
2* Copyright 2020-2021 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#ifndef CPU_X64_JIT_UNI_ELTWISE_INT_HPP
18#define CPU_X64_JIT_UNI_ELTWISE_INT_HPP
19
20#include <assert.h>
21
22#include "common/c_types_map.hpp"
23#include "common/primitive.hpp"
24#include "common/type_helpers.hpp"
25#include "common/utils.hpp"
26
27#include "cpu/cpu_eltwise_pd.hpp"
28
29#include "cpu/x64/cpu_isa_traits.hpp"
30
31namespace dnnl {
32namespace impl {
33namespace cpu {
34namespace x64 {
35
36struct jit_uni_eltwise_int_kernel;
37
38template <cpu_isa_t isa, impl::data_type_t d_type>
39struct jit_uni_eltwise_int_fwd_t : public primitive_t {
40 struct pd_t : public cpu_eltwise_fwd_pd_t {
41 using cpu_eltwise_fwd_pd_t::cpu_eltwise_fwd_pd_t;
42
43 DECLARE_COMMON_PD_T(JIT_IMPL_NAME_HELPER("jit_int8:", isa, ""),
44 jit_uni_eltwise_int_fwd_t);
45
46 status_t init(engine_t *engine);
47 };
48
49 jit_uni_eltwise_int_fwd_t(const pd_t *apd);
50 ~jit_uni_eltwise_int_fwd_t();
51
52 typedef typename prec_traits<d_type>::type data_t;
53
54 status_t init(engine_t *engine) override;
55
56 status_t execute(const exec_ctx_t &ctx) const override {
57 return execute_forward(ctx);
58 }
59
60private:
61 status_t execute_forward(const exec_ctx_t &ctx) const;
62 const pd_t *pd() const { return (const pd_t *)primitive_t::pd().get(); }
63 jit_uni_eltwise_int_kernel *kernel_ = nullptr;
64};
65
66} // namespace x64
67} // namespace cpu
68} // namespace impl
69} // namespace dnnl
70
71#endif
72