Implement Compilation_finish()
authorHanjoung Lee <hanjoung.lee@samsung.com>
Thu, 22 Mar 2018 07:30:39 +0000 (16:30 +0900)
committer최형규/동작제어Lab(SR)/Senior Engineer/삼성전자 <hk0110.choi@samsung.com>
Thu, 22 Mar 2018 10:09:41 +0000 (19:09 +0900)
Compilation_finish is almost same as original code but without ExecutionPlan.

src/runtime/ref/nn/runtime/CompilationBuilder.cpp
src/runtime/ref/nn/runtime/NeuralNetworks.cpp

index 8290a60..9d78a3f 100644 (file)
@@ -36,19 +36,18 @@ CompilationBuilder::CompilationBuilder(const ModelBuilder* model) :
 }
 
 int CompilationBuilder::finish() {
-    // Dummy Implementation
-    return ANEURALNETWORKS_NO_ERROR;
-
-    // Original code for reference
-#if 0
     if (mFinished) {
-        LOG(ERROR) << "ANeuralNetworksCompilation_finish called more than once";
+        // TODO-NNRT Uncomment when LOG is available
+        // LOG(ERROR) << "ANeuralNetworksCompilation_finish called more than once";
         return ANEURALNETWORKS_BAD_STATE;
     }
     // TODO validate the rest
 
     mFinished = true;
 
+    // TODO-NNRT The below original code is commented out because we don't actually do partitioning
+    //           for now.
+#if 0 // REF-ANN
     if (uint32_t p = DeviceManager::get()->getPartitioning()) {
         // Get the list of HAL devices.
         const std::vector<std::shared_ptr<Device>>& devices = DeviceManager::get()->getDrivers();
@@ -59,9 +58,9 @@ int CompilationBuilder::finish() {
             return n;
         }
     }
+#endif
 
     return ANEURALNETWORKS_NO_ERROR;
-#endif
 }
 
 int CompilationBuilder::setPreference(int32_t preference) {
index bf6e25f..0b5856f 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <iostream>
 
+#include "CompilationBuilder.h"
+
 // TODO Include these files once availible
 #if 0
 #include "Callbacks.h"
@@ -419,18 +421,13 @@ int ANeuralNetworksCompilation_setPreference(ANeuralNetworksCompilation* compila
 }
 
 int ANeuralNetworksCompilation_finish(ANeuralNetworksCompilation* compilation) {
-    // Dummy Implementation
-    return ANEURALNETWORKS_NO_ERROR;
-
-    // Original code for reference
-#if 0
     if (!compilation) {
-        LOG(ERROR) << "ANeuralNetworksCompilation_finish passed a nullptr";
+        // TODO-NNRT Uncomment once LOG is available
+        // LOG(ERROR) << "ANeuralNetworksCompilation_finish passed a nullptr";
         return ANEURALNETWORKS_UNEXPECTED_NULL;
     }
     CompilationBuilder* c = reinterpret_cast<CompilationBuilder*>(compilation);
     return c->finish();
-#endif
 }
 
 int ANeuralNetworksExecution_create(ANeuralNetworksCompilation* compilation,