Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / src / mkldnn_plugin / mkldnn / iml_type_mapper.cpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #include "iml_type_mapper.h"
6
7 using namespace MKLDNNPlugin;
8
9 impl_desc_type MKLDNNPlugin::parse_impl_name(std::string impl_desc_name) {
10     impl_desc_type res = impl_desc_type::unknown;
11
12 #define SEARCH_WORD(_wrd) if (impl_desc_name.find(#_wrd) != std::string::npos) \
13     res = static_cast<impl_desc_type>(res | impl_desc_type::_wrd);
14
15     SEARCH_WORD(ref);
16     SEARCH_WORD(jit);
17     SEARCH_WORD(gemm);
18     SEARCH_WORD(blas);
19     SEARCH_WORD(sse42);
20     SEARCH_WORD(avx2);
21     SEARCH_WORD(avx512);
22     SEARCH_WORD(any);
23     SEARCH_WORD(_1x1);
24     SEARCH_WORD(_dw);
25     SEARCH_WORD(reorder);
26     if ((res & impl_desc_type::avx2) != impl_desc_type::avx2 &&
27         (res & impl_desc_type::avx512) != impl_desc_type::avx512)
28         SEARCH_WORD(avx);
29 #undef SEARCH_WORD
30
31 #define SEARCH_WORD_2(_wrd, _key) if (impl_desc_name.find(#_wrd) != std::string::npos) \
32     res = static_cast<impl_desc_type>(res | impl_desc_type::_key);
33
34     SEARCH_WORD_2(nchw, ref);
35     SEARCH_WORD_2(ncdhw, ref);
36     SEARCH_WORD_2(wino, winograd);
37 #undef SEARCH_WORD_2
38
39     return res;
40 }