Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 1 | // |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 2 | // Copyright © 2019 Arm Ltd and Contributors. All rights reserved. |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
Jim Flynn | 3443025 | 2022-03-04 15:03:58 +0000 | [diff] [blame] | 6 | #include <ArmNNProfilingServiceInitialiser.hpp> |
Jim Flynn | 4c9ed1d | 2022-01-23 23:57:20 +0000 | [diff] [blame] | 7 | #include "ProfilingOptionsConverter.hpp" |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 8 | #include "ProfilingTestUtils.hpp" |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 9 | |
| 10 | #include <armnn/Descriptors.hpp> |
Jim Flynn | 3443025 | 2022-03-04 15:03:58 +0000 | [diff] [blame] | 11 | #include <armnn/profiling/ArmNNProfiling.hpp> |
Matthew Sloyan | 371b70e | 2020-09-11 10:14:57 +0100 | [diff] [blame] | 12 | |
Jim Flynn | 3e9bc19 | 2022-03-23 23:01:26 +0000 | [diff] [blame] | 13 | #include <client/src/ProfilingService.hpp> |
| 14 | #include <client/src/ProfilingUtils.hpp> |
Sadik Armagan | ea41b57 | 2020-03-19 18:16:46 +0000 | [diff] [blame] | 15 | |
Jim Flynn | 6730fe9 | 2022-03-10 22:57:47 +0000 | [diff] [blame] | 16 | #include <common/include/Assert.hpp> |
Nikhil Raj | 77fe76b | 2021-06-09 14:55:32 +0100 | [diff] [blame] | 17 | #include <common/include/LabelsAndEventClasses.hpp> |
Jim Flynn | 75c14f4 | 2022-03-10 22:05:42 +0000 | [diff] [blame] | 18 | #include <common/include/NumericCast.hpp> |
Jim Flynn | 77b284e | 2022-03-13 20:53:35 +0000 | [diff] [blame] | 19 | #include <common/include/Processes.hpp> |
Jim Flynn | 9c85b41 | 2022-03-16 00:27:43 +0000 | [diff] [blame] | 20 | #include <common/include/Threads.hpp> |
Nikhil Raj | 77fe76b | 2021-06-09 14:55:32 +0100 | [diff] [blame] | 21 | |
Sadik Armagan | a097d2a | 2021-11-24 15:47:28 +0000 | [diff] [blame] | 22 | #include <TestUtils.hpp> |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 23 | |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 24 | #include <doctest/doctest.h> |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 25 | |
Finn Williams | a0de056 | 2020-04-22 12:27:37 +0100 | [diff] [blame] | 26 | uint32_t GetStreamMetaDataPacketSize() |
| 27 | { |
| 28 | uint32_t sizeUint32 = sizeof(uint32_t); |
| 29 | uint32_t payloadSize = 0; |
Jim Flynn | 9c85b41 | 2022-03-16 00:27:43 +0000 | [diff] [blame] | 30 | payloadSize += arm::pipe::numeric_cast<uint32_t>(arm::pipe::ARMNN_SOFTWARE_INFO.size()) + 1; |
| 31 | payloadSize += arm::pipe::numeric_cast<uint32_t>(arm::pipe::ARMNN_HARDWARE_VERSION.size()) + 1; |
| 32 | payloadSize += arm::pipe::numeric_cast<uint32_t>(arm::pipe::ARMNN_SOFTWARE_VERSION.size()) + 1; |
Jim Flynn | 75c14f4 | 2022-03-10 22:05:42 +0000 | [diff] [blame] | 33 | payloadSize += arm::pipe::numeric_cast<uint32_t>(GetProcessName().size()) + 1; |
Finn Williams | a0de056 | 2020-04-22 12:27:37 +0100 | [diff] [blame] | 34 | |
| 35 | // Add packetVersionEntries |
Jim Flynn | 83d08a9 | 2020-07-09 13:48:16 +0100 | [diff] [blame] | 36 | payloadSize += 13 * 2 * sizeUint32; |
Finn Williams | a0de056 | 2020-04-22 12:27:37 +0100 | [diff] [blame] | 37 | // Add packetVersionCountSize |
| 38 | payloadSize += sizeUint32; |
| 39 | |
| 40 | uint32_t headerSize = 2 * sizeUint32; |
| 41 | uint32_t bodySize = 10 * sizeUint32; |
| 42 | |
| 43 | return headerSize + bodySize + payloadSize; |
| 44 | } |
| 45 | |
Jan Eilers | f78c767 | 2020-07-01 18:09:39 +0100 | [diff] [blame] | 46 | std::vector<BackendId> GetSuitableBackendRegistered() |
| 47 | { |
| 48 | std::vector<BackendId> suitableBackends; |
| 49 | if (BackendRegistryInstance().IsBackendRegistered(GetComputeDeviceAsCString(armnn::Compute::CpuRef))) |
| 50 | { |
| 51 | suitableBackends.push_back(armnn::Compute::CpuRef); |
| 52 | } |
| 53 | if (BackendRegistryInstance().IsBackendRegistered(GetComputeDeviceAsCString(armnn::Compute::CpuAcc))) |
| 54 | { |
| 55 | suitableBackends.push_back(armnn::Compute::CpuAcc); |
| 56 | } |
| 57 | if (BackendRegistryInstance().IsBackendRegistered(GetComputeDeviceAsCString(armnn::Compute::GpuAcc))) |
| 58 | { |
| 59 | suitableBackends.push_back(armnn::Compute::GpuAcc); |
| 60 | } |
| 61 | return suitableBackends; |
| 62 | } |
| 63 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 64 | inline unsigned int OffsetToNextWord(unsigned int numberOfBytes) |
| 65 | { |
| 66 | unsigned int uint32_t_size = sizeof(uint32_t); |
| 67 | |
| 68 | unsigned int remainder = numberOfBytes % uint32_t_size; |
| 69 | if (remainder == 0) |
| 70 | { |
| 71 | return numberOfBytes; |
| 72 | } |
| 73 | |
| 74 | return numberOfBytes + uint32_t_size - remainder; |
| 75 | } |
| 76 | |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 77 | void VerifyTimelineHeaderBinary(const unsigned char* readableData, |
| 78 | unsigned int& offset, |
| 79 | uint32_t packetDataLength) |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 80 | { |
Jim Flynn | 6730fe9 | 2022-03-10 22:57:47 +0000 | [diff] [blame] | 81 | ARM_PIPE_ASSERT(readableData); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 82 | |
| 83 | // Utils |
| 84 | unsigned int uint32_t_size = sizeof(uint32_t); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 85 | |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 86 | // Check the TimelineEventClassBinaryPacket header |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 87 | uint32_t timelineBinaryPacketHeaderWord0 = ReadUint32(readableData, offset); |
| 88 | uint32_t timelineBinaryPacketFamily = (timelineBinaryPacketHeaderWord0 >> 26) & 0x0000003F; |
| 89 | uint32_t timelineBinaryPacketClass = (timelineBinaryPacketHeaderWord0 >> 19) & 0x0000007F; |
| 90 | uint32_t timelineBinaryPacketType = (timelineBinaryPacketHeaderWord0 >> 16) & 0x00000007; |
| 91 | uint32_t timelineBinaryPacketStreamId = (timelineBinaryPacketHeaderWord0 >> 0) & 0x00000007; |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 92 | CHECK(timelineBinaryPacketFamily == 1); |
| 93 | CHECK(timelineBinaryPacketClass == 0); |
| 94 | CHECK(timelineBinaryPacketType == 1); |
| 95 | CHECK(timelineBinaryPacketStreamId == 0); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 96 | offset += uint32_t_size; |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 97 | uint32_t timelineBinaryPacketHeaderWord1 = ReadUint32(readableData, offset); |
| 98 | uint32_t timelineBinaryPacketSequenceNumber = (timelineBinaryPacketHeaderWord1 >> 24) & 0x00000001; |
| 99 | uint32_t timelineBinaryPacketDataLength = (timelineBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF; |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 100 | CHECK(timelineBinaryPacketSequenceNumber == 0); |
| 101 | CHECK(timelineBinaryPacketDataLength == packetDataLength); |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 102 | offset += uint32_t_size; |
| 103 | } |
| 104 | |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 105 | ProfilingGuid VerifyTimelineLabelBinaryPacketData(arm::pipe::Optional<ProfilingGuid> guid, |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 106 | const std::string& label, |
| 107 | const unsigned char* readableData, |
| 108 | unsigned int& offset) |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 109 | { |
Jim Flynn | 6730fe9 | 2022-03-10 22:57:47 +0000 | [diff] [blame] | 110 | ARM_PIPE_ASSERT(readableData); |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 111 | |
| 112 | // Utils |
| 113 | unsigned int uint32_t_size = sizeof(uint32_t); |
| 114 | unsigned int uint64_t_size = sizeof(uint64_t); |
Jim Flynn | 75c14f4 | 2022-03-10 22:05:42 +0000 | [diff] [blame] | 115 | unsigned int label_size = arm::pipe::numeric_cast<unsigned int>(label.size()); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 116 | |
| 117 | // Check the decl id |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 118 | uint32_t eventClassDeclId = ReadUint32(readableData, offset); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 119 | CHECK(eventClassDeclId == 0); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 120 | |
| 121 | // Check the profiling GUID |
| 122 | offset += uint32_t_size; |
| 123 | uint64_t readProfilingGuid = ReadUint64(readableData, offset); |
| 124 | if (guid.has_value()) |
| 125 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 126 | CHECK(readProfilingGuid == guid.value()); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 127 | } |
| 128 | else |
| 129 | { |
Jim Flynn | 3443025 | 2022-03-04 15:03:58 +0000 | [diff] [blame] | 130 | ArmNNProfilingServiceInitialiser initialiser; |
Jim Flynn | 9c85b41 | 2022-03-16 00:27:43 +0000 | [diff] [blame] | 131 | ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, |
| 132 | initialiser, |
| 133 | arm::pipe::ARMNN_SOFTWARE_INFO, |
| 134 | arm::pipe::ARMNN_SOFTWARE_VERSION, |
| 135 | arm::pipe::ARMNN_HARDWARE_VERSION); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 136 | CHECK(readProfilingGuid == profilingService.GetStaticId(label)); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | // Check the SWTrace label |
| 140 | offset += uint64_t_size; |
| 141 | uint32_t swTraceLabelLength = ReadUint32(readableData, offset); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 142 | CHECK(swTraceLabelLength == label_size + 1); // Label length including the null-terminator |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 143 | offset += uint32_t_size; |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 144 | CHECK(std::memcmp(readableData + offset, // Offset to the label in the buffer |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 145 | label.data(), // The original label |
| 146 | swTraceLabelLength - 1) == 0); // The length of the label |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 147 | |
| 148 | // SWTrace strings are written in blocks of words, so the offset has to be updated to the next whole word |
| 149 | offset += OffsetToNextWord(swTraceLabelLength); |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 150 | |
| 151 | ProfilingGuid labelGuid(readProfilingGuid); |
| 152 | return labelGuid; |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 153 | } |
| 154 | |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 155 | void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid, |
Jim Flynn | 1892d21 | 2020-05-26 21:10:49 +0100 | [diff] [blame] | 156 | ProfilingGuid nameGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 157 | const unsigned char* readableData, |
| 158 | unsigned int& offset) |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 159 | { |
Jim Flynn | 6730fe9 | 2022-03-10 22:57:47 +0000 | [diff] [blame] | 160 | ARM_PIPE_ASSERT(readableData); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 161 | |
| 162 | // Utils |
| 163 | unsigned int uint32_t_size = sizeof(uint32_t); |
| 164 | unsigned int uint64_t_size = sizeof(uint64_t); |
| 165 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 166 | // Check the decl id |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 167 | uint32_t eventClassDeclId = ReadUint32(readableData, offset); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 168 | CHECK(eventClassDeclId == 2); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 169 | |
| 170 | // Check the profiling GUID |
| 171 | offset += uint32_t_size; |
| 172 | uint64_t readProfilingGuid = ReadUint64(readableData, offset); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 173 | CHECK(readProfilingGuid == guid); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 174 | |
Jim Flynn | 1892d21 | 2020-05-26 21:10:49 +0100 | [diff] [blame] | 175 | offset += uint64_t_size; |
| 176 | uint64_t readProfiilngNameGuid = ReadUint64(readableData, offset); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 177 | CHECK(readProfiilngNameGuid == nameGuid); |
Jim Flynn | 1892d21 | 2020-05-26 21:10:49 +0100 | [diff] [blame] | 178 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 179 | // Update the offset to allow parsing to be continued after this function returns |
| 180 | offset += uint64_t_size; |
| 181 | } |
| 182 | |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 183 | void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relationshipType, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 184 | arm::pipe::Optional<ProfilingGuid> relationshipGuid, |
| 185 | arm::pipe::Optional<ProfilingGuid> headGuid, |
| 186 | arm::pipe::Optional<ProfilingGuid> tailGuid, |
| 187 | arm::pipe::Optional<ProfilingGuid> attributeGuid, |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 188 | const unsigned char* readableData, |
| 189 | unsigned int& offset) |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 190 | { |
Jim Flynn | 6730fe9 | 2022-03-10 22:57:47 +0000 | [diff] [blame] | 191 | ARM_PIPE_ASSERT(readableData); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 192 | |
| 193 | uint32_t relationshipTypeUint = 0; |
| 194 | switch (relationshipType) |
| 195 | { |
| 196 | case ProfilingRelationshipType::RetentionLink: |
| 197 | relationshipTypeUint = 0; |
| 198 | break; |
| 199 | case ProfilingRelationshipType::ExecutionLink: |
| 200 | relationshipTypeUint = 1; |
| 201 | break; |
| 202 | case ProfilingRelationshipType::DataLink: |
| 203 | relationshipTypeUint = 2; |
| 204 | break; |
| 205 | case ProfilingRelationshipType::LabelLink: |
| 206 | relationshipTypeUint = 3; |
| 207 | break; |
| 208 | default: |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 209 | FAIL("Unknown relationship type"); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | // Utils |
| 213 | unsigned int uint32_t_size = sizeof(uint32_t); |
| 214 | unsigned int uint64_t_size = sizeof(uint64_t); |
| 215 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 216 | // Check the decl id |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 217 | uint32_t eventClassDeclId = ReadUint32(readableData, offset); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 218 | CHECK(eventClassDeclId == 3); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 219 | |
| 220 | // Check the relationship type |
| 221 | offset += uint32_t_size; |
| 222 | uint32_t readRelationshipTypeUint = ReadUint32(readableData, offset); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 223 | CHECK(readRelationshipTypeUint == relationshipTypeUint); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 224 | |
| 225 | // Check the relationship GUID |
| 226 | offset += uint32_t_size; |
| 227 | uint64_t readRelationshipGuid = ReadUint64(readableData, offset); |
| 228 | if (relationshipGuid.has_value()) |
| 229 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 230 | CHECK(readRelationshipGuid == relationshipGuid.value()); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 231 | } |
| 232 | else |
| 233 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 234 | CHECK(readRelationshipGuid != ProfilingGuid(0)); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 235 | } |
| 236 | |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 237 | // Check the head GUID of the relationship |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 238 | offset += uint64_t_size; |
| 239 | uint64_t readHeadRelationshipGuid = ReadUint64(readableData, offset); |
| 240 | if (headGuid.has_value()) |
| 241 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 242 | CHECK(readHeadRelationshipGuid == headGuid.value()); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 243 | } |
| 244 | else |
| 245 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 246 | CHECK(readHeadRelationshipGuid != ProfilingGuid(0)); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 247 | } |
| 248 | |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 249 | // Check the tail GUID of the relationship |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 250 | offset += uint64_t_size; |
| 251 | uint64_t readTailRelationshipGuid = ReadUint64(readableData, offset); |
| 252 | if (tailGuid.has_value()) |
| 253 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 254 | CHECK(readTailRelationshipGuid == tailGuid.value()); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 255 | } |
| 256 | else |
| 257 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 258 | CHECK(readTailRelationshipGuid != ProfilingGuid(0)); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 259 | } |
| 260 | |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 261 | // Check the attribute GUID of the relationship |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 262 | offset += uint64_t_size; |
| 263 | uint64_t readAttributeRelationshipGuid = ReadUint64(readableData, offset); |
| 264 | if (attributeGuid.has_value()) |
| 265 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 266 | CHECK(readAttributeRelationshipGuid == attributeGuid.value()); |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 267 | } |
| 268 | else |
| 269 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 270 | CHECK(readAttributeRelationshipGuid == ProfilingGuid(0)); |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 271 | } |
| 272 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 273 | // Update the offset to allow parsing to be continued after this function returns |
| 274 | offset += uint64_t_size; |
| 275 | } |
| 276 | |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 277 | ProfilingGuid VerifyTimelineEntityBinaryPacketData(arm::pipe::Optional<ProfilingGuid> guid, |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 278 | const unsigned char* readableData, |
| 279 | unsigned int& offset) |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 280 | { |
Jim Flynn | 6730fe9 | 2022-03-10 22:57:47 +0000 | [diff] [blame] | 281 | ARM_PIPE_ASSERT(readableData); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 282 | |
| 283 | // Utils |
| 284 | unsigned int uint32_t_size = sizeof(uint32_t); |
| 285 | unsigned int uint64_t_size = sizeof(uint64_t); |
| 286 | |
| 287 | // Reading TimelineEntityClassBinaryPacket |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 288 | // Check the decl_id |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 289 | uint32_t entityDeclId = ReadUint32(readableData, offset); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 290 | CHECK(entityDeclId == 1); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 291 | |
| 292 | // Check the profiling GUID |
| 293 | offset += uint32_t_size; |
| 294 | uint64_t readProfilingGuid = ReadUint64(readableData, offset); |
| 295 | |
| 296 | if (guid.has_value()) |
| 297 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 298 | CHECK(readProfilingGuid == guid.value()); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 299 | } |
| 300 | else |
| 301 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 302 | CHECK(readProfilingGuid != ProfilingGuid(0)); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | offset += uint64_t_size; |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 306 | |
| 307 | ProfilingGuid entityGuid(readProfilingGuid); |
| 308 | return entityGuid; |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 309 | } |
| 310 | |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 311 | ProfilingGuid VerifyTimelineEventBinaryPacket(arm::pipe::Optional<uint64_t> timestamp, |
| 312 | arm::pipe::Optional<int> threadId, |
| 313 | arm::pipe::Optional<ProfilingGuid> eventGuid, |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 314 | const unsigned char* readableData, |
| 315 | unsigned int& offset) |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 316 | { |
Jim Flynn | 6730fe9 | 2022-03-10 22:57:47 +0000 | [diff] [blame] | 317 | ARM_PIPE_ASSERT(readableData); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 318 | |
| 319 | // Utils |
| 320 | unsigned int uint32_t_size = sizeof(uint32_t); |
| 321 | unsigned int uint64_t_size = sizeof(uint64_t); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 322 | |
| 323 | // Reading TimelineEventBinaryPacket |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 324 | // Check the decl_id |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 325 | uint32_t entityDeclId = ReadUint32(readableData, offset); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 326 | CHECK(entityDeclId == 4); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 327 | |
| 328 | // Check the timestamp |
| 329 | offset += uint32_t_size; |
| 330 | uint64_t readTimestamp = ReadUint64(readableData, offset); |
| 331 | if (timestamp.has_value()) |
| 332 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 333 | CHECK(readTimestamp == timestamp.value()); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 334 | } |
| 335 | else |
| 336 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 337 | CHECK(readTimestamp != 0); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 338 | } |
| 339 | |
| 340 | // Check the thread id |
| 341 | offset += uint64_t_size; |
Colm Donelan | 5bb3d8a | 2020-05-12 16:36:46 +0100 | [diff] [blame] | 342 | std::vector<uint8_t> readThreadId(ThreadIdSize, 0); |
| 343 | ReadBytes(readableData, offset, ThreadIdSize, readThreadId.data()); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 344 | if (threadId.has_value()) |
| 345 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 346 | CHECK(readThreadId == threadId.value()); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 347 | } |
| 348 | else |
| 349 | { |
Jim Flynn | 9c85b41 | 2022-03-16 00:27:43 +0000 | [diff] [blame] | 350 | CHECK(readThreadId == arm::pipe::GetCurrentThreadId()); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | // Check the event GUID |
Colm Donelan | 5bb3d8a | 2020-05-12 16:36:46 +0100 | [diff] [blame] | 354 | offset += ThreadIdSize; |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 355 | uint64_t readEventGuid = ReadUint64(readableData, offset); |
| 356 | if (eventGuid.has_value()) |
| 357 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 358 | CHECK(readEventGuid == eventGuid.value()); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 359 | } |
| 360 | else |
| 361 | { |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 362 | CHECK(readEventGuid != ProfilingGuid(0)); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | offset += uint64_t_size; |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 366 | |
| 367 | ProfilingGuid eventid(readEventGuid); |
| 368 | return eventid; |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 369 | } |
| 370 | |
| 371 | void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) |
| 372 | { |
| 373 | using namespace armnn; |
| 374 | |
| 375 | // Create runtime in which test will run |
| 376 | armnn::IRuntime::CreationOptions options; |
| 377 | options.m_ProfilingOptions.m_EnableProfiling = true; |
Keith Davis | 33ed221 | 2020-03-30 10:43:41 +0100 | [diff] [blame] | 378 | options.m_ProfilingOptions.m_TimelineEnabled = true; |
Kevin May | d92a6e4 | 2021-02-04 10:27:41 +0000 | [diff] [blame] | 379 | armnn::RuntimeImpl runtime(options); |
Jim Flynn | 4c9ed1d | 2022-01-23 23:57:20 +0000 | [diff] [blame] | 380 | GetProfilingService(&runtime).ResetExternalProfilingOptions( |
| 381 | ConvertExternalProfilingOptions(options.m_ProfilingOptions), false); |
Keith Davis | 33ed221 | 2020-03-30 10:43:41 +0100 | [diff] [blame] | 382 | |
Jim Flynn | 3443025 | 2022-03-04 15:03:58 +0000 | [diff] [blame] | 383 | ArmNNProfilingServiceInitialiser initialiser; |
| 384 | ProfilingServiceRuntimeHelper profilingServiceHelper( |
| 385 | arm::pipe::MAX_ARMNN_COUNTER, initialiser, GetProfilingService(&runtime)); |
Keith Davis | 33ed221 | 2020-03-30 10:43:41 +0100 | [diff] [blame] | 386 | profilingServiceHelper.ForceTransitionToState(ProfilingState::NotConnected); |
| 387 | profilingServiceHelper.ForceTransitionToState(ProfilingState::WaitingForAck); |
| 388 | profilingServiceHelper.ForceTransitionToState(ProfilingState::Active); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 389 | |
| 390 | // build up the structure of the network |
| 391 | INetworkPtr net(INetwork::Create()); |
| 392 | |
| 393 | // Convolution details |
| 394 | TensorInfo inputInfo({ 1, 2, 5, 1 }, DataType::Float32); |
Cathal Corbett | 5b8093c | 2021-10-22 11:12:07 +0100 | [diff] [blame] | 395 | TensorInfo weightInfo({ 3, 2, 3, 1 }, DataType::Float32, 0.0f, 0, true); |
| 396 | TensorInfo biasInfo({ 3 }, DataType::Float32, 0.0f, 0, true); |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 397 | TensorInfo outputInfo({ 1, 3, 7, 1 }, DataType::Float32); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 398 | std::vector<float> weightsData{ |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 399 | 1.0f, 0.0f, 0.0f, |
| 400 | 0.0f, 2.0f, -1.5f, |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 401 | |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 402 | 0.0f, 0.0f, 0.0f, |
| 403 | 0.2f, 0.2f, 0.2f, |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 404 | |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 405 | 0.5f, 0.0f, 0.5f, |
| 406 | 0.0f, -1.0f, 0.0f |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 407 | }; |
| 408 | ConstTensor weights(weightInfo, weightsData); |
| 409 | |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 410 | armnn::Optional<ConstTensor> optionalBiases; |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 411 | std::vector<float> biasesData{ 1.0f, 0.0f, 0.0f }; |
| 412 | ConstTensor biases(biasInfo, biasesData); |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 413 | optionalBiases = armnn::Optional<ConstTensor>(biases); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 414 | |
| 415 | // Input layer |
| 416 | IConnectableLayer* input = net->AddInputLayer(0, "input"); |
| 417 | |
| 418 | // Convolution2d layer |
| 419 | Convolution2dDescriptor conv2dDesc; |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 420 | conv2dDesc.m_StrideX = 1; |
| 421 | conv2dDesc.m_StrideY = 1; |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 422 | conv2dDesc.m_PadLeft = 0; |
| 423 | conv2dDesc.m_PadRight = 0; |
| 424 | conv2dDesc.m_PadTop = 2; |
| 425 | conv2dDesc.m_PadBottom = 2; |
| 426 | conv2dDesc.m_BiasEnabled = true; |
Keith Davis | 721e629 | 2022-05-17 10:06:53 +0100 | [diff] [blame] | 427 | |
| 428 | IConnectableLayer* conv2d = net->AddConvolution2dLayer(conv2dDesc); |
| 429 | |
| 430 | armnn::IConnectableLayer* weightsLayer = net->AddConstantLayer(weights, "Weights"); |
| 431 | armnn::IConnectableLayer* biasLayer = net->AddConstantLayer(biases, "Bias"); |
| 432 | |
| 433 | weightsLayer->GetOutputSlot(0).SetTensorInfo(weightInfo); |
| 434 | weightsLayer->GetOutputSlot(0).Connect(conv2d->GetInputSlot(1u)); |
| 435 | |
| 436 | biasLayer->GetOutputSlot(0).SetTensorInfo(biasInfo); |
| 437 | biasLayer->GetOutputSlot(0).Connect(conv2d->GetInputSlot(2u)); |
| 438 | |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 439 | // Abs layer |
| 440 | armnn::ElementwiseUnaryDescriptor absDesc; |
| 441 | armnn::IConnectableLayer* const abs = net->AddElementwiseUnaryLayer(absDesc, "abs"); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 442 | |
| 443 | // Output layer |
| 444 | IConnectableLayer* output = net->AddOutputLayer(0, "output"); |
| 445 | |
| 446 | input->GetOutputSlot(0).Connect(conv2d->GetInputSlot(0)); |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 447 | conv2d->GetOutputSlot(0).Connect(abs->GetInputSlot(0)); |
| 448 | abs->GetOutputSlot(0).Connect(output->GetInputSlot(0)); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 449 | |
| 450 | input->GetOutputSlot(0).SetTensorInfo(inputInfo); |
| 451 | conv2d->GetOutputSlot(0).SetTensorInfo(outputInfo); |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 452 | abs->GetOutputSlot(0).SetTensorInfo(outputInfo); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 453 | |
| 454 | // optimize the network |
| 455 | std::vector<armnn::BackendId> backends = { backendId }; |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 456 | IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime.GetDeviceSpec()); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 457 | |
| 458 | ProfilingGuid optNetGuid = optNet->GetGuid(); |
| 459 | |
| 460 | // Load it into the runtime. It should success. |
| 461 | armnn::NetworkId netId; |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 462 | CHECK(runtime.LoadNetwork(netId, std::move(optNet)) == Status::Success); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 463 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 464 | BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 465 | auto readableBuffer = bufferManager.GetReadableBuffer(); |
| 466 | |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 467 | // Profiling is enabled, the post-optimisation structure should be created |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 468 | CHECK(readableBuffer != nullptr); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 469 | unsigned int size = readableBuffer->GetSize(); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 470 | |
| 471 | const unsigned char* readableData = readableBuffer->GetReadableData(); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 472 | CHECK(readableData != nullptr); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 473 | |
| 474 | unsigned int offset = 0; |
| 475 | |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 476 | // Verify Header |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 477 | VerifyTimelineHeaderBinary(readableData, offset, size - 8); |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 478 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 479 | // Post-optimisation network |
| 480 | // Network entity |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 481 | VerifyTimelineEntityBinaryPacketData(optNetGuid, readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 482 | |
| 483 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 484 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 485 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 486 | optNetGuid, |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 487 | LabelsAndEventClasses::NETWORK_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 488 | LabelsAndEventClasses::TYPE_GUID, |
| 489 | readableData, |
| 490 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 491 | |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 492 | // Network - START OF LIFE |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 493 | ProfilingGuid networkSolEventGuid = VerifyTimelineEventBinaryPacket(arm::pipe::EmptyOptional(), |
| 494 | arm::pipe::EmptyOptional(), |
| 495 | arm::pipe::EmptyOptional(), |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 496 | readableData, |
| 497 | offset); |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 498 | |
| 499 | // Network - START OF LIFE event relationship |
| 500 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 501 | arm::pipe::EmptyOptional(), |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 502 | optNetGuid, |
| 503 | networkSolEventGuid, |
| 504 | LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, |
| 505 | readableData, |
| 506 | offset); |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 507 | |
| 508 | // Process ID Label |
Jim Flynn | 9c85b41 | 2022-03-16 00:27:43 +0000 | [diff] [blame] | 509 | int processID = arm::pipe::GetCurrentProcessId(); |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 510 | std::stringstream ss; |
| 511 | ss << processID; |
| 512 | std::string processIdLabel = ss.str(); |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 513 | VerifyTimelineLabelBinaryPacketData( |
| 514 | arm::pipe::EmptyOptional(), processIdLabel, readableData, offset); |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 515 | |
| 516 | // Entity - Process ID relationship |
| 517 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 518 | arm::pipe::EmptyOptional(), |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 519 | optNetGuid, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 520 | arm::pipe::EmptyOptional(), |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 521 | LabelsAndEventClasses::PROCESS_ID_GUID, |
| 522 | readableData, |
| 523 | offset); |
Jim Flynn | f771321 | 2020-07-14 09:50:59 +0100 | [diff] [blame] | 524 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 525 | // Input layer |
| 526 | // Input layer entity |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 527 | VerifyTimelineEntityBinaryPacketData(input->GetGuid(), readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 528 | // Name Entity |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 529 | ProfilingGuid inputLabelGuid = VerifyTimelineLabelBinaryPacketData( |
| 530 | arm::pipe::EmptyOptional(), "input", readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 531 | |
| 532 | // Entity - Name relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 533 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 534 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 535 | input->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 536 | inputLabelGuid, |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 537 | LabelsAndEventClasses::NAME_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 538 | readableData, |
| 539 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 540 | |
| 541 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 542 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 543 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 544 | input->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 545 | LabelsAndEventClasses::LAYER_GUID, |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 546 | LabelsAndEventClasses::TYPE_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 547 | readableData, |
| 548 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 549 | |
| 550 | // Network - Input layer relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 551 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 552 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 553 | optNetGuid, |
| 554 | input->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 555 | LabelsAndEventClasses::CHILD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 556 | readableData, |
| 557 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 558 | |
Keith Davis | b4dd5cc | 2022-04-07 11:32:00 +0100 | [diff] [blame] | 559 | // Weights layer |
| 560 | // We will not check the GUID from the packets since we haven't direct access to the layer |
| 561 | // The GUID will change depending on the number of tests ran since we do are not explicitly resetting the |
| 562 | // ProfilingGuid counter at the beginning of this test |
| 563 | |
| 564 | |
| 565 | // Weights layer entity |
| 566 | VerifyTimelineEntityBinaryPacketData( arm::pipe::EmptyOptional(), readableData, offset); |
| 567 | |
| 568 | // Name entity |
| 569 | ProfilingGuid weightsNameLabelGuid = VerifyTimelineLabelBinaryPacketData( |
| 570 | arm::pipe::EmptyOptional(), "Weights", readableData, offset); |
| 571 | |
| 572 | // Entity - Name relationship |
| 573 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
| 574 | arm::pipe::EmptyOptional(), |
| 575 | arm::pipe::EmptyOptional(), |
| 576 | weightsNameLabelGuid, |
| 577 | LabelsAndEventClasses::NAME_GUID, |
| 578 | readableData, |
| 579 | offset); |
| 580 | |
| 581 | // Entity - Type relationship |
| 582 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
| 583 | arm::pipe::EmptyOptional(), |
| 584 | arm::pipe::EmptyOptional(), |
| 585 | LabelsAndEventClasses::LAYER_GUID, |
| 586 | LabelsAndEventClasses::TYPE_GUID, |
| 587 | readableData, |
| 588 | offset); |
| 589 | |
| 590 | // Network - Weights layer relationship |
| 591 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
| 592 | arm::pipe::EmptyOptional(), |
| 593 | optNetGuid, |
| 594 | arm::pipe::EmptyOptional(), |
| 595 | LabelsAndEventClasses::CHILD_GUID, |
| 596 | readableData, |
| 597 | offset); |
| 598 | |
| 599 | // Weights workload |
| 600 | // Weights workload entity |
| 601 | ProfilingGuid weightsWorkloadGuid = VerifyTimelineEntityBinaryPacketData( |
| 602 | arm::pipe::EmptyOptional(), readableData, offset); |
| 603 | |
| 604 | // Entity - Type relationship |
| 605 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
| 606 | arm::pipe::EmptyOptional(), |
| 607 | weightsWorkloadGuid, |
| 608 | LabelsAndEventClasses::WORKLOAD_GUID, |
| 609 | LabelsAndEventClasses::TYPE_GUID, |
| 610 | readableData, |
| 611 | offset); |
| 612 | |
| 613 | // BackendId entity |
| 614 | ProfilingGuid backendIdLabelGuid = VerifyTimelineLabelBinaryPacketData( |
| 615 | arm::pipe::EmptyOptional(), backendId.Get(), readableData, offset); |
| 616 | |
| 617 | // Entity - BackendId relationship |
| 618 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
| 619 | arm::pipe::EmptyOptional(), |
| 620 | weightsWorkloadGuid, |
| 621 | backendIdLabelGuid, |
| 622 | LabelsAndEventClasses::BACKENDID_GUID, |
| 623 | readableData, |
| 624 | offset); |
| 625 | |
| 626 | |
| 627 | // Weights layer - Weights workload relationship |
| 628 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
| 629 | arm::pipe::EmptyOptional(), |
| 630 | arm::pipe::EmptyOptional(), |
| 631 | weightsWorkloadGuid, |
| 632 | LabelsAndEventClasses::CHILD_GUID, |
| 633 | readableData, |
| 634 | offset); |
| 635 | |
| 636 | // Bias layer |
| 637 | // We will not check the GUID from the packets since we haven't direct access to the layer |
| 638 | // The GUID will change depending on the number of tests ran since we do are not explicitly resetting the |
| 639 | // ProfilingGuid counter at the beginning of this test |
| 640 | |
| 641 | // Bias layer entity |
| 642 | VerifyTimelineEntityBinaryPacketData(arm::pipe::EmptyOptional(), readableData, offset); |
| 643 | |
| 644 | // Name entity |
| 645 | ProfilingGuid biasNameLabelGuid = VerifyTimelineLabelBinaryPacketData( |
| 646 | arm::pipe::EmptyOptional(), "Bias", readableData, offset); |
| 647 | |
| 648 | // Entity - Name relationship |
| 649 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
| 650 | arm::pipe::EmptyOptional(), |
| 651 | arm::pipe::EmptyOptional(), |
| 652 | biasNameLabelGuid, |
| 653 | LabelsAndEventClasses::NAME_GUID, |
| 654 | readableData, |
| 655 | offset); |
| 656 | |
| 657 | // Entity - Type relationship |
| 658 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
| 659 | arm::pipe::EmptyOptional(), |
| 660 | arm::pipe::EmptyOptional(), |
| 661 | LabelsAndEventClasses::LAYER_GUID, |
| 662 | LabelsAndEventClasses::TYPE_GUID, |
| 663 | readableData, |
| 664 | offset); |
| 665 | |
| 666 | // Network - Bias layer relationship |
| 667 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
| 668 | arm::pipe::EmptyOptional(), |
| 669 | optNetGuid, |
| 670 | arm::pipe::EmptyOptional(), |
| 671 | LabelsAndEventClasses::CHILD_GUID, |
| 672 | readableData, |
| 673 | offset); |
| 674 | |
| 675 | // Bias workload |
| 676 | // Bias workload entity |
| 677 | ProfilingGuid biasWorkloadGuid = VerifyTimelineEntityBinaryPacketData( |
| 678 | arm::pipe::EmptyOptional(), readableData, offset); |
| 679 | |
| 680 | // Entity - Type relationship |
| 681 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
| 682 | arm::pipe::EmptyOptional(), |
| 683 | biasWorkloadGuid, |
| 684 | LabelsAndEventClasses::WORKLOAD_GUID, |
| 685 | LabelsAndEventClasses::TYPE_GUID, |
| 686 | readableData, |
| 687 | offset); |
| 688 | |
| 689 | // BackendId entity |
| 690 | backendIdLabelGuid = VerifyTimelineLabelBinaryPacketData( |
| 691 | arm::pipe::EmptyOptional(), backendId.Get(), readableData, offset); |
| 692 | |
| 693 | // Entity - BackendId relationship |
| 694 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
| 695 | arm::pipe::EmptyOptional(), |
| 696 | biasWorkloadGuid, |
| 697 | backendIdLabelGuid, |
| 698 | LabelsAndEventClasses::BACKENDID_GUID, |
| 699 | readableData, |
| 700 | offset); |
| 701 | |
| 702 | |
| 703 | // Bias layer - Bias workload relationship |
| 704 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
| 705 | arm::pipe::EmptyOptional(), |
| 706 | arm::pipe::EmptyOptional(), |
| 707 | biasWorkloadGuid, |
| 708 | LabelsAndEventClasses::CHILD_GUID, |
| 709 | readableData, |
| 710 | offset); |
| 711 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 712 | // Conv2d layer |
| 713 | // Conv2d layer entity |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 714 | VerifyTimelineEntityBinaryPacketData(conv2d->GetGuid(), readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 715 | |
| 716 | // Name entity |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 717 | ProfilingGuid conv2dNameLabelGuid = VerifyTimelineLabelBinaryPacketData( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 718 | arm::pipe::EmptyOptional(), "<Unnamed>", readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 719 | |
| 720 | // Entity - Name relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 721 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 722 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 723 | conv2d->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 724 | conv2dNameLabelGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 725 | LabelsAndEventClasses::NAME_GUID, |
| 726 | readableData, |
| 727 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 728 | |
| 729 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 730 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 731 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 732 | conv2d->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 733 | LabelsAndEventClasses::LAYER_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 734 | LabelsAndEventClasses::TYPE_GUID, |
| 735 | readableData, |
| 736 | offset); |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 737 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 738 | // Network - Conv2d layer relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 739 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 740 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 741 | optNetGuid, |
| 742 | conv2d->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 743 | LabelsAndEventClasses::CHILD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 744 | readableData, |
| 745 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 746 | |
| 747 | // Input layer - Conv2d layer relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 748 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 749 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 750 | input->GetGuid(), |
| 751 | conv2d->GetGuid(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 752 | LabelsAndEventClasses::CONNECTION_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 753 | readableData, |
| 754 | offset); |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 755 | |
Keith Davis | b4dd5cc | 2022-04-07 11:32:00 +0100 | [diff] [blame] | 756 | // Weights layer - Conv2d layer relationship |
| 757 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
| 758 | arm::pipe::EmptyOptional(), |
| 759 | arm::pipe::EmptyOptional(), |
| 760 | conv2d->GetGuid(), |
| 761 | LabelsAndEventClasses::CONNECTION_GUID, |
| 762 | readableData, |
| 763 | offset); |
| 764 | |
| 765 | // Bias layer - Conv2d layer relationship |
| 766 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
| 767 | arm::pipe::EmptyOptional(), |
| 768 | arm::pipe::EmptyOptional(), |
| 769 | conv2d->GetGuid(), |
| 770 | LabelsAndEventClasses::CONNECTION_GUID, |
| 771 | readableData, |
| 772 | offset); |
| 773 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 774 | // Conv2d workload |
| 775 | // Conv2d workload entity |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 776 | ProfilingGuid conv2DWorkloadGuid = VerifyTimelineEntityBinaryPacketData( |
| 777 | arm::pipe::EmptyOptional(), readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 778 | |
| 779 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 780 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 781 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 782 | conv2DWorkloadGuid, |
| 783 | LabelsAndEventClasses::WORKLOAD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 784 | LabelsAndEventClasses::TYPE_GUID, |
| 785 | readableData, |
| 786 | offset); |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 787 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 788 | // BackendId entity |
Keith Davis | b4dd5cc | 2022-04-07 11:32:00 +0100 | [diff] [blame] | 789 | backendIdLabelGuid = VerifyTimelineLabelBinaryPacketData( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 790 | arm::pipe::EmptyOptional(), backendId.Get(), readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 791 | |
| 792 | // Entity - BackendId relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 793 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 794 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 795 | conv2DWorkloadGuid, |
| 796 | backendIdLabelGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 797 | LabelsAndEventClasses::BACKENDID_GUID, |
| 798 | readableData, |
| 799 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 800 | |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 801 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 802 | // Conv2d layer - Conv2d workload relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 803 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 804 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 805 | conv2d->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 806 | conv2DWorkloadGuid, |
| 807 | LabelsAndEventClasses::CHILD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 808 | readableData, |
| 809 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 810 | |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 811 | // Abs layer |
| 812 | // Abs layer entity |
| 813 | VerifyTimelineEntityBinaryPacketData(abs->GetGuid(), readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 814 | |
| 815 | // Name entity |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 816 | ProfilingGuid absLabelGuid = VerifyTimelineLabelBinaryPacketData( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 817 | arm::pipe::EmptyOptional(), "abs", readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 818 | |
| 819 | // Entity - Name relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 820 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 821 | arm::pipe::EmptyOptional(), |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 822 | abs->GetGuid(), |
| 823 | absLabelGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 824 | LabelsAndEventClasses::NAME_GUID, |
| 825 | readableData, |
| 826 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 827 | |
| 828 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 829 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 830 | arm::pipe::EmptyOptional(), |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 831 | abs->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 832 | LabelsAndEventClasses::LAYER_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 833 | LabelsAndEventClasses::TYPE_GUID, |
| 834 | readableData, |
| 835 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 836 | |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 837 | // Network - Abs layer relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 838 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 839 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 840 | optNetGuid, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 841 | abs->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 842 | LabelsAndEventClasses::CHILD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 843 | readableData, |
| 844 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 845 | |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 846 | // Conv2d layer - Abs layer relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 847 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 848 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 849 | conv2d->GetGuid(), |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 850 | abs->GetGuid(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 851 | LabelsAndEventClasses::CONNECTION_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 852 | readableData, |
| 853 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 854 | |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 855 | // Abs workload |
| 856 | // Abs workload entity |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 857 | ProfilingGuid absWorkloadGuid = VerifyTimelineEntityBinaryPacketData( |
| 858 | arm::pipe::EmptyOptional(), readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 859 | |
| 860 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 861 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 862 | arm::pipe::EmptyOptional(), |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 863 | absWorkloadGuid, |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 864 | LabelsAndEventClasses::WORKLOAD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 865 | LabelsAndEventClasses::TYPE_GUID, |
| 866 | readableData, |
| 867 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 868 | |
| 869 | // BackendId entity |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 870 | VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), backendId.Get(), readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 871 | |
| 872 | // Entity - BackendId relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 873 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 874 | arm::pipe::EmptyOptional(), |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 875 | absWorkloadGuid, |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 876 | backendIdLabelGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 877 | LabelsAndEventClasses::BACKENDID_GUID, |
| 878 | readableData, |
| 879 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 880 | |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 881 | // Abs layer - Abs workload relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 882 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 883 | arm::pipe::EmptyOptional(), |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 884 | abs->GetGuid(), |
| 885 | absWorkloadGuid, |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 886 | LabelsAndEventClasses::CHILD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 887 | readableData, |
| 888 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 889 | |
| 890 | // Output layer |
| 891 | // Output layer entity |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 892 | VerifyTimelineEntityBinaryPacketData(output->GetGuid(), readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 893 | |
| 894 | // Name entity |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 895 | ProfilingGuid outputLabelGuid = VerifyTimelineLabelBinaryPacketData( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 896 | arm::pipe::EmptyOptional(), "output", readableData, offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 897 | |
| 898 | // Entity - Name relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 899 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 900 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 901 | output->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 902 | outputLabelGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 903 | LabelsAndEventClasses::NAME_GUID, |
| 904 | readableData, |
| 905 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 906 | |
| 907 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 908 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 909 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 910 | output->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 911 | LabelsAndEventClasses::LAYER_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 912 | LabelsAndEventClasses::TYPE_GUID, |
| 913 | readableData, |
| 914 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 915 | |
| 916 | // Network - Output layer relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 917 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 918 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 919 | optNetGuid, |
| 920 | output->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 921 | LabelsAndEventClasses::CHILD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 922 | readableData, |
| 923 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 924 | |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 925 | // Abs layer - Output layer relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 926 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 927 | arm::pipe::EmptyOptional(), |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 928 | abs->GetGuid(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 929 | output->GetGuid(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 930 | LabelsAndEventClasses::CONNECTION_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 931 | readableData, |
| 932 | offset); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 933 | |
| 934 | bufferManager.MarkRead(readableBuffer); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 935 | |
| 936 | // Creates structures for input & output. |
| 937 | std::vector<float> inputData(inputInfo.GetNumElements()); |
| 938 | std::vector<float> outputData(outputInfo.GetNumElements()); |
| 939 | |
Cathal Corbett | 5b8093c | 2021-10-22 11:12:07 +0100 | [diff] [blame] | 940 | TensorInfo inputTensorInfo = runtime.GetInputTensorInfo(netId, 0); |
| 941 | inputTensorInfo.SetConstant(true); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 942 | InputTensors inputTensors |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 943 | { |
Cathal Corbett | 5b8093c | 2021-10-22 11:12:07 +0100 | [diff] [blame] | 944 | {0, ConstTensor(inputTensorInfo, inputData.data())} |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 945 | }; |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 946 | OutputTensors outputTensors |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 947 | { |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 948 | {0, Tensor(runtime.GetOutputTensorInfo(netId, 0), outputData.data())} |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 949 | }; |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 950 | |
| 951 | // Does the inference. |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 952 | runtime.EnqueueWorkload(netId, inputTensors, outputTensors); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 953 | |
Finn Williams | b6a402f | 2020-03-24 13:46:22 +0000 | [diff] [blame] | 954 | // Get readable buffer for input workload |
| 955 | auto inputReadableBuffer = bufferManager.GetReadableBuffer(); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 956 | CHECK(inputReadableBuffer != nullptr); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 957 | |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 958 | // Get readable buffer for output workload |
| 959 | auto outputReadableBuffer = bufferManager.GetReadableBuffer(); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 960 | CHECK(outputReadableBuffer != nullptr); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 961 | |
Finn Williams | b6a402f | 2020-03-24 13:46:22 +0000 | [diff] [blame] | 962 | // Get readable buffer for inference timeline |
| 963 | auto inferenceReadableBuffer = bufferManager.GetReadableBuffer(); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 964 | CHECK(inferenceReadableBuffer != nullptr); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 965 | |
| 966 | // Validate input workload data |
| 967 | size = inputReadableBuffer->GetSize(); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 968 | CHECK(size == 164); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 969 | |
| 970 | readableData = inputReadableBuffer->GetReadableData(); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 971 | CHECK(readableData != nullptr); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 972 | |
| 973 | offset = 0; |
| 974 | |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 975 | // Verify Header |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 976 | VerifyTimelineHeaderBinary(readableData, offset, 156); |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 977 | |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 978 | // Input workload |
| 979 | // Input workload entity |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 980 | ProfilingGuid inputWorkloadGuid = VerifyTimelineEntityBinaryPacketData( |
| 981 | arm::pipe::EmptyOptional(), readableData, offset); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 982 | |
| 983 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 984 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 985 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 986 | inputWorkloadGuid, |
| 987 | LabelsAndEventClasses::WORKLOAD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 988 | LabelsAndEventClasses::TYPE_GUID, |
| 989 | readableData, |
| 990 | offset); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 991 | |
| 992 | // BackendId entity |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 993 | VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), backendId.Get(), readableData, offset); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 994 | |
| 995 | // Entity - BackendId relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 996 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 997 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 998 | inputWorkloadGuid, |
| 999 | backendIdLabelGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1000 | LabelsAndEventClasses::BACKENDID_GUID, |
| 1001 | readableData, |
| 1002 | offset); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 1003 | |
| 1004 | // Input layer - Input workload relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1005 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1006 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1007 | input->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1008 | inputWorkloadGuid, |
| 1009 | LabelsAndEventClasses::CHILD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1010 | readableData, |
| 1011 | offset); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 1012 | |
| 1013 | bufferManager.MarkRead(inputReadableBuffer); |
| 1014 | |
| 1015 | // Validate output workload data |
| 1016 | size = outputReadableBuffer->GetSize(); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 1017 | CHECK(size == 164); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 1018 | |
| 1019 | readableData = outputReadableBuffer->GetReadableData(); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 1020 | CHECK(readableData != nullptr); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 1021 | |
| 1022 | offset = 0; |
| 1023 | |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1024 | // Verify Header |
Finn Williams | 0a336dc | 2020-05-11 15:39:58 +0100 | [diff] [blame] | 1025 | VerifyTimelineHeaderBinary(readableData, offset, 156); |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1026 | |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 1027 | // Output workload |
| 1028 | // Output workload entity |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1029 | ProfilingGuid outputWorkloadGuid = VerifyTimelineEntityBinaryPacketData( |
| 1030 | arm::pipe::EmptyOptional(), readableData, offset); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 1031 | |
| 1032 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1033 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1034 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1035 | outputWorkloadGuid, |
| 1036 | LabelsAndEventClasses::WORKLOAD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1037 | LabelsAndEventClasses::TYPE_GUID, |
| 1038 | readableData, |
| 1039 | offset); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 1040 | |
| 1041 | // BackendId entity |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1042 | VerifyTimelineLabelBinaryPacketData(arm::pipe::EmptyOptional(), backendId.Get(), readableData, offset); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 1043 | |
| 1044 | // Entity - BackendId relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1045 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1046 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1047 | outputWorkloadGuid, |
| 1048 | backendIdLabelGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1049 | LabelsAndEventClasses::BACKENDID_GUID, |
| 1050 | readableData, |
| 1051 | offset); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 1052 | |
| 1053 | // Output layer - Output workload relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1054 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1055 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1056 | output->GetGuid(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1057 | outputWorkloadGuid, |
| 1058 | LabelsAndEventClasses::CHILD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1059 | readableData, |
| 1060 | offset); |
Narumol Prangnawarat | aa68e01 | 2019-11-29 17:17:43 +0000 | [diff] [blame] | 1061 | |
| 1062 | bufferManager.MarkRead(outputReadableBuffer); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1063 | |
| 1064 | // Validate inference data |
| 1065 | size = inferenceReadableBuffer->GetSize(); |
Jan Eilers | a10e2a2 | 2020-03-26 12:04:54 +0000 | [diff] [blame] | 1066 | |
Keith Davis | b4dd5cc | 2022-04-07 11:32:00 +0100 | [diff] [blame] | 1067 | CHECK(size == 1748 + 10 * ThreadIdSize); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1068 | |
| 1069 | readableData = inferenceReadableBuffer->GetReadableData(); |
Sadik Armagan | 1625efc | 2021-06-10 18:24:34 +0100 | [diff] [blame] | 1070 | CHECK(readableData != nullptr); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1071 | |
| 1072 | offset = 0; |
| 1073 | |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1074 | // Verify Header |
Keith Davis | b4dd5cc | 2022-04-07 11:32:00 +0100 | [diff] [blame] | 1075 | VerifyTimelineHeaderBinary(readableData, offset, 1740 + 10 * ThreadIdSize); |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1076 | |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1077 | // Inference timeline trace |
| 1078 | // Inference entity |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1079 | ProfilingGuid inferenceGuid = VerifyTimelineEntityBinaryPacketData( |
| 1080 | arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1081 | |
| 1082 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1083 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1084 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1085 | inferenceGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1086 | LabelsAndEventClasses::INFERENCE_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1087 | LabelsAndEventClasses::TYPE_GUID, |
| 1088 | readableData, |
| 1089 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1090 | |
| 1091 | // Network - Inference relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1092 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1093 | arm::pipe::EmptyOptional(), |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1094 | optNetGuid, |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1095 | inferenceGuid, |
| 1096 | LabelsAndEventClasses::EXECUTION_OF_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1097 | readableData, |
| 1098 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1099 | |
| 1100 | // Start Inference life |
| 1101 | // Event packet - timeline, threadId, eventGuid |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1102 | ProfilingGuid inferenceEventGuid = VerifyTimelineEventBinaryPacket( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1103 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1104 | |
| 1105 | // Inference - event relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1106 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1107 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1108 | inferenceGuid, |
| 1109 | inferenceEventGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1110 | LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, |
| 1111 | readableData, |
| 1112 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1113 | |
| 1114 | // Execution |
| 1115 | // Input workload execution |
| 1116 | // Input workload execution entity |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1117 | ProfilingGuid inputWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1118 | arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1119 | |
| 1120 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1121 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1122 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1123 | inputWorkloadExecutionGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1124 | LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1125 | LabelsAndEventClasses::TYPE_GUID, |
| 1126 | readableData, |
| 1127 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1128 | |
| 1129 | // Inference - Workload execution relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1130 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1131 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1132 | inferenceGuid, |
| 1133 | inputWorkloadExecutionGuid, |
| 1134 | LabelsAndEventClasses::CHILD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1135 | readableData, |
| 1136 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1137 | |
| 1138 | // Workload - Workload execution relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1139 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1140 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1141 | inputWorkloadGuid, |
| 1142 | inputWorkloadExecutionGuid, |
| 1143 | LabelsAndEventClasses::EXECUTION_OF_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1144 | readableData, |
| 1145 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1146 | |
| 1147 | // Start Input workload execution life |
| 1148 | // Event packet - timeline, threadId, eventGuid |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1149 | ProfilingGuid inputWorkloadExecutionSOLEventId = VerifyTimelineEventBinaryPacket( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1150 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1151 | |
| 1152 | // Input workload execution - event relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1153 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1154 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1155 | inputWorkloadExecutionGuid, |
| 1156 | inputWorkloadExecutionSOLEventId, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1157 | LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, |
| 1158 | readableData, |
| 1159 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1160 | |
| 1161 | // End of Input workload execution life |
| 1162 | // Event packet - timeline, threadId, eventGuid |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1163 | ProfilingGuid inputWorkloadExecutionEOLEventId = VerifyTimelineEventBinaryPacket( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1164 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1165 | |
| 1166 | // Input workload execution - event relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1167 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1168 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1169 | inputWorkloadExecutionGuid, |
| 1170 | inputWorkloadExecutionEOLEventId, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1171 | LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, |
| 1172 | readableData, |
| 1173 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1174 | |
Keith Davis | b4dd5cc | 2022-04-07 11:32:00 +0100 | [diff] [blame] | 1175 | // Weights workload execution |
| 1176 | // Weights workload execution entity |
| 1177 | ProfilingGuid weightsWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( |
| 1178 | arm::pipe::EmptyOptional(), readableData, offset); |
| 1179 | |
| 1180 | // Entity - Type relationship |
| 1181 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
| 1182 | arm::pipe::EmptyOptional(), |
| 1183 | weightsWorkloadExecutionGuid, |
| 1184 | LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, |
| 1185 | LabelsAndEventClasses::TYPE_GUID, |
| 1186 | readableData, |
| 1187 | offset); |
| 1188 | |
| 1189 | // Inference - Workload execution relationship |
| 1190 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
| 1191 | arm::pipe::EmptyOptional(), |
| 1192 | inferenceGuid, |
| 1193 | weightsWorkloadExecutionGuid, |
| 1194 | LabelsAndEventClasses::CHILD_GUID, |
| 1195 | readableData, |
| 1196 | offset); |
| 1197 | |
| 1198 | // Workload - Workload execution relationship |
| 1199 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
| 1200 | arm::pipe::EmptyOptional(), |
| 1201 | weightsWorkloadGuid, |
| 1202 | weightsWorkloadExecutionGuid, |
| 1203 | LabelsAndEventClasses::EXECUTION_OF_GUID, |
| 1204 | readableData, |
| 1205 | offset); |
| 1206 | |
| 1207 | // Start Weights workload execution life |
| 1208 | // Event packet - timeline, threadId, eventGuid |
| 1209 | ProfilingGuid weightsWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket( |
| 1210 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
| 1211 | |
| 1212 | // Weights workload execution - event relationship |
| 1213 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
| 1214 | arm::pipe::EmptyOptional(), |
| 1215 | weightsWorkloadExecutionGuid, |
| 1216 | weightsWorkloadExecutionSOLEventGuid, |
| 1217 | LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, |
| 1218 | readableData, |
| 1219 | offset); |
| 1220 | |
| 1221 | // End of Weights workload execution life |
| 1222 | // Event packet - timeline, threadId, eventGuid |
| 1223 | ProfilingGuid weightsWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket( |
| 1224 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
| 1225 | |
| 1226 | // Weights workload execution - event relationship |
| 1227 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
| 1228 | arm::pipe::EmptyOptional(), |
| 1229 | weightsWorkloadExecutionGuid, |
| 1230 | weightsWorkloadExecutionEOLEventGuid, |
| 1231 | LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, |
| 1232 | readableData, |
| 1233 | offset); |
| 1234 | |
| 1235 | // Bias workload execution |
| 1236 | // Bias workload execution entity |
| 1237 | ProfilingGuid biasWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( |
| 1238 | arm::pipe::EmptyOptional(), readableData, offset); |
| 1239 | |
| 1240 | // Entity - Type relationship |
| 1241 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
| 1242 | arm::pipe::EmptyOptional(), |
| 1243 | biasWorkloadExecutionGuid, |
| 1244 | LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, |
| 1245 | LabelsAndEventClasses::TYPE_GUID, |
| 1246 | readableData, |
| 1247 | offset); |
| 1248 | |
| 1249 | // Inference - Workload execution relationship |
| 1250 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
| 1251 | arm::pipe::EmptyOptional(), |
| 1252 | inferenceGuid, |
| 1253 | biasWorkloadExecutionGuid, |
| 1254 | LabelsAndEventClasses::CHILD_GUID, |
| 1255 | readableData, |
| 1256 | offset); |
| 1257 | |
| 1258 | // Workload - Workload execution relationship |
| 1259 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
| 1260 | arm::pipe::EmptyOptional(), |
| 1261 | biasWorkloadGuid, |
| 1262 | biasWorkloadExecutionGuid, |
| 1263 | LabelsAndEventClasses::EXECUTION_OF_GUID, |
| 1264 | readableData, |
| 1265 | offset); |
| 1266 | |
| 1267 | // Start Bias workload execution life |
| 1268 | // Event packet - timeline, threadId, eventGuid |
| 1269 | ProfilingGuid biasWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket( |
| 1270 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
| 1271 | |
| 1272 | // Bias workload execution - event relationship |
| 1273 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
| 1274 | arm::pipe::EmptyOptional(), |
| 1275 | biasWorkloadExecutionGuid, |
| 1276 | biasWorkloadExecutionSOLEventGuid, |
| 1277 | LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, |
| 1278 | readableData, |
| 1279 | offset); |
| 1280 | |
| 1281 | // End of Bias workload execution life |
| 1282 | // Event packet - timeline, threadId, eventGuid |
| 1283 | ProfilingGuid biasWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket( |
| 1284 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
| 1285 | |
| 1286 | // Bias workload execution - event relationship |
| 1287 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
| 1288 | arm::pipe::EmptyOptional(), |
| 1289 | biasWorkloadExecutionGuid, |
| 1290 | biasWorkloadExecutionEOLEventGuid, |
| 1291 | LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, |
| 1292 | readableData, |
| 1293 | offset); |
| 1294 | |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1295 | // Conv2d workload execution |
| 1296 | // Conv2d workload execution entity |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1297 | ProfilingGuid conv2DWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1298 | arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1299 | |
| 1300 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1301 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1302 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1303 | conv2DWorkloadExecutionGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1304 | LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1305 | LabelsAndEventClasses::TYPE_GUID, |
| 1306 | readableData, |
| 1307 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1308 | |
| 1309 | // Inference - Workload execution relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1310 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1311 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1312 | inferenceGuid, |
| 1313 | conv2DWorkloadExecutionGuid, |
| 1314 | LabelsAndEventClasses::CHILD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1315 | readableData, |
| 1316 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1317 | |
| 1318 | // Workload - Workload execution relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1319 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1320 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1321 | conv2DWorkloadGuid, |
| 1322 | conv2DWorkloadExecutionGuid, |
| 1323 | LabelsAndEventClasses::EXECUTION_OF_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1324 | readableData, |
| 1325 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1326 | |
| 1327 | // Start Conv2d workload execution life |
| 1328 | // Event packet - timeline, threadId, eventGuid |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1329 | ProfilingGuid conv2DWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1330 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1331 | |
| 1332 | // Conv2d workload execution - event relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1333 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1334 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1335 | conv2DWorkloadExecutionGuid, |
| 1336 | conv2DWorkloadExecutionSOLEventGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1337 | LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, |
| 1338 | readableData, |
| 1339 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1340 | |
| 1341 | // End of Conv2d workload execution life |
| 1342 | // Event packet - timeline, threadId, eventGuid |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1343 | ProfilingGuid conv2DWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1344 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1345 | |
| 1346 | // Conv2d workload execution - event relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1347 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1348 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1349 | conv2DWorkloadExecutionGuid, |
| 1350 | conv2DWorkloadExecutionEOLEventGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1351 | LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, |
| 1352 | readableData, |
| 1353 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1354 | |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1355 | // Abs workload execution |
| 1356 | // Abs workload execution entity |
| 1357 | ProfilingGuid absWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1358 | arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1359 | |
| 1360 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1361 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1362 | arm::pipe::EmptyOptional(), |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1363 | absWorkloadExecutionGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1364 | LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1365 | LabelsAndEventClasses::TYPE_GUID, |
| 1366 | readableData, |
| 1367 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1368 | |
| 1369 | // Inference - Workload execution relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1370 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1371 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1372 | inferenceGuid, |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1373 | absWorkloadExecutionGuid, |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1374 | LabelsAndEventClasses::CHILD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1375 | readableData, |
| 1376 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1377 | |
| 1378 | // Workload - Workload execution relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1379 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1380 | arm::pipe::EmptyOptional(), |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1381 | absWorkloadGuid, |
| 1382 | absWorkloadExecutionGuid, |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1383 | LabelsAndEventClasses::EXECUTION_OF_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1384 | readableData, |
| 1385 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1386 | |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1387 | // Start Abs workload execution life |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1388 | // Event packet - timeline, threadId, eventGuid |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1389 | ProfilingGuid absWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1390 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1391 | |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1392 | // Abs workload execution - event relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1393 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1394 | arm::pipe::EmptyOptional(), |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1395 | absWorkloadExecutionGuid, |
| 1396 | absWorkloadExecutionSOLEventGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1397 | LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, |
| 1398 | readableData, |
| 1399 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1400 | |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1401 | // End of Abs workload execution life |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1402 | // Event packet - timeline, threadId, eventGuid |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1403 | ProfilingGuid absWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1404 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1405 | |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1406 | // Abs workload execution - event relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1407 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1408 | arm::pipe::EmptyOptional(), |
Mike Kelly | 07810fc | 2020-11-12 10:58:48 +0000 | [diff] [blame] | 1409 | absWorkloadExecutionGuid, |
| 1410 | absWorkloadExecutionEOLEventGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1411 | LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, |
| 1412 | readableData, |
| 1413 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1414 | |
| 1415 | // Output workload execution |
| 1416 | // Output workload execution entity |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1417 | ProfilingGuid outputWorkloadExecutionGuid = VerifyTimelineEntityBinaryPacketData( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1418 | arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1419 | |
| 1420 | // Entity - Type relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1421 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1422 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1423 | outputWorkloadExecutionGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1424 | LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1425 | LabelsAndEventClasses::TYPE_GUID, |
| 1426 | readableData, |
| 1427 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1428 | |
| 1429 | // Inference - Workload execution relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1430 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1431 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1432 | inferenceGuid, |
| 1433 | outputWorkloadExecutionGuid, |
| 1434 | LabelsAndEventClasses::CHILD_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1435 | readableData, |
| 1436 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1437 | |
| 1438 | // Workload - Workload execution relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1439 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1440 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1441 | outputWorkloadGuid, |
| 1442 | outputWorkloadExecutionGuid, |
| 1443 | LabelsAndEventClasses::EXECUTION_OF_GUID, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1444 | readableData, |
| 1445 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1446 | |
| 1447 | // Start Output workload execution life |
| 1448 | // Event packet - timeline, threadId, eventGuid |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1449 | ProfilingGuid outputWorkloadExecutionSOLEventGuid = VerifyTimelineEventBinaryPacket( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1450 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1451 | |
| 1452 | // Output workload execution - event relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1453 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1454 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1455 | outputWorkloadExecutionGuid, |
| 1456 | outputWorkloadExecutionSOLEventGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1457 | LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, |
| 1458 | readableData, |
| 1459 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1460 | |
| 1461 | // End of Normalize workload execution life |
| 1462 | // Event packet - timeline, threadId, eventGuid |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1463 | ProfilingGuid outputWorkloadExecutionEOLEventGuid = VerifyTimelineEventBinaryPacket( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1464 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1465 | |
| 1466 | // Output workload execution - event relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1467 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1468 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1469 | outputWorkloadExecutionGuid, |
| 1470 | outputWorkloadExecutionEOLEventGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1471 | LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, |
| 1472 | readableData, |
| 1473 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1474 | |
| 1475 | // End of Inference life |
| 1476 | // Event packet - timeline, threadId, eventGuid |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1477 | ProfilingGuid inferenceEOLEventGuid = VerifyTimelineEventBinaryPacket( |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1478 | arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), arm::pipe::EmptyOptional(), readableData, offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1479 | |
| 1480 | // Inference - event relationship |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1481 | VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 1482 | arm::pipe::EmptyOptional(), |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1483 | inferenceGuid, |
| 1484 | inferenceEOLEventGuid, |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 1485 | LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, |
| 1486 | readableData, |
| 1487 | offset); |
David Monahan | 6198fe0 | 2019-12-02 08:35:43 +0000 | [diff] [blame] | 1488 | |
| 1489 | bufferManager.MarkRead(inferenceReadableBuffer); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 1490 | } |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1491 | |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 1492 | bool CompareOutput(std::vector<std::string> output, std::vector<std::string> expectedOutput) |
| 1493 | { |
| 1494 | if (output.size() != expectedOutput.size()) |
| 1495 | { |
| 1496 | std::cerr << "output has [" << output.size() << "] lines, expected was [" |
| 1497 | << expectedOutput.size() << "] lines" << std::endl; |
| 1498 | std::cerr << std::endl << "actual" << std::endl << std::endl; |
| 1499 | for (auto line : output) |
| 1500 | { |
| 1501 | std::cerr << line << std::endl; |
| 1502 | } |
| 1503 | std::cerr << std::endl << "expected" << std::endl << std::endl; |
| 1504 | for (auto line : expectedOutput) |
| 1505 | { |
| 1506 | std::cerr << line << std::endl; |
| 1507 | } |
| 1508 | return false; |
| 1509 | } |
| 1510 | bool bRet = true; |
| 1511 | for (unsigned long i = 0; i < output.size(); ++i) |
| 1512 | { |
| 1513 | if (output[i] != expectedOutput[i]) |
| 1514 | { |
| 1515 | bRet = false; |
| 1516 | std::cerr << i << ": actual [" << output[i] << "] expected [" << expectedOutput[i] << "]" << std::endl; |
| 1517 | } |
| 1518 | } |
| 1519 | return bRet; |
| 1520 | } |