1 /*******************************************************************************
2 * Copyright 2017-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_AVX512_COMMON_LRN_HPP
18 #define CPU_JIT_AVX512_COMMON_LRN_HPP
20 #include "c_types_map.hpp"
21 #include "cpu_lrn_pd.hpp"
22 #include "cpu_engine.hpp"
23 #include "jit_generator.hpp"
29 struct jit_avx512_common_lrn_fwd_t: public cpu_primitive_t {
30 struct pd_t: public cpu_lrn_fwd_pd_t {
31 pd_t(engine_t *engine, const lrn_desc_t *adesc,
32 const primitive_attr_t *attr, const lrn_fwd_pd_t *hint_fwd_pd)
33 : cpu_lrn_fwd_pd_t(engine, adesc, attr, hint_fwd_pd) {}
36 JIT_IMPL_NAME_HELPER("jit:", avx512_common, ""),
37 jit_avx512_common_lrn_fwd_t);
39 virtual status_t init() override;
42 jit_avx512_common_lrn_fwd_t(const pd_t *apd, const input_vector &inputs,
43 const output_vector &outputs);
44 ~jit_avx512_common_lrn_fwd_t();
46 typedef typename prec_traits<data_type::f32>::type data_t;
48 virtual void execute(event_t *e) const {
50 e->set_state(event_t::ready);
54 void execute_forward() const;
55 const pd_t *pd() const { return (const pd_t *)primitive_t::pd(); }
57 int use_h_parallelism;
58 struct jit_avx512_common_lrn_kernel_f32;
59 jit_avx512_common_lrn_kernel_f32 *ker_, *ker_first_, *ker_last_;
63 struct jit_avx512_common_lrn_bwd_t: public cpu_primitive_t {
64 struct pd_t: public cpu_lrn_bwd_pd_t {
65 pd_t(engine_t *engine, const lrn_desc_t *adesc,
66 const primitive_attr_t *attr, const lrn_fwd_pd_t *hint_fwd_pd)
67 : cpu_lrn_bwd_pd_t(engine, adesc, attr, hint_fwd_pd) {}
70 JIT_IMPL_NAME_HELPER("jit:", avx512_common, ""),
71 jit_avx512_common_lrn_bwd_t);
73 virtual status_t init() override;
76 jit_avx512_common_lrn_bwd_t(const pd_t *apd, const input_vector &inputs,
77 const output_vector &outputs);
78 ~jit_avx512_common_lrn_bwd_t();
80 typedef typename prec_traits<data_type::f32>::type data_t;
82 virtual void execute(event_t *e) const {
84 e->set_state(event_t::ready);
88 void execute_backward() const;
89 const pd_t *pd() const { return (const pd_t *)primitive_t::pd(); }
91 int use_h_parallelism;
92 struct jit_avx512_common_lrn_kernel_f32;
93 jit_avx512_common_lrn_kernel_f32 *ker_, *ker_first_, *ker_last_;
103 // vim: et ts=4 sw=4 cindent cino^=l0,\:0,N-s