From: 김수진/동작제어Lab(SR)/Engineer/삼성전자 Date: Wed, 11 Apr 2018 07:46:46 +0000 (+0900) Subject: Remove unused PreparedModelCallback (#555) X-Git-Tag: 0.1~323 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b13ec03ec6e0838248bac85548e60363e0f1915e;p=platform%2Fcore%2Fml%2Fnnfw.git Remove unused PreparedModelCallback (#555) 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 --- diff --git a/src/runtime/ref/nn/runtime/Callbacks.cpp b/src/runtime/ref/nn/runtime/Callbacks.cpp index 5ae9e5c..b13e20f 100644 --- a/src/runtime/ref/nn/runtime/Callbacks.cpp +++ b/src/runtime/ref/nn/runtime/Callbacks.cpp @@ -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 PreparedModelCallback::notify(ErrorStatus errorStatus, - const sp& preparedModel) { - mErrorStatus = errorStatus; - mPreparedModel = preparedModel; - CallbackBase::notify(); - return Void(); -} - -ErrorStatus PreparedModelCallback::getStatus() { - wait(); - return mErrorStatus; -} - -sp PreparedModelCallback::getPreparedModel() { - wait(); - return mPreparedModel; -} -#endif // REF-ANN ExecutionCallback::ExecutionCallback() : mErrorStatus(ErrorStatus::GENERAL_FAILURE) {} ExecutionCallback::~ExecutionCallback() {} diff --git a/src/runtime/ref/nn/runtime/Callbacks.h b/src/runtime/ref/nn/runtime/Callbacks.h index a64e19c..392bb18 100644 --- a/src/runtime/ref/nn/runtime/Callbacks.h +++ b/src/runtime/ref/nn/runtime/Callbacks.h @@ -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 notify(ErrorStatus status, const sp& 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 getPreparedModel(); - - private: - ErrorStatus mErrorStatus; - sp 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 diff --git a/src/runtime/ref/nn/runtime/ExecutionBuilder.h b/src/runtime/ref/nn/runtime/ExecutionBuilder.h index cdaa824..e42e3af 100644 --- a/src/runtime/ref/nn/runtime/ExecutionBuilder.h +++ b/src/runtime/ref/nn/runtime/ExecutionBuilder.h @@ -28,9 +28,6 @@ #endif #include -#if 0 // REF-ANN -using ::android::hardware::neuralnetworks::V1_0::implementation::PreparedModelCallback; -#endif using ::android::hardware::neuralnetworks::V1_0::implementation::ExecutionCallback; namespace android {