From 65c42dc4d68ac163b77a3139feee3e7d4530b5c5 Mon Sep 17 00:00:00 2001 From: Mike Kelly Date: Mon, 22 Jul 2019 14:06:00 +0100 Subject: IVGCVSW-3463 Fix Hal 1.2 Dynamic Output Shape VTS test failures *Updating ArmnnPreparedModel_1_2 to work with output shapes and timing. Change-Id: I06c4ecaf1e2c36ef77a0731ece4885fc3997cd3b Signed-off-by: Sadik Armagan Signed-off-by: Mike Kelly --- ArmnnPreparedModel.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'ArmnnPreparedModel.cpp') diff --git a/ArmnnPreparedModel.cpp b/ArmnnPreparedModel.cpp index 3256836e..462970aa 100644 --- a/ArmnnPreparedModel.cpp +++ b/ArmnnPreparedModel.cpp @@ -87,9 +87,8 @@ using namespace android::hardware; namespace armnn_driver { - template -RequestThread ArmnnPreparedModel::m_RequestThread; +RequestThread ArmnnPreparedModel::m_RequestThread; template template @@ -218,10 +217,17 @@ Return ArmnnPreparedModel::execute(const Request& reque } ALOGV("ArmnnPreparedModel::execute(...) before PostMsg"); + + auto cb = [callback](ErrorStatus errorStatus, std::string callingFunction) + { + NotifyCallbackAndCheck(callback, errorStatus, callingFunction); + }; + + ArmnnCallback_1_0 armnnCb; + armnnCb.callback = cb; // post the request for asynchronous execution - m_RequestThread.PostMsg(this, pMemPools, pInputTensors, pOutputTensors, callback); + m_RequestThread.PostMsg(this, pMemPools, pInputTensors, pOutputTensors, armnnCb); ALOGV("ArmnnPreparedModel::execute(...) after PostMsg"); - return ErrorStatus::NONE; // successfully queued } @@ -230,7 +236,7 @@ void ArmnnPreparedModel::ExecuteGraph( std::shared_ptr>& pMemPools, std::shared_ptr& pInputTensors, std::shared_ptr& pOutputTensors, - const ::android::sp& callback) + ArmnnCallback_1_0 cb) { ALOGV("ArmnnPreparedModel::ExecuteGraph(...)"); @@ -243,14 +249,14 @@ void ArmnnPreparedModel::ExecuteGraph( if (status != armnn::Status::Success) { ALOGW("EnqueueWorkload failed"); - NotifyCallbackAndCheck(callback, ErrorStatus::GENERAL_FAILURE, "ArmnnPreparedModel::ExecuteGraph"); + cb.callback(ErrorStatus::GENERAL_FAILURE, "ArmnnPreparedModel::ExecuteGraph"); return; } } catch (armnn::Exception& e) { ALOGW("armnn::Exception caught from EnqueueWorkload: %s", e.what()); - NotifyCallbackAndCheck(callback, ErrorStatus::GENERAL_FAILURE, "ArmnnPreparedModel::ExecuteGraph"); + cb.callback(ErrorStatus::GENERAL_FAILURE, "ArmnnPreparedModel::ExecuteGraph"); return; } @@ -264,7 +270,7 @@ void ArmnnPreparedModel::ExecuteGraph( pool.update(); } - NotifyCallbackAndCheck(callback, ErrorStatus::NONE, "ExecuteGraph"); + cb.callback(ErrorStatus::NONE, "ExecuteGraph"); } template -- cgit v1.2.1