Replace VersionedInterfaces with neuralnetworks_utils_hal_service
Compared to VersionedInterfaces, the new code
1. does not allow to choose asynchronous execution when synchronous
execution is available, and
2. does not fallback to asynchronous execution when synchronous
execution fails.
Bug: 170289677
Test: NNT_static
Change-Id: Ic03b3071e1d99f446f78ee9a69cd0a839592ec41
Merged-In: Ic03b3071e1d99f446f78ee9a69cd0a839592ec41
(cherry picked from commit c3c4760df0e1503906ce7b5f1456b465d81311f5)
diff --git a/runtime/Callbacks.cpp b/runtime/Callbacks.cpp
index d31098c..a6cfa11 100644
--- a/runtime/Callbacks.cpp
+++ b/runtime/Callbacks.cpp
@@ -91,26 +91,9 @@
// ExecutionCallback methods begin here
-hardware::Return<void> ExecutionCallback::notify(V1_0::ErrorStatus errorStatus) {
- return notifyInternal(false, uncheckedConvert(errorStatus), {}, {});
-}
-
-hardware::Return<void> ExecutionCallback::notify_1_2(
- V1_0::ErrorStatus errorStatus, const hardware::hidl_vec<V1_2::OutputShape>& outputShapes,
- const V1_2::Timing& timing) {
- return notifyInternal(false, uncheckedConvert(errorStatus), uncheckedConvert(outputShapes),
- uncheckedConvert(timing));
-}
-
-hardware::Return<void> ExecutionCallback::notify_1_3(
- V1_3::ErrorStatus errorStatus, const hardware::hidl_vec<V1_2::OutputShape>& outputShapes,
- const V1_2::Timing& timing) {
- return notifyInternal(false, uncheckedConvert(errorStatus), uncheckedConvert(outputShapes),
- uncheckedConvert(timing));
-}
-
-void ExecutionCallback::notifyAsDeadObject() {
- notifyInternal(true, ErrorStatus::GENERAL_FAILURE, {}, {});
+void ExecutionCallback::notify(ErrorStatus status, const std::vector<OutputShape>& outputShapes,
+ const Timing& timing) {
+ notifyInternal(status, outputShapes, timing);
}
void ExecutionCallback::wait() const {
@@ -148,11 +131,6 @@
return mTiming;
}
-bool ExecutionCallback::isDeadObject() const {
- wait();
- return mDeadObject;
-}
-
bool ExecutionCallback::bindThread(std::thread asyncThread) {
std::lock_guard<std::mutex> lock(mMutex);
@@ -198,11 +176,10 @@
mOnFinish = finish;
}
-hardware::Return<void> ExecutionCallback::notifyInternal(bool deadObject, ErrorStatus errorStatus,
- std::vector<OutputShape> outputShapes,
- Timing timing) {
+void ExecutionCallback::notifyInternal(ErrorStatus errorStatus,
+ std::vector<OutputShape> outputShapes, Timing timing) {
// check results
- if (!deadObject) {
+ {
if (errorStatus == ErrorStatus::OUTPUT_INSUFFICIENT_SIZE) {
// outputShapes must not be empty if OUTPUT_INSUFFICIENT_SIZE.
if (outputShapes.size() == 0) {
@@ -231,10 +208,9 @@
// quick-return if object has already been notified
if (mNotified) {
- return hardware::Void();
+ return;
}
- mDeadObject = deadObject;
mErrorStatus = errorStatus;
mOutputShapes = std::move(outputShapes);
mTiming = timing;
@@ -249,7 +225,6 @@
}
}
mCondition.notify_all();
- return hardware::Void();
}
} // namespace android::nn