diff options
author | alered01 <Alex.Redshaw@arm.com> | 2020-05-07 14:58:29 +0100 |
---|---|---|
committer | Alex Redshaw <Alex.Redshaw@arm.com> | 2020-05-22 11:05:07 +0000 |
commit | a7227ac8fa45c9ea0da0e1ed66bb0c551c61095b (patch) | |
tree | b0d1af7bed0e1d2de1bb7f2e64b67c56d43c10dc /tests/ExecuteNetwork/ExecuteNetwork.cpp | |
parent | 985ef1f2baf052a4d845b4fc7b6019ee7cd5e846 (diff) | |
download | armnn-a7227ac8fa45c9ea0da0e1ed66bb0c551c61095b.tar.gz |
Adding more performance metrics
* Implemented CLTuning flow for ExecuteNetwork tests
* Added --tuning-path to specify tuning file to use/create
* Added --tuning-level to specify tuning level to use as well as enable extra tuning run to generate the tuning file
* Fixed issue where TuningLevel was being parsed incorrectly
* Added measurements for initialization, network parsing, network optimization, tuning, and shutdown
* Added flag to control number of iterations inference is run for
Signed-off-by: alered01 <Alex.Redshaw@arm.com>
Change-Id: Ic739ff26e136e32aff9f0995217c1c3207008ca4
Diffstat (limited to 'tests/ExecuteNetwork/ExecuteNetwork.cpp')
-rw-r--r-- | tests/ExecuteNetwork/ExecuteNetwork.cpp | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/tests/ExecuteNetwork/ExecuteNetwork.cpp b/tests/ExecuteNetwork/ExecuteNetwork.cpp index 57b8692701..66d8e1378f 100644 --- a/tests/ExecuteNetwork/ExecuteNetwork.cpp +++ b/tests/ExecuteNetwork/ExecuteNetwork.cpp @@ -35,6 +35,10 @@ int main(int argc, const char* argv[]) uint32_t counterCapturePeriod; std::string fileFormat; + size_t iterations = 1; + int tuningLevel = 0; + std::string tuningPath; + double thresholdTime = 0.0; size_t subgraphId = 0; @@ -121,6 +125,14 @@ int main(int argc, const char* argv[]) "If profiling is enabled in 'file-only' mode this is the capture period that will be used in the test") ("file-format", po::value(&fileFormat)->default_value("binary"), "If profiling is enabled specifies the output file format") + ("iterations", po::value<size_t>(&iterations)->default_value(1), + "Number of iterations to run the network for, default is set to 1") + ("tuning-path", po::value(&tuningPath), + "Path to tuning file. Enables use of CL tuning") + ("tuning-level", po::value<int>(&tuningLevel)->default_value(0), + "Sets the tuning level which enables a tuning run which will update/create a tuning file. " + "Available options are: 1 (Rapid), 2 (Normal), 3 (Exhaustive). " + "Requires tuning-path to be set, default is set to 0 (No tuning run)") ("parse-unsupported", po::bool_switch()->default_value(false), "Add unsupported operators as stand-in layers (where supported by parser)"); } @@ -275,6 +287,33 @@ int main(int argc, const char* argv[]) // Remove duplicates from the list of compute devices. RemoveDuplicateDevices(computeDevices); +#if defined(ARMCOMPUTECL_ENABLED) + std::shared_ptr<armnn::IGpuAccTunedParameters> tuned_params; + + if (tuningPath != "") + { + if (tuningLevel != 0) + { + RunCLTuning(tuningPath, tuningLevel, modelFormat, inputTensorShapes, computeDevices, + dynamicBackendsPath, modelPath, inputNames, inputTensorDataFilePaths, inputTypes, quantizeInput, + outputTypes, outputNames, outputTensorFiles, dequantizeOutput, enableProfiling, + enableFp16TurboMode, enableBf16TurboMode, thresholdTime, printIntermediate, subgraphId, + enableLayerDetails, parseUnsupported); + } + ARMNN_LOG(info) << "Using tuning params: " << tuningPath << "\n"; + options.m_BackendOptions.emplace_back( + armnn::BackendOptions + { + "GpuAcc", + { + {"TuningLevel", 0}, + {"TuningFile", tuningPath.c_str()}, + {"KernelProfilingEnabled", enableProfiling} + } + } + ); + } +#endif try { CheckOptionDependencies(vm); @@ -288,9 +327,9 @@ int main(int argc, const char* argv[]) // Create runtime std::shared_ptr<armnn::IRuntime> runtime(armnn::IRuntime::Create(options)); - return RunTest(modelFormat, inputTensorShapes, computeDevices, dynamicBackendsPath, modelPath, inputNames, - inputTensorDataFilePaths, inputTypes, quantizeInput, outputTypes, outputNames, - outputTensorFiles, dequantizeOutput, enableProfiling, enableFp16TurboMode, enableBf16TurboMode, - thresholdTime, printIntermediate, subgraphId, enableLayerDetails, parseUnsupported, runtime); + return RunTest(modelFormat, inputTensorShapes, computeDevices, dynamicBackendsPath, modelPath, + inputNames, inputTensorDataFilePaths, inputTypes, quantizeInput, outputTypes, outputNames, + outputTensorFiles, dequantizeOutput, enableProfiling, enableFp16TurboMode, enableBf16TurboMode, + thresholdTime, printIntermediate, subgraphId, enableLayerDetails, parseUnsupported, iterations, runtime); } } |