blob: cf78ab81553388f967242738b7c8c5bf2b6d804b [file] [log] [blame]
// 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, "tosa.fbs")
DEF_OPTION_STR(test_desc, "Json test descriptor", FOF_STR_LEN, "desc.json")
DEF_OPTION_STR(flatbuffer_dir, "Flatbuffer directory to load. If not specified, it will be overwritten by dirname(test_desc)", FOF_STR_LEN, "")
DEF_OPTION_STR(output_dir, "Output directory to write. If not specified, it will be overwritten by dirname(test_desc)", FOF_STR_LEN, "")
DEF_OPTION_STR(tosa_file, "Flatbuffer file. Support .json or .tosa. Specifying this will overwrite the one initialized by -Ctest_desc.", FOF_STR_LEN, "")
DEF_OPTION_STR(ifm_name, "Input tensor name. Comma(,) seperated. Specifying this will overwrite the one initialized by -Ctest_desc.", FOF_STR_LEN, "")
DEF_OPTION_STR(ifm_file, "Input tensor numpy Comma(,) seperated. file to initialize with placeholder. Specifying this will overwrite the one initialized by -Ctest_desc.", FOF_STR_LEN, "")
DEF_OPTION_STR(ofm_name, "Output tensor name. Comma(,) seperated. Specifying this will overwrite the one initialized by -Ctest_desc.", FOF_STR_LEN, "")
DEF_OPTION_STR(ofm_file, "Output tensor numpy file to be generated. Comma(,) seperated. Specifying this will overwrite the one initialized by -Ctest_desc.", 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(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^^