68 unsigned int const*)
const override 75 const
bool IsMemoryManaged = true)
const override 78 return std::make_unique<MockTensorHandle>(tensorInfo, m_MemoryManager);
84 const
bool IsMemoryManaged = true)
const override 87 return std::make_unique<MockTensorHandle>(tensorInfo,
static_cast<unsigned int>(
MemorySource::Malloc));
92 "CreateWorkload(LayerType, const QueueDescriptor&, const WorkloadInfo& info) instead.",
109 "MockWorkloadFactory::CreateInput: data input and output differ in byte count.");
112 return std::make_unique<CopyMemGenericWorkload>(descriptor,
info);
115 std::unique_ptr<IWorkload>
119 mutable std::shared_ptr<MockMemoryManager> m_MemoryManager;
133 : m_BackendProfiling(
std::move(backendProfiling))
135 , m_IsTimelineEnabled(true)
142 return m_BackendProfiling;
147 std::unique_ptr<arm::pipe::IRegisterBackendCounters> counterRegistrar =
148 m_BackendProfiling->GetCounterRegistrationInterface(static_cast<uint16_t>(currentMaxGlobalCounterId));
150 std::string categoryName(
"MockCounters");
151 counterRegistrar->RegisterCategory(categoryName);
153 counterRegistrar->RegisterCounter(0, categoryName, 0, 0, 1.f,
"Mock Counter One",
"Some notional counter");
155 counterRegistrar->RegisterCounter(1, categoryName, 0, 0, 1.f,
"Mock Counter Two",
156 "Another notional counter");
158 std::string units(
"microseconds");
159 uint16_t nextMaxGlobalCounterId =
160 counterRegistrar->RegisterCounter(2, categoryName, 0, 0, 1.f,
"Mock MultiCore Counter",
161 "A dummy four core counter", units, 4);
162 return nextMaxGlobalCounterId;
165 arm::pipe::Optional<std::string>
ActivateCounters(uint32_t capturePeriod,
const std::vector<uint16_t>& counterIds)
167 if (capturePeriod == 0 || counterIds.size() == 0)
169 m_ActiveCounters.clear();
171 else if (capturePeriod == 15939u)
173 return arm::pipe::Optional<std::string>(
"ActivateCounters example test error");
175 m_CapturePeriod = capturePeriod;
176 m_ActiveCounters = counterIds;
177 return arm::pipe::Optional<std::string>();
182 std::vector<arm::pipe::CounterValue> counterValues;
184 for (
auto counterId : m_ActiveCounters)
186 counterValues.emplace_back(arm::pipe::CounterValue{ counterId, counterId + 1u });
189 uint64_t timestamp = m_CapturePeriod;
190 return { arm::pipe::Timestamp{ timestamp, counterValues } };
195 auto sendTimelinePacket = m_BackendProfiling->GetSendTimelinePacket();
196 sendTimelinePacket->SendTimelineEntityBinaryPacket(4256);
197 sendTimelinePacket->Commit();
203 m_IsTimelineEnabled = isEnabled;
209 return m_IsTimelineEnabled;
214 uint32_t m_CapturePeriod;
215 std::vector<uint16_t> m_ActiveCounters;
216 std::atomic<bool> m_IsTimelineEnabled;
231 return m_sharedContext.get();
236 m_sharedContext = shared;
240 std::shared_ptr<MockBackendProfilingContext> m_sharedContext;
247 const std::vector<TensorInfo>& infos,
263 if (infos.size() != 4)
266 "TensorInfos. TensorInfos should be of format: " 267 "{input, output, weights, biases}.");
270 auto desc = *(PolymorphicDowncast<const Convolution2dDescriptor*>(&descriptor));
278 reasonIfUnsupported);
287 reasonIfUnsupported);
ARMNN_DEPRECATED_MSG_REMOVAL_DATE("Use ABI stable " "CreateWorkload(LayerType, const QueueDescriptor&, const WorkloadInfo& info) instead.", "22.11") std std::unique_ptr< IWorkload > CreateWorkload(LayerType type, const QueueDescriptor &descriptor, const WorkloadInfo &info) const override
MockBackendProfilingContext(IBackendInternal::IBackendProfilingPtr &backendProfiling)
bool IsOutputSupported(const BackendId &backend, const TensorInfo &output, char *reasonIfUnsupported=nullptr, size_t reasonIfUnsupportedMaxLength=1024)
Deprecated in favor of IBackend and ILayerSupport interfaces.
std::unique_ptr< IWorkloadFactory > IWorkloadFactoryPtr
void SetProfilingContextPtr(std::shared_ptr< MockBackendProfilingContext > shared)
bool IsOutputSupported(const TensorInfo &, Optional< std::string &>) const override
A Convolution2dDescriptor for the Convolution2dLayer.
IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory(const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
bool IsInputSupported(const TensorInfo &, Optional< std::string &>) const override
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override
IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions &) const override
Create the runtime context of the backend.
OptimizationViews OptimizeSubgraphView(const SubgraphView &subgraph) const override
Copyright (c) 2021 ARM Limited and Contributors.
std::unique_ptr< IMemoryManager > IMemoryManagerUniquePtr
void IgnoreUnused(Ts &&...)
const BackendId & GetId() const override
Base class for all descriptors.
The SubgraphView class represents a subgraph of a Graph.
std::vector< TensorInfo > m_InputTensorInfos
const char * GetBackendId()
std::unique_ptr< ICustomAllocator > GetDefaultAllocator() const override
Returns the default memory allocator for the backend.
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
static const BackendId & GetIdStatic()
ARMNN_NO_DEPRECATE_WARN_BEGIN struct ARMNN_DEPRECATED_MSG_REMOVAL_DATE("ResizeBilinearQueueDescriptor is deprecated use ResizeQueueDescriptor instead", "22.08") ResizeBilinearQueueDescriptor
std::vector< TensorInfo > m_OutputTensorInfos
bool IsConvolution2dSupported(const TensorInfo &, const TensorInfo &, const Convolution2dDescriptor &, const TensorInfo &, const Optional< TensorInfo > &, Optional< std::string &>) const override
static MockBackendProfilingService & Instance()
std::shared_ptr< arm::pipe::IBackendProfilingContext > IBackendProfilingContextPtr
This is the bridge between backend and backend profiling we'll keep it in the backend namespace...
std::vector< arm::pipe::Timestamp > ReportCounterValues()
bool IsConvolution2dSupported(const BackendId &backend, const TensorInfo &input, const TensorInfo &output, const Convolution2dDescriptor &descriptor, const TensorInfo &weights, const Optional< TensorInfo > &biases, char *reasonIfUnsupported=nullptr, size_t reasonIfUnsupportedMaxLength=1024)
Deprecated in favor of IBackend and ILayerSupport interfaces.
bool IsAdditionSupported(const TensorInfo &, const TensorInfo &, const TensorInfo &, Optional< std::string &>) const override
IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions &creationOptions, IBackendProfilingPtr &backendProfiling) override
Create context specifically used for profiling interaction from backends.
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr
bool EnableProfiling(bool)
bool IsInputSupported(const BackendId &backend, const TensorInfo &input, char *reasonIfUnsupported=nullptr, size_t reasonIfUnsupportedMaxLength=1024)
Deprecated in favor of IBackend and ILayerSupport interfaces.
MockBackendProfilingContext * GetContext()
std::unique_ptr< arm::pipe::IBackendProfiling > IBackendProfilingPtr
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
bool TimelineReportingEnabled()
arm::pipe::Optional< std::string > ActivateCounters(uint32_t capturePeriod, const std::vector< uint16_t > &counterIds)
Contains information about TensorInfos of a layer.
IBackendInternal::IBackendProfilingPtr & GetBackendProfiling()
#define ARMNN_DEPRECATED_MSG(message)
bool IsAdditionSupported(const BackendId &backend, const TensorInfo &input0, const TensorInfo &input1, const TensorInfo &output, char *reasonIfUnsupported=nullptr, size_t reasonIfUnsupportedMaxLength=1024)
Deprecated in favor of IBackend and ILayerSupport interfaces.
bool EnableTimelineReporting(bool isEnabled)
bool SupportsSubTensors() const override
bool IsLayerSupported(const LayerType &type, const std::vector< TensorInfo > &infos, const BaseDescriptor &descriptor, const Optional< LstmInputParamsInfo > &, const Optional< QuantizedLstmInputParamsInfo > &, Optional< std::string &> reasonIfUnsupported) const override
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...
uint16_t RegisterCounters(uint16_t currentMaxGlobalCounterId)
std::unique_ptr< IBackendContext > IBackendContextPtr