aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKeith Davis <keith.davis@arm.com>2021-07-20 11:25:22 +0100
committerKeith Davis <keith.davis@arm.com>2021-08-04 11:49:16 +0100
commit554fa09a0f3d6c9c572634c9d2de9bfb6c3218b0 (patch)
tree1820a2cadcc1f34667199acff2d044e5d2083ea2 /include
parent96fd98c28441618fbdf9376fe46a368ef06b19e1 (diff)
downloadarmnn-554fa09a0f3d6c9c572634c9d2de9bfb6c3218b0.tar.gz
IVGCVSW-5980 JSON profiling output
* Add new ProfilingDetails class to construct operator details string * Add new macro which helps append layer details to ostream * Add ProfilingEnabled to NetworkProperties so that profiling can be realised when loading the network * Add further optional info to WorkloadInfo specific to convolutions * Generalise some JsonPrinter functions into JsonUtils for reusability * Remove explicit enabling of profiling within InferenceModel as it is done when loading network * Add ProfilingDetails macros to ConvolutionWorkloads for validation Signed-off-by: Keith Davis <keith.davis@arm.com> Change-Id: Ie84bc7dc667e72e6bcb635544f9ead7af1765690
Diffstat (limited to 'include')
-rw-r--r--include/armnn/IProfiler.hpp12
-rw-r--r--include/armnn/IRuntime.hpp48
-rw-r--r--include/armnn/backends/WorkloadInfo.hpp5
3 files changed, 44 insertions, 21 deletions
diff --git a/include/armnn/IProfiler.hpp b/include/armnn/IProfiler.hpp
index ac422b714f..1d350855f6 100644
--- a/include/armnn/IProfiler.hpp
+++ b/include/armnn/IProfiler.hpp
@@ -16,6 +16,8 @@ class ProfilerImpl;
class BackendId;
class Instrument;
class Event;
+struct WorkloadInfo;
+
class IProfiler
{
public:
@@ -41,12 +43,22 @@ public:
IProfiler();
private:
+
using InstrumentPtr = std::unique_ptr<Instrument>;
+
+ template<typename DescriptorType>
+ void AddLayerDetails(const std::string& name,
+ const DescriptorType& desc,
+ const WorkloadInfo& infos);
+
Event* BeginEvent(const BackendId& backendId,
const std::string& label,
std::vector<InstrumentPtr>&& instruments);
+
std::unique_ptr<ProfilerImpl> pProfilerImpl;
+
friend class ScopedProfilingEvent;
+ friend class ScopedProfilingUpdateDescriptions;
// Friend functions for unit testing, see ProfilerTests.cpp.
friend size_t GetProfilerEventSequenceSize(armnn::IProfiler* profiler);
diff --git a/include/armnn/IRuntime.hpp b/include/armnn/IRuntime.hpp
index fcb8c05e30..1bae94374e 100644
--- a/include/armnn/IRuntime.hpp
+++ b/include/armnn/IRuntime.hpp
@@ -33,44 +33,52 @@ struct INetworkProperties
ARMNN_DEPRECATED_MSG("Please use INetworkProperties constructor with MemorySource argument")
INetworkProperties(bool importEnabled = false,
bool exportEnabled = false,
- bool asyncEnabled = false)
- : m_ImportEnabled(importEnabled)
- , m_ExportEnabled(exportEnabled)
- , m_AsyncEnabled(asyncEnabled)
- , m_InputSource(m_ImportEnabled ? MemorySource::Malloc : MemorySource::Undefined)
- , m_OutputSource(m_ExportEnabled ? MemorySource::Malloc : MemorySource::Undefined)
+ bool asyncEnabled = false,
+ bool profilingEnabled = false)
+ : m_ImportEnabled(importEnabled),
+ m_ExportEnabled(exportEnabled),
+ m_AsyncEnabled(asyncEnabled),
+ m_ProfilingEnabled(profilingEnabled),
+ m_InputSource(m_ImportEnabled ? MemorySource::Malloc : MemorySource::Undefined),
+ m_OutputSource(m_ExportEnabled ? MemorySource::Malloc : MemorySource::Undefined)
{}
ARMNN_DEPRECATED_MSG("Please use INetworkProperties constructor without numThreads argument")
INetworkProperties(bool asyncEnabled,
MemorySource m_InputSource,
MemorySource m_OutputSource,
- size_t numThreads)
- : m_ImportEnabled(m_InputSource != MemorySource::Undefined)
- , m_ExportEnabled(m_OutputSource != MemorySource::Undefined)
- , m_AsyncEnabled(asyncEnabled)
- , m_InputSource(m_InputSource)
- , m_OutputSource(m_OutputSource)
+ size_t numThreads,
+ bool profilingEnabled = false)
+ : m_ImportEnabled(m_InputSource != MemorySource::Undefined),
+ m_ExportEnabled(m_OutputSource != MemorySource::Undefined),
+ m_AsyncEnabled(asyncEnabled),
+ m_ProfilingEnabled(profilingEnabled),
+ m_InputSource(m_InputSource),
+ m_OutputSource(m_OutputSource)
{
armnn::IgnoreUnused(numThreads);
}
INetworkProperties(bool asyncEnabled,
MemorySource m_InputSource,
- MemorySource m_OutputSource)
- : m_ImportEnabled(m_InputSource != MemorySource::Undefined)
- , m_ExportEnabled(m_OutputSource != MemorySource::Undefined)
- , m_AsyncEnabled(asyncEnabled)
- , m_InputSource(m_InputSource)
- , m_OutputSource(m_OutputSource)
- {}
+ MemorySource m_OutputSource,
+ bool profilingEnabled = false)
+ : m_ImportEnabled(m_InputSource != MemorySource::Undefined),
+ m_ExportEnabled(m_OutputSource != MemorySource::Undefined),
+ m_AsyncEnabled(asyncEnabled),
+ m_ProfilingEnabled(profilingEnabled),
+ m_InputSource(m_InputSource),
+ m_OutputSource(m_OutputSource)
+ {}
/// Deprecated and will be removed in future release.
const bool m_ImportEnabled;
/// Deprecated and will be removed in future release.
const bool m_ExportEnabled;
- const bool m_AsyncEnabled;
+ const bool m_AsyncEnabled;
+
+ const bool m_ProfilingEnabled;
const MemorySource m_InputSource;
const MemorySource m_OutputSource;
diff --git a/include/armnn/backends/WorkloadInfo.hpp b/include/armnn/backends/WorkloadInfo.hpp
index edf3581791..1d6967e134 100644
--- a/include/armnn/backends/WorkloadInfo.hpp
+++ b/include/armnn/backends/WorkloadInfo.hpp
@@ -11,12 +11,15 @@
namespace armnn
{
-/// Contains information about inputs and outputs to a layer.
+/// Contains information about TensorInfos of a layer.
/// This is needed at construction of workloads, but are not stored.
struct WorkloadInfo
{
std::vector<TensorInfo> m_InputTensorInfos;
std::vector<TensorInfo> m_OutputTensorInfos;
+ Optional<TensorInfo> m_WeightsTensorInfo = EmptyOptional();
+ Optional<TensorInfo> m_BiasTensorInfo = EmptyOptional();
+ Optional<std::string> m_ConvolutionMethod = EmptyOptional();
};
} //namespace armnn