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