diff options
-rw-r--r-- | delegate/include/DelegateOptions.hpp | 18 | ||||
-rw-r--r-- | delegate/src/DelegateOptions.cpp | 33 | ||||
-rw-r--r-- | tests/ExecuteNetwork/ExecuteNetwork.cpp | 2 | ||||
-rw-r--r-- | tests/ExecuteNetwork/TfliteExecutor.cpp | 6 | ||||
-rw-r--r-- | tests/ExecuteNetwork/TfliteExecutor.hpp | 4 |
5 files changed, 24 insertions, 39 deletions
diff --git a/delegate/include/DelegateOptions.hpp b/delegate/include/DelegateOptions.hpp index 4f157db73b..a3c1edf82f 100644 --- a/delegate/include/DelegateOptions.hpp +++ b/delegate/include/DelegateOptions.hpp @@ -1,17 +1,13 @@ // -// Copyright © 2020 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2020-2023 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once #include <armnn/ArmNN.hpp> -#include <armnn/Logging.hpp> #include <armnn/Optional.hpp> -#include <client/include/ProfilingOptions.hpp> - -#include <set> #include <string> #include <vector> @@ -247,13 +243,6 @@ public: bool GetInternalProfilingState() const { return m_InternalProfilingEnabled; } const armnn::ProfilingDetailsMethod& GetInternalProfilingDetail() const { return m_InternalProfilingDetail; } - void SetExternalProfilingParams( - const arm::pipe::ProfilingOptions& externalProfilingParams) - { m_ProfilingOptions = externalProfilingParams; } - - const arm::pipe::ProfilingOptions& GetExternalProfilingParams() const - { return m_ProfilingOptions; } - void SetSerializeToDot(const std::string& serializeToDotFile) { m_SerializeToDot = serializeToDotFile; } const std::string& GetSerializeToDot() const { return m_SerializeToDot; } @@ -291,10 +280,7 @@ private: /// Options for the optimization step for the network armnn::OptimizerOptions m_OptimizerOptions; - /// External profiling options. - arm::pipe::ProfilingOptions m_ProfilingOptions; - - /// Internal profiling options. + /// Internal profiling options. Written to INetworkProperties during model load. /// Indicates whether internal profiling is enabled or not. bool m_InternalProfilingEnabled = false; /// Sets the level of detail output by the profiling. Options are DetailsWithEvents = 1 and DetailsOnly = 2 diff --git a/delegate/src/DelegateOptions.cpp b/delegate/src/DelegateOptions.cpp index bb1edab009..fc4858fa29 100644 --- a/delegate/src/DelegateOptions.cpp +++ b/delegate/src/DelegateOptions.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2020 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2020-2023 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -59,7 +59,6 @@ DelegateOptions::DelegateOptions(char const* const* options_keys, armnn::OptimizerOptions optimizerOptions; bool internalProfilingState = false; armnn::ProfilingDetailsMethod internalProfilingDetail = armnn::ProfilingDetailsMethod::DetailsWithEvents; - arm::pipe::ProfilingOptions extProfilingParams; for (size_t i = 0; i < num_options; ++i) { // Process backends @@ -200,39 +199,40 @@ DelegateOptions::DelegateOptions(char const* const* options_keys, // Process enable-external-profiling else if (std::string(options_keys[i]) == std::string("enable-external-profiling")) { - extProfilingParams.m_EnableProfiling = armnn::stringUtils::StringToBool(options_values[i]); + runtimeOptions.m_ProfilingOptions.m_EnableProfiling = + armnn::stringUtils::StringToBool(options_values[i]); } - // Process timeline-profiling + // Process timeline-profiling else if (std::string(options_keys[i]) == std::string("timeline-profiling")) { - extProfilingParams.m_TimelineEnabled = armnn::stringUtils::StringToBool(options_values[i]); + runtimeOptions.m_ProfilingOptions.m_TimelineEnabled = armnn::stringUtils::StringToBool(options_values[i]); } - // Process outgoing-capture-file + // Process outgoing-capture-file else if (std::string(options_keys[i]) == std::string("outgoing-capture-file")) { - extProfilingParams.m_OutgoingCaptureFile = options_values[i]; + runtimeOptions.m_ProfilingOptions.m_OutgoingCaptureFile = options_values[i]; } - // Process incoming-capture-file + // Process incoming-capture-file else if (std::string(options_keys[i]) == std::string("incoming-capture-file")) { - extProfilingParams.m_IncomingCaptureFile = options_values[i]; + runtimeOptions.m_ProfilingOptions.m_IncomingCaptureFile = options_values[i]; } - // Process file-only-external-profiling + // Process file-only-external-profiling else if (std::string(options_keys[i]) == std::string("file-only-external-profiling")) { - extProfilingParams.m_FileOnly = armnn::stringUtils::StringToBool(options_values[i]); + runtimeOptions.m_ProfilingOptions.m_FileOnly = armnn::stringUtils::StringToBool(options_values[i]); } - // Process counter-capture-period + // Process counter-capture-period else if (std::string(options_keys[i]) == std::string("counter-capture-period")) { - extProfilingParams.m_CapturePeriod = static_cast<uint32_t>(std::stoul(options_values[i])); + runtimeOptions.m_ProfilingOptions.m_CapturePeriod = static_cast<uint32_t>(std::stoul(options_values[i])); } - // Process profiling-file-format + // Process profiling-file-format else if (std::string(options_keys[i]) == std::string("profiling-file-format")) { - extProfilingParams.m_FileFormat = options_values[i]; + runtimeOptions.m_ProfilingOptions.m_FileFormat = options_values[i]; } - // Process serialize-to-dot + // Process serialize-to-dot else if (std::string(options_keys[i]) == std::string("serialize-to-dot")) { this->SetSerializeToDot(options_values[i]); @@ -252,6 +252,5 @@ DelegateOptions::DelegateOptions(char const* const* options_keys, this->SetRuntimeOptions(runtimeOptions); this->SetOptimizerOptions(optimizerOptions); this->SetInternalProfilingParams(internalProfilingState, internalProfilingDetail); - this->SetExternalProfilingParams(extProfilingParams); } } // namespace armnnDelegate diff --git a/tests/ExecuteNetwork/ExecuteNetwork.cpp b/tests/ExecuteNetwork/ExecuteNetwork.cpp index a70f33ff23..14841ec1e9 100644 --- a/tests/ExecuteNetwork/ExecuteNetwork.cpp +++ b/tests/ExecuteNetwork/ExecuteNetwork.cpp @@ -17,7 +17,7 @@ std::unique_ptr<IExecutor> BuildExecutor(ProgramOptions& programOptions) programOptions.m_ExNetParams.m_TfLiteExecutor == ExecuteNetworkParams::TfLiteExecutor::TfliteInterpreter) { #if defined(ARMNN_TFLITE_DELEGATE) - return std::make_unique<TfLiteExecutor>(programOptions.m_ExNetParams); + return std::make_unique<TfLiteExecutor>(programOptions.m_ExNetParams, programOptions.m_RuntimeOptions); #else ARMNN_LOG(fatal) << "Not built with Arm NN Tensorflow-Lite delegate support."; return nullptr; diff --git a/tests/ExecuteNetwork/TfliteExecutor.cpp b/tests/ExecuteNetwork/TfliteExecutor.cpp index f01abfccd7..fc9c21a559 100644 --- a/tests/ExecuteNetwork/TfliteExecutor.cpp +++ b/tests/ExecuteNetwork/TfliteExecutor.cpp @@ -6,7 +6,8 @@ #include "TfliteExecutor.hpp" #include "tensorflow/lite/kernels/kernel_util.h" -TfLiteExecutor::TfLiteExecutor(const ExecuteNetworkParams& params) : m_Params(params) +TfLiteExecutor::TfLiteExecutor(const ExecuteNetworkParams& params, armnn::IRuntime::CreationOptions runtimeOptions) + : m_Params(params) { m_Model = tflite::FlatBufferModel::BuildFromFile(m_Params.m_ModelPath.c_str()); if (!m_Model) @@ -26,8 +27,7 @@ TfLiteExecutor::TfLiteExecutor(const ExecuteNetworkParams& params) : m_Params(pa // Create the Armnn Delegate // Populate a DelegateOptions from the ExecuteNetworkParams. armnnDelegate::DelegateOptions delegateOptions = m_Params.ToDelegateOptions(); - delegateOptions.SetExternalProfilingParams(delegateOptions.GetExternalProfilingParams()); - + delegateOptions.SetRuntimeOptions(runtimeOptions); std::unique_ptr<TfLiteDelegate, decltype(&armnnDelegate::TfLiteArmnnDelegateDelete)> theArmnnDelegate(armnnDelegate::TfLiteArmnnDelegateCreate(delegateOptions), armnnDelegate::TfLiteArmnnDelegateDelete); diff --git a/tests/ExecuteNetwork/TfliteExecutor.hpp b/tests/ExecuteNetwork/TfliteExecutor.hpp index 623d6357eb..5101ac0182 100644 --- a/tests/ExecuteNetwork/TfliteExecutor.hpp +++ b/tests/ExecuteNetwork/TfliteExecutor.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once @@ -21,7 +21,7 @@ using namespace tflite; class TfLiteExecutor : public IExecutor { public: - TfLiteExecutor(const ExecuteNetworkParams& m_Params); + TfLiteExecutor(const ExecuteNetworkParams& m_Params, armnn::IRuntime::CreationOptions runtimeOptions); std::vector<const void*> Execute() override; void PrintNetworkInfo() override{}; |