Remove unused PreparedModelCallback (#555)
author김수진/동작제어Lab(SR)/Engineer/삼성전자 <sjsujin.kim@samsung.com>
Wed, 11 Apr 2018 07:46:46 +0000 (16:46 +0900)
committer최형규/동작제어Lab(SR)/Senior Engineer/삼성전자 <hk0110.choi@samsung.com>
Wed, 11 Apr 2018 07:46:46 +0000 (16:46 +0900)
This commit removes unused PreparedModelCallback.
The PreparedModelCallback class is used to receive the error status of preparing a model as well as the prepared model from a task executing  asynchronously with respect to the runtime.
But in the environment of running on CPU only, it is no needed.

If it is needed later, can be copied from AndroidNN or implemented on our own.

Signed-off-by: sjsujinkim <sjsujin.kim@samsung.com>
src/runtime/ref/nn/runtime/Callbacks.cpp
src/runtime/ref/nn/runtime/Callbacks.h
src/runtime/ref/nn/runtime/ExecutionBuilder.h

index 5ae9e5c..b13e20f 100644 (file)
@@ -97,30 +97,7 @@ void CallbackBase::join_thread_locked() {
         mThread.join();
     }
 }
-#if 0 // REF-ANN
-PreparedModelCallback::PreparedModelCallback() :
-        mErrorStatus(ErrorStatus::GENERAL_FAILURE), mPreparedModel(nullptr) {}
 
-PreparedModelCallback::~PreparedModelCallback() {}
-
-Return<void> PreparedModelCallback::notify(ErrorStatus errorStatus,
-                                           const sp<IPreparedModel>& preparedModel) {
-    mErrorStatus = errorStatus;
-    mPreparedModel = preparedModel;
-    CallbackBase::notify();
-    return Void();
-}
-
-ErrorStatus PreparedModelCallback::getStatus() {
-    wait();
-    return mErrorStatus;
-}
-
-sp<IPreparedModel> PreparedModelCallback::getPreparedModel() {
-    wait();
-    return mPreparedModel;
-}
-#endif // REF-ANN
 ExecutionCallback::ExecutionCallback() : mErrorStatus(ErrorStatus::GENERAL_FAILURE) {}
 
 ExecutionCallback::~ExecutionCallback() {}
index a64e19c..392bb18 100644 (file)
@@ -187,82 +187,6 @@ class CallbackBase {
 };
 
 /**
- * The PreparedModelCallback class is used to receive the error status of
- * preparing a model as well as the prepared model from a task executing
- * asynchronously with respect to the runtime. If a calling thread calls wait*
- * or get* on a PreparedModelCallback object and the corresponding asynchronous
- * task has not finished preparing the model, the calling thread will block
- * until the asynchronous task has called notify. For more information on the
- * synchronization behavior, refer to the CallbackBase class.
- *
- * This class inherits the basic blocking and signaling calls from
- * CallbackBase, and implements the HIDL notify call from
- * IPreparedModelCallback. This callback object is passed as an argument to
- * IDevice::prepareModel.
- */
-#if 0 // REF-ANN
-class PreparedModelCallback : public CallbackBase, public IPreparedModelCallback {
- public:
-    PreparedModelCallback();
-    ~PreparedModelCallback() override;
-
-    /**
-     * IPreparedModelCallback::notify marks the callback object with the return
-     * status of the asynchronous model preparation along with the prepared
-     * model, and calls CallbackBase::notify, enabling all prior and future
-     * wait* calls on the PreparedModelCallback object to proceed. For more
-     * information on the synchronization behavior, refer to the CallbackBase
-     * class.
-     *
-     * IPreparedModelCallback::notify must be called exactly once on a given
-     * PreparedModelCallback object.
-     *
-     * @param status Error status returned from asynchronously preparing the
-     *               model; will be:
-     *               - NONE if the asynchronous preparation was successful
-     *               - DEVICE_UNAVAILABLE if driver is offline or busy
-     *               - GENERAL_FAILURE if there is an unspecified error
-     *               - INVALID_ARGUMENT if the input model is invalid
-     * @param preparedModel Returned model that has been prepared for execution,
-     *                      nullptr if the model was unable to be prepared.
-     */
-    Return<void> notify(ErrorStatus status, const sp<IPreparedModel>& preparedModel) override;
-
-    /**
-     * Retrieves the error status returned from the asynchronous task launched
-     * by IDevice::prepareModel. If IDevice::prepareModel has not finished
-     * asynchronously preparing the model, this call will block until the
-     * asynchronous task notifies the object.
-     *
-     * @return status Error status returned from asynchronously preparing the
-     *                model; will be:
-     *                - NONE if the asynchronous preparation was successful
-     *                - DEVICE_UNAVAILABLE if driver is offline or busy
-     *                - GENERAL_FAILURE if there is an unspecified error
-     *                - INVALID_ARGUMENT if the input model is invalid
-     */
-    ErrorStatus getStatus();
-
-    /**
-     * Retrieves the model that has been prepared for execution from the
-     * asynchronous task launched by IDevice::prepareModel. If
-     * IDevice::prepareModel has not finished asynchronously preparing the
-     * model, this call will block until the asynchronous task notifies the
-     * object.
-     *
-     * @return preparedModel Returned model that has been prepared for
-     *                       execution, nullptr if the model was unable to be
-     *                       prepared.
-     */
-    sp<IPreparedModel> getPreparedModel();
-
- private:
-    ErrorStatus        mErrorStatus;
-    sp<IPreparedModel> mPreparedModel;
-};
-#endif // REF-ANN
-
-/**
  * The ExecutionCallback class is used to receive the error status of the
  * execution from a task executing asynchronously with respect to the runtime.
  * If a calling thread calls wait* or get* on a PreparedModelCallback object and
index cdaa824..e42e3af 100644 (file)
@@ -28,9 +28,6 @@
 #endif
 #include <vector>
 
-#if 0 // REF-ANN
-using ::android::hardware::neuralnetworks::V1_0::implementation::PreparedModelCallback;
-#endif
 using ::android::hardware::neuralnetworks::V1_0::implementation::ExecutionCallback;
 
 namespace android {