diff options
author | Xusong Wang <xusongw@google.com> | 2019-02-25 14:33:52 -0800 |
---|---|---|
committer | Xusong Wang <xusongw@google.com> | 2019-03-22 13:16:06 -0700 |
commit | 985bf3e540afb9d020836e7d06c21948725dd611 (patch) | |
tree | 8d9f93af6b0e5bbea1468d213611c97699d9f206 /nn/runtime/test/TestExecution.cpp | |
parent | 985c214cefc0991fc1523deb68740b86594b5e74 (diff) | |
download | ml-985bf3e540afb9d020836e7d06c21948725dd611.tar.gz |
Fix caching interface according to vendor feedback.
There are three major changes
- Instead of isCachingSupport returning a single boolean, switch to
getNumberOfCacheFilesNeeded returning the number of cache files. This
is to support use cases when driver needs more than one cache file for
each type, or when driver does not need data cache.
- Instead of a separate saveToCache, pass cache info along with
prepareModel_1_2 to save into cache as well as perform compilation.
This is to avoid a potential additional copy of cache files.
- Grant RDWR permission for prepareModelFromCache and prepareModel_1_2.
This is for the driver to be able to read/update later, e.g.
multi-stage compilation that does a fast compilation first and refines
later.
Bug: 123780248
Test: NeuralNetworksTest_static
Change-Id: Id370919b742a60bf1f3277c3bc6bda1e8475f1da
Merged-In: Id370919b742a60bf1f3277c3bc6bda1e8475f1da
(cherry picked from commit d83197cb2375acf1fe9955d03a82bdf2905ca418)
Diffstat (limited to 'nn/runtime/test/TestExecution.cpp')
-rw-r--r-- | nn/runtime/test/TestExecution.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/nn/runtime/test/TestExecution.cpp b/nn/runtime/test/TestExecution.cpp index f4791ce2c..5d5efa8ad 100644 --- a/nn/runtime/test/TestExecution.cpp +++ b/nn/runtime/test/TestExecution.cpp @@ -125,11 +125,6 @@ class TestPreparedModel12 : public V1_2::IPreparedModel { } } - Return<ErrorStatus> saveToCache(const hidl_handle&, const hidl_handle&, - const HidlToken&) override { - return ErrorStatus::GENERAL_FAILURE; - } - private: const sp<V1_0::IPreparedModel> mPreparedModelV1_0; const sp<V1_2::IPreparedModel> mPreparedModelV1_2; @@ -188,10 +183,11 @@ class TestDriver12 : public SampleDriver { Return<ErrorStatus> prepareModel_1_2( const HidlModel& model, ExecutionPreference preference, - const sp<IPreparedModelCallback>& actualCallback) override { + const hidl_vec<hidl_handle>& modelCache, const hidl_vec<hidl_handle>& dataCache, + const HidlToken& token, const sp<IPreparedModelCallback>& actualCallback) override { sp<PreparedModelCallback> localCallback = new PreparedModelCallback; - Return<ErrorStatus> prepareModelReturn = - SampleDriver::prepareModel_1_2(model, preference, localCallback); + Return<ErrorStatus> prepareModelReturn = SampleDriver::prepareModel_1_2( + model, preference, modelCache, dataCache, token, localCallback); if (!prepareModelReturn.isOkUnchecked()) { return prepareModelReturn; } |