Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / mkl-dnn / src / cpu / jit_uni_binarization.hpp
1 /*******************************************************************************
2 * Copyright 2019 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_JIT_UNI_BINARIZATION_HPP
18 #define CPU_JIT_UNI_BINARIZATION_HPP
19
20 #include <assert.h>
21
22 #include "c_types_map.hpp"
23 #include "cpu_binarization_pd.hpp"
24 #include "cpu_engine.hpp"
25 #include "type_helpers.hpp"
26 #include "utils.hpp"
27 #include "jit_primitive_conf.hpp"
28 #include "jit_generator.hpp"
29
30 namespace mkldnn {
31 namespace impl {
32 namespace cpu {
33
34 struct jit_uni_binarization_kernel_f32;
35
36 template <cpu_isa_t isa>
37 struct jit_uni_binarization_fwd_t : public cpu_primitive_t {
38     struct pd_t : public cpu_binarization_fwd_pd_t {
39         pd_t(engine_t *engine, const binarization_desc_t *adesc,
40                 const primitive_attr_t *attr,
41                 const binarization_fwd_pd_t *hint_fwd_pd)
42             : cpu_binarization_fwd_pd_t(engine, adesc, attr, hint_fwd_pd) {}
43
44         DECLARE_COMMON_PD_T(
45                 JIT_IMPL_NAME_HELPER("jit:", isa, ""),
46                 jit_uni_binarization_fwd_t<isa>);
47
48         virtual status_t init() override;
49     };
50
51     jit_uni_binarization_fwd_t(const pd_t *apd, const input_vector &inputs,
52                        const output_vector &outputs);
53     ~jit_uni_binarization_fwd_t();
54
55     typedef typename prec_traits<data_type::f32>::type src_data_t;
56
57     virtual void execute(event_t *e) const
58     {
59         execute_forward();
60         e->set_state(event_t::ready);
61     }
62
63 private:
64     void execute_forward() const;
65     const pd_t *pd() const { return (const pd_t *)primitive_t::pd(); }
66     jit_uni_binarization_kernel_f32 *kernel_;
67 };
68
69 }
70 }
71 }
72
73 #endif