[Pure CL] Add setPreference and free (#1524)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Mon, 4 Jun 2018 01:51:01 +0000 (10:51 +0900)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Mon, 4 Jun 2018 01:51:01 +0000 (10:51 +0900)
* [Pure CL] Add setPreference and free

This commit implements ANeuralNetworksCompilation_setPreference and
ANeuralNetworksCompilation_free in pure CL runtime.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
* Fix format errors

runtimes/pure_arm_compute/src/compilation.cc
runtimes/pure_arm_compute/symbolcheck.cpp

index 26e31a2..3ea2e22 100644 (file)
@@ -1402,6 +1402,14 @@ int ANeuralNetworksCompilation_create(ANeuralNetworksModel *model,
   return ANEURALNETWORKS_NO_ERROR;
 }
 
+int ANeuralNetworksCompilation_setPreference(ANeuralNetworksCompilation *compilation,
+                                             int32_t preference)
+{
+  // NOTE Pure CL runimte currently ignores this API call
+  // TODO Use preference
+  return ANEURALNETWORKS_NO_ERROR;
+}
+
 int ANeuralNetworksCompilation_finish(ANeuralNetworksCompilation *compilation)
 {
   arm_compute::CLScheduler::get().default_init();
@@ -1420,3 +1428,8 @@ int ANeuralNetworksCompilation_finish(ANeuralNetworksCompilation *compilation)
 
   return ANEURALNETWORKS_NO_ERROR;
 }
+
+void ANeuralNetworksCompilation_free(ANeuralNetworksCompilation *compilation)
+{
+  delete compilation;
+}
index bc937d7..59aa08c 100644 (file)
@@ -23,6 +23,11 @@ int main(int argc, char **argv)
 
   SHOW_FUNC_ENTRY(ANeuralNetworksCompilation_create);
   SHOW_FUNC_ENTRY(ANeuralNetworksCompilation_finish);
+  // ANeuralNetworksCompilation_setPreference and ANeuralNetworksCompilation_free
+  // are introduced to reuse NNAPI tests under runtimes/tests. Note that these APIs
+  // are not necessary for supporting Tensorflow Lite interperter
+  SHOW_FUNC_ENTRY(ANeuralNetworksCompilation_setPreference);
+  SHOW_FUNC_ENTRY(ANeuralNetworksCompilation_free);
   SHOW_FUNC_ENTRY(ANeuralNetworksCompilation_create);
 
   SHOW_FUNC_ENTRY(ANeuralNetworksExecution_create);
@@ -36,8 +41,6 @@ int main(int argc, char **argv)
 
   // NOTE Pure CL runtime does not implement following NN API(s) as
   //      Tensorflow Lite does not use these API(s)
-  // SHOW_FUNC_ENTRY(ANeuralNetworksCompilation_free);
-  // SHOW_FUNC_ENTRY(ANeuralNetworksCompilation_setPreference);
   // SHOW_FUNC_ENTRY(ANeuralNetworksExecution_setInputFromMemory);
   // SHOW_FUNC_ENTRY(ANeuralNetworksExecution_setOutputFromMemory);