15 #include <boost/test/unit_test.hpp> 19 uint32_t sizeUint32 =
sizeof(uint32_t);
20 uint32_t payloadSize = 0;
27 payloadSize += 6 * 2 * sizeUint32;
29 payloadSize += sizeUint32;
31 uint32_t headerSize = 2 * sizeUint32;
32 uint32_t bodySize = 10 * sizeUint32;
34 return headerSize + bodySize + payloadSize;
47 return numberOfBytes + uint32_t_size - remainder;
52 uint32_t packetDataLength)
60 uint32_t entityBinaryPacketHeaderWord0 =
ReadUint32(readableData, offset);
61 uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
62 uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
63 uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
64 uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
70 uint32_t entityBinaryPacketHeaderWord1 =
ReadUint32(readableData, offset);
71 uint32_t eventBinaryPacketSequenceNumber = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
72 uint32_t eventBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
74 BOOST_CHECK(eventBinaryPacketDataLength == packetDataLength);
79 const std::string& label,
80 const unsigned char* readableData,
87 unsigned int uint64_t_size =
sizeof(uint64_t);
91 uint32_t eventClassDeclId =
ReadUint32(readableData, offset);
96 uint64_t readProfilingGuid =
ReadUint64(readableData, offset);
108 offset += uint64_t_size;
109 uint32_t swTraceLabelLength =
ReadUint32(readableData, offset);
114 swTraceLabelLength - 1) == 0);
121 const unsigned char* readableData,
122 unsigned int& offset)
128 unsigned int uint64_t_size =
sizeof(uint64_t);
131 uint32_t eventClassDeclId =
ReadUint32(readableData, offset);
136 uint64_t readProfilingGuid =
ReadUint64(readableData, offset);
140 offset += uint64_t_size;
147 const unsigned char* readableData,
148 unsigned int& offset)
152 uint32_t relationshipTypeUint = 0;
153 switch (relationshipType)
155 case ProfilingRelationshipType::RetentionLink:
156 relationshipTypeUint = 0;
158 case ProfilingRelationshipType::ExecutionLink:
159 relationshipTypeUint = 1;
161 case ProfilingRelationshipType::DataLink:
162 relationshipTypeUint = 2;
164 case ProfilingRelationshipType::LabelLink:
165 relationshipTypeUint = 3;
168 BOOST_ERROR(
"Unknown relationship type");
173 unsigned int uint64_t_size =
sizeof(uint64_t);
176 uint32_t eventClassDeclId =
ReadUint32(readableData, offset);
181 uint32_t readRelationshipTypeUint =
ReadUint32(readableData, offset);
182 BOOST_CHECK(readRelationshipTypeUint == relationshipTypeUint);
186 uint64_t readRelationshipGuid =
ReadUint64(readableData, offset);
197 offset += uint64_t_size;
198 uint64_t readHeadRelationshipGuid =
ReadUint64(readableData, offset);
209 offset += uint64_t_size;
210 uint64_t readTailRelationshipGuid =
ReadUint64(readableData, offset);
221 offset += uint64_t_size;
225 const unsigned char* readableData,
226 unsigned int& offset)
232 unsigned int uint64_t_size =
sizeof(uint64_t);
236 uint32_t entityDeclId =
ReadUint32(readableData, offset);
241 uint64_t readProfilingGuid =
ReadUint64(readableData, offset);
252 offset += uint64_t_size;
258 const unsigned char* readableData,
259 unsigned int& offset)
265 unsigned int uint64_t_size =
sizeof(uint64_t);
269 uint32_t entityDeclId =
ReadUint32(readableData, offset);
274 uint64_t readTimestamp =
ReadUint64(readableData, offset);
285 offset += uint64_t_size;
294 BOOST_CHECK(readThreadId == std::this_thread::get_id());
299 uint64_t readEventGuid =
ReadUint64(readableData, offset);
309 offset += uint64_t_size;
314 using namespace armnn;
336 std::vector<float> weightsData{
349 std::vector<float> biasesData{ 1.0f, 0.0f, 0.0f };
365 IConnectableLayer* conv2d = net->AddConvolution2dLayer(conv2dDesc, weights, optionalBiases);
374 input->GetOutputSlot(0).Connect(conv2d->
GetInputSlot(0));
378 input->GetOutputSlot(0).SetTensorInfo(inputInfo);
383 std::vector<armnn::BackendId> backends = { backendId };
398 unsigned int size = readableBuffer->GetSize();
401 const unsigned char* readableData = readableBuffer->GetReadableData();
404 unsigned int offset = 0;
783 bufferManager.MarkRead(readableBuffer);
786 std::vector<float> inputData(inputInfo.GetNumElements());
787 std::vector<float> outputData(outputInfo.GetNumElements());
802 auto inputReadableBuffer = bufferManager.GetReadableBuffer();
806 auto outputReadableBuffer = bufferManager.GetReadableBuffer();
810 auto inferenceReadableBuffer = bufferManager.GetReadableBuffer();
814 size = inputReadableBuffer->GetSize();
817 readableData = inputReadableBuffer->GetReadableData();
872 bufferManager.MarkRead(inputReadableBuffer);
875 size = outputReadableBuffer->GetSize();
878 readableData = outputReadableBuffer->GetReadableData();
933 bufferManager.MarkRead(outputReadableBuffer);
936 size = inferenceReadableBuffer->GetSize();
940 readableData = inferenceReadableBuffer->GetReadableData();
1321 bufferManager.MarkRead(inferenceReadableBuffer);
static ARMNN_DLLEXPORT ProfilingStaticGuid INFERENCE_GUID
uint32_t m_PadBottom
Padding bottom value in the height dimension.
bool m_BiasEnabled
Enable/disable bias.
virtual TensorInfo GetOutputTensorInfo(NetworkId networkId, LayerBindingId layerId) const override
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
void VerifyTimelineEntityBinaryPacketData(Optional< ProfilingGuid > guid, const unsigned char *readableData, unsigned int &offset)
void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
std::string GetHardwareVersion()
virtual const IDeviceSpec & GetDeviceSpec() const override
void ReadBytes(const IPacketBufferPtr &packetBuffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[])
uint64_t ReadUint64(const IPacketBufferPtr &packetBuffer, unsigned int offset)
void ForceTransitionToState(ProfilingState newState)
A Convolution2dDescriptor for the Convolution2dLayer.
uint32_t GetStreamMetaDataPacketSize()
std::string GetProcessName()
Head retains(parents) Tail.
std::vector< std::pair< LayerBindingId, class ConstTensor > > InputTensors
uint32_t m_PadRight
Padding right value in the width dimension.
void VerifyTimelineLabelBinaryPacketData(Optional< ProfilingGuid > guid, const std::string &label, const unsigned char *readableData, unsigned int &offset)
Copyright (c) 2020 ARM Limited.
Head execution start depends on Tail execution completion.
std::string GetSoftwareInfo()
static ARMNN_DLLEXPORT ProfilingStaticGuid CONNECTION_GUID
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
static ARMNN_DLLEXPORT ProfilingStaticGuid WORKLOAD_EXECUTION_GUID
static ARMNN_DLLEXPORT ProfilingStaticGuid ARMNN_PROFILING_EOL_EVENT_CLASS
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
static ARMNN_DLLEXPORT ProfilingStaticGuid NAME_GUID
static ARMNN_DLLEXPORT ProfilingStaticGuid ARMNN_PROFILING_SOL_EVENT_CLASS
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
unsigned int OffsetToNextWord(unsigned int numberOfBytes)
uint32_t m_PadTop
Padding top value in the height dimension.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
static ProfilingStaticGuid GetStaticId(const std::string &str)
IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptions &options=OptimizerOptions(), Optional< std::vector< std::string > &> messages=EmptyOptional())
Create an optimized version of the network.
profiling::ProfilingService & GetProfilingService(armnn::Runtime *runtime)
bool has_value() const noexcept
virtual LayerGuid GetGuid() const =0
Returns the unique id of the layer.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
std::vector< std::pair< LayerBindingId, class Tensor > > OutputTensors
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
void ResetExternalProfilingOptions(const ExternalProfilingOptions &options, bool resetProfilingService=false)
ProfilingRelationshipType
#define ARMNN_ASSERT(COND)
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
IPacketBufferPtr GetReadableBuffer() override
constexpr unsigned int ThreadIdSize
An ActivationDescriptor for the ActivationLayer.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)
armnn::profiling::ProfilingService profilingService
void VerifyTimelineHeaderBinary(const unsigned char *readableData, unsigned int &offset, uint32_t packetDataLength)
std::string GetSoftwareVersion()
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid, const unsigned char *readableData, unsigned int &offset)
void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relationshipType, Optional< ProfilingGuid > relationshipGuid, Optional< ProfilingGuid > headGuid, Optional< ProfilingGuid > tailGuid, const unsigned char *readableData, unsigned int &offset)
static ARMNN_DLLEXPORT ProfilingStaticGuid TYPE_GUID
virtual Status LoadNetwork(NetworkId &networkIdOut, IOptimizedNetworkPtr network) override
Loads a complete network into the Runtime.
void VerifyTimelineEventBinaryPacket(Optional< uint64_t > timestamp, Optional< std::thread::id > threadId, Optional< ProfilingGuid > eventGuid, const unsigned char *readableData, unsigned int &offset)
const std::string & Get() const
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
Get a const input slot handle by slot index.
BufferManager & GetProfilingBufferManager()
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
Get the const output slot handle by slot index.
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
virtual int Connect(IInputSlot &destination)=0
armnn::Runtime::CreationOptions::ExternalProfilingOptions options
ExternalProfilingOptions m_ProfilingOptions
virtual Status EnqueueWorkload(NetworkId networkId, const InputTensors &inputTensors, const OutputTensors &outputTensors) override
Evaluates a network using input in inputTensors and outputs filled into outputTensors.
static ARMNN_DLLEXPORT ProfilingStaticGuid BACKENDID_GUID
static INetworkPtr Create()
uint32_t m_PadLeft
Padding left value in the width dimension.
virtual TensorInfo GetInputTensorInfo(NetworkId networkId, LayerBindingId layerId) const override