summaryrefslogtreecommitdiff
path: root/nn/runtime/test/TestExecution.cpp
diff options
context:
space:
mode:
authorXusong Wang <xusongw@google.com>2019-02-25 14:33:52 -0800
committerXusong Wang <xusongw@google.com>2019-03-20 17:27:39 -0700
commitd83197cb2375acf1fe9955d03a82bdf2905ca418 (patch)
tree718f7d5a0c79c468aed68752c007a887962f4f6a /nn/runtime/test/TestExecution.cpp
parent377c37389d15cb187f60c14ae5ec06b0dc9c2cb0 (diff)
downloadml-d83197cb2375acf1fe9955d03a82bdf2905ca418.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
Diffstat (limited to 'nn/runtime/test/TestExecution.cpp')
-rw-r--r--nn/runtime/test/TestExecution.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/nn/runtime/test/TestExecution.cpp b/nn/runtime/test/TestExecution.cpp
index 09067e6a6..168c15cdb 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;
@@ -187,10 +182,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;
}