| 1 | /******************************************************************************* |
| 2 | * Copyright 2016-2018 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_ENGINE_HPP |
| 18 | #define CPU_ENGINE_HPP |
| 19 | |
| 20 | #include <assert.h> |
| 21 | |
| 22 | #include "mkldnn.h" |
| 23 | |
| 24 | #include "c_types_map.hpp" |
| 25 | #include "../common/engine.hpp" |
| 26 | |
| 27 | namespace mkldnn { |
| 28 | namespace impl { |
| 29 | namespace cpu { |
| 30 | |
| 31 | class cpu_engine_t: public engine_t { |
| 32 | public: |
| 33 | cpu_engine_t(): engine_t(engine_kind::cpu) {} |
| 34 | |
| 35 | /* implementation part */ |
| 36 | |
| 37 | virtual status_t memory_create(memory_t **memory, |
| 38 | const memory_desc_t *md, void *handle) override; |
| 39 | |
| 40 | virtual const concat_primitive_desc_create_f* |
| 41 | get_concat_implementation_list() const override; |
| 42 | virtual const reorder_primitive_desc_create_f* |
| 43 | get_reorder_implementation_list() const override; |
| 44 | virtual const sum_primitive_desc_create_f* |
| 45 | get_sum_implementation_list() const override; |
| 46 | virtual const primitive_desc_create_f* |
| 47 | get_implementation_list() const override; |
| 48 | }; |
| 49 | |
| 50 | class cpu_engine_factory_t: public engine_factory_t { |
| 51 | public: |
| 52 | virtual size_t count() const override { return 1; } |
| 53 | virtual engine_kind_t kind() const override { return engine_kind::cpu; } |
| 54 | virtual status_t engine_create(engine_t **engine, |
| 55 | size_t index) const override { |
| 56 | assert(index == 0); |
| 57 | *engine = new cpu_engine_t(); |
| 58 | return status::success; |
| 59 | }; |
| 60 | }; |
| 61 | |
| 62 | extern cpu_engine_factory_t engine_factory; |
| 63 | |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | #endif |
| 69 | |
| 70 | // vim: et ts=4 sw=4 cindent cino^=l0,\:0,N-s |
| 71 | |