1/*******************************************************************************
2* Copyright 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#ifndef UTILS_SETTINGS_HPP
18#define UTILS_SETTINGS_HPP
19
20struct base_settings_t {
21 base_settings_t() {
22 dnnl_get_default_fpmath_mode(&(this->fpmath_mode[0]));
23 };
24
25 std::vector<int64_t> mb {0};
26 std::vector<bool> inplace {false};
27 std::vector<attr_t::scale_t> oscale {attr_t::scale_t()};
28 std::vector<attr_t::arg_scales_t> scales {attr_t::arg_scales_t()};
29 std::vector<attr_t::zero_points_t> zero_points {attr_t::zero_points_t()};
30 std::vector<attr_t::post_ops_t> post_ops {attr_t::post_ops_t()};
31 std::vector<dnnl_scratchpad_mode_t> scratchpad_mode {
32 dnnl_scratchpad_mode_library};
33 std::vector<dnnl_fpmath_mode_t> fpmath_mode {dnnl_fpmath_mode_strict};
34 std::vector<thr_ctx_t> ctx_init {default_thr_ctx};
35 std::vector<thr_ctx_t> ctx_exe {default_thr_ctx};
36 const char *pattern = NULL;
37
38 const char *perf_template_csv_base(const std::string &driver_args) const {
39 static const std::string csv_pre
40 = std::string("perf,%engine%,%impl%,%name%,");
41 static const std::string csv_post = std::string(
42 ",%attr%,%DESC%,%Gops%,%-time%,%-Gflops%,%0time%,%0Gflops%");
43 static const std::string csv = csv_pre + driver_args + csv_post;
44 return csv.c_str();
45 }
46
47 const char *perf_template_def
48 = "perf,%engine%,%impl%,%name%,%prb%,%Gops%,%-time%,%-Gflops%,%"
49 "0time%,%0Gflops%";
50 const char *perf_template = perf_template_def;
51
52 template <typename... ArgsT>
53 static attr_t get_attr(const ArgsT &... args) {
54 attr_t attr;
55 attr.insert(args...);
56 return attr;
57 }
58};
59
60#endif
61