From b9cb84484b29ca588661b542bf8f93a8fb14edc1 Mon Sep 17 00:00:00 2001 From: Derek Lamberti Date: Thu, 28 Nov 2019 13:34:48 +0000 Subject: Catch std::exception instead of armnn::Exception Signed-off-by: Derek Lamberti Change-Id: I89ae4f3b607ccb83f1bf16e085c805d5fc5cf89c --- 1.2/ArmnnDriverImpl.cpp | 10 +++++----- ArmnnDevice.cpp | 6 +++++- ArmnnDriverImpl.cpp | 10 +++++----- ArmnnPreparedModel.cpp | 12 ++++++------ ArmnnPreparedModel_1_2.cpp | 20 ++++++++++---------- ConversionUtils.hpp | 2 +- ModelToINetworkConverter.cpp | 2 +- 7 files changed, 33 insertions(+), 29 deletions(-) diff --git a/1.2/ArmnnDriverImpl.cpp b/1.2/ArmnnDriverImpl.cpp index 6ea9bc43..d369aa27 100644 --- a/1.2/ArmnnDriverImpl.cpp +++ b/1.2/ArmnnDriverImpl.cpp @@ -138,10 +138,10 @@ Return ArmnnDriverImpl::prepareArmnnModel_1_2(const armnn::IRuntime OptOptions, errMessages); } - catch (armnn::Exception &e) + catch (std::exception &e) { std::stringstream message; - message << "armnn::Exception (" << e.what() << ") caught from optimize."; + message << "Exception (" << e.what() << ") caught from optimize."; FailPrepareModel(ErrorStatus::GENERAL_FAILURE, message.str(), cb); return ErrorStatus::NONE; } @@ -173,10 +173,10 @@ Return ArmnnDriverImpl::prepareArmnnModel_1_2(const armnn::IRuntime return FailPrepareModel(ErrorStatus::GENERAL_FAILURE, "Network could not be loaded", cb); } } - catch (armnn::Exception& e) + catch (std::exception& e) { std::stringstream message; - message << "armnn::Exception (" << e.what()<< ") caught from LoadNetwork."; + message << "Exception (" << e.what()<< ") caught from LoadNetwork."; FailPrepareModel(ErrorStatus::GENERAL_FAILURE, message.str(), cb); return ErrorStatus::NONE; } @@ -204,7 +204,7 @@ Return ArmnnDriverImpl::prepareArmnnModel_1_2(const armnn::IRuntime { clTunedParameters->Save(options.GetClTunedParametersFile().c_str()); } - catch (const armnn::Exception& error) + catch (std::exception& error) { ALOGE("ArmnnDriverImpl::prepareModel: Failed to save CL tuned parameters file '%s': %s", options.GetClTunedParametersFile().c_str(), error.what()); diff --git a/ArmnnDevice.cpp b/ArmnnDevice.cpp index a03d9cc9..34019c32 100644 --- a/ArmnnDevice.cpp +++ b/ArmnnDevice.cpp @@ -64,7 +64,7 @@ ArmnnDevice::ArmnnDevice(DriverOptions options) { m_ClTunedParameters->Load(m_Options.GetClTunedParametersFile().c_str()); } - catch (const armnn::Exception& error) + catch (std::exception& error) { // This is only a warning because the file won't exist the first time you are generating it. ALOGW("ArmnnDevice: Failed to load CL tuned parameters file '%s': %s", @@ -77,6 +77,10 @@ ArmnnDevice::ArmnnDevice(DriverOptions options) { ALOGE("ArmnnDevice: Failed to setup CL runtime: %s. Device will be unavailable.", error.what()); } + catch (std::exception& error) + { + ALOGE("ArmnnDevice: Unknown exception: %s. Device will be unavailable.", error.what()); + } #endif runtimeOptions.m_EnableGpuProfiling = m_Options.IsGpuProfilingEnabled(); m_Runtime = armnn::IRuntime::Create(runtimeOptions); diff --git a/ArmnnDriverImpl.cpp b/ArmnnDriverImpl.cpp index de80445a..9fe2c0e7 100644 --- a/ArmnnDriverImpl.cpp +++ b/ArmnnDriverImpl.cpp @@ -108,10 +108,10 @@ Return ArmnnDriverImpl::prepareModel( OptOptions, errMessages); } - catch (armnn::Exception &e) + catch (std::exception &e) { stringstream message; - message << "armnn::Exception (" << e.what() << ") caught from optimize."; + message << "Exception (" << e.what() << ") caught from optimize."; FailPrepareModel(ErrorStatus::GENERAL_FAILURE, message.str(), cb); return ErrorStatus::NONE; } @@ -142,10 +142,10 @@ Return ArmnnDriverImpl::prepareModel( return FailPrepareModel(ErrorStatus::GENERAL_FAILURE, "Network could not be loaded", cb); } } - catch (armnn::Exception& e) + catch (std::exception& e) { stringstream message; - message << "armnn::Exception (" << e.what()<< ") caught from LoadNetwork."; + message << "Exception (" << e.what()<< ") caught from LoadNetwork."; FailPrepareModel(ErrorStatus::GENERAL_FAILURE, message.str(), cb); return ErrorStatus::NONE; } @@ -173,7 +173,7 @@ Return ArmnnDriverImpl::prepareModel( { clTunedParameters->Save(options.GetClTunedParametersFile().c_str()); } - catch (const armnn::Exception& error) + catch (std::exception& error) { ALOGE("ArmnnDriverImpl::prepareModel: Failed to save CL tuned parameters file '%s': %s", options.GetClTunedParametersFile().c_str(), error.what()); diff --git a/ArmnnPreparedModel.cpp b/ArmnnPreparedModel.cpp index 462970aa..2f1abef7 100644 --- a/ArmnnPreparedModel.cpp +++ b/ArmnnPreparedModel.cpp @@ -209,9 +209,9 @@ Return ArmnnPreparedModel::execute(const Request& reque pOutputTensors->emplace_back(i, outputTensor); } } - catch (armnn::Exception& e) + catch (std::exception& e) { - ALOGW("armnn::Exception caught while preparing for EnqueueWorkload: %s", e.what()); + ALOGW("Exception caught while preparing for EnqueueWorkload: %s", e.what()); NotifyCallbackAndCheck(callback, ErrorStatus::GENERAL_FAILURE, "ArmnnPreparedModel::execute"); return ErrorStatus::GENERAL_FAILURE; } @@ -253,9 +253,9 @@ void ArmnnPreparedModel::ExecuteGraph( return; } } - catch (armnn::Exception& e) + catch (std::exception& e) { - ALOGW("armnn::Exception caught from EnqueueWorkload: %s", e.what()); + ALOGW("Exception caught from EnqueueWorkload: %s", e.what()); cb.callback(ErrorStatus::GENERAL_FAILURE, "ArmnnPreparedModel::ExecuteGraph"); return; } @@ -306,9 +306,9 @@ bool ArmnnPreparedModel::ExecuteWithDummyInputs() return false; } } - catch (armnn::Exception& e) + catch (std::exception& e) { - ALOGW("ExecuteWithDummyInputs: armnn::Exception caught from EnqueueWorkload: %s", e.what()); + ALOGW("ExecuteWithDummyInputs: Exception caught from EnqueueWorkload: %s", e.what()); return false; } return true; diff --git a/ArmnnPreparedModel_1_2.cpp b/ArmnnPreparedModel_1_2.cpp index a7997c72..a1e481df 100644 --- a/ArmnnPreparedModel_1_2.cpp +++ b/ArmnnPreparedModel_1_2.cpp @@ -314,9 +314,9 @@ Return ArmnnPreparedModel_1_2::executeSynchronously(const Requ pOutputTensors->emplace_back(i, outputTensor); } } - catch (armnn::Exception& e) + catch (std::exception& e) { - ALOGW("armnn::Exception caught while preparing for EnqueueWorkload: %s", e.what()); + ALOGW("Exception caught while preparing for EnqueueWorkload: %s", e.what()); cb(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming); return Void(); } @@ -345,9 +345,9 @@ Return ArmnnPreparedModel_1_2::executeSynchronously(const Requ return Void(); } } - catch (armnn::Exception& e) + catch (std::exception& e) { - ALOGW("armnn::Exception caught from EnqueueWorkload: %s", e.what()); + ALOGW("Exception caught from EnqueueWorkload: %s", e.what()); cb(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming); return Void(); } @@ -531,9 +531,9 @@ void ArmnnPreparedModel_1_2::ExecuteGraph( return; } } - catch (armnn::Exception& e) + catch (std::exception& e) { - ALOGW("armnn::Exception caught from EnqueueWorkload: %s", e.what()); + ALOGW("Exception caught from EnqueueWorkload: %s", e.what()); cb.callback(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_2::ExecuteGraph"); return; @@ -594,9 +594,9 @@ bool ArmnnPreparedModel_1_2::ExecuteWithDummyInputs() return false; } } - catch (armnn::Exception& e) + catch (std::exception& e) { - ALOGW("ExecuteWithDummyInputs: armnn::Exception caught from EnqueueWorkload: %s", e.what()); + ALOGW("ExecuteWithDummyInputs: Exception caught from EnqueueWorkload: %s", e.what()); return false; } return true; @@ -707,9 +707,9 @@ Return ArmnnPreparedModel_1_2::Execute(const Request& } } } - catch (armnn::Exception& e) + catch (std::exception& e) { - ALOGW("armnn::Exception caught while preparing for EnqueueWorkload: %s", e.what()); + ALOGW("Exception caught while preparing for EnqueueWorkload: %s", e.what()); callback(ErrorStatus::GENERAL_FAILURE, {}, g_NoTiming, "ArmnnPreparedModel_1_2::execute"); return ErrorStatus::GENERAL_FAILURE; } diff --git a/ConversionUtils.hpp b/ConversionUtils.hpp index 9b24dc1d..977a8674 100644 --- a/ConversionUtils.hpp +++ b/ConversionUtils.hpp @@ -1807,7 +1807,7 @@ bool ConvertConcatenation(const HalOperation& operation, const HalModel& model, concatDescriptor = armnn::CreateDescriptorForConcatenation(inputShapes.begin(), inputShapes.end(), concatDim); } - catch (const armnn::Exception& error) + catch (std::exception& error) { return Fail("%s: Error preparing concat descriptor. %s", __func__, error.what()); } diff --git a/ModelToINetworkConverter.cpp b/ModelToINetworkConverter.cpp index 4797ccfd..05e60462 100644 --- a/ModelToINetworkConverter.cpp +++ b/ModelToINetworkConverter.cpp @@ -25,7 +25,7 @@ ModelToINetworkConverter::ModelToINetworkConverter(const std::vector< { Convert(); } - catch (armnn::Exception& e) + catch (std::exception& e) { m_ConversionResult = ConversionResult::UnsupportedFeature; ALOGE("%s: Unexpected exception: %s", __func__, e.what()); -- cgit v1.2.1