From df15c4e8a03423188d0598dc1a503c2d7a6d9f4e Mon Sep 17 00:00:00 2001 From: Teresa Charlin Date: Tue, 21 Feb 2023 15:16:09 +0000 Subject: Report errors when running LoadedNetwork in End to End tests Signed-off-by: Teresa Charlin Change-Id: I8d65673580924907db51d903d9054d1b0914493c --- .../backendsCommon/test/EndToEndTestImpl.hpp | 91 ++++++++++++---------- 1 file changed, 49 insertions(+), 42 deletions(-) (limited to 'src/backends') diff --git a/src/backends/backendsCommon/test/EndToEndTestImpl.hpp b/src/backends/backendsCommon/test/EndToEndTestImpl.hpp index 44ae2beb76..795fc13c32 100644 --- a/src/backends/backendsCommon/test/EndToEndTestImpl.hpp +++ b/src/backends/backendsCommon/test/EndToEndTestImpl.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2017 Arm Ltd. All rights reserved. +// Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once @@ -56,7 +56,9 @@ bool ConstantUsageTest(const std::vector& computeDevice, // Loads it into the runtime. NetworkId netId; - runtime->LoadNetwork(netId, std::move(optNet)); + std::string errorMessage; + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); // Creates structures for input & output. std::vector outputData(inputData.size()); @@ -141,7 +143,9 @@ void EndToEndLayerTestImpl(INetworkPtr network, // Loads it into the runtime. NetworkId netId; - runtime->LoadNetwork(netId, std::move(optNet)); + std::string errorMessage; + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); InputTensors inputTensors; inputTensors.reserve(inputTensorData.size()); @@ -211,10 +215,11 @@ inline void ImportNonAlignedInputPointerTest(std::vector backends) // Loads it into the runtime. NetworkId netId; - std::string ignoredErrorMessage; + std::string errorMessage; // Enable Importing INetworkProperties networkProperties(false, MemorySource::Malloc, MemorySource::Undefined); - runtime->LoadNetwork(netId, std::move(optNet), ignoredErrorMessage, networkProperties); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); // Creates structures for input & output std::vector inputData @@ -279,10 +284,11 @@ inline void ExportNonAlignedOutputPointerTest(std::vector backends) // Loads it into the runtime. NetworkId netId; - std::string ignoredErrorMessage; + std::string errorMessage; // Enable Importing and Exporting INetworkProperties networkProperties(false, MemorySource::Malloc, MemorySource::Malloc); - runtime->LoadNetwork(netId, std::move(optNet), ignoredErrorMessage, networkProperties); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); // Creates structures for input & output std::vector inputData @@ -353,10 +359,11 @@ inline void ImportAlignedPointerTest(std::vector backends) // Loads it into the runtime. NetworkId netId; - std::string ignoredErrorMessage; + std::string errorMessage; // Enable Importing INetworkProperties networkProperties(false, MemorySource::Malloc, MemorySource::Malloc); - runtime->LoadNetwork(netId, std::move(optNet), ignoredErrorMessage, networkProperties); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); // Creates structures for input & output std::vector inputData @@ -439,12 +446,10 @@ inline void ImportOnlyWorkload(std::vector backends) INFO("Load Network"); // Load it into the runtime. It should pass. NetworkId netId; - std::string ignoredErrorMessage; - + std::string errorMessage; INetworkProperties networkProperties(false, MemorySource::Malloc, MemorySource::Undefined); - - CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties) - == Status::Success); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); INFO("Generate Data"); // Creates structures for input & output @@ -531,10 +536,10 @@ inline void ExportOnlyWorkload(std::vector backends) INFO("Load Network"); // Load it into the runtime. It should pass. NetworkId netId; - std::string ignoredErrorMessage; + std::string errorMessage; INetworkProperties networkProperties(false, MemorySource::Undefined, MemorySource::Malloc); - CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties) - == Status::Success); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); INFO("Generate Data"); // Creates structures for input & output @@ -621,12 +626,10 @@ inline void ImportAndExportWorkload(std::vector backends) INFO("Load Network"); // Load it into the runtime. It should pass. NetworkId netId; - std::string ignoredErrorMessage; - + std::string errorMessage; INetworkProperties networkProperties(false, MemorySource::Malloc, MemorySource::Malloc); - - CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties) - == Status::Success); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); INFO("Generate Data"); // Creates structures for input & output @@ -716,10 +719,11 @@ inline void ExportOutputWithSeveralOutputSlotConnectionsTest(std::vectorLoadNetwork(netId, std::move(optNet), ignoredErrorMessage, networkProperties); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); // Creates structures for input & output std::vector inputData @@ -852,10 +856,11 @@ inline void ForceImportWithAlignedBuffersEndToEndTest(std::vector bac // Load it into the runtime. It should pass. NetworkId netId; - std::string ignoredErrorMessage; + std::string errorMessage; INetworkProperties networkProperties(false, MemorySource::Undefined, MemorySource::Undefined); - CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties) - == Status::Success); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); + INFO("Generate Data"); // Creates structures for input & output @@ -955,10 +960,11 @@ inline void ForceImportWithMisalignedInputBuffersEndToEndTest(std::vectorLoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties) - == Status::Success); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); + INFO("Generate Data"); // This code looks a little funky but the idea is to create a buffer of floats but offset by the size of a char @@ -1077,10 +1083,11 @@ inline void ForceImportWithMisalignedOutputBuffersEndToEndTest(std::vectorLoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties) - == Status::Success); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); + INFO("Generate Data"); // This code looks a little funky but the idea is to create a buffer of floats but offset by the size of a char @@ -1198,10 +1205,10 @@ inline void ForceImportWithMisalignedInputAndOutputBuffersEndToEndTest(std::vect INFO("Load Network"); // Load it into the runtime. It should pass. NetworkId netId; - std::string ignoredErrorMessage; + std::string errorMessage; INetworkProperties networkProperties(false, MemorySource::Undefined, MemorySource::Undefined); - CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties) - == Status::Success); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); INFO("Generate Data"); // This code looks a little funky but the idea is to create a buffer of floats but offset by the size of a char @@ -1316,10 +1323,10 @@ inline void ForceImportRepeatedInferencesEndToEndTest(std::vector bac INFO("Load Network"); // Load it into the runtime. It should pass. NetworkId netId; - std::string ignoredErrorMessage; + std::string errorMessage; INetworkProperties networkProperties(false, MemorySource::Undefined, MemorySource::Undefined); - CHECK(runtime->LoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties) - == Status::Success); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); INFO("Generate Data"); // Creates structures for input & output @@ -1502,10 +1509,10 @@ inline void ForceImportRepeatedInferencesInvertedEndToEndTest(std::vectorLoadNetwork(netId, std::move(optNet),ignoredErrorMessage, networkProperties) - == Status::Success); + armnn::Status loadingStatus = runtime->LoadNetwork(netId, std::move(optNet), errorMessage, networkProperties); + CHECK_MESSAGE(loadingStatus == Status::Success, errorMessage); INFO("Generate Data"); // This code looks a little funky but the idea is to create a buffer of floats but offset by the size of a char -- cgit v1.2.1