aboutsummaryrefslogtreecommitdiff
path: root/reference_model/src/func_config.def
blob: 004cf36bf07a92290fce709e3103f1418b569538 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

// Copyright (c) 2020, ARM Limited.
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//         http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.

/*
 *   Filename:     src/func_config.def
 *   Description:
 *    Defines the model parameters/options for the functional model.
 */

// Placeholder values for the Functional model Option Formatting (FOF) fields
//
//   FOF_DEC is decimal
//   FOF_HEX is hexidecimal
//
// Floating point values are not supported yet, but there is no fundamental reason
// why we can't have them.
#ifndef FOF_DEC
#define FOF_DEC 1
#endif

#ifndef FOF_HEX
#define FOF_HEX 1
#endif

#ifndef FOF_STR_LEN
#define FOF_STR_LEN 1024
#endif

// Options are defined as follows:
// DEF_OPTION() defines a top-level option
//  Arguments:
//  option_field_name: a C-syntax field name in the struct
//  description: a short string that describes the purpose of the option (printed out with help)
//  C type: the type of the option (typically a uint64_t, uint32_t, etc)
//  Format field: the FOF_* type used to figure out how to format/print the option
//  Default value: the default value assigned to the option, if it isn't assigned by an configuration file
//    or command line override

// For defining hierarchical options (example hierarchy is 'cle', use the following formula).
// All options within the hierarchical space must be grouped together:
//

// #define CURRENT_UNIT cle
// DEF_UNIT_START(CURRENT_UNIT)
//  DEF_UNIT_OPTION(CURRENT_UNIT,...)
//  ...
// DEF_UNIT_END(CURRENT_UNIT)
// #undef CURRENT_UNIT
//
// The CURRENT_UNIT argument is required as a parameter in these definitions because
// macro processing rules only allow stringification of macro parameters.  Unfortunately,
// Other tokens that are NOT passed in as macro parameters cannot be stringified.

DEF_OPTION_STR(operator_fbs, "Flat buffer syntax file", FOF_STR_LEN, "../serialization/tosa.fbs")
DEF_OPTION_STR(subgraph_dir, "Subgraph directory to load", FOF_STR_LEN, ".")
DEF_OPTION_STR(subgraph_file, "Subgraph file to load", FOF_STR_LEN, "")
DEF_OPTION_STR(input_dir, "Input directory path for dumps/files", FOF_STR_LEN, ".")
DEF_OPTION_STR(input_tensor, "A list of pairs <name0>:<npy0>,<name1>:<npy1>", FOF_STR_LEN, "")
DEF_OPTION_STR(output_dir, "Output directory path for output dumps/files", FOF_STR_LEN, ".")
DEF_OPTION(eval, "Evaluate the network (0/1)", uint32_t, FOF_DEC, 1)
DEF_OPTION(validate_only, "Validate the network, but do not read inputs or evaluate (0/1)", uint32_t, FOF_DEC, 0)
DEF_OPTION(output_tensors, "Output tensors to a file (0/1)", uint32_t, FOF_DEC, 1)
DEF_OPTION(tosa_profile, "Set TOSA profile (0 = Base Inference, 1 = Main Inference, 2 = Main Training)", uint32_t, FOF_DEC, 1)
DEF_OPTION_STR(output_tensor_prefix, "Optional output tensor prefix", FOF_STR_LEN, "output_")
DEF_OPTION(dump_intermediates, "Dump intermediate tensors (0/1)", uint32_t, FOF_DEC, 0)
DEF_OPTION_STR(fp_format, "Floating-point number dump format string (printf-style format, e.g. 0.5)", FOF_STR_LEN, "0.5")
// Example of a hierarchical option
//#define CURRENT_UNIT arch
//DEF_UNIT_START(arch)
//DEF_UNIT_OPTION(arch, ifm_width, "input feature map width(x dim)", uint32_t, FOF_DEC, 10)
//DEF_UNIT_END(CURRENT_UNIT)
///#undef CURRENT_UNIT

// START Do not delete
// Required for keeping the FOFs clean
#undef FOF_DEC
#undef FOF_HEX
// END Do not delete^^