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_REORDER_PD_HPP
18 #define CPU_REORDER_PD_HPP
22 #include "c_types_map.hpp"
23 #include "reorder_pd.hpp"
24 #include "cpu_engine.hpp"
25 #include "cpu_memory.hpp"
26 #include "cpu_primitive.hpp"
27 #include "type_helpers.hpp"
34 struct cpu_reorder_pd_t: public reorder_pd_t {
35 using cpu_memory_pd_t = cpu_memory_t::pd_t;
37 cpu_reorder_pd_t(const cpu_memory_pd_t *input_pd,
38 const cpu_memory_pd_t *output_pd, const primitive_attr_t *attr)
39 : reorder_pd_t(input_pd->engine(), attr)
40 , input_pd_(*input_pd), output_pd_(*output_pd) {}
41 virtual ~cpu_reorder_pd_t() {}
43 virtual status_t init() {
44 const auto &post_ops = attr()->post_ops_;
46 && IMPLICATION(post_ops.len_ != 0,
48 && post_ops.entry_[0].kind == primitive_kind::sum);
49 return args_ok ? success : unimplemented;
52 virtual const cpu_memory_pd_t *input_pd(int index = 0) const override
53 { return index == 0 ? &input_pd_ : nullptr; }
54 virtual const cpu_memory_pd_t *output_pd(int index = 0) const override
55 { return index == 0 ? &output_pd_ : nullptr; }
58 cpu_memory_pd_t input_pd_, output_pd_;
67 // vim: et ts=4 sw=4 cindent cino^=l0,\:0,N-s