aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Davis <keith.davis@arm.com>2021-08-18 17:14:05 +0100
committerNikhil Raj Arm <nikhil.raj@arm.com>2021-08-20 09:10:22 +0000
commit4914d0c1f4cbb01fe276a7093af4cff13270b74a (patch)
treece6c4364bb596803148833af535215aa6ab6de90
parente369dbddae66c58f4b444c4b25871c10af19ed9d (diff)
downloadarmnn-4914d0c1f4cbb01fe276a7093af4cff13270b74a.tar.gz
IVGCVSW-6249 Add ProfilingDetails Macros to all workloads in Ref, Neon, CL
* Add functionality to only output network details in ExNet Signed-off-by: Keith Davis <keith.davis@arm.com> Change-Id: I0c45e67193f308ce7b86f1bb1a918a266fefba2e
-rw-r--r--include/armnn/IProfiler.hpp4
-rw-r--r--include/armnn/IRuntime.hpp10
-rw-r--r--include/armnn/Types.hpp9
-rw-r--r--src/armnn/LoadedNetwork.cpp2
-rw-r--r--src/armnn/Profiling.cpp25
-rw-r--r--src/armnn/Profiling.hpp5
-rw-r--r--tests/ExecuteNetwork/ExecuteNetwork.cpp5
-rw-r--r--tests/ExecuteNetwork/ExecuteNetworkParams.hpp1
-rw-r--r--tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp9
-rw-r--r--tests/InferenceModel.hpp14
10 files changed, 61 insertions, 23 deletions
diff --git a/include/armnn/IProfiler.hpp b/include/armnn/IProfiler.hpp
index 5fbb67000a..1b450d0151 100644
--- a/include/armnn/IProfiler.hpp
+++ b/include/armnn/IProfiler.hpp
@@ -40,8 +40,8 @@ public:
void Print(std::ostream& outStream) const;
/// Print out details of each layer within the network that possesses a descriptor.
- /// Also outputs tensor info.
- void EnableNetworkDetailsToStdOut();
+ /// Also outputs tensor info. This will be part of the profiling json output
+ void EnableNetworkDetailsToStdOut(ProfilingDetailsMethod detailsMethod);
~IProfiler();
IProfiler();
diff --git a/include/armnn/IRuntime.hpp b/include/armnn/IRuntime.hpp
index 97a9c2889e..345cdeb10a 100644
--- a/include/armnn/IRuntime.hpp
+++ b/include/armnn/IRuntime.hpp
@@ -40,7 +40,7 @@ struct INetworkProperties
m_ExportEnabled(exportEnabled),
m_AsyncEnabled(asyncEnabled),
m_ProfilingEnabled(profilingEnabled),
- m_OutputNetworkDetails(false),
+ m_OutputNetworkDetailsMethod(ProfilingDetailsMethod::Undefined),
m_InputSource(m_ImportEnabled ? MemorySource::Malloc : MemorySource::Undefined),
m_OutputSource(m_ExportEnabled ? MemorySource::Malloc : MemorySource::Undefined)
{}
@@ -55,7 +55,7 @@ struct INetworkProperties
m_ExportEnabled(outputSource != MemorySource::Undefined),
m_AsyncEnabled(asyncEnabled),
m_ProfilingEnabled(profilingEnabled),
- m_OutputNetworkDetails(false),
+ m_OutputNetworkDetailsMethod(ProfilingDetailsMethod::Undefined),
m_InputSource(inputSource),
m_OutputSource(outputSource)
{
@@ -66,12 +66,12 @@ struct INetworkProperties
MemorySource inputSource,
MemorySource outputSource,
bool profilingEnabled = false,
- bool outputDetails = false)
+ ProfilingDetailsMethod detailsMethod = ProfilingDetailsMethod::Undefined)
: m_ImportEnabled(inputSource != MemorySource::Undefined),
m_ExportEnabled(outputSource != MemorySource::Undefined),
m_AsyncEnabled(asyncEnabled),
m_ProfilingEnabled(profilingEnabled),
- m_OutputNetworkDetails(outputDetails),
+ m_OutputNetworkDetailsMethod(detailsMethod),
m_InputSource(inputSource),
m_OutputSource(outputSource)
{}
@@ -85,7 +85,7 @@ struct INetworkProperties
const bool m_ProfilingEnabled;
- const bool m_OutputNetworkDetails;
+ const ProfilingDetailsMethod m_OutputNetworkDetailsMethod;
const MemorySource m_InputSource;
const MemorySource m_OutputSource;
diff --git a/include/armnn/Types.hpp b/include/armnn/Types.hpp
index 056aa83d2f..5e00026eba 100644
--- a/include/armnn/Types.hpp
+++ b/include/armnn/Types.hpp
@@ -56,6 +56,15 @@ enum class DataLayout
NHWC = 2
};
+/// Define the behaviour of the internal profiler when outputting network details
+enum class ProfilingDetailsMethod
+{
+ Undefined = 0,
+ DetailsWithEvents = 1,
+ DetailsOnly = 2
+};
+
+
enum class QosExecPriority
{
Low = 0,
diff --git a/src/armnn/LoadedNetwork.cpp b/src/armnn/LoadedNetwork.cpp
index 70b5f4e89b..531d43dbb5 100644
--- a/src/armnn/LoadedNetwork.cpp
+++ b/src/armnn/LoadedNetwork.cpp
@@ -127,7 +127,7 @@ LoadedNetwork::LoadedNetwork(std::unique_ptr<IOptimizedNetwork> net,
m_Profiler->EnableProfiling(networkProperties.m_ProfilingEnabled);
- if (networkProperties.m_OutputNetworkDetails) m_Profiler->EnableNetworkDetailsToStdOut();
+ m_Profiler->EnableNetworkDetailsToStdOut(networkProperties.m_OutputNetworkDetailsMethod);
Graph& order = m_OptimizedNetwork->pOptimizedNetworkImpl->GetGraph().TopologicalSort();
//First create tensor handlers, backends and workload factories.
diff --git a/src/armnn/Profiling.cpp b/src/armnn/Profiling.cpp
index 8208fd9e0e..7de602fc40 100644
--- a/src/armnn/Profiling.cpp
+++ b/src/armnn/Profiling.cpp
@@ -163,7 +163,7 @@ void ProfilerImpl::AnalyzeEventSequenceAndWriteResults(ItertType first, ItertTyp
ProfilerImpl::ProfilerImpl()
: m_ProfilingEnabled(false),
- m_EnableDetailsToStdOut(false)
+ m_DetailsToStdOutMethod(ProfilingDetailsMethod::Undefined)
{
m_EventSequence.reserve(g_ProfilingEventCountHint);
@@ -197,9 +197,9 @@ void ProfilerImpl::EnableProfiling(bool enableProfiling)
m_ProfilingEnabled = enableProfiling;
}
-void ProfilerImpl::EnableNetworkDetailsToStdOut()
+void ProfilerImpl::EnableNetworkDetailsToStdOut(ProfilingDetailsMethod details)
{
- m_EnableDetailsToStdOut = true;
+ m_DetailsToStdOutMethod = details;
}
Event* ProfilerImpl::BeginEvent(armnn::IProfiler* profiler,
@@ -384,7 +384,9 @@ void ProfilerImpl::Print(std::ostream& outStream) const
printer.PrintHeader();
printer.PrintArmNNHeader();
- if (m_ProfilingDetails.get()->DetailsExist() && m_EnableDetailsToStdOut)
+ if (m_ProfilingDetails.get()->DetailsExist() &&
+ (m_DetailsToStdOutMethod == ProfilingDetailsMethod::DetailsOnly
+ || m_DetailsToStdOutMethod == ProfilingDetailsMethod::DetailsWithEvents))
{
JsonChildObject detailsObject{ "layer_details" };
ConfigureDetailsObject(detailsObject, m_ProfilingDetails.get()->GetProfilingDetails());
@@ -395,8 +397,10 @@ void ProfilerImpl::Print(std::ostream& outStream) const
// print inference object, also prints child layer and kernel measurements
size_t id = 0;
- printer.PrintJsonChildObject(inferenceObject, id);
-
+ if (m_DetailsToStdOutMethod != ProfilingDetailsMethod::DetailsOnly)
+ {
+ printer.PrintJsonChildObject(inferenceObject, id);
+ }
// end of ArmNN
printer.PrintNewLine();
printer.PrintFooter();
@@ -409,6 +413,11 @@ void ProfilerImpl::Print(std::ostream& outStream) const
// Restores previous precision settings.
outStream.flags(oldFlags);
outStream.precision(oldPrecision);
+
+ if (m_DetailsToStdOutMethod == ProfilingDetailsMethod::DetailsOnly)
+ {
+ exit(0);
+ }
}
void ProfilerImpl::AnalyzeEventsAndWriteResults(std::ostream& outStream) const
@@ -545,9 +554,9 @@ void IProfiler::EnableProfiling(bool enableProfiling)
pProfilerImpl->EnableProfiling(enableProfiling);
}
-void IProfiler::EnableNetworkDetailsToStdOut()
+void IProfiler::EnableNetworkDetailsToStdOut(ProfilingDetailsMethod detailsMethod)
{
- pProfilerImpl->EnableNetworkDetailsToStdOut();
+ pProfilerImpl->EnableNetworkDetailsToStdOut(detailsMethod);
}
bool IProfiler::IsProfilingEnabled()
diff --git a/src/armnn/Profiling.hpp b/src/armnn/Profiling.hpp
index 372b489abf..42d7f4d638 100644
--- a/src/armnn/Profiling.hpp
+++ b/src/armnn/Profiling.hpp
@@ -60,7 +60,7 @@ public:
bool IsProfilingEnabled();
// Enables outputting the layer descriptors and infos to stdout
- void EnableNetworkDetailsToStdOut();
+ void EnableNetworkDetailsToStdOut(ProfilingDetailsMethod detailsMethod);
// Increments the event tag, allowing grouping of events in a user-defined manner (e.g. per inference).
void UpdateEventTag();
@@ -102,7 +102,8 @@ public:
std::vector<EventPtr> m_EventSequence;
DescPtr m_ProfilingDetails = std::make_unique<ProfilingDetails>();
bool m_ProfilingEnabled;
- bool m_EnableDetailsToStdOut;
+ ProfilingDetailsMethod m_DetailsToStdOutMethod;
+
};
// Singleton profiler manager.
diff --git a/tests/ExecuteNetwork/ExecuteNetwork.cpp b/tests/ExecuteNetwork/ExecuteNetwork.cpp
index 64296d31b7..9a4864542f 100644
--- a/tests/ExecuteNetwork/ExecuteNetwork.cpp
+++ b/tests/ExecuteNetwork/ExecuteNetwork.cpp
@@ -325,6 +325,7 @@ int MainImpl(const ExecuteNetworkParams& params,
inferenceModelParams.m_AsyncEnabled = params.m_Concurrent;
inferenceModelParams.m_ThreadPoolSize = params.m_ThreadPoolSize;
inferenceModelParams.m_OutputDetailsToStdOut = params.m_OutputDetailsToStdOut;
+ inferenceModelParams.m_OutputDetailsOnlyToStdOut = params.m_OutputDetailsOnlyToStdOut;
for(const std::string& inputName: params.m_InputNames)
{
@@ -769,7 +770,9 @@ int main(int argc, const char* argv[])
return EXIT_FAILURE;
}
- if (ProgramOptions.m_ExNetParams.m_OutputDetailsToStdOut && !ProgramOptions.m_ExNetParams.m_EnableProfiling)
+ if ((ProgramOptions.m_ExNetParams.m_OutputDetailsToStdOut ||
+ ProgramOptions.m_ExNetParams.m_OutputDetailsOnlyToStdOut)
+ && !ProgramOptions.m_ExNetParams.m_EnableProfiling)
{
ARMNN_LOG(fatal) << "You must enable profiling if you would like to output layer details";
return EXIT_FAILURE;
diff --git a/tests/ExecuteNetwork/ExecuteNetworkParams.hpp b/tests/ExecuteNetwork/ExecuteNetworkParams.hpp
index 97c605b0a7..e519b028a0 100644
--- a/tests/ExecuteNetwork/ExecuteNetworkParams.hpp
+++ b/tests/ExecuteNetwork/ExecuteNetworkParams.hpp
@@ -44,6 +44,7 @@ struct ExecuteNetworkParams
std::string m_ModelPath;
unsigned int m_NumberOfThreads;
bool m_OutputDetailsToStdOut;
+ bool m_OutputDetailsOnlyToStdOut;
std::vector<std::string> m_OutputNames;
std::vector<std::string> m_OutputTensorFiles;
std::vector<std::string> m_OutputTypes;
diff --git a/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp b/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp
index 1fd4b3d96d..927d804725 100644
--- a/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp
+++ b/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp
@@ -410,9 +410,14 @@ ProgramOptions::ProgramOptions() : m_CxxOptions{"ExecuteNetwork",
cxxopts::value<uint32_t>(m_RuntimeOptions.m_ProfilingOptions.m_CapturePeriod)->default_value("150"))
("output-network-details",
- "Outputs layer tensor infos and descriptors to std out. Defaults to off.",
+ "Outputs layer tensor infos and descriptors to std out along with profiling events. Defaults to off.",
cxxopts::value<bool>(m_ExNetParams.m_OutputDetailsToStdOut)->default_value("false")
- ->implicit_value("true"));
+ ->implicit_value("true"))
+ ("output-network-details-only",
+ "Outputs layer tensor infos and descriptors to std out without profiling events. Defaults to off.",
+ cxxopts::value<bool>(m_ExNetParams.m_OutputDetailsOnlyToStdOut)->default_value("false")
+ ->implicit_value("true"));
+
}
catch (const std::exception& e)
{
diff --git a/tests/InferenceModel.hpp b/tests/InferenceModel.hpp
index 1db287f453..b982df396d 100644
--- a/tests/InferenceModel.hpp
+++ b/tests/InferenceModel.hpp
@@ -101,6 +101,7 @@ struct Params
bool m_EnableFastMath;
bool m_SaveCachedNetwork;
bool m_OutputDetailsToStdOut;
+ bool m_OutputDetailsOnlyToStdOut;
std::string m_CachedNetworkFilePath;
unsigned int m_NumberOfThreads;
std::string m_MLGOTuningFilePath;
@@ -121,6 +122,7 @@ struct Params
, m_EnableFastMath(false)
, m_SaveCachedNetwork(false)
, m_OutputDetailsToStdOut(false)
+ , m_OutputDetailsOnlyToStdOut(false)
, m_CachedNetworkFilePath("")
, m_NumberOfThreads(0)
, m_MLGOTuningFilePath("")
@@ -406,7 +408,8 @@ public:
bool enableProfiling,
const std::string& dynamicBackendsPath,
const std::shared_ptr<armnn::IRuntime>& runtime = nullptr)
- : m_EnableProfiling(enableProfiling)
+ : m_EnableProfiling(enableProfiling),
+ m_ProfilingDetailsMethod(armnn::ProfilingDetailsMethod::Undefined)
, m_DynamicBackendsPath(dynamicBackendsPath)
{
if (runtime)
@@ -421,6 +424,12 @@ public:
m_Runtime = armnn::IRuntime::Create(options);
}
+ // Configure the Profiler if the the profiling details are opted for
+ if (params.m_OutputDetailsOnlyToStdOut)
+ m_ProfilingDetailsMethod = armnn::ProfilingDetailsMethod::DetailsOnly;
+ else if (params.m_OutputDetailsToStdOut)
+ m_ProfilingDetailsMethod = armnn::ProfilingDetailsMethod::DetailsWithEvents;
+
std::string invalidBackends;
if (!CheckRequestedBackendsAreValid(params.m_ComputeDevices, armnn::Optional<std::string&>(invalidBackends)))
{
@@ -492,7 +501,7 @@ public:
armnn::MemorySource::Undefined,
armnn::MemorySource::Undefined,
enableProfiling,
- params.m_OutputDetailsToStdOut);
+ m_ProfilingDetailsMethod);
std::string errorMessage;
ret = m_Runtime->LoadNetwork(m_NetworkIdentifier, std::move(optNet), errorMessage, networkProperties);
@@ -744,6 +753,7 @@ private:
std::vector<armnn::BindingPointInfo> m_InputBindings;
std::vector<armnn::BindingPointInfo> m_OutputBindings;
bool m_EnableProfiling;
+ armnn::ProfilingDetailsMethod m_ProfilingDetailsMethod;
std::string m_DynamicBackendsPath;
template<typename TContainer>