1/*******************************************************************************
2* Copyright 2019-2022 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 <cinttypes>
19#include <stdio.h>
20
21#include "oneapi/dnnl/dnnl_debug.h"
22#include "oneapi/dnnl/dnnl_types.h"
23
24#include "c_types_map.hpp"
25#include "type_helpers.hpp"
26#include "utils.hpp"
27
28using namespace dnnl::impl;
29
30const char *dnnl_runtime2str(unsigned runtime) {
31 switch (runtime) {
32 case DNNL_RUNTIME_NONE: return "none";
33 case DNNL_RUNTIME_SEQ: return "sequential";
34 case DNNL_RUNTIME_OMP: return "OpenMP";
35 case DNNL_RUNTIME_TBB: return "TBB";
36 case DNNL_RUNTIME_OCL: return "OpenCL";
37 case DNNL_RUNTIME_THREADPOOL: return "threadpool";
38#ifdef DNNL_WITH_SYCL
39 case DNNL_RUNTIME_SYCL: return "DPC++";
40#endif
41 default: return "unknown";
42 }
43}
44
45const char *dnnl_fmt_kind2str(dnnl_format_kind_t v) {
46 if (v == dnnl_format_kind_undef) return "undef";
47 if (v == dnnl_format_kind_any) return "any";
48 if (v == dnnl_blocked) return "blocked";
49 if (v == format_kind::wino || v == format_kind::rnn_packed) return "opaque";
50 if (v == dnnl_format_kind_max) return "max";
51 assert(!"unknown fmt_kind");
52 return "unknown fmt_kind";
53}
54