| 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 | #include <assert.h> |
| 18 | #include "mkldnn.h" |
| 19 | |
| 20 | #include "c_types_map.hpp" |
| 21 | #include "engine.hpp" |
| 22 | #include "stream.hpp" |
| 23 | #include "utils.hpp" |
| 24 | |
| 25 | using namespace mkldnn::impl; |
| 26 | using namespace mkldnn::impl::status; |
| 27 | |
| 28 | /* API */ |
| 29 | |
| 30 | status_t mkldnn_stream_create(stream_t **stream, engine_t *engine, |
| 31 | unsigned flags) { |
| 32 | bool args_ok = true |
| 33 | && !utils::any_null(stream, engine) |
| 34 | && flags == stream_flags::default_flags; |
| 35 | if (!args_ok) |
| 36 | return invalid_arguments; |
| 37 | |
| 38 | return safe_ptr_assign<stream_t>(*stream, new stream_t(engine, flags)); |
| 39 | } |
| 40 | |
| 41 | status_t mkldnn_stream_destroy(stream_t *stream) { |
| 42 | delete stream; |
| 43 | return success; |
| 44 | } |
| 45 | |
| 46 | // vim: et ts=4 sw=4 cindent cino^=l0,\:0,N-s |
| 47 | |