1 /*******************************************************************************
2 * Copyright 2016-2018 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_JIT_UNI_LRN_FWD_HPP
18 #define CPU_JIT_UNI_LRN_FWD_HPP
20 #include "c_types_map.hpp"
21 #include "cpu_lrn_pd.hpp"
22 #include "cpu_engine.hpp"
23 #include "jit_uni_lrn_kernel_f32.hpp"
24 #include "jit_generator.hpp"
25 #include "type_helpers.hpp"
32 using namespace mkldnn::impl::status;
33 using namespace mkldnn::impl::memory_format;
34 using namespace mkldnn::impl::utils;
36 template <cpu_isa_t isa>
37 struct jit_uni_lrn_fwd_t: public cpu_primitive_t {
38 struct pd_t: public cpu_lrn_fwd_pd_t {
39 pd_t(engine_t *engine, const lrn_desc_t *adesc,
40 const primitive_attr_t *attr, const lrn_fwd_pd_t *hint_fwd_pd)
41 : cpu_lrn_fwd_pd_t(engine, adesc, attr, hint_fwd_pd) {}
44 JIT_IMPL_NAME_HELPER("jit:", isa, ""),
45 jit_uni_lrn_fwd_t<isa>);
47 virtual status_t init() override;
50 jit_uni_lrn_fwd_t(const pd_t *apd, const input_vector &inputs,
51 const output_vector &outputs);
54 typedef typename prec_traits<data_type::f32>::type data_t;
56 virtual void execute(event_t *e) const {
58 e->set_state(event_t::ready);
62 void execute_forward() const;
63 const pd_t *pd() const { return (const pd_t *)primitive_t::pd(); }
65 jit_uni_lrn_fwd_kernel_f32<isa> *ker_, *ker_first_, *ker_last_;
68 template <cpu_isa_t isa>
69 struct jit_uni_lrn_bwd_t: public cpu_primitive_t {
70 struct pd_t: public cpu_lrn_bwd_pd_t {
71 pd_t(engine_t *engine, const lrn_desc_t *adesc,
72 const primitive_attr_t *attr, const lrn_fwd_pd_t *hint_fwd_pd)
73 : cpu_lrn_bwd_pd_t(engine, adesc, attr, hint_fwd_pd) {}
76 JIT_IMPL_NAME_HELPER("jit:", isa, ""),
77 jit_uni_lrn_bwd_t<isa>);
79 virtual status_t init() override;
82 jit_uni_lrn_bwd_t(const pd_t *apd, const input_vector &inputs,
83 const output_vector &outputs);
86 typedef typename prec_traits<data_type::f32>::type data_t;
88 virtual void execute(event_t *e) const {
90 e->set_state(event_t::ready);
94 void execute_backward() const;
95 const pd_t *pd() const { return (const pd_t *)primitive_t::pd(); }
97 jit_uni_lrn_bwd_kernel_f32<isa> *ker_, *ker_first_, *ker_last_;
106 // vim: et ts=4 sw=4 cindent cino^=l0,\:0,N-s